From 26f72d96cedf19ed4608e5643fcb5e01816491c0 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Wed, 30 Aug 2023 03:53:53 +0800 Subject: [PATCH 01/54] Restore sendChatScreenshotTakenNotification --- client/function.go | 28 +- client/type.go | 1904 ++++++++++++++++++++--------------------- client/unmarshaler.go | 880 +++++++++---------- data/td_api.tl | 317 +++---- 4 files changed, 1579 insertions(+), 1550 deletions(-) diff --git a/client/function.go b/client/function.go index 3fde614..ff812ee 100755 --- a/client/function.go +++ b/client/function.go @@ -1736,7 +1736,7 @@ type GetTopChatsRequest struct { Limit int32 `json:"limit"` } -// Returns a list of frequently used chats. Supported only if the chat info database is enabled +// Returns a list of frequently used chats func (client *Client) GetTopChats(req *GetTopChatsRequest) (*Chats, error) { result, err := client.Send(Request{ meta: meta{ @@ -3327,6 +3327,32 @@ func (client *Client) ResendMessages(req *ResendMessagesRequest) (*Messages, err return UnmarshalMessages(result.Data) } +type SendChatScreenshotTakenNotificationRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` +} + +// Sends a notification about a screenshot taken in a chat. Supported only in private and secret chats +func (client *Client) SendChatScreenshotTakenNotification(req *SendChatScreenshotTakenNotificationRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendChatScreenshotTakenNotification", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type AddLocalMessageRequest struct { // Target chat ChatId int64 `json:"chat_id"` diff --git a/client/type.go b/client/type.go index b618326..3b74865 100755 --- a/client/type.go +++ b/client/type.go @@ -64,6 +64,11 @@ const ( ClassChatAction = "ChatAction" ClassUserStatus = "UserStatus" ClassEmojiCategoryType = "EmojiCategoryType" + ClassStoryAreaType = "StoryAreaType" + ClassInputStoryAreaType = "InputStoryAreaType" + ClassStoryContent = "StoryContent" + ClassInputStoryContent = "InputStoryContent" + ClassStoryList = "StoryList" ClassCallDiscardReason = "CallDiscardReason" ClassCallServerType = "CallServerType" ClassCallState = "CallState" @@ -105,11 +110,6 @@ const ( ClassReportReason = "ReportReason" ClassTargetChat = "TargetChat" ClassInternalLinkType = "InternalLinkType" - ClassStoryAreaType = "StoryAreaType" - ClassInputStoryAreaType = "InputStoryAreaType" - ClassStoryContent = "StoryContent" - ClassInputStoryContent = "InputStoryContent" - ClassStoryList = "StoryList" ClassBlockList = "BlockList" ClassFileType = "FileType" ClassNetworkType = "NetworkType" @@ -307,6 +307,18 @@ const ( ClassTrendingStickerSets = "TrendingStickerSets" ClassEmojiCategory = "EmojiCategory" ClassEmojiCategories = "EmojiCategories" + ClassStoryViewer = "StoryViewer" + ClassStoryViewers = "StoryViewers" + ClassStoryAreaPosition = "StoryAreaPosition" + ClassStoryArea = "StoryArea" + ClassInputStoryArea = "InputStoryArea" + ClassInputStoryAreas = "InputStoryAreas" + ClassStoryVideo = "StoryVideo" + ClassStoryInteractionInfo = "StoryInteractionInfo" + ClassStory = "Story" + ClassStories = "Stories" + ClassStoryInfo = "StoryInfo" + ClassChatActiveStories = "ChatActiveStories" ClassCallProtocol = "CallProtocol" ClassCallServer = "CallServer" ClassCallId = "CallId" @@ -368,18 +380,6 @@ const ( ClassConnectedWebsites = "ConnectedWebsites" ClassMessageLink = "MessageLink" ClassMessageLinkInfo = "MessageLinkInfo" - ClassStoryViewer = "StoryViewer" - ClassStoryViewers = "StoryViewers" - ClassStoryAreaPosition = "StoryAreaPosition" - ClassStoryArea = "StoryArea" - ClassInputStoryArea = "InputStoryArea" - ClassInputStoryAreas = "InputStoryAreas" - ClassStoryVideo = "StoryVideo" - ClassStoryInteractionInfo = "StoryInteractionInfo" - ClassStory = "Story" - ClassStories = "Stories" - ClassStoryInfo = "StoryInfo" - ClassChatActiveStories = "ChatActiveStories" ClassFilePart = "FilePart" ClassStorageStatisticsByFileType = "StorageStatisticsByFileType" ClassStorageStatisticsByChat = "StorageStatisticsByChat" @@ -1026,6 +1026,30 @@ const ( TypeEmojiCategoryTypeDefault = "emojiCategoryTypeDefault" TypeEmojiCategoryTypeEmojiStatus = "emojiCategoryTypeEmojiStatus" TypeEmojiCategoryTypeChatPhoto = "emojiCategoryTypeChatPhoto" + TypeStoryViewer = "storyViewer" + TypeStoryViewers = "storyViewers" + TypeStoryAreaPosition = "storyAreaPosition" + TypeStoryAreaTypeLocation = "storyAreaTypeLocation" + TypeStoryAreaTypeVenue = "storyAreaTypeVenue" + TypeStoryArea = "storyArea" + TypeInputStoryAreaTypeLocation = "inputStoryAreaTypeLocation" + TypeInputStoryAreaTypeFoundVenue = "inputStoryAreaTypeFoundVenue" + TypeInputStoryAreaTypePreviousVenue = "inputStoryAreaTypePreviousVenue" + TypeInputStoryArea = "inputStoryArea" + TypeInputStoryAreas = "inputStoryAreas" + TypeStoryVideo = "storyVideo" + TypeStoryContentPhoto = "storyContentPhoto" + TypeStoryContentVideo = "storyContentVideo" + TypeStoryContentUnsupported = "storyContentUnsupported" + TypeInputStoryContentPhoto = "inputStoryContentPhoto" + TypeInputStoryContentVideo = "inputStoryContentVideo" + TypeStoryListMain = "storyListMain" + TypeStoryListArchive = "storyListArchive" + TypeStoryInteractionInfo = "storyInteractionInfo" + TypeStory = "story" + TypeStories = "stories" + TypeStoryInfo = "storyInfo" + TypeChatActiveStories = "chatActiveStories" TypeCallDiscardReasonEmpty = "callDiscardReasonEmpty" TypeCallDiscardReasonMissed = "callDiscardReasonMissed" TypeCallDiscardReasonDeclined = "callDiscardReasonDeclined" @@ -1426,30 +1450,6 @@ const ( TypeInternalLinkTypeWebApp = "internalLinkTypeWebApp" TypeMessageLink = "messageLink" TypeMessageLinkInfo = "messageLinkInfo" - TypeStoryViewer = "storyViewer" - TypeStoryViewers = "storyViewers" - TypeStoryAreaPosition = "storyAreaPosition" - TypeStoryAreaTypeLocation = "storyAreaTypeLocation" - TypeStoryAreaTypeVenue = "storyAreaTypeVenue" - TypeStoryArea = "storyArea" - TypeInputStoryAreaTypeLocation = "inputStoryAreaTypeLocation" - TypeInputStoryAreaTypeFoundVenue = "inputStoryAreaTypeFoundVenue" - TypeInputStoryAreaTypePreviousVenue = "inputStoryAreaTypePreviousVenue" - TypeInputStoryArea = "inputStoryArea" - TypeInputStoryAreas = "inputStoryAreas" - TypeStoryVideo = "storyVideo" - TypeStoryContentPhoto = "storyContentPhoto" - TypeStoryContentVideo = "storyContentVideo" - TypeStoryContentUnsupported = "storyContentUnsupported" - TypeInputStoryContentPhoto = "inputStoryContentPhoto" - TypeInputStoryContentVideo = "inputStoryContentVideo" - TypeStoryListMain = "storyListMain" - TypeStoryListArchive = "storyListArchive" - TypeStoryInteractionInfo = "storyInteractionInfo" - TypeStory = "story" - TypeStories = "stories" - TypeStoryInfo = "storyInfo" - TypeChatActiveStories = "chatActiveStories" TypeBlockListMain = "blockListMain" TypeBlockListStories = "blockListStories" TypeFilePart = "filePart" @@ -1973,6 +1973,31 @@ type EmojiCategoryType interface { EmojiCategoryTypeType() string } +// Describes type of a clickable rectangle area on a story media +type StoryAreaType interface { + StoryAreaTypeType() string +} + +// Describes type of a clickable rectangle area on a story media to be added +type InputStoryAreaType interface { + InputStoryAreaTypeType() string +} + +// Contains the content of a story +type StoryContent interface { + StoryContentType() string +} + +// The content of a story to send +type InputStoryContent interface { + InputStoryContentType() string +} + +// Describes a list of stories +type StoryList interface { + StoryListType() string +} + // Describes the reason why a call was discarded type CallDiscardReason interface { CallDiscardReasonType() string @@ -2178,31 +2203,6 @@ type InternalLinkType interface { InternalLinkTypeType() string } -// Describes type of a clickable rectangle area on a story media -type StoryAreaType interface { - StoryAreaTypeType() string -} - -// Describes type of a clickable rectangle area on a story media to be added -type InputStoryAreaType interface { - InputStoryAreaTypeType() string -} - -// Contains the content of a story -type StoryContent interface { - StoryContentType() string -} - -// The content of a story to send -type InputStoryContent interface { - InputStoryContentType() string -} - -// Describes a list of stories -type StoryList interface { - StoryListType() string -} - // Describes a type of a block list type BlockList interface { BlockListType() string @@ -9597,7 +9597,7 @@ type ChatNotificationSettings struct { ShowPreview bool `json:"show_preview"` // If true, mute_stories is ignored and the value for the relevant type of chat is used instead UseDefaultMuteStories bool `json:"use_default_mute_stories"` - // True, if story notifications are received without sound + // True, if story notifications are disabled for the chat MuteStories bool `json:"mute_stories"` // If true, the value for the relevant type of chat is used instead of story_sound_id UseDefaultStorySound bool `json:"use_default_story_sound"` @@ -9642,9 +9642,9 @@ type ScopeNotificationSettings struct { SoundId JsonInt64 `json:"sound_id"` // True, if message content must be displayed in notifications ShowPreview bool `json:"show_preview"` - // If true, mute_stories is ignored and stories are unmuted only for the first 5 chats from topChatCategoryUsers + // If true, mute_stories is ignored and story notifications are received only for the first 5 chats from topChatCategoryUsers UseDefaultMuteStories bool `json:"use_default_mute_stories"` - // True, if story notifications are received without sound + // True, if story notifications are disabled for the chat MuteStories bool `json:"mute_stories"` // Identifier of the notification sound to be played for stories; 0 if sound is disabled StorySoundId JsonInt64 `json:"story_sound_id"` @@ -22288,6 +22288,889 @@ func (*EmojiCategoryTypeChatPhoto) EmojiCategoryTypeType() string { return TypeEmojiCategoryTypeChatPhoto } +// Represents a viewer of a story +type StoryViewer struct { + meta + // User identifier of the viewer + UserId int64 `json:"user_id"` + // Approximate point in time (Unix timestamp) when the story was viewed + ViewDate int32 `json:"view_date"` + // Block list to which the user is added; may be null if none + BlockList BlockList `json:"block_list"` + // Type of the reaction that was chosen by the user; may be null if none + ChosenReactionType ReactionType `json:"chosen_reaction_type"` +} + +func (entity *StoryViewer) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryViewer + + return json.Marshal((*stub)(entity)) +} + +func (*StoryViewer) GetClass() string { + return ClassStoryViewer +} + +func (*StoryViewer) GetType() string { + return TypeStoryViewer +} + +func (storyViewer *StoryViewer) UnmarshalJSON(data []byte) error { + var tmp struct { + UserId int64 `json:"user_id"` + ViewDate int32 `json:"view_date"` + BlockList json.RawMessage `json:"block_list"` + ChosenReactionType json.RawMessage `json:"chosen_reaction_type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + storyViewer.UserId = tmp.UserId + storyViewer.ViewDate = tmp.ViewDate + + fieldBlockList, _ := UnmarshalBlockList(tmp.BlockList) + storyViewer.BlockList = fieldBlockList + + fieldChosenReactionType, _ := UnmarshalReactionType(tmp.ChosenReactionType) + storyViewer.ChosenReactionType = fieldChosenReactionType + + return nil +} + +// Represents a list of story viewers +type StoryViewers struct { + meta + // Approximate total number of story viewers found + TotalCount int32 `json:"total_count"` + // List of story viewers + Viewers []*StoryViewer `json:"viewers"` + // The offset for the next request. If empty, there are no more results + NextOffset string `json:"next_offset"` +} + +func (entity *StoryViewers) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryViewers + + return json.Marshal((*stub)(entity)) +} + +func (*StoryViewers) GetClass() string { + return ClassStoryViewers +} + +func (*StoryViewers) GetType() string { + return TypeStoryViewers +} + +// Describes position of a clickable rectangle area on a story media +type StoryAreaPosition struct { + meta + // The abscissa of the rectangle's center, as a percentage of the media width + XPercentage float64 `json:"x_percentage"` + // The ordinate of the rectangle's center, as a percentage of the media height + YPercentage float64 `json:"y_percentage"` + // The width of the rectangle, as a percentage of the media width + WidthPercentage float64 `json:"width_percentage"` + // The ordinate of the rectangle's center, as a percentage of the media height + HeightPercentage float64 `json:"height_percentage"` + // Clockwise rotation angle of the rectangle, in degrees; 0-360 + RotationAngle float64 `json:"rotation_angle"` +} + +func (entity *StoryAreaPosition) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryAreaPosition + + return json.Marshal((*stub)(entity)) +} + +func (*StoryAreaPosition) GetClass() string { + return ClassStoryAreaPosition +} + +func (*StoryAreaPosition) GetType() string { + return TypeStoryAreaPosition +} + +// An area pointing to a location +type StoryAreaTypeLocation struct { + meta + // The location + Location *Location `json:"location"` +} + +func (entity *StoryAreaTypeLocation) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryAreaTypeLocation + + return json.Marshal((*stub)(entity)) +} + +func (*StoryAreaTypeLocation) GetClass() string { + return ClassStoryAreaType +} + +func (*StoryAreaTypeLocation) GetType() string { + return TypeStoryAreaTypeLocation +} + +func (*StoryAreaTypeLocation) StoryAreaTypeType() string { + return TypeStoryAreaTypeLocation +} + +// An area pointing to a venue +type StoryAreaTypeVenue struct { + meta + // Information about the venue + Venue *Venue `json:"venue"` +} + +func (entity *StoryAreaTypeVenue) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryAreaTypeVenue + + return json.Marshal((*stub)(entity)) +} + +func (*StoryAreaTypeVenue) GetClass() string { + return ClassStoryAreaType +} + +func (*StoryAreaTypeVenue) GetType() string { + return TypeStoryAreaTypeVenue +} + +func (*StoryAreaTypeVenue) StoryAreaTypeType() string { + return TypeStoryAreaTypeVenue +} + +// Describes a clickable rectangle area on a story media +type StoryArea struct { + meta + // Position of the area + Position *StoryAreaPosition `json:"position"` + // Type of the area + Type StoryAreaType `json:"type"` +} + +func (entity *StoryArea) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryArea + + return json.Marshal((*stub)(entity)) +} + +func (*StoryArea) GetClass() string { + return ClassStoryArea +} + +func (*StoryArea) GetType() string { + return TypeStoryArea +} + +func (storyArea *StoryArea) UnmarshalJSON(data []byte) error { + var tmp struct { + Position *StoryAreaPosition `json:"position"` + Type json.RawMessage `json:"type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + storyArea.Position = tmp.Position + + fieldType, _ := UnmarshalStoryAreaType(tmp.Type) + storyArea.Type = fieldType + + return nil +} + +// An area pointing to a location +type InputStoryAreaTypeLocation struct { + meta + // The location + Location *Location `json:"location"` +} + +func (entity *InputStoryAreaTypeLocation) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputStoryAreaTypeLocation + + return json.Marshal((*stub)(entity)) +} + +func (*InputStoryAreaTypeLocation) GetClass() string { + return ClassInputStoryAreaType +} + +func (*InputStoryAreaTypeLocation) GetType() string { + return TypeInputStoryAreaTypeLocation +} + +func (*InputStoryAreaTypeLocation) InputStoryAreaTypeType() string { + return TypeInputStoryAreaTypeLocation +} + +// An area pointing to a venue found by the bot getOption("venue_search_bot_username") +type InputStoryAreaTypeFoundVenue struct { + meta + // Identifier of the inline query, used to found the venue + QueryId JsonInt64 `json:"query_id"` + // Identifier of the inline query result + ResultId string `json:"result_id"` +} + +func (entity *InputStoryAreaTypeFoundVenue) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputStoryAreaTypeFoundVenue + + return json.Marshal((*stub)(entity)) +} + +func (*InputStoryAreaTypeFoundVenue) GetClass() string { + return ClassInputStoryAreaType +} + +func (*InputStoryAreaTypeFoundVenue) GetType() string { + return TypeInputStoryAreaTypeFoundVenue +} + +func (*InputStoryAreaTypeFoundVenue) InputStoryAreaTypeType() string { + return TypeInputStoryAreaTypeFoundVenue +} + +// An area pointing to a venue already added to the story +type InputStoryAreaTypePreviousVenue struct { + meta + // Provider of the venue + VenueProvider string `json:"venue_provider"` + // Identifier of the venue in the provider database + VenueId string `json:"venue_id"` +} + +func (entity *InputStoryAreaTypePreviousVenue) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputStoryAreaTypePreviousVenue + + return json.Marshal((*stub)(entity)) +} + +func (*InputStoryAreaTypePreviousVenue) GetClass() string { + return ClassInputStoryAreaType +} + +func (*InputStoryAreaTypePreviousVenue) GetType() string { + return TypeInputStoryAreaTypePreviousVenue +} + +func (*InputStoryAreaTypePreviousVenue) InputStoryAreaTypeType() string { + return TypeInputStoryAreaTypePreviousVenue +} + +// Describes a clickable rectangle area on a story media to be added +type InputStoryArea struct { + meta + // Position of the area + Position *StoryAreaPosition `json:"position"` + // Type of the area + Type InputStoryAreaType `json:"type"` +} + +func (entity *InputStoryArea) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputStoryArea + + return json.Marshal((*stub)(entity)) +} + +func (*InputStoryArea) GetClass() string { + return ClassInputStoryArea +} + +func (*InputStoryArea) GetType() string { + return TypeInputStoryArea +} + +func (inputStoryArea *InputStoryArea) UnmarshalJSON(data []byte) error { + var tmp struct { + Position *StoryAreaPosition `json:"position"` + Type json.RawMessage `json:"type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + inputStoryArea.Position = tmp.Position + + fieldType, _ := UnmarshalInputStoryAreaType(tmp.Type) + inputStoryArea.Type = fieldType + + return nil +} + +// Contains a list of story areas to be added +type InputStoryAreas struct { + meta + // List of 0-10 input story areas + Areas []*InputStoryArea `json:"areas"` +} + +func (entity *InputStoryAreas) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputStoryAreas + + return json.Marshal((*stub)(entity)) +} + +func (*InputStoryAreas) GetClass() string { + return ClassInputStoryAreas +} + +func (*InputStoryAreas) GetType() string { + return TypeInputStoryAreas +} + +// Describes a video file sent in a story +type StoryVideo struct { + meta + // Duration of the video, in seconds + Duration float64 `json:"duration"` + // Video width + Width int32 `json:"width"` + // Video height + Height int32 `json:"height"` + // True, if stickers were added to the video. The list of corresponding sticker sets can be received using getAttachedStickerSets + HasStickers bool `json:"has_stickers"` + // True, if the video has no sound + IsAnimation bool `json:"is_animation"` + // Video minithumbnail; may be null + Minithumbnail *Minithumbnail `json:"minithumbnail"` + // Video thumbnail in JPEG or MPEG4 format; may be null + Thumbnail *Thumbnail `json:"thumbnail"` + // Size of file prefix, which is supposed to be preloaded, in bytes + PreloadPrefixSize int32 `json:"preload_prefix_size"` + // File containing the video + Video *File `json:"video"` +} + +func (entity *StoryVideo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryVideo + + return json.Marshal((*stub)(entity)) +} + +func (*StoryVideo) GetClass() string { + return ClassStoryVideo +} + +func (*StoryVideo) GetType() string { + return TypeStoryVideo +} + +// A photo story +type StoryContentPhoto struct { + meta + // The photo + Photo *Photo `json:"photo"` +} + +func (entity *StoryContentPhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryContentPhoto + + return json.Marshal((*stub)(entity)) +} + +func (*StoryContentPhoto) GetClass() string { + return ClassStoryContent +} + +func (*StoryContentPhoto) GetType() string { + return TypeStoryContentPhoto +} + +func (*StoryContentPhoto) StoryContentType() string { + return TypeStoryContentPhoto +} + +// A video story +type StoryContentVideo struct { + meta + // The video in MPEG4 format + Video *StoryVideo `json:"video"` + // Alternative version of the video in MPEG4 format, encoded by x264 codec; may be null + AlternativeVideo *StoryVideo `json:"alternative_video"` +} + +func (entity *StoryContentVideo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryContentVideo + + return json.Marshal((*stub)(entity)) +} + +func (*StoryContentVideo) GetClass() string { + return ClassStoryContent +} + +func (*StoryContentVideo) GetType() string { + return TypeStoryContentVideo +} + +func (*StoryContentVideo) StoryContentType() string { + return TypeStoryContentVideo +} + +// A story content that is not supported in the current TDLib version +type StoryContentUnsupported struct{ + meta +} + +func (entity *StoryContentUnsupported) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryContentUnsupported + + return json.Marshal((*stub)(entity)) +} + +func (*StoryContentUnsupported) GetClass() string { + return ClassStoryContent +} + +func (*StoryContentUnsupported) GetType() string { + return TypeStoryContentUnsupported +} + +func (*StoryContentUnsupported) StoryContentType() string { + return TypeStoryContentUnsupported +} + +// A photo story +type InputStoryContentPhoto struct { + meta + // Photo to send. The photo must be at most 10 MB in size. The photo size must be 1080x1920 + Photo InputFile `json:"photo"` + // File identifiers of the stickers added to the photo, if applicable + AddedStickerFileIds []int32 `json:"added_sticker_file_ids"` +} + +func (entity *InputStoryContentPhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputStoryContentPhoto + + return json.Marshal((*stub)(entity)) +} + +func (*InputStoryContentPhoto) GetClass() string { + return ClassInputStoryContent +} + +func (*InputStoryContentPhoto) GetType() string { + return TypeInputStoryContentPhoto +} + +func (*InputStoryContentPhoto) InputStoryContentType() string { + return TypeInputStoryContentPhoto +} + +func (inputStoryContentPhoto *InputStoryContentPhoto) UnmarshalJSON(data []byte) error { + var tmp struct { + Photo json.RawMessage `json:"photo"` + AddedStickerFileIds []int32 `json:"added_sticker_file_ids"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + inputStoryContentPhoto.AddedStickerFileIds = tmp.AddedStickerFileIds + + fieldPhoto, _ := UnmarshalInputFile(tmp.Photo) + inputStoryContentPhoto.Photo = fieldPhoto + + return nil +} + +// A video story +type InputStoryContentVideo struct { + meta + // Video to be sent. The video size must be 720x1280. The video must be streamable and stored in MPEG4 format, after encoding with x265 codec and key frames added each second + Video InputFile `json:"video"` + // File identifiers of the stickers added to the video, if applicable + AddedStickerFileIds []int32 `json:"added_sticker_file_ids"` + // Precise duration of the video, in seconds; 0-60 + Duration float64 `json:"duration"` + // True, if the video has no sound + IsAnimation bool `json:"is_animation"` +} + +func (entity *InputStoryContentVideo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputStoryContentVideo + + return json.Marshal((*stub)(entity)) +} + +func (*InputStoryContentVideo) GetClass() string { + return ClassInputStoryContent +} + +func (*InputStoryContentVideo) GetType() string { + return TypeInputStoryContentVideo +} + +func (*InputStoryContentVideo) InputStoryContentType() string { + return TypeInputStoryContentVideo +} + +func (inputStoryContentVideo *InputStoryContentVideo) UnmarshalJSON(data []byte) error { + var tmp struct { + Video json.RawMessage `json:"video"` + AddedStickerFileIds []int32 `json:"added_sticker_file_ids"` + Duration float64 `json:"duration"` + IsAnimation bool `json:"is_animation"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + inputStoryContentVideo.AddedStickerFileIds = tmp.AddedStickerFileIds + inputStoryContentVideo.Duration = tmp.Duration + inputStoryContentVideo.IsAnimation = tmp.IsAnimation + + fieldVideo, _ := UnmarshalInputFile(tmp.Video) + inputStoryContentVideo.Video = fieldVideo + + return nil +} + +// The list of stories, shown in the main chat list and folder chat lists +type StoryListMain struct{ + meta +} + +func (entity *StoryListMain) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryListMain + + return json.Marshal((*stub)(entity)) +} + +func (*StoryListMain) GetClass() string { + return ClassStoryList +} + +func (*StoryListMain) GetType() string { + return TypeStoryListMain +} + +func (*StoryListMain) StoryListType() string { + return TypeStoryListMain +} + +// The list of stories, shown in the Arvhive chat list +type StoryListArchive struct{ + meta +} + +func (entity *StoryListArchive) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryListArchive + + return json.Marshal((*stub)(entity)) +} + +func (*StoryListArchive) GetClass() string { + return ClassStoryList +} + +func (*StoryListArchive) GetType() string { + return TypeStoryListArchive +} + +func (*StoryListArchive) StoryListType() string { + return TypeStoryListArchive +} + +// Contains information about interactions with a story +type StoryInteractionInfo struct { + meta + // Number of times the story was viewed + ViewCount int32 `json:"view_count"` + // Number of reactions added to the story + ReactionCount int32 `json:"reaction_count"` + // Identifiers of at most 3 recent viewers of the story + RecentViewerUserIds []int64 `json:"recent_viewer_user_ids"` +} + +func (entity *StoryInteractionInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryInteractionInfo + + return json.Marshal((*stub)(entity)) +} + +func (*StoryInteractionInfo) GetClass() string { + return ClassStoryInteractionInfo +} + +func (*StoryInteractionInfo) GetType() string { + return TypeStoryInteractionInfo +} + +// Represents a story +type Story struct { + meta + // Unique story identifier among stories of the given sender + Id int32 `json:"id"` + // Identifier of the chat that posted the story + SenderChatId int64 `json:"sender_chat_id"` + // Point in time (Unix timestamp) when the story was published + Date int32 `json:"date"` + // True, if the story is being sent by the current user + IsBeingSent bool `json:"is_being_sent"` + // True, if the story is being edited by the current user + IsBeingEdited bool `json:"is_being_edited"` + // True, if the story was edited + IsEdited bool `json:"is_edited"` + // True, if the story is saved in the sender's profile and will be available there after expiration + IsPinned bool `json:"is_pinned"` + // True, if the story is visible only for the current user + IsVisibleOnlyForSelf bool `json:"is_visible_only_for_self"` + // True, if the story can be forwarded as a message. Otherwise, screenshots and saving of the story content must be also forbidden + CanBeForwarded bool `json:"can_be_forwarded"` + // True, if the story can be replied in the chat with the story sender + CanBeReplied bool `json:"can_be_replied"` + // True, if users viewed the story can be received through getStoryViewers + CanGetViewers bool `json:"can_get_viewers"` + // True, if users viewed the story can't be received, because the story has expired more than getOption("story_viewers_expiration_delay") seconds ago + HasExpiredViewers bool `json:"has_expired_viewers"` + // Information about interactions with the story; may be null if the story isn't owned or there were no interactions + InteractionInfo *StoryInteractionInfo `json:"interaction_info"` + // Type of the chosen reaction; may be null if none + ChosenReactionType ReactionType `json:"chosen_reaction_type"` + // Privacy rules affecting story visibility; may be approximate for non-owned stories + PrivacySettings StoryPrivacySettings `json:"privacy_settings"` + // Content of the story + Content StoryContent `json:"content"` + // Clickable areas to be shown on the story content + Areas []*StoryArea `json:"areas"` + // Caption of the story + Caption *FormattedText `json:"caption"` +} + +func (entity *Story) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Story + + return json.Marshal((*stub)(entity)) +} + +func (*Story) GetClass() string { + return ClassStory +} + +func (*Story) GetType() string { + return TypeStory +} + +func (story *Story) UnmarshalJSON(data []byte) error { + var tmp struct { + Id int32 `json:"id"` + SenderChatId int64 `json:"sender_chat_id"` + Date int32 `json:"date"` + IsBeingSent bool `json:"is_being_sent"` + IsBeingEdited bool `json:"is_being_edited"` + IsEdited bool `json:"is_edited"` + IsPinned bool `json:"is_pinned"` + IsVisibleOnlyForSelf bool `json:"is_visible_only_for_self"` + CanBeForwarded bool `json:"can_be_forwarded"` + CanBeReplied bool `json:"can_be_replied"` + CanGetViewers bool `json:"can_get_viewers"` + HasExpiredViewers bool `json:"has_expired_viewers"` + InteractionInfo *StoryInteractionInfo `json:"interaction_info"` + ChosenReactionType json.RawMessage `json:"chosen_reaction_type"` + PrivacySettings json.RawMessage `json:"privacy_settings"` + Content json.RawMessage `json:"content"` + Areas []*StoryArea `json:"areas"` + Caption *FormattedText `json:"caption"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + story.Id = tmp.Id + story.SenderChatId = tmp.SenderChatId + story.Date = tmp.Date + story.IsBeingSent = tmp.IsBeingSent + story.IsBeingEdited = tmp.IsBeingEdited + story.IsEdited = tmp.IsEdited + story.IsPinned = tmp.IsPinned + story.IsVisibleOnlyForSelf = tmp.IsVisibleOnlyForSelf + story.CanBeForwarded = tmp.CanBeForwarded + story.CanBeReplied = tmp.CanBeReplied + story.CanGetViewers = tmp.CanGetViewers + story.HasExpiredViewers = tmp.HasExpiredViewers + story.InteractionInfo = tmp.InteractionInfo + story.Areas = tmp.Areas + story.Caption = tmp.Caption + + fieldChosenReactionType, _ := UnmarshalReactionType(tmp.ChosenReactionType) + story.ChosenReactionType = fieldChosenReactionType + + fieldPrivacySettings, _ := UnmarshalStoryPrivacySettings(tmp.PrivacySettings) + story.PrivacySettings = fieldPrivacySettings + + fieldContent, _ := UnmarshalStoryContent(tmp.Content) + story.Content = fieldContent + + return nil +} + +// Represents a list of stories +type Stories struct { + meta + // Approximate total number of stories found + TotalCount int32 `json:"total_count"` + // The list of stories + Stories []*Story `json:"stories"` +} + +func (entity *Stories) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Stories + + return json.Marshal((*stub)(entity)) +} + +func (*Stories) GetClass() string { + return ClassStories +} + +func (*Stories) GetType() string { + return TypeStories +} + +// Contains basic information about a story +type StoryInfo struct { + meta + // Unique story identifier among stories of the given sender + StoryId int32 `json:"story_id"` + // Point in time (Unix timestamp) when the story was published + Date int32 `json:"date"` + // True, if the story is available only to close friends + IsForCloseFriends bool `json:"is_for_close_friends"` +} + +func (entity *StoryInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryInfo + + return json.Marshal((*stub)(entity)) +} + +func (*StoryInfo) GetClass() string { + return ClassStoryInfo +} + +func (*StoryInfo) GetType() string { + return TypeStoryInfo +} + +// Describes active stories posted by a chat +type ChatActiveStories struct { + meta + // Identifier of the chat that posted the stories + ChatId int64 `json:"chat_id"` + // Identifier of the story list in which the stories are shown; may be null if the stories aren't shown in a story list + List StoryList `json:"list"` + // A parameter used to determine order of the stories in the story list; 0 if the stories doesn't need to be shown in the story list. Stories must be sorted by the pair (order, story_sender_chat_id) in descending order + Order int64 `json:"order"` + // Identifier of the last read active story + MaxReadStoryId int32 `json:"max_read_story_id"` + // Basic information about the stories; use getStory to get full information about the stories. The stories are in a chronological order (i.e., in order of increasing story identifiers) + Stories []*StoryInfo `json:"stories"` +} + +func (entity *ChatActiveStories) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatActiveStories + + return json.Marshal((*stub)(entity)) +} + +func (*ChatActiveStories) GetClass() string { + return ClassChatActiveStories +} + +func (*ChatActiveStories) GetType() string { + return TypeChatActiveStories +} + +func (chatActiveStories *ChatActiveStories) UnmarshalJSON(data []byte) error { + var tmp struct { + ChatId int64 `json:"chat_id"` + List json.RawMessage `json:"list"` + Order int64 `json:"order"` + MaxReadStoryId int32 `json:"max_read_story_id"` + Stories []*StoryInfo `json:"stories"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + chatActiveStories.ChatId = tmp.ChatId + chatActiveStories.Order = tmp.Order + chatActiveStories.MaxReadStoryId = tmp.MaxReadStoryId + chatActiveStories.Stories = tmp.Stories + + fieldList, _ := UnmarshalStoryList(tmp.List) + chatActiveStories.List = fieldList + + return nil +} + // The call wasn't discarded, or the reason is unknown type CallDiscardReasonEmpty struct{ meta @@ -34658,889 +35541,6 @@ func (*MessageLinkInfo) GetType() string { return TypeMessageLinkInfo } -// Represents a viewer of a story -type StoryViewer struct { - meta - // User identifier of the viewer - UserId int64 `json:"user_id"` - // Approximate point in time (Unix timestamp) when the story was viewed - ViewDate int32 `json:"view_date"` - // Block list to which the user is added; may be null if none - BlockList BlockList `json:"block_list"` - // Type of the reaction that was chosen by the user; may be null if none - ChosenReactionType ReactionType `json:"chosen_reaction_type"` -} - -func (entity *StoryViewer) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StoryViewer - - return json.Marshal((*stub)(entity)) -} - -func (*StoryViewer) GetClass() string { - return ClassStoryViewer -} - -func (*StoryViewer) GetType() string { - return TypeStoryViewer -} - -func (storyViewer *StoryViewer) UnmarshalJSON(data []byte) error { - var tmp struct { - UserId int64 `json:"user_id"` - ViewDate int32 `json:"view_date"` - BlockList json.RawMessage `json:"block_list"` - ChosenReactionType json.RawMessage `json:"chosen_reaction_type"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - storyViewer.UserId = tmp.UserId - storyViewer.ViewDate = tmp.ViewDate - - fieldBlockList, _ := UnmarshalBlockList(tmp.BlockList) - storyViewer.BlockList = fieldBlockList - - fieldChosenReactionType, _ := UnmarshalReactionType(tmp.ChosenReactionType) - storyViewer.ChosenReactionType = fieldChosenReactionType - - return nil -} - -// Represents a list of story viewers -type StoryViewers struct { - meta - // Approximate total number of story viewers found - TotalCount int32 `json:"total_count"` - // List of story viewers - Viewers []*StoryViewer `json:"viewers"` - // The offset for the next request. If empty, there are no more results - NextOffset string `json:"next_offset"` -} - -func (entity *StoryViewers) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StoryViewers - - return json.Marshal((*stub)(entity)) -} - -func (*StoryViewers) GetClass() string { - return ClassStoryViewers -} - -func (*StoryViewers) GetType() string { - return TypeStoryViewers -} - -// Describes position of a clickable rectangle area on a story media -type StoryAreaPosition struct { - meta - // The abscissa of the rectangle's center, as a percentage of the media width - XPercentage float64 `json:"x_percentage"` - // The ordinate of the rectangle's center, as a percentage of the media height - YPercentage float64 `json:"y_percentage"` - // The width of the rectangle, as a percentage of the media width - WidthPercentage float64 `json:"width_percentage"` - // The ordinate of the rectangle's center, as a percentage of the media height - HeightPercentage float64 `json:"height_percentage"` - // Clockwise rotation angle of the rectangle, in degrees; 0-360 - RotationAngle float64 `json:"rotation_angle"` -} - -func (entity *StoryAreaPosition) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StoryAreaPosition - - return json.Marshal((*stub)(entity)) -} - -func (*StoryAreaPosition) GetClass() string { - return ClassStoryAreaPosition -} - -func (*StoryAreaPosition) GetType() string { - return TypeStoryAreaPosition -} - -// An area pointing to a location -type StoryAreaTypeLocation struct { - meta - // The location - Location *Location `json:"location"` -} - -func (entity *StoryAreaTypeLocation) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StoryAreaTypeLocation - - return json.Marshal((*stub)(entity)) -} - -func (*StoryAreaTypeLocation) GetClass() string { - return ClassStoryAreaType -} - -func (*StoryAreaTypeLocation) GetType() string { - return TypeStoryAreaTypeLocation -} - -func (*StoryAreaTypeLocation) StoryAreaTypeType() string { - return TypeStoryAreaTypeLocation -} - -// An area pointing to a venue -type StoryAreaTypeVenue struct { - meta - // Information about the venue - Venue *Venue `json:"venue"` -} - -func (entity *StoryAreaTypeVenue) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StoryAreaTypeVenue - - return json.Marshal((*stub)(entity)) -} - -func (*StoryAreaTypeVenue) GetClass() string { - return ClassStoryAreaType -} - -func (*StoryAreaTypeVenue) GetType() string { - return TypeStoryAreaTypeVenue -} - -func (*StoryAreaTypeVenue) StoryAreaTypeType() string { - return TypeStoryAreaTypeVenue -} - -// Describes a clickable rectangle area on a story media -type StoryArea struct { - meta - // Position of the area - Position *StoryAreaPosition `json:"position"` - // Type of the area - Type StoryAreaType `json:"type"` -} - -func (entity *StoryArea) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StoryArea - - return json.Marshal((*stub)(entity)) -} - -func (*StoryArea) GetClass() string { - return ClassStoryArea -} - -func (*StoryArea) GetType() string { - return TypeStoryArea -} - -func (storyArea *StoryArea) UnmarshalJSON(data []byte) error { - var tmp struct { - Position *StoryAreaPosition `json:"position"` - Type json.RawMessage `json:"type"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - storyArea.Position = tmp.Position - - fieldType, _ := UnmarshalStoryAreaType(tmp.Type) - storyArea.Type = fieldType - - return nil -} - -// An area pointing to a location -type InputStoryAreaTypeLocation struct { - meta - // The location - Location *Location `json:"location"` -} - -func (entity *InputStoryAreaTypeLocation) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputStoryAreaTypeLocation - - return json.Marshal((*stub)(entity)) -} - -func (*InputStoryAreaTypeLocation) GetClass() string { - return ClassInputStoryAreaType -} - -func (*InputStoryAreaTypeLocation) GetType() string { - return TypeInputStoryAreaTypeLocation -} - -func (*InputStoryAreaTypeLocation) InputStoryAreaTypeType() string { - return TypeInputStoryAreaTypeLocation -} - -// An area pointing to a venue found by the bot getOption("venue_search_bot_username") -type InputStoryAreaTypeFoundVenue struct { - meta - // Identifier of the inline query, used to found the venue - QueryId JsonInt64 `json:"query_id"` - // Identifier of the inline query result - ResultId string `json:"result_id"` -} - -func (entity *InputStoryAreaTypeFoundVenue) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputStoryAreaTypeFoundVenue - - return json.Marshal((*stub)(entity)) -} - -func (*InputStoryAreaTypeFoundVenue) GetClass() string { - return ClassInputStoryAreaType -} - -func (*InputStoryAreaTypeFoundVenue) GetType() string { - return TypeInputStoryAreaTypeFoundVenue -} - -func (*InputStoryAreaTypeFoundVenue) InputStoryAreaTypeType() string { - return TypeInputStoryAreaTypeFoundVenue -} - -// An area pointing to a venue already added to the story -type InputStoryAreaTypePreviousVenue struct { - meta - // Provider of the venue - VenueProvider string `json:"venue_provider"` - // Identifier of the venue in the provider database - VenueId string `json:"venue_id"` -} - -func (entity *InputStoryAreaTypePreviousVenue) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputStoryAreaTypePreviousVenue - - return json.Marshal((*stub)(entity)) -} - -func (*InputStoryAreaTypePreviousVenue) GetClass() string { - return ClassInputStoryAreaType -} - -func (*InputStoryAreaTypePreviousVenue) GetType() string { - return TypeInputStoryAreaTypePreviousVenue -} - -func (*InputStoryAreaTypePreviousVenue) InputStoryAreaTypeType() string { - return TypeInputStoryAreaTypePreviousVenue -} - -// Describes a clickable rectangle area on a story media to be added -type InputStoryArea struct { - meta - // Position of the area - Position *StoryAreaPosition `json:"position"` - // Type of the area - Type InputStoryAreaType `json:"type"` -} - -func (entity *InputStoryArea) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputStoryArea - - return json.Marshal((*stub)(entity)) -} - -func (*InputStoryArea) GetClass() string { - return ClassInputStoryArea -} - -func (*InputStoryArea) GetType() string { - return TypeInputStoryArea -} - -func (inputStoryArea *InputStoryArea) UnmarshalJSON(data []byte) error { - var tmp struct { - Position *StoryAreaPosition `json:"position"` - Type json.RawMessage `json:"type"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - inputStoryArea.Position = tmp.Position - - fieldType, _ := UnmarshalInputStoryAreaType(tmp.Type) - inputStoryArea.Type = fieldType - - return nil -} - -// Contains a list of story areas to be added -type InputStoryAreas struct { - meta - // List of 0-10 input story areas - Areas []*InputStoryArea `json:"areas"` -} - -func (entity *InputStoryAreas) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputStoryAreas - - return json.Marshal((*stub)(entity)) -} - -func (*InputStoryAreas) GetClass() string { - return ClassInputStoryAreas -} - -func (*InputStoryAreas) GetType() string { - return TypeInputStoryAreas -} - -// Describes a video file sent in a story -type StoryVideo struct { - meta - // Duration of the video, in seconds - Duration float64 `json:"duration"` - // Video width - Width int32 `json:"width"` - // Video height - Height int32 `json:"height"` - // True, if stickers were added to the video. The list of corresponding sticker sets can be received using getAttachedStickerSets - HasStickers bool `json:"has_stickers"` - // True, if the video has no sound - IsAnimation bool `json:"is_animation"` - // Video minithumbnail; may be null - Minithumbnail *Minithumbnail `json:"minithumbnail"` - // Video thumbnail in JPEG or MPEG4 format; may be null - Thumbnail *Thumbnail `json:"thumbnail"` - // Size of file prefix, which is supposed to be preloaded, in bytes - PreloadPrefixSize int32 `json:"preload_prefix_size"` - // File containing the video - Video *File `json:"video"` -} - -func (entity *StoryVideo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StoryVideo - - return json.Marshal((*stub)(entity)) -} - -func (*StoryVideo) GetClass() string { - return ClassStoryVideo -} - -func (*StoryVideo) GetType() string { - return TypeStoryVideo -} - -// A photo story -type StoryContentPhoto struct { - meta - // The photo - Photo *Photo `json:"photo"` -} - -func (entity *StoryContentPhoto) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StoryContentPhoto - - return json.Marshal((*stub)(entity)) -} - -func (*StoryContentPhoto) GetClass() string { - return ClassStoryContent -} - -func (*StoryContentPhoto) GetType() string { - return TypeStoryContentPhoto -} - -func (*StoryContentPhoto) StoryContentType() string { - return TypeStoryContentPhoto -} - -// A video story -type StoryContentVideo struct { - meta - // The video in MPEG4 format - Video *StoryVideo `json:"video"` - // Alternative version of the video in MPEG4 format, encoded by x264 codec; may be null - AlternativeVideo *StoryVideo `json:"alternative_video"` -} - -func (entity *StoryContentVideo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StoryContentVideo - - return json.Marshal((*stub)(entity)) -} - -func (*StoryContentVideo) GetClass() string { - return ClassStoryContent -} - -func (*StoryContentVideo) GetType() string { - return TypeStoryContentVideo -} - -func (*StoryContentVideo) StoryContentType() string { - return TypeStoryContentVideo -} - -// A story content that is not supported in the current TDLib version -type StoryContentUnsupported struct{ - meta -} - -func (entity *StoryContentUnsupported) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StoryContentUnsupported - - return json.Marshal((*stub)(entity)) -} - -func (*StoryContentUnsupported) GetClass() string { - return ClassStoryContent -} - -func (*StoryContentUnsupported) GetType() string { - return TypeStoryContentUnsupported -} - -func (*StoryContentUnsupported) StoryContentType() string { - return TypeStoryContentUnsupported -} - -// A photo story -type InputStoryContentPhoto struct { - meta - // Photo to send. The photo must be at most 10 MB in size. The photo size must be 1080x1920 - Photo InputFile `json:"photo"` - // File identifiers of the stickers added to the photo, if applicable - AddedStickerFileIds []int32 `json:"added_sticker_file_ids"` -} - -func (entity *InputStoryContentPhoto) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputStoryContentPhoto - - return json.Marshal((*stub)(entity)) -} - -func (*InputStoryContentPhoto) GetClass() string { - return ClassInputStoryContent -} - -func (*InputStoryContentPhoto) GetType() string { - return TypeInputStoryContentPhoto -} - -func (*InputStoryContentPhoto) InputStoryContentType() string { - return TypeInputStoryContentPhoto -} - -func (inputStoryContentPhoto *InputStoryContentPhoto) UnmarshalJSON(data []byte) error { - var tmp struct { - Photo json.RawMessage `json:"photo"` - AddedStickerFileIds []int32 `json:"added_sticker_file_ids"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - inputStoryContentPhoto.AddedStickerFileIds = tmp.AddedStickerFileIds - - fieldPhoto, _ := UnmarshalInputFile(tmp.Photo) - inputStoryContentPhoto.Photo = fieldPhoto - - return nil -} - -// A video story -type InputStoryContentVideo struct { - meta - // Video to be sent. The video size must be 720x1280. The video must be streamable and stored in MPEG4 format, after encoding with x265 codec and key frames added each second - Video InputFile `json:"video"` - // File identifiers of the stickers added to the video, if applicable - AddedStickerFileIds []int32 `json:"added_sticker_file_ids"` - // Precise duration of the video, in seconds; 0-60 - Duration float64 `json:"duration"` - // True, if the video has no sound - IsAnimation bool `json:"is_animation"` -} - -func (entity *InputStoryContentVideo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputStoryContentVideo - - return json.Marshal((*stub)(entity)) -} - -func (*InputStoryContentVideo) GetClass() string { - return ClassInputStoryContent -} - -func (*InputStoryContentVideo) GetType() string { - return TypeInputStoryContentVideo -} - -func (*InputStoryContentVideo) InputStoryContentType() string { - return TypeInputStoryContentVideo -} - -func (inputStoryContentVideo *InputStoryContentVideo) UnmarshalJSON(data []byte) error { - var tmp struct { - Video json.RawMessage `json:"video"` - AddedStickerFileIds []int32 `json:"added_sticker_file_ids"` - Duration float64 `json:"duration"` - IsAnimation bool `json:"is_animation"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - inputStoryContentVideo.AddedStickerFileIds = tmp.AddedStickerFileIds - inputStoryContentVideo.Duration = tmp.Duration - inputStoryContentVideo.IsAnimation = tmp.IsAnimation - - fieldVideo, _ := UnmarshalInputFile(tmp.Video) - inputStoryContentVideo.Video = fieldVideo - - return nil -} - -// The list of stories, shown in the main chat list and folder chat lists -type StoryListMain struct{ - meta -} - -func (entity *StoryListMain) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StoryListMain - - return json.Marshal((*stub)(entity)) -} - -func (*StoryListMain) GetClass() string { - return ClassStoryList -} - -func (*StoryListMain) GetType() string { - return TypeStoryListMain -} - -func (*StoryListMain) StoryListType() string { - return TypeStoryListMain -} - -// The list of stories, shown in the Arvhive chat list -type StoryListArchive struct{ - meta -} - -func (entity *StoryListArchive) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StoryListArchive - - return json.Marshal((*stub)(entity)) -} - -func (*StoryListArchive) GetClass() string { - return ClassStoryList -} - -func (*StoryListArchive) GetType() string { - return TypeStoryListArchive -} - -func (*StoryListArchive) StoryListType() string { - return TypeStoryListArchive -} - -// Contains information about interactions with a story -type StoryInteractionInfo struct { - meta - // Number of times the story was viewed - ViewCount int32 `json:"view_count"` - // Number of reactions added to the story - ReactionCount int32 `json:"reaction_count"` - // Identifiers of at most 3 recent viewers of the story - RecentViewerUserIds []int64 `json:"recent_viewer_user_ids"` -} - -func (entity *StoryInteractionInfo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StoryInteractionInfo - - return json.Marshal((*stub)(entity)) -} - -func (*StoryInteractionInfo) GetClass() string { - return ClassStoryInteractionInfo -} - -func (*StoryInteractionInfo) GetType() string { - return TypeStoryInteractionInfo -} - -// Represents a story -type Story struct { - meta - // Unique story identifier among stories of the given sender - Id int32 `json:"id"` - // Identifier of the chat that posted the story - SenderChatId int64 `json:"sender_chat_id"` - // Point in time (Unix timestamp) when the story was published - Date int32 `json:"date"` - // True, if the story is being sent by the current user - IsBeingSent bool `json:"is_being_sent"` - // True, if the story is being edited by the current user - IsBeingEdited bool `json:"is_being_edited"` - // True, if the story was edited - IsEdited bool `json:"is_edited"` - // True, if the story is saved in the sender's profile and will be available there after expiration - IsPinned bool `json:"is_pinned"` - // True, if the story is visible only for the current user - IsVisibleOnlyForSelf bool `json:"is_visible_only_for_self"` - // True, if the story can be forwarded as a message. Otherwise, screenshots and saving of the story content must be also forbidden - CanBeForwarded bool `json:"can_be_forwarded"` - // True, if the story can be replied in the chat with the story sender - CanBeReplied bool `json:"can_be_replied"` - // True, if users viewed the story can be received through getStoryViewers - CanGetViewers bool `json:"can_get_viewers"` - // True, if users viewed the story can't be received, because the story has expired more than getOption("story_viewers_expiration_delay") seconds ago - HasExpiredViewers bool `json:"has_expired_viewers"` - // Information about interactions with the story; may be null if the story isn't owned or there were no interactions - InteractionInfo *StoryInteractionInfo `json:"interaction_info"` - // Type of the chosen reaction; may be null if none - ChosenReactionType ReactionType `json:"chosen_reaction_type"` - // Privacy rules affecting story visibility; may be approximate for non-owned stories - PrivacySettings StoryPrivacySettings `json:"privacy_settings"` - // Content of the story - Content StoryContent `json:"content"` - // Clickable areas to be shown on the story content - Areas []*StoryArea `json:"areas"` - // Caption of the story - Caption *FormattedText `json:"caption"` -} - -func (entity *Story) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub Story - - return json.Marshal((*stub)(entity)) -} - -func (*Story) GetClass() string { - return ClassStory -} - -func (*Story) GetType() string { - return TypeStory -} - -func (story *Story) UnmarshalJSON(data []byte) error { - var tmp struct { - Id int32 `json:"id"` - SenderChatId int64 `json:"sender_chat_id"` - Date int32 `json:"date"` - IsBeingSent bool `json:"is_being_sent"` - IsBeingEdited bool `json:"is_being_edited"` - IsEdited bool `json:"is_edited"` - IsPinned bool `json:"is_pinned"` - IsVisibleOnlyForSelf bool `json:"is_visible_only_for_self"` - CanBeForwarded bool `json:"can_be_forwarded"` - CanBeReplied bool `json:"can_be_replied"` - CanGetViewers bool `json:"can_get_viewers"` - HasExpiredViewers bool `json:"has_expired_viewers"` - InteractionInfo *StoryInteractionInfo `json:"interaction_info"` - ChosenReactionType json.RawMessage `json:"chosen_reaction_type"` - PrivacySettings json.RawMessage `json:"privacy_settings"` - Content json.RawMessage `json:"content"` - Areas []*StoryArea `json:"areas"` - Caption *FormattedText `json:"caption"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - story.Id = tmp.Id - story.SenderChatId = tmp.SenderChatId - story.Date = tmp.Date - story.IsBeingSent = tmp.IsBeingSent - story.IsBeingEdited = tmp.IsBeingEdited - story.IsEdited = tmp.IsEdited - story.IsPinned = tmp.IsPinned - story.IsVisibleOnlyForSelf = tmp.IsVisibleOnlyForSelf - story.CanBeForwarded = tmp.CanBeForwarded - story.CanBeReplied = tmp.CanBeReplied - story.CanGetViewers = tmp.CanGetViewers - story.HasExpiredViewers = tmp.HasExpiredViewers - story.InteractionInfo = tmp.InteractionInfo - story.Areas = tmp.Areas - story.Caption = tmp.Caption - - fieldChosenReactionType, _ := UnmarshalReactionType(tmp.ChosenReactionType) - story.ChosenReactionType = fieldChosenReactionType - - fieldPrivacySettings, _ := UnmarshalStoryPrivacySettings(tmp.PrivacySettings) - story.PrivacySettings = fieldPrivacySettings - - fieldContent, _ := UnmarshalStoryContent(tmp.Content) - story.Content = fieldContent - - return nil -} - -// Represents a list of stories -type Stories struct { - meta - // Approximate total number of stories found - TotalCount int32 `json:"total_count"` - // The list of stories - Stories []*Story `json:"stories"` -} - -func (entity *Stories) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub Stories - - return json.Marshal((*stub)(entity)) -} - -func (*Stories) GetClass() string { - return ClassStories -} - -func (*Stories) GetType() string { - return TypeStories -} - -// Contains basic information about a story -type StoryInfo struct { - meta - // Unique story identifier among stories of the given sender - StoryId int32 `json:"story_id"` - // Point in time (Unix timestamp) when the story was published - Date int32 `json:"date"` - // True, if the story is available only to close friends - IsForCloseFriends bool `json:"is_for_close_friends"` -} - -func (entity *StoryInfo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StoryInfo - - return json.Marshal((*stub)(entity)) -} - -func (*StoryInfo) GetClass() string { - return ClassStoryInfo -} - -func (*StoryInfo) GetType() string { - return TypeStoryInfo -} - -// Describes active stories posted by a chat -type ChatActiveStories struct { - meta - // Identifier of the chat that posted the stories - ChatId int64 `json:"chat_id"` - // Identifier of the story list in which the stories are shown; may be null if the stories aren't shown in a story list - List StoryList `json:"list"` - // A parameter used to determine order of the stories in the story list; 0 if the stories doesn't need to be shown in the story list. Stories must be sorted by the pair (order, story_sender_chat_id) in descending order - Order int64 `json:"order"` - // Identifier of the last read active story - MaxReadStoryId int32 `json:"max_read_story_id"` - // Basic information about the stories; use getStory to get full information about the stories. The stories are in a chronological order (i.e., in order of increasing story identifiers) - Stories []*StoryInfo `json:"stories"` -} - -func (entity *ChatActiveStories) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatActiveStories - - return json.Marshal((*stub)(entity)) -} - -func (*ChatActiveStories) GetClass() string { - return ClassChatActiveStories -} - -func (*ChatActiveStories) GetType() string { - return TypeChatActiveStories -} - -func (chatActiveStories *ChatActiveStories) UnmarshalJSON(data []byte) error { - var tmp struct { - ChatId int64 `json:"chat_id"` - List json.RawMessage `json:"list"` - Order int64 `json:"order"` - MaxReadStoryId int32 `json:"max_read_story_id"` - Stories []*StoryInfo `json:"stories"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - chatActiveStories.ChatId = tmp.ChatId - chatActiveStories.Order = tmp.Order - chatActiveStories.MaxReadStoryId = tmp.MaxReadStoryId - chatActiveStories.Stories = tmp.Stories - - fieldList, _ := UnmarshalStoryList(tmp.List) - chatActiveStories.List = fieldList - - return nil -} - // The main block list that disallows writing messages to the current user, receiving their status and photo, viewing of stories, and some other actions type BlockListMain struct{ meta diff --git a/client/unmarshaler.go b/client/unmarshaler.go index ced4391..695a3d7 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -2869,6 +2869,182 @@ func UnmarshalListOfEmojiCategoryType(dataList []json.RawMessage) ([]EmojiCatego return list, nil } +func UnmarshalStoryAreaType(data json.RawMessage) (StoryAreaType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeStoryAreaTypeLocation: + return UnmarshalStoryAreaTypeLocation(data) + + case TypeStoryAreaTypeVenue: + return UnmarshalStoryAreaTypeVenue(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfStoryAreaType(dataList []json.RawMessage) ([]StoryAreaType, error) { + list := []StoryAreaType{} + + for _, data := range dataList { + entity, err := UnmarshalStoryAreaType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalInputStoryAreaType(data json.RawMessage) (InputStoryAreaType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeInputStoryAreaTypeLocation: + return UnmarshalInputStoryAreaTypeLocation(data) + + case TypeInputStoryAreaTypeFoundVenue: + return UnmarshalInputStoryAreaTypeFoundVenue(data) + + case TypeInputStoryAreaTypePreviousVenue: + return UnmarshalInputStoryAreaTypePreviousVenue(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfInputStoryAreaType(dataList []json.RawMessage) ([]InputStoryAreaType, error) { + list := []InputStoryAreaType{} + + for _, data := range dataList { + entity, err := UnmarshalInputStoryAreaType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalStoryContent(data json.RawMessage) (StoryContent, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeStoryContentPhoto: + return UnmarshalStoryContentPhoto(data) + + case TypeStoryContentVideo: + return UnmarshalStoryContentVideo(data) + + case TypeStoryContentUnsupported: + return UnmarshalStoryContentUnsupported(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfStoryContent(dataList []json.RawMessage) ([]StoryContent, error) { + list := []StoryContent{} + + for _, data := range dataList { + entity, err := UnmarshalStoryContent(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalInputStoryContent(data json.RawMessage) (InputStoryContent, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeInputStoryContentPhoto: + return UnmarshalInputStoryContentPhoto(data) + + case TypeInputStoryContentVideo: + return UnmarshalInputStoryContentVideo(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfInputStoryContent(dataList []json.RawMessage) ([]InputStoryContent, error) { + list := []InputStoryContent{} + + for _, data := range dataList { + entity, err := UnmarshalInputStoryContent(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalStoryList(data json.RawMessage) (StoryList, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeStoryListMain: + return UnmarshalStoryListMain(data) + + case TypeStoryListArchive: + return UnmarshalStoryListArchive(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfStoryList(dataList []json.RawMessage) ([]StoryList, error) { + list := []StoryList{} + + for _, data := range dataList { + entity, err := UnmarshalStoryList(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalCallDiscardReason(data json.RawMessage) (CallDiscardReason, error) { var meta meta @@ -5034,182 +5210,6 @@ func UnmarshalListOfInternalLinkType(dataList []json.RawMessage) ([]InternalLink return list, nil } -func UnmarshalStoryAreaType(data json.RawMessage) (StoryAreaType, error) { - var meta meta - - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } - - switch meta.Type { - case TypeStoryAreaTypeLocation: - return UnmarshalStoryAreaTypeLocation(data) - - case TypeStoryAreaTypeVenue: - return UnmarshalStoryAreaTypeVenue(data) - - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } -} - -func UnmarshalListOfStoryAreaType(dataList []json.RawMessage) ([]StoryAreaType, error) { - list := []StoryAreaType{} - - for _, data := range dataList { - entity, err := UnmarshalStoryAreaType(data) - if err != nil { - return nil, err - } - list = append(list, entity) - } - - return list, nil -} - -func UnmarshalInputStoryAreaType(data json.RawMessage) (InputStoryAreaType, error) { - var meta meta - - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } - - switch meta.Type { - case TypeInputStoryAreaTypeLocation: - return UnmarshalInputStoryAreaTypeLocation(data) - - case TypeInputStoryAreaTypeFoundVenue: - return UnmarshalInputStoryAreaTypeFoundVenue(data) - - case TypeInputStoryAreaTypePreviousVenue: - return UnmarshalInputStoryAreaTypePreviousVenue(data) - - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } -} - -func UnmarshalListOfInputStoryAreaType(dataList []json.RawMessage) ([]InputStoryAreaType, error) { - list := []InputStoryAreaType{} - - for _, data := range dataList { - entity, err := UnmarshalInputStoryAreaType(data) - if err != nil { - return nil, err - } - list = append(list, entity) - } - - return list, nil -} - -func UnmarshalStoryContent(data json.RawMessage) (StoryContent, error) { - var meta meta - - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } - - switch meta.Type { - case TypeStoryContentPhoto: - return UnmarshalStoryContentPhoto(data) - - case TypeStoryContentVideo: - return UnmarshalStoryContentVideo(data) - - case TypeStoryContentUnsupported: - return UnmarshalStoryContentUnsupported(data) - - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } -} - -func UnmarshalListOfStoryContent(dataList []json.RawMessage) ([]StoryContent, error) { - list := []StoryContent{} - - for _, data := range dataList { - entity, err := UnmarshalStoryContent(data) - if err != nil { - return nil, err - } - list = append(list, entity) - } - - return list, nil -} - -func UnmarshalInputStoryContent(data json.RawMessage) (InputStoryContent, error) { - var meta meta - - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } - - switch meta.Type { - case TypeInputStoryContentPhoto: - return UnmarshalInputStoryContentPhoto(data) - - case TypeInputStoryContentVideo: - return UnmarshalInputStoryContentVideo(data) - - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } -} - -func UnmarshalListOfInputStoryContent(dataList []json.RawMessage) ([]InputStoryContent, error) { - list := []InputStoryContent{} - - for _, data := range dataList { - entity, err := UnmarshalInputStoryContent(data) - if err != nil { - return nil, err - } - list = append(list, entity) - } - - return list, nil -} - -func UnmarshalStoryList(data json.RawMessage) (StoryList, error) { - var meta meta - - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } - - switch meta.Type { - case TypeStoryListMain: - return UnmarshalStoryListMain(data) - - case TypeStoryListArchive: - return UnmarshalStoryListArchive(data) - - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } -} - -func UnmarshalListOfStoryList(dataList []json.RawMessage) ([]StoryList, error) { - list := []StoryList{} - - for _, data := range dataList { - entity, err := UnmarshalStoryList(data) - if err != nil { - return nil, err - } - list = append(list, entity) - } - - return list, nil -} - func UnmarshalBlockList(data json.RawMessage) (BlockList, error) { var meta meta @@ -11087,6 +11087,198 @@ func UnmarshalEmojiCategoryTypeChatPhoto(data json.RawMessage) (*EmojiCategoryTy return &resp, err } +func UnmarshalStoryViewer(data json.RawMessage) (*StoryViewer, error) { + var resp StoryViewer + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryViewers(data json.RawMessage) (*StoryViewers, error) { + var resp StoryViewers + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryAreaPosition(data json.RawMessage) (*StoryAreaPosition, error) { + var resp StoryAreaPosition + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryAreaTypeLocation(data json.RawMessage) (*StoryAreaTypeLocation, error) { + var resp StoryAreaTypeLocation + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryAreaTypeVenue(data json.RawMessage) (*StoryAreaTypeVenue, error) { + var resp StoryAreaTypeVenue + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryArea(data json.RawMessage) (*StoryArea, error) { + var resp StoryArea + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputStoryAreaTypeLocation(data json.RawMessage) (*InputStoryAreaTypeLocation, error) { + var resp InputStoryAreaTypeLocation + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputStoryAreaTypeFoundVenue(data json.RawMessage) (*InputStoryAreaTypeFoundVenue, error) { + var resp InputStoryAreaTypeFoundVenue + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputStoryAreaTypePreviousVenue(data json.RawMessage) (*InputStoryAreaTypePreviousVenue, error) { + var resp InputStoryAreaTypePreviousVenue + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputStoryArea(data json.RawMessage) (*InputStoryArea, error) { + var resp InputStoryArea + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputStoryAreas(data json.RawMessage) (*InputStoryAreas, error) { + var resp InputStoryAreas + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryVideo(data json.RawMessage) (*StoryVideo, error) { + var resp StoryVideo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryContentPhoto(data json.RawMessage) (*StoryContentPhoto, error) { + var resp StoryContentPhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryContentVideo(data json.RawMessage) (*StoryContentVideo, error) { + var resp StoryContentVideo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryContentUnsupported(data json.RawMessage) (*StoryContentUnsupported, error) { + var resp StoryContentUnsupported + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputStoryContentPhoto(data json.RawMessage) (*InputStoryContentPhoto, error) { + var resp InputStoryContentPhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputStoryContentVideo(data json.RawMessage) (*InputStoryContentVideo, error) { + var resp InputStoryContentVideo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryListMain(data json.RawMessage) (*StoryListMain, error) { + var resp StoryListMain + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryListArchive(data json.RawMessage) (*StoryListArchive, error) { + var resp StoryListArchive + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryInteractionInfo(data json.RawMessage) (*StoryInteractionInfo, error) { + var resp StoryInteractionInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStory(data json.RawMessage) (*Story, error) { + var resp Story + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStories(data json.RawMessage) (*Stories, error) { + var resp Stories + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryInfo(data json.RawMessage) (*StoryInfo, error) { + var resp StoryInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatActiveStories(data json.RawMessage) (*ChatActiveStories, error) { + var resp ChatActiveStories + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalCallDiscardReasonEmpty(data json.RawMessage) (*CallDiscardReasonEmpty, error) { var resp CallDiscardReasonEmpty @@ -14287,198 +14479,6 @@ func UnmarshalMessageLinkInfo(data json.RawMessage) (*MessageLinkInfo, error) { return &resp, err } -func UnmarshalStoryViewer(data json.RawMessage) (*StoryViewer, error) { - var resp StoryViewer - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalStoryViewers(data json.RawMessage) (*StoryViewers, error) { - var resp StoryViewers - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalStoryAreaPosition(data json.RawMessage) (*StoryAreaPosition, error) { - var resp StoryAreaPosition - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalStoryAreaTypeLocation(data json.RawMessage) (*StoryAreaTypeLocation, error) { - var resp StoryAreaTypeLocation - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalStoryAreaTypeVenue(data json.RawMessage) (*StoryAreaTypeVenue, error) { - var resp StoryAreaTypeVenue - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalStoryArea(data json.RawMessage) (*StoryArea, error) { - var resp StoryArea - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalInputStoryAreaTypeLocation(data json.RawMessage) (*InputStoryAreaTypeLocation, error) { - var resp InputStoryAreaTypeLocation - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalInputStoryAreaTypeFoundVenue(data json.RawMessage) (*InputStoryAreaTypeFoundVenue, error) { - var resp InputStoryAreaTypeFoundVenue - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalInputStoryAreaTypePreviousVenue(data json.RawMessage) (*InputStoryAreaTypePreviousVenue, error) { - var resp InputStoryAreaTypePreviousVenue - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalInputStoryArea(data json.RawMessage) (*InputStoryArea, error) { - var resp InputStoryArea - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalInputStoryAreas(data json.RawMessage) (*InputStoryAreas, error) { - var resp InputStoryAreas - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalStoryVideo(data json.RawMessage) (*StoryVideo, error) { - var resp StoryVideo - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalStoryContentPhoto(data json.RawMessage) (*StoryContentPhoto, error) { - var resp StoryContentPhoto - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalStoryContentVideo(data json.RawMessage) (*StoryContentVideo, error) { - var resp StoryContentVideo - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalStoryContentUnsupported(data json.RawMessage) (*StoryContentUnsupported, error) { - var resp StoryContentUnsupported - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalInputStoryContentPhoto(data json.RawMessage) (*InputStoryContentPhoto, error) { - var resp InputStoryContentPhoto - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalInputStoryContentVideo(data json.RawMessage) (*InputStoryContentVideo, error) { - var resp InputStoryContentVideo - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalStoryListMain(data json.RawMessage) (*StoryListMain, error) { - var resp StoryListMain - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalStoryListArchive(data json.RawMessage) (*StoryListArchive, error) { - var resp StoryListArchive - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalStoryInteractionInfo(data json.RawMessage) (*StoryInteractionInfo, error) { - var resp StoryInteractionInfo - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalStory(data json.RawMessage) (*Story, error) { - var resp Story - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalStories(data json.RawMessage) (*Stories, error) { - var resp Stories - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalStoryInfo(data json.RawMessage) (*StoryInfo, error) { - var resp StoryInfo - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalChatActiveStories(data json.RawMessage) (*ChatActiveStories, error) { - var resp ChatActiveStories - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - func UnmarshalBlockListMain(data json.RawMessage) (*BlockListMain, error) { var resp BlockListMain @@ -18182,6 +18182,78 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeEmojiCategoryTypeChatPhoto: return UnmarshalEmojiCategoryTypeChatPhoto(data) + case TypeStoryViewer: + return UnmarshalStoryViewer(data) + + case TypeStoryViewers: + return UnmarshalStoryViewers(data) + + case TypeStoryAreaPosition: + return UnmarshalStoryAreaPosition(data) + + case TypeStoryAreaTypeLocation: + return UnmarshalStoryAreaTypeLocation(data) + + case TypeStoryAreaTypeVenue: + return UnmarshalStoryAreaTypeVenue(data) + + case TypeStoryArea: + return UnmarshalStoryArea(data) + + case TypeInputStoryAreaTypeLocation: + return UnmarshalInputStoryAreaTypeLocation(data) + + case TypeInputStoryAreaTypeFoundVenue: + return UnmarshalInputStoryAreaTypeFoundVenue(data) + + case TypeInputStoryAreaTypePreviousVenue: + return UnmarshalInputStoryAreaTypePreviousVenue(data) + + case TypeInputStoryArea: + return UnmarshalInputStoryArea(data) + + case TypeInputStoryAreas: + return UnmarshalInputStoryAreas(data) + + case TypeStoryVideo: + return UnmarshalStoryVideo(data) + + case TypeStoryContentPhoto: + return UnmarshalStoryContentPhoto(data) + + case TypeStoryContentVideo: + return UnmarshalStoryContentVideo(data) + + case TypeStoryContentUnsupported: + return UnmarshalStoryContentUnsupported(data) + + case TypeInputStoryContentPhoto: + return UnmarshalInputStoryContentPhoto(data) + + case TypeInputStoryContentVideo: + return UnmarshalInputStoryContentVideo(data) + + case TypeStoryListMain: + return UnmarshalStoryListMain(data) + + case TypeStoryListArchive: + return UnmarshalStoryListArchive(data) + + case TypeStoryInteractionInfo: + return UnmarshalStoryInteractionInfo(data) + + case TypeStory: + return UnmarshalStory(data) + + case TypeStories: + return UnmarshalStories(data) + + case TypeStoryInfo: + return UnmarshalStoryInfo(data) + + case TypeChatActiveStories: + return UnmarshalChatActiveStories(data) + case TypeCallDiscardReasonEmpty: return UnmarshalCallDiscardReasonEmpty(data) @@ -19382,78 +19454,6 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageLinkInfo: return UnmarshalMessageLinkInfo(data) - case TypeStoryViewer: - return UnmarshalStoryViewer(data) - - case TypeStoryViewers: - return UnmarshalStoryViewers(data) - - case TypeStoryAreaPosition: - return UnmarshalStoryAreaPosition(data) - - case TypeStoryAreaTypeLocation: - return UnmarshalStoryAreaTypeLocation(data) - - case TypeStoryAreaTypeVenue: - return UnmarshalStoryAreaTypeVenue(data) - - case TypeStoryArea: - return UnmarshalStoryArea(data) - - case TypeInputStoryAreaTypeLocation: - return UnmarshalInputStoryAreaTypeLocation(data) - - case TypeInputStoryAreaTypeFoundVenue: - return UnmarshalInputStoryAreaTypeFoundVenue(data) - - case TypeInputStoryAreaTypePreviousVenue: - return UnmarshalInputStoryAreaTypePreviousVenue(data) - - case TypeInputStoryArea: - return UnmarshalInputStoryArea(data) - - case TypeInputStoryAreas: - return UnmarshalInputStoryAreas(data) - - case TypeStoryVideo: - return UnmarshalStoryVideo(data) - - case TypeStoryContentPhoto: - return UnmarshalStoryContentPhoto(data) - - case TypeStoryContentVideo: - return UnmarshalStoryContentVideo(data) - - case TypeStoryContentUnsupported: - return UnmarshalStoryContentUnsupported(data) - - case TypeInputStoryContentPhoto: - return UnmarshalInputStoryContentPhoto(data) - - case TypeInputStoryContentVideo: - return UnmarshalInputStoryContentVideo(data) - - case TypeStoryListMain: - return UnmarshalStoryListMain(data) - - case TypeStoryListArchive: - return UnmarshalStoryListArchive(data) - - case TypeStoryInteractionInfo: - return UnmarshalStoryInteractionInfo(data) - - case TypeStory: - return UnmarshalStory(data) - - case TypeStories: - return UnmarshalStories(data) - - case TypeStoryInfo: - return UnmarshalStoryInfo(data) - - case TypeChatActiveStories: - return UnmarshalChatActiveStories(data) - case TypeBlockListMain: return UnmarshalBlockListMain(data) diff --git a/data/td_api.tl b/data/td_api.tl index d69567b..9f2eec0 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -1320,7 +1320,7 @@ notificationSettingsScopeChannelChats = NotificationSettingsScope; //@use_default_show_preview If true, show_preview is ignored and the value for the relevant type of chat or the forum chat is used instead //@show_preview True, if message content must be displayed in notifications //@use_default_mute_stories If true, mute_stories is ignored and the value for the relevant type of chat is used instead -//@mute_stories True, if story notifications are received without sound +//@mute_stories True, if story notifications are disabled for the chat //@use_default_story_sound If true, the value for the relevant type of chat is used instead of story_sound_id //@story_sound_id Identifier of the notification sound to be played for stories; 0 if sound is disabled //@use_default_show_story_sender If true, show_story_sender is ignored and the value for the relevant type of chat is used instead @@ -1335,8 +1335,8 @@ chatNotificationSettings use_default_mute_for:Bool mute_for:int32 use_default_so //@mute_for Time left before notifications will be unmuted, in seconds //@sound_id Identifier of the notification sound to be played; 0 if sound is disabled //@show_preview True, if message content must be displayed in notifications -//@use_default_mute_stories If true, mute_stories is ignored and stories are unmuted only for the first 5 chats from topChatCategoryUsers -//@mute_stories True, if story notifications are received without sound +//@use_default_mute_stories If true, mute_stories is ignored and story notifications are received only for the first 5 chats from topChatCategoryUsers +//@mute_stories True, if story notifications are disabled for the chat //@story_sound_id Identifier of the notification sound to be played for stories; 0 if sound is disabled //@show_story_sender True, if the sender of stories must be displayed in notifications //@disable_pinned_message_notifications True, if notifications for incoming pinned messages will be created as for an ordinary unread message @@ -3153,6 +3153,159 @@ emojiCategoryTypeEmojiStatus = EmojiCategoryType; emojiCategoryTypeChatPhoto = EmojiCategoryType; +//@description Represents a viewer of a story +//@user_id User identifier of the viewer +//@view_date Approximate point in time (Unix timestamp) when the story was viewed +//@block_list Block list to which the user is added; may be null if none +//@chosen_reaction_type Type of the reaction that was chosen by the user; may be null if none +storyViewer user_id:int53 view_date:int32 block_list:BlockList chosen_reaction_type:ReactionType = StoryViewer; + +//@description Represents a list of story viewers +//@total_count Approximate total number of story viewers found +//@viewers List of story viewers +//@next_offset The offset for the next request. If empty, there are no more results +storyViewers total_count:int32 viewers:vector next_offset:string = StoryViewers; + + +//@description Describes position of a clickable rectangle area on a story media +//@x_percentage The abscissa of the rectangle's center, as a percentage of the media width +//@y_percentage The ordinate of the rectangle's center, as a percentage of the media height +//@width_percentage The width of the rectangle, as a percentage of the media width +//@height_percentage The ordinate of the rectangle's center, as a percentage of the media height +//@rotation_angle Clockwise rotation angle of the rectangle, in degrees; 0-360 +storyAreaPosition x_percentage:double y_percentage:double width_percentage:double height_percentage:double rotation_angle:double = StoryAreaPosition; + + +//@class StoryAreaType @description Describes type of a clickable rectangle area on a story media + +//@description An area pointing to a location @location The location +storyAreaTypeLocation location:location = StoryAreaType; + +//@description An area pointing to a venue @venue Information about the venue +storyAreaTypeVenue venue:venue = StoryAreaType; + + +//@description Describes a clickable rectangle area on a story media @position Position of the area @type Type of the area +storyArea position:storyAreaPosition type:StoryAreaType = StoryArea; + + +//@class InputStoryAreaType @description Describes type of a clickable rectangle area on a story media to be added + +//@description An area pointing to a location @location The location +inputStoryAreaTypeLocation location:location = InputStoryAreaType; + +//@description An area pointing to a venue found by the bot getOption("venue_search_bot_username") +//@query_id Identifier of the inline query, used to found the venue +//@result_id Identifier of the inline query result +inputStoryAreaTypeFoundVenue query_id:int64 result_id:string = InputStoryAreaType; + +//@description An area pointing to a venue already added to the story +//@venue_provider Provider of the venue +//@venue_id Identifier of the venue in the provider database +inputStoryAreaTypePreviousVenue venue_provider:string venue_id:string = InputStoryAreaType; + + +//@description Describes a clickable rectangle area on a story media to be added @position Position of the area @type Type of the area +inputStoryArea position:storyAreaPosition type:InputStoryAreaType = InputStoryArea; + +//@description Contains a list of story areas to be added @areas List of 0-10 input story areas +inputStoryAreas areas:vector = InputStoryAreas; + + +//@description Describes a video file sent in a story +//@duration Duration of the video, in seconds +//@width Video width +//@height Video height +//@has_stickers True, if stickers were added to the video. The list of corresponding sticker sets can be received using getAttachedStickerSets +//@is_animation True, if the video has no sound +//@minithumbnail Video minithumbnail; may be null +//@thumbnail Video thumbnail in JPEG or MPEG4 format; may be null +//@preload_prefix_size Size of file prefix, which is supposed to be preloaded, in bytes +//@video File containing the video +storyVideo duration:double width:int32 height:int32 has_stickers:Bool is_animation:Bool minithumbnail:minithumbnail thumbnail:thumbnail preload_prefix_size:int32 video:file = StoryVideo; + + +//@class StoryContent @description Contains the content of a story + +//@description A photo story @photo The photo +storyContentPhoto photo:photo = StoryContent; + +//@description A video story @video The video in MPEG4 format @alternative_video Alternative version of the video in MPEG4 format, encoded by x264 codec; may be null +storyContentVideo video:storyVideo alternative_video:storyVideo = StoryContent; + +//@description A story content that is not supported in the current TDLib version +storyContentUnsupported = StoryContent; + + +//@class InputStoryContent @description The content of a story to send + +//@description A photo story +//@photo Photo to send. The photo must be at most 10 MB in size. The photo size must be 1080x1920 +//@added_sticker_file_ids File identifiers of the stickers added to the photo, if applicable +inputStoryContentPhoto photo:InputFile added_sticker_file_ids:vector = InputStoryContent; + +//@description A video story +//@video Video to be sent. The video size must be 720x1280. The video must be streamable and stored in MPEG4 format, after encoding with x265 codec and key frames added each second +//@added_sticker_file_ids File identifiers of the stickers added to the video, if applicable +//@duration Precise duration of the video, in seconds; 0-60 +//@is_animation True, if the video has no sound +inputStoryContentVideo video:InputFile added_sticker_file_ids:vector duration:double is_animation:Bool = InputStoryContent; + + +//@class StoryList @description Describes a list of stories + +//@description The list of stories, shown in the main chat list and folder chat lists +storyListMain = StoryList; + +//@description The list of stories, shown in the Arvhive chat list +storyListArchive = StoryList; + + +//@description Contains information about interactions with a story +//@view_count Number of times the story was viewed +//@reaction_count Number of reactions added to the story +//@recent_viewer_user_ids Identifiers of at most 3 recent viewers of the story +storyInteractionInfo view_count:int32 reaction_count:int32 recent_viewer_user_ids:vector = StoryInteractionInfo; + +//@description Represents a story +//@id Unique story identifier among stories of the given sender +//@sender_chat_id Identifier of the chat that posted the story +//@date Point in time (Unix timestamp) when the story was published +//@is_being_sent True, if the story is being sent by the current user +//@is_being_edited True, if the story is being edited by the current user +//@is_edited True, if the story was edited +//@is_pinned True, if the story is saved in the sender's profile and will be available there after expiration +//@is_visible_only_for_self True, if the story is visible only for the current user +//@can_be_forwarded True, if the story can be forwarded as a message. Otherwise, screenshots and saving of the story content must be also forbidden +//@can_be_replied True, if the story can be replied in the chat with the story sender +//@can_get_viewers True, if users viewed the story can be received through getStoryViewers +//@has_expired_viewers True, if users viewed the story can't be received, because the story has expired more than getOption("story_viewers_expiration_delay") seconds ago +//@interaction_info Information about interactions with the story; may be null if the story isn't owned or there were no interactions +//@chosen_reaction_type Type of the chosen reaction; may be null if none +//@privacy_settings Privacy rules affecting story visibility; may be approximate for non-owned stories +//@content Content of the story +//@areas Clickable areas to be shown on the story content +//@caption Caption of the story +story id:int32 sender_chat_id:int53 date:int32 is_being_sent:Bool is_being_edited:Bool is_edited:Bool is_pinned:Bool is_visible_only_for_self:Bool can_be_forwarded:Bool can_be_replied:Bool can_get_viewers:Bool has_expired_viewers:Bool interaction_info:storyInteractionInfo chosen_reaction_type:ReactionType privacy_settings:StoryPrivacySettings content:StoryContent areas:vector caption:formattedText = Story; + +//@description Represents a list of stories @total_count Approximate total number of stories found @stories The list of stories +stories total_count:int32 stories:vector = Stories; + +//@description Contains basic information about a story +//@story_id Unique story identifier among stories of the given sender +//@date Point in time (Unix timestamp) when the story was published +//@is_for_close_friends True, if the story is available only to close friends +storyInfo story_id:int32 date:int32 is_for_close_friends:Bool = StoryInfo; + +//@description Describes active stories posted by a chat +//@chat_id Identifier of the chat that posted the stories +//@list Identifier of the story list in which the stories are shown; may be null if the stories aren't shown in a story list +//@order A parameter used to determine order of the stories in the story list; 0 if the stories doesn't need to be shown in the story list. Stories must be sorted by the pair (order, story_sender_chat_id) in descending order +//@max_read_story_id Identifier of the last read active story +//@stories Basic information about the stories; use getStory to get full information about the stories. The stories are in a chronological order (i.e., in order of increasing story identifiers) +chatActiveStories chat_id:int53 list:StoryList order:int53 max_read_story_id:int32 stories:vector = ChatActiveStories; + + //@class CallDiscardReason @description Describes the reason why a call was discarded //@description The call wasn't discarded, or the reason is unknown @@ -4961,159 +5114,6 @@ messageLink link:string is_public:Bool = MessageLink; messageLinkInfo is_public:Bool chat_id:int53 message_thread_id:int53 message:message media_timestamp:int32 for_album:Bool = MessageLinkInfo; -//@description Represents a viewer of a story -//@user_id User identifier of the viewer -//@view_date Approximate point in time (Unix timestamp) when the story was viewed -//@block_list Block list to which the user is added; may be null if none -//@chosen_reaction_type Type of the reaction that was chosen by the user; may be null if none -storyViewer user_id:int53 view_date:int32 block_list:BlockList chosen_reaction_type:ReactionType = StoryViewer; - -//@description Represents a list of story viewers -//@total_count Approximate total number of story viewers found -//@viewers List of story viewers -//@next_offset The offset for the next request. If empty, there are no more results -storyViewers total_count:int32 viewers:vector next_offset:string = StoryViewers; - - -//@description Describes position of a clickable rectangle area on a story media -//@x_percentage The abscissa of the rectangle's center, as a percentage of the media width -//@y_percentage The ordinate of the rectangle's center, as a percentage of the media height -//@width_percentage The width of the rectangle, as a percentage of the media width -//@height_percentage The ordinate of the rectangle's center, as a percentage of the media height -//@rotation_angle Clockwise rotation angle of the rectangle, in degrees; 0-360 -storyAreaPosition x_percentage:double y_percentage:double width_percentage:double height_percentage:double rotation_angle:double = StoryAreaPosition; - - -//@class StoryAreaType @description Describes type of a clickable rectangle area on a story media - -//@description An area pointing to a location @location The location -storyAreaTypeLocation location:location = StoryAreaType; - -//@description An area pointing to a venue @venue Information about the venue -storyAreaTypeVenue venue:venue = StoryAreaType; - - -//@description Describes a clickable rectangle area on a story media @position Position of the area @type Type of the area -storyArea position:storyAreaPosition type:StoryAreaType = StoryArea; - - -//@class InputStoryAreaType @description Describes type of a clickable rectangle area on a story media to be added - -//@description An area pointing to a location @location The location -inputStoryAreaTypeLocation location:location = InputStoryAreaType; - -//@description An area pointing to a venue found by the bot getOption("venue_search_bot_username") -//@query_id Identifier of the inline query, used to found the venue -//@result_id Identifier of the inline query result -inputStoryAreaTypeFoundVenue query_id:int64 result_id:string = InputStoryAreaType; - -//@description An area pointing to a venue already added to the story -//@venue_provider Provider of the venue -//@venue_id Identifier of the venue in the provider database -inputStoryAreaTypePreviousVenue venue_provider:string venue_id:string = InputStoryAreaType; - - -//@description Describes a clickable rectangle area on a story media to be added @position Position of the area @type Type of the area -inputStoryArea position:storyAreaPosition type:InputStoryAreaType = InputStoryArea; - -//@description Contains a list of story areas to be added @areas List of 0-10 input story areas -inputStoryAreas areas:vector = InputStoryAreas; - - -//@description Describes a video file sent in a story -//@duration Duration of the video, in seconds -//@width Video width -//@height Video height -//@has_stickers True, if stickers were added to the video. The list of corresponding sticker sets can be received using getAttachedStickerSets -//@is_animation True, if the video has no sound -//@minithumbnail Video minithumbnail; may be null -//@thumbnail Video thumbnail in JPEG or MPEG4 format; may be null -//@preload_prefix_size Size of file prefix, which is supposed to be preloaded, in bytes -//@video File containing the video -storyVideo duration:double width:int32 height:int32 has_stickers:Bool is_animation:Bool minithumbnail:minithumbnail thumbnail:thumbnail preload_prefix_size:int32 video:file = StoryVideo; - - -//@class StoryContent @description Contains the content of a story - -//@description A photo story @photo The photo -storyContentPhoto photo:photo = StoryContent; - -//@description A video story @video The video in MPEG4 format @alternative_video Alternative version of the video in MPEG4 format, encoded by x264 codec; may be null -storyContentVideo video:storyVideo alternative_video:storyVideo = StoryContent; - -//@description A story content that is not supported in the current TDLib version -storyContentUnsupported = StoryContent; - - -//@class InputStoryContent @description The content of a story to send - -//@description A photo story -//@photo Photo to send. The photo must be at most 10 MB in size. The photo size must be 1080x1920 -//@added_sticker_file_ids File identifiers of the stickers added to the photo, if applicable -inputStoryContentPhoto photo:InputFile added_sticker_file_ids:vector = InputStoryContent; - -//@description A video story -//@video Video to be sent. The video size must be 720x1280. The video must be streamable and stored in MPEG4 format, after encoding with x265 codec and key frames added each second -//@added_sticker_file_ids File identifiers of the stickers added to the video, if applicable -//@duration Precise duration of the video, in seconds; 0-60 -//@is_animation True, if the video has no sound -inputStoryContentVideo video:InputFile added_sticker_file_ids:vector duration:double is_animation:Bool = InputStoryContent; - - -//@class StoryList @description Describes a list of stories - -//@description The list of stories, shown in the main chat list and folder chat lists -storyListMain = StoryList; - -//@description The list of stories, shown in the Arvhive chat list -storyListArchive = StoryList; - - -//@description Contains information about interactions with a story -//@view_count Number of times the story was viewed -//@reaction_count Number of reactions added to the story -//@recent_viewer_user_ids Identifiers of at most 3 recent viewers of the story -storyInteractionInfo view_count:int32 reaction_count:int32 recent_viewer_user_ids:vector = StoryInteractionInfo; - -//@description Represents a story -//@id Unique story identifier among stories of the given sender -//@sender_chat_id Identifier of the chat that posted the story -//@date Point in time (Unix timestamp) when the story was published -//@is_being_sent True, if the story is being sent by the current user -//@is_being_edited True, if the story is being edited by the current user -//@is_edited True, if the story was edited -//@is_pinned True, if the story is saved in the sender's profile and will be available there after expiration -//@is_visible_only_for_self True, if the story is visible only for the current user -//@can_be_forwarded True, if the story can be forwarded as a message. Otherwise, screenshots and saving of the story content must be also forbidden -//@can_be_replied True, if the story can be replied in the chat with the story sender -//@can_get_viewers True, if users viewed the story can be received through getStoryViewers -//@has_expired_viewers True, if users viewed the story can't be received, because the story has expired more than getOption("story_viewers_expiration_delay") seconds ago -//@interaction_info Information about interactions with the story; may be null if the story isn't owned or there were no interactions -//@chosen_reaction_type Type of the chosen reaction; may be null if none -//@privacy_settings Privacy rules affecting story visibility; may be approximate for non-owned stories -//@content Content of the story -//@areas Clickable areas to be shown on the story content -//@caption Caption of the story -story id:int32 sender_chat_id:int53 date:int32 is_being_sent:Bool is_being_edited:Bool is_edited:Bool is_pinned:Bool is_visible_only_for_self:Bool can_be_forwarded:Bool can_be_replied:Bool can_get_viewers:Bool has_expired_viewers:Bool interaction_info:storyInteractionInfo chosen_reaction_type:ReactionType privacy_settings:StoryPrivacySettings content:StoryContent areas:vector caption:formattedText = Story; - -//@description Represents a list of stories @total_count Approximate total number of stories found @stories The list of stories -stories total_count:int32 stories:vector = Stories; - -//@description Contains basic information about a story -//@story_id Unique story identifier among stories of the given sender -//@date Point in time (Unix timestamp) when the story was published -//@is_for_close_friends True, if the story is available only to close friends -storyInfo story_id:int32 date:int32 is_for_close_friends:Bool = StoryInfo; - -//@description Describes active stories posted by a chat -//@chat_id Identifier of the chat that posted the stories -//@list Identifier of the story list in which the stories are shown; may be null if the stories aren't shown in a story list -//@order A parameter used to determine order of the stories in the story list; 0 if the stories doesn't need to be shown in the story list. Stories must be sorted by the pair (order, story_sender_chat_id) in descending order -//@max_read_story_id Identifier of the last read active story -//@stories Basic information about the stories; use getStory to get full information about the stories. The stories are in a chronological order (i.e., in order of increasing story identifiers) -chatActiveStories chat_id:int53 list:StoryList order:int53 max_read_story_id:int32 stories:vector = ChatActiveStories; - - //@class BlockList @description Describes a type of a block list //@description The main block list that disallows writing messages to the current user, receiving their status and photo, viewing of stories, and some other actions @@ -6377,7 +6377,7 @@ searchChatsOnServer query:string limit:int32 = Chats; //@location Current user location searchChatsNearby location:location = ChatsNearby; -//@description Returns a list of frequently used chats. Supported only if the chat info database is enabled @category Category of chats to be returned @limit The maximum number of chats to be returned; up to 30 +//@description Returns a list of frequently used chats @category Category of chats to be returned @limit The maximum number of chats to be returned; up to 30 getTopChats category:TopChatCategory limit:int32 = Chats; //@description Removes a chat from the list of frequently used chats. Supported only if the chat info database is enabled @category Category of frequently used chats @chat_id Chat identifier @@ -6667,6 +6667,9 @@ forwardMessages chat_id:int53 message_thread_id:int53 from_chat_id:int53 message //@message_ids Identifiers of the messages to resend. Message identifiers must be in a strictly increasing order resendMessages chat_id:int53 message_ids:vector = Messages; +//@description Sends a notification about a screenshot taken in a chat. Supported only in private and secret chats @chat_id Chat identifier +sendChatScreenshotTakenNotification chat_id:int53 = Ok; + //@description Adds a local message to a chat. The message is persistent across application restarts only if the message database is used. Returns the added message //@chat_id Target chat //@sender_id Identifier of the sender of the message From af2b93f686a66f9c538752e6df359177d620f162 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Sat, 16 Sep 2023 15:09:40 +0800 Subject: [PATCH 02/54] Update to TDLib 1.8.18 --- client/function.go | 215 ++++++++++++++++++++-- client/type.go | 414 ++++++++++++++++++++++++++++++++++++------ client/unmarshaler.go | 188 ++++++++++++++++++- data/td_api.tl | 200 ++++++++++++++------ 4 files changed, 888 insertions(+), 129 deletions(-) diff --git a/client/function.go b/client/function.go index ff812ee..883efd3 100755 --- a/client/function.go +++ b/client/function.go @@ -1513,7 +1513,7 @@ type GetRemoteFileRequest struct { FileType FileType `json:"file_type"` } -// Returns information about a file by its remote ID; this is an offline request. Can be used to register a URL as a file for further uploading, or sending as a message. Even the request succeeds, the file can be used only if it is still accessible to the user. For example, if the file is from a message, then the message must be not deleted and accessible to the user. If the file database is disabled, then the corresponding object with the file must be preloaded by the application +// Returns information about a file by its remote identifier; this is an offline request. Can be used to register a URL as a file for further uploading, or sending as a message. Even the request succeeds, the file can be used only if it is still accessible to the user. For example, if the file is from a message, then the message must be not deleted and accessible to the user. If the file database is disabled, then the corresponding object with the file must be preloaded by the application func (client *Client) GetRemoteFile(req *GetRemoteFileRequest) (*File, error) { result, err := client.Send(Request{ meta: meta{ @@ -1914,7 +1914,7 @@ func (client *Client) GetRecentlyOpenedChats(req *GetRecentlyOpenedChatsRequest) } type CheckChatUsernameRequest struct { - // Chat identifier; must be identifier of a supergroup chat, or a channel chat, or a private chat with self, or zero if the chat is being created + // Chat identifier; must be identifier of a supergroup chat, or a channel chat, or a private chat with self, or 0 if the chat is being created ChatId int64 `json:"chat_id"` // Username to be checked Username string `json:"username"` @@ -5282,7 +5282,7 @@ func (client *Client) GetWebAppLinkUrl(req *GetWebAppLinkUrlRequest) (*HttpUrl, type GetWebAppUrlRequest struct { // Identifier of the target bot BotUserId int64 `json:"bot_user_id"` - // The URL from the keyboardButtonTypeWebApp or inlineQueryResultsButtonTypeWebApp button + // The URL from a keyboardButtonTypeWebApp button, inlineQueryResultsButtonTypeWebApp button, an internalLinkTypeSideMenuBot link, or an empty when the bot is opened from the side menu Url string `json:"url"` // Preferred Web App theme; pass null to use the default theme Theme *ThemeParameters `json:"theme"` @@ -5290,7 +5290,7 @@ type GetWebAppUrlRequest struct { ApplicationName string `json:"application_name"` } -// Returns an HTTPS URL of a Web App to open after keyboardButtonTypeWebApp or inlineQueryResultsButtonTypeWebApp button is pressed +// Returns an HTTPS URL of a Web App to open from the side menu, a keyboardButtonTypeWebApp button, an inlineQueryResultsButtonTypeWebApp button, or an internalLinkTypeSideMenuBot link func (client *Client) GetWebAppUrl(req *GetWebAppUrlRequest) (*HttpUrl, error) { result, err := client.Send(Request{ meta: meta{ @@ -5351,7 +5351,7 @@ type OpenWebAppRequest struct { ChatId int64 `json:"chat_id"` // Identifier of the bot, providing the Web App BotUserId int64 `json:"bot_user_id"` - // The URL from an inlineKeyboardButtonTypeWebApp button, a botMenuButton button, or an internalLinkTypeAttachmentMenuBot link, or an empty string otherwise + // The URL from an inlineKeyboardButtonTypeWebApp button, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an empty string otherwise Url string `json:"url"` // Preferred Web App theme; pass null to use the default theme Theme *ThemeParameters `json:"theme"` @@ -5363,7 +5363,7 @@ type OpenWebAppRequest struct { ReplyTo MessageReplyTo `json:"reply_to"` } -// Informs TDLib that a Web App is being opened from attachment menu, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an inlineKeyboardButtonTypeWebApp button. For each bot, a confirmation alert about data sent to the bot must be shown once +// Informs TDLib that a Web App is being opened from the attachment menu, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an inlineKeyboardButtonTypeWebApp button. For each bot, a confirmation alert about data sent to the bot must be shown once func (client *Client) OpenWebApp(req *OpenWebAppRequest) (*WebAppInfo, error) { result, err := client.Send(Request{ meta: meta{ @@ -6062,6 +6062,9 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeSettings: return UnmarshalInternalLinkTypeSettings(result.Data) + case TypeInternalLinkTypeSideMenuBot: + return UnmarshalInternalLinkTypeSideMenuBot(result.Data) + case TypeInternalLinkTypeStickerSet: return UnmarshalInternalLinkTypeStickerSet(result.Data) @@ -9022,7 +9025,7 @@ type GetAttachmentMenuBotRequest struct { BotUserId int64 `json:"bot_user_id"` } -// Returns information about a bot that can be added to attachment menu +// Returns information about a bot that can be added to attachment or side menu func (client *Client) GetAttachmentMenuBot(req *GetAttachmentMenuBotRequest) (*AttachmentMenuBot, error) { result, err := client.Send(Request{ meta: meta{ @@ -9052,7 +9055,7 @@ type ToggleBotIsAddedToAttachmentMenuRequest struct { AllowWriteAccess bool `json:"allow_write_access"` } -// Adds or removes a bot to attachment menu. Bot can be added to attachment menu, only if userTypeBot.can_be_added_to_attachment_menu == true +// Adds or removes a bot to attachment and side menu. Bot can be added to the menu, only if userTypeBot.can_be_added_to_attachment_menu == true func (client *Client) ToggleBotIsAddedToAttachmentMenu(req *ToggleBotIsAddedToAttachmentMenuRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -11867,6 +11870,41 @@ func (client *Client) GetStickers(req *GetStickersRequest) (*Stickers, error) { return UnmarshalStickers(result.Data) } +type GetAllStickerEmojisRequest struct { + // Type of the stickers to search for + StickerType StickerType `json:"sticker_type"` + // Search query + Query string `json:"query"` + // Chat identifier for which to find stickers + ChatId int64 `json:"chat_id"` + // Pass true if only main emoji for each found sticker must be included in the result + ReturnOnlyMainEmoji bool `json:"return_only_main_emoji"` +} + +// Returns unique emoji that correspond to stickers to be found by the getStickers(sticker_type, query, 1000000, chat_id) +func (client *Client) GetAllStickerEmojis(req *GetAllStickerEmojisRequest) (*Emojis, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getAllStickerEmojis", + }, + Data: map[string]interface{}{ + "sticker_type": req.StickerType, + "query": req.Query, + "chat_id": req.ChatId, + "return_only_main_emoji": req.ReturnOnlyMainEmoji, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalEmojis(result.Data) +} + type SearchStickersRequest struct { // Type of the stickers to return StickerType StickerType `json:"sticker_type"` @@ -13378,6 +13416,90 @@ func (client *Client) SetDefaultChannelAdministratorRights(req *SetDefaultChanne return UnmarshalOk(result.Data) } +type CanBotSendMessagesRequest struct { + // Identifier of the target bot + BotUserId int64 `json:"bot_user_id"` +} + +// Checks whether the specified bot can send messages to the user. Returns a 404 error if can't and the access can be granted by call to allowBotToSendMessages +func (client *Client) CanBotSendMessages(req *CanBotSendMessagesRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "canBotSendMessages", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type AllowBotToSendMessagesRequest struct { + // Identifier of the target bot + BotUserId int64 `json:"bot_user_id"` +} + +// Allows the specified bot to send messages to the user +func (client *Client) AllowBotToSendMessages(req *AllowBotToSendMessagesRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "allowBotToSendMessages", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SendWebAppCustomRequestRequest struct { + // Identifier of the bot + BotUserId int64 `json:"bot_user_id"` + // The method name + Method string `json:"method"` + // JSON-serialized method parameters + Parameters string `json:"parameters"` +} + +// Sends a custom request from a Web App +func (client *Client) SendWebAppCustomRequest(req *SendWebAppCustomRequestRequest) (*CustomRequestResult, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendWebAppCustomRequest", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "method": req.Method, + "parameters": req.Parameters, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalCustomRequestResult(result.Data) +} + type SetBotNameRequest struct { // Identifier of the target bot BotUserId int64 `json:"bot_user_id"` @@ -13715,6 +13837,32 @@ func (client *Client) TerminateAllOtherSessions() (*Ok, error) { return UnmarshalOk(result.Data) } +type ConfirmSessionRequest struct { + // Session identifier + SessionId JsonInt64 `json:"session_id"` +} + +// Confirms an unconfirmed session of the current user from another device +func (client *Client) ConfirmSession(req *ConfirmSessionRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "confirmSession", + }, + Data: map[string]interface{}{ + "session_id": req.SessionId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type ToggleSessionCanAcceptCallsRequest struct { // Session identifier SessionId JsonInt64 `json:"session_id"` @@ -14922,7 +15070,7 @@ func (client *Client) AddCustomServerLanguagePack(req *AddCustomServerLanguagePa } type SetCustomLanguagePackRequest struct { - // Information about the language pack. Language pack ID must start with 'X', consist only of English letters, digits and hyphens, and must not exceed 64 characters. Can be called before authorization + // Information about the language pack. Language pack identifier must start with 'X', consist only of English letters, digits and hyphens, and must not exceed 64 characters. Can be called before authorization Info *LanguagePackInfo `json:"info"` // Strings of the new language pack Strings []*LanguagePackString `json:"strings"` @@ -17304,6 +17452,46 @@ func (client *Client) AcceptTermsOfService(req *AcceptTermsOfServiceRequest) (*O return UnmarshalOk(result.Data) } +type SearchStringsByPrefixRequest struct { + // The strings to search in for the query + Strings []string `json:"strings"` + // Query to search for + Query string `json:"query"` + // The maximum number of objects to return + Limit int32 `json:"limit"` + // Pass true to receive no results for an empty query + ReturnNoneForEmptyQuery bool `json:"return_none_for_empty_query"` +} + +// Searches specified query by word prefixes in the provided strings. Returns 0-based positions of strings that matched. Can be called synchronously +func SearchStringsByPrefix(req *SearchStringsByPrefixRequest) (*FoundPositions, error) { + result, err := Execute(Request{ + meta: meta{ + Type: "searchStringsByPrefix", + }, + Data: map[string]interface{}{ + "strings": req.Strings, + "query": req.Query, + "limit": req.Limit, + "return_none_for_empty_query": req.ReturnNoneForEmptyQuery, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFoundPositions(result.Data) +} + +// deprecated +// Searches specified query by word prefixes in the provided strings. Returns 0-based positions of strings that matched. Can be called synchronously +func (client *Client) SearchStringsByPrefix(req *SearchStringsByPrefixRequest) (*FoundPositions, error) { + return SearchStringsByPrefix(req)} + type SendCustomRequestRequest struct { // The method name Method string `json:"method"` @@ -17630,7 +17818,7 @@ func (client *Client) GetApplicationDownloadLink() (*HttpUrl, error) { } type AddProxyRequest struct { - // Proxy server IP address + // Proxy server domain or IP address Server string `json:"server"` // Proxy server port Port int32 `json:"port"` @@ -17667,7 +17855,7 @@ func (client *Client) AddProxy(req *AddProxyRequest) (*Proxy, error) { type EditProxyRequest struct { // Proxy identifier ProxyId int32 `json:"proxy_id"` - // Proxy server IP address + // Proxy server domain or IP address Server string `json:"server"` // Proxy server port Port int32 `json:"port"` @@ -18384,7 +18572,7 @@ func (client *Client) TestNetwork() (*Ok, error) { } type TestProxyRequest struct { - // Proxy server IP address + // Proxy server domain or IP address Server string `json:"server"` // Proxy server port Port int32 `json:"port"` @@ -18739,6 +18927,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateUsersNearby: return UnmarshalUpdateUsersNearby(result.Data) + case TypeUpdateUnconfirmedSession: + return UnmarshalUpdateUnconfirmedSession(result.Data) + case TypeUpdateAttachmentMenuBots: return UnmarshalUpdateAttachmentMenuBots(result.Data) diff --git a/client/type.go b/client/type.go index 3b74865..eba7be1 100755 --- a/client/type.go +++ b/client/type.go @@ -24,6 +24,7 @@ const ( ClassChatMemberStatus = "ChatMemberStatus" ClassChatMembersFilter = "ChatMembersFilter" ClassSupergroupMembersFilter = "SupergroupMembersFilter" + ClassInviteLinkChatType = "InviteLinkChatType" ClassSecretChatState = "SecretChatState" ClassMessageSender = "MessageSender" ClassMessageForwardOrigin = "MessageForwardOrigin" @@ -59,6 +60,7 @@ const ( ClassMessageContent = "MessageContent" ClassTextEntityType = "TextEntityType" ClassMessageSchedulingState = "MessageSchedulingState" + ClassMessageSelfDestructType = "MessageSelfDestructType" ClassInputMessageContent = "InputMessageContent" ClassSearchMessagesFilter = "SearchMessagesFilter" ClassChatAction = "ChatAction" @@ -376,6 +378,7 @@ const ( ClassMessageAutoDeleteTime = "MessageAutoDeleteTime" ClassSession = "Session" ClassSessions = "Sessions" + ClassUnconfirmedSession = "UnconfirmedSession" ClassConnectedWebsite = "ConnectedWebsite" ClassConnectedWebsites = "ConnectedWebsites" ClassMessageLink = "MessageLink" @@ -392,6 +395,7 @@ const ( ClassScopeAutosaveSettings = "ScopeAutosaveSettings" ClassAutosaveSettingsException = "AutosaveSettingsException" ClassAutosaveSettings = "AutosaveSettings" + ClassFoundPositions = "FoundPositions" ClassTMeUrl = "TMeUrl" ClassTMeUrls = "TMeUrls" ClassCount = "Count" @@ -575,6 +579,9 @@ const ( TypeChatInviteLinkCounts = "chatInviteLinkCounts" TypeChatInviteLinkMember = "chatInviteLinkMember" TypeChatInviteLinkMembers = "chatInviteLinkMembers" + TypeInviteLinkChatTypeBasicGroup = "inviteLinkChatTypeBasicGroup" + TypeInviteLinkChatTypeSupergroup = "inviteLinkChatTypeSupergroup" + TypeInviteLinkChatTypeChannel = "inviteLinkChatTypeChannel" TypeChatInviteLinkInfo = "chatInviteLinkInfo" TypeChatJoinRequest = "chatJoinRequest" TypeChatJoinRequests = "chatJoinRequests" @@ -957,6 +964,8 @@ const ( TypeInputThumbnail = "inputThumbnail" TypeMessageSchedulingStateSendAtDate = "messageSchedulingStateSendAtDate" TypeMessageSchedulingStateSendWhenOnline = "messageSchedulingStateSendWhenOnline" + TypeMessageSelfDestructTypeTimer = "messageSelfDestructTypeTimer" + TypeMessageSelfDestructTypeImmediately = "messageSelfDestructTypeImmediately" TypeMessageSendOptions = "messageSendOptions" TypeMessageCopyOptions = "messageCopyOptions" TypeInputMessageText = "inputMessageText" @@ -1353,7 +1362,7 @@ const ( TypeStoryPrivacySettingsEveryone = "storyPrivacySettingsEveryone" TypeStoryPrivacySettingsContacts = "storyPrivacySettingsContacts" TypeStoryPrivacySettingsCloseFriends = "storyPrivacySettingsCloseFriends" - TypeStoryPrivacySettingsSelectedContacts = "storyPrivacySettingsSelectedContacts" + TypeStoryPrivacySettingsSelectedUsers = "storyPrivacySettingsSelectedUsers" TypeUserPrivacySettingRuleAllowAll = "userPrivacySettingRuleAllowAll" TypeUserPrivacySettingRuleAllowContacts = "userPrivacySettingRuleAllowContacts" TypeUserPrivacySettingRuleAllowUsers = "userPrivacySettingRuleAllowUsers" @@ -1394,6 +1403,7 @@ const ( TypeSessionTypeXbox = "sessionTypeXbox" TypeSession = "session" TypeSessions = "sessions" + TypeUnconfirmedSession = "unconfirmedSession" TypeConnectedWebsite = "connectedWebsite" TypeConnectedWebsites = "connectedWebsites" TypeReportReasonSpam = "reportReasonSpam" @@ -1438,6 +1448,7 @@ const ( TypeInternalLinkTypeQrCodeAuthentication = "internalLinkTypeQrCodeAuthentication" TypeInternalLinkTypeRestorePurchases = "internalLinkTypeRestorePurchases" TypeInternalLinkTypeSettings = "internalLinkTypeSettings" + TypeInternalLinkTypeSideMenuBot = "internalLinkTypeSideMenuBot" TypeInternalLinkTypeStickerSet = "internalLinkTypeStickerSet" TypeInternalLinkTypeStory = "internalLinkTypeStory" TypeInternalLinkTypeTheme = "internalLinkTypeTheme" @@ -1506,6 +1517,7 @@ const ( TypeTopChatCategoryInlineBots = "topChatCategoryInlineBots" TypeTopChatCategoryCalls = "topChatCategoryCalls" TypeTopChatCategoryForwardChats = "topChatCategoryForwardChats" + TypeFoundPositions = "foundPositions" TypeTMeUrlTypeUser = "tMeUrlTypeUser" TypeTMeUrlTypeSupergroup = "tMeUrlTypeSupergroup" TypeTMeUrlTypeChatInvite = "tMeUrlTypeChatInvite" @@ -1650,6 +1662,7 @@ const ( TypeUpdateConnectionState = "updateConnectionState" TypeUpdateTermsOfService = "updateTermsOfService" TypeUpdateUsersNearby = "updateUsersNearby" + TypeUpdateUnconfirmedSession = "updateUnconfirmedSession" TypeUpdateAttachmentMenuBots = "updateAttachmentMenuBots" TypeUpdateWebAppMessageSent = "updateWebAppMessageSent" TypeUpdateActiveEmojiReactions = "updateActiveEmojiReactions" @@ -1773,6 +1786,11 @@ type SupergroupMembersFilter interface { SupergroupMembersFilterType() string } +// Describes the type of a chat to which points an invite link +type InviteLinkChatType interface { + InviteLinkChatTypeType() string +} + // Describes the current secret chat state type SecretChatState interface { SecretChatStateType() string @@ -1948,6 +1966,11 @@ type MessageSchedulingState interface { MessageSchedulingStateType() string } +// Describes when a message will be self-destructed +type MessageSelfDestructType interface { + MessageSelfDestructTypeType() string +} + // The content of a message to send type InputMessageContent interface { InputMessageContentType() string @@ -3369,7 +3392,7 @@ func (*LocalFile) GetType() string { // Represents a remote file type RemoteFile struct { meta - // Remote file identifier; may be empty. Can be used by the current user across application restarts or even from other devices. Uniquely identifies a file, but a file can have a lot of different valid identifiers. If the ID starts with "http://" or "https://", it represents the HTTP URL of the file. TDLib is currently unable to download files if only their URL is known. If downloadFile/addFileToDownloads is called on such a file or if it is sent to a secret chat, TDLib starts a file generation process by sending updateFileGenerationStart to the application with the HTTP URL in the original_path and "#url#" as the conversion string. Application must generate the file by downloading it to the specified location + // Remote file identifier; may be empty. Can be used by the current user across application restarts or even from other devices. Uniquely identifies a file, but a file can have a lot of different valid identifiers. If the identifier starts with "http://" or "https://", it represents the HTTP URL of the file. TDLib is currently unable to download files if only their URL is known. If downloadFile/addFileToDownloads is called on such a file or if it is sent to a secret chat, TDLib starts a file generation process by sending updateFileGenerationStart to the application with the HTTP URL in the original_path and "#url#" as the conversion string. Application must generate the file by downloading it to the specified location Id string `json:"id"` // Unique file identifier; may be empty if unknown. The unique file identifier which is the same for the same file even for different users and is persistent over time UniqueId string `json:"unique_id"` @@ -3430,7 +3453,7 @@ func (*File) GetType() string { return TypeFile } -// A file defined by its unique ID +// A file defined by its unique identifier type InputFileId struct { meta // Unique file identifier @@ -3457,7 +3480,7 @@ func (*InputFileId) InputFileType() string { return TypeInputFileId } -// A file defined by its remote ID. The remote ID is guaranteed to be usable only if the corresponding file is still accessible to the user and known to TDLib. For example, if the file is from a message, then the message must be not deleted and accessible to the user. If the file database is disabled, then the corresponding object with the file must be preloaded by the application +// A file defined by its remote identifier. The remote identifier is guaranteed to be usable only if the corresponding file is still accessible to the user and known to TDLib. For example, if the file is from a message, then the message must be not deleted and accessible to the user. If the file database is disabled, then the corresponding object with the file must be preloaded by the application type InputFileRemote struct { meta // Remote file identifier @@ -5216,7 +5239,7 @@ type UserTypeBot struct { InlineQueryPlaceholder string `json:"inline_query_placeholder"` // True, if the location of the user is expected to be sent with every inline query to this bot NeedLocation bool `json:"need_location"` - // True, if the bot can be added to attachment menu + // True, if the bot can be added to attachment or side menu CanBeAddedToAttachmentMenu bool `json:"can_be_added_to_attachment_menu"` } @@ -7169,6 +7192,81 @@ func (*ChatInviteLinkMembers) GetType() string { return TypeChatInviteLinkMembers } +// The link is an invite link for a basic group +type InviteLinkChatTypeBasicGroup struct{ + meta +} + +func (entity *InviteLinkChatTypeBasicGroup) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InviteLinkChatTypeBasicGroup + + return json.Marshal((*stub)(entity)) +} + +func (*InviteLinkChatTypeBasicGroup) GetClass() string { + return ClassInviteLinkChatType +} + +func (*InviteLinkChatTypeBasicGroup) GetType() string { + return TypeInviteLinkChatTypeBasicGroup +} + +func (*InviteLinkChatTypeBasicGroup) InviteLinkChatTypeType() string { + return TypeInviteLinkChatTypeBasicGroup +} + +// The link is an invite link for a supergroup +type InviteLinkChatTypeSupergroup struct{ + meta +} + +func (entity *InviteLinkChatTypeSupergroup) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InviteLinkChatTypeSupergroup + + return json.Marshal((*stub)(entity)) +} + +func (*InviteLinkChatTypeSupergroup) GetClass() string { + return ClassInviteLinkChatType +} + +func (*InviteLinkChatTypeSupergroup) GetType() string { + return TypeInviteLinkChatTypeSupergroup +} + +func (*InviteLinkChatTypeSupergroup) InviteLinkChatTypeType() string { + return TypeInviteLinkChatTypeSupergroup +} + +// The link is an invite link for a channel +type InviteLinkChatTypeChannel struct{ + meta +} + +func (entity *InviteLinkChatTypeChannel) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InviteLinkChatTypeChannel + + return json.Marshal((*stub)(entity)) +} + +func (*InviteLinkChatTypeChannel) GetClass() string { + return ClassInviteLinkChatType +} + +func (*InviteLinkChatTypeChannel) GetType() string { + return TypeInviteLinkChatTypeChannel +} + +func (*InviteLinkChatTypeChannel) InviteLinkChatTypeType() string { + return TypeInviteLinkChatTypeChannel +} + // Contains information about a chat invite link type ChatInviteLinkInfo struct { meta @@ -7177,7 +7275,7 @@ type ChatInviteLinkInfo struct { // If non-zero, the amount of time for which read access to the chat will remain available, in seconds AccessibleFor int32 `json:"accessible_for"` // Type of the chat - Type ChatType `json:"type"` + Type InviteLinkChatType `json:"type"` // Title of the chat Title string `json:"title"` // Chat photo; may be null @@ -7192,6 +7290,12 @@ type ChatInviteLinkInfo struct { CreatesJoinRequest bool `json:"creates_join_request"` // True, if the chat is a public supergroup or channel, i.e. it has a username or it is a location-based supergroup IsPublic bool `json:"is_public"` + // True, if the chat is verified + IsVerified bool `json:"is_verified"` + // True, if many users reported this chat as a scam + IsScam bool `json:"is_scam"` + // True, if many users reported this chat as a fake account + IsFake bool `json:"is_fake"` } func (entity *ChatInviteLinkInfo) MarshalJSON() ([]byte, error) { @@ -7222,6 +7326,9 @@ func (chatInviteLinkInfo *ChatInviteLinkInfo) UnmarshalJSON(data []byte) error { MemberUserIds []int64 `json:"member_user_ids"` CreatesJoinRequest bool `json:"creates_join_request"` IsPublic bool `json:"is_public"` + IsVerified bool `json:"is_verified"` + IsScam bool `json:"is_scam"` + IsFake bool `json:"is_fake"` } err := json.Unmarshal(data, &tmp) @@ -7238,8 +7345,11 @@ func (chatInviteLinkInfo *ChatInviteLinkInfo) UnmarshalJSON(data []byte) error { chatInviteLinkInfo.MemberUserIds = tmp.MemberUserIds chatInviteLinkInfo.CreatesJoinRequest = tmp.CreatesJoinRequest chatInviteLinkInfo.IsPublic = tmp.IsPublic + chatInviteLinkInfo.IsVerified = tmp.IsVerified + chatInviteLinkInfo.IsScam = tmp.IsScam + chatInviteLinkInfo.IsFake = tmp.IsFake - fieldType, _ := UnmarshalChatType(tmp.Type) + fieldType, _ := UnmarshalInviteLinkChatType(tmp.Type) chatInviteLinkInfo.Type = fieldType return nil @@ -8569,11 +8679,11 @@ type Message struct { ReplyTo MessageReplyTo `json:"reply_to"` // If non-zero, the identifier of the message thread the message belongs to; unique within the chat to which the message belongs MessageThreadId int64 `json:"message_thread_id"` - // The message's self-destruct time, in seconds; 0 if none. TDLib will send updateDeleteMessages or updateMessageContent once the time expires - SelfDestructTime int32 `json:"self_destruct_time"` - // Time left before the message self-destruct timer expires, in seconds. If the self-destruct timer isn't started yet, equals to the value of the self_destruct_time field + // The message's self-destruct type; may be null if none + SelfDestructType MessageSelfDestructType `json:"self_destruct_type"` + // Time left before the message self-destruct timer expires, in seconds; 0 if self-desctruction isn't scheduled yet SelfDestructIn float64 `json:"self_destruct_in"` - // Time left before the message will be automatically deleted by message_auto_delete_time setting of the chat, in seconds; 0 if never. TDLib will send updateDeleteMessages or updateMessageContent once the time expires + // Time left before the message will be automatically deleted by message_auto_delete_time setting of the chat, in seconds; 0 if never AutoDeleteIn float64 `json:"auto_delete_in"` // If non-zero, the user identifier of the bot through which this message was sent ViaBotUserId int64 `json:"via_bot_user_id"` @@ -8636,7 +8746,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { UnreadReactions []*UnreadReaction `json:"unread_reactions"` ReplyTo json.RawMessage `json:"reply_to"` MessageThreadId int64 `json:"message_thread_id"` - SelfDestructTime int32 `json:"self_destruct_time"` + SelfDestructType json.RawMessage `json:"self_destruct_type"` SelfDestructIn float64 `json:"self_destruct_in"` AutoDeleteIn float64 `json:"auto_delete_in"` ViaBotUserId int64 `json:"via_bot_user_id"` @@ -8677,7 +8787,6 @@ func (message *Message) UnmarshalJSON(data []byte) error { message.InteractionInfo = tmp.InteractionInfo message.UnreadReactions = tmp.UnreadReactions message.MessageThreadId = tmp.MessageThreadId - message.SelfDestructTime = tmp.SelfDestructTime message.SelfDestructIn = tmp.SelfDestructIn message.AutoDeleteIn = tmp.AutoDeleteIn message.ViaBotUserId = tmp.ViaBotUserId @@ -8697,6 +8806,9 @@ func (message *Message) UnmarshalJSON(data []byte) error { fieldReplyTo, _ := UnmarshalMessageReplyTo(tmp.ReplyTo) message.ReplyTo = fieldReplyTo + fieldSelfDestructType, _ := UnmarshalMessageSelfDestructType(tmp.SelfDestructType) + message.SelfDestructType = fieldSelfDestructType + fieldContent, _ := UnmarshalMessageContent(tmp.Content) message.Content = fieldContent @@ -11665,6 +11777,8 @@ type FoundWebApp struct { meta // The Web App WebApp *WebApp `json:"web_app"` + // True, if the app supports "settings_button_pressed" event + SupportsSettings bool `json:"supports_settings"` // True, if the user must be asked for the permission to the bot to send them messages RequestWriteAccess bool `json:"request_write_access"` // True, if there is no need to show an ordinary open URL confirmation before opening the Web App. The field must be ignored and confirmation must be shown anyway if the Web App link was hidden @@ -19083,6 +19197,8 @@ type MessageBotWriteAccessAllowed struct { meta // Information about the Web App, which requested the access; may be null if none or the Web App was opened from the attachment menu WebApp *WebApp `json:"web_app"` + // True, if user allowed the bot to send messages by an explicit call to allowBotToSendMessages + ByRequest bool `json:"by_request"` } func (entity *MessageBotWriteAccessAllowed) MarshalJSON() ([]byte, error) { @@ -19922,6 +20038,58 @@ func (*MessageSchedulingStateSendWhenOnline) MessageSchedulingStateType() string return TypeMessageSchedulingStateSendWhenOnline } +// The message will be self-destructed in the specified time after its content was opened +type MessageSelfDestructTypeTimer struct { + meta + // The message's self-destruct time, in seconds; must be between 0 and 60 in private chats + SelfDestructTime int32 `json:"self_destruct_time"` +} + +func (entity *MessageSelfDestructTypeTimer) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSelfDestructTypeTimer + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSelfDestructTypeTimer) GetClass() string { + return ClassMessageSelfDestructType +} + +func (*MessageSelfDestructTypeTimer) GetType() string { + return TypeMessageSelfDestructTypeTimer +} + +func (*MessageSelfDestructTypeTimer) MessageSelfDestructTypeType() string { + return TypeMessageSelfDestructTypeTimer +} + +// The message can be opened only once and will be self-destructed once closed +type MessageSelfDestructTypeImmediately struct{ + meta +} + +func (entity *MessageSelfDestructTypeImmediately) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSelfDestructTypeImmediately + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSelfDestructTypeImmediately) GetClass() string { + return ClassMessageSelfDestructType +} + +func (*MessageSelfDestructTypeImmediately) GetType() string { + return TypeMessageSelfDestructTypeImmediately +} + +func (*MessageSelfDestructTypeImmediately) MessageSelfDestructTypeType() string { + return TypeMessageSelfDestructTypeImmediately +} + // Options to be used when a message is sent type MessageSendOptions struct { meta @@ -20247,8 +20415,8 @@ type InputMessagePhoto struct { Height int32 `json:"height"` // Photo caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters Caption *FormattedText `json:"caption"` - // Photo self-destruct time, in seconds (0-60). A non-zero self-destruct time can be specified only in private chats - SelfDestructTime int32 `json:"self_destruct_time"` + // Photo self-destruct type; pass null if none; private chats only + SelfDestructType MessageSelfDestructType `json:"self_destruct_type"` // True, if the photo preview must be covered by a spoiler animation; not supported in secret chats HasSpoiler bool `json:"has_spoiler"` } @@ -20281,7 +20449,7 @@ func (inputMessagePhoto *InputMessagePhoto) UnmarshalJSON(data []byte) error { Width int32 `json:"width"` Height int32 `json:"height"` Caption *FormattedText `json:"caption"` - SelfDestructTime int32 `json:"self_destruct_time"` + SelfDestructType json.RawMessage `json:"self_destruct_type"` HasSpoiler bool `json:"has_spoiler"` } @@ -20295,12 +20463,14 @@ func (inputMessagePhoto *InputMessagePhoto) UnmarshalJSON(data []byte) error { inputMessagePhoto.Width = tmp.Width inputMessagePhoto.Height = tmp.Height inputMessagePhoto.Caption = tmp.Caption - inputMessagePhoto.SelfDestructTime = tmp.SelfDestructTime inputMessagePhoto.HasSpoiler = tmp.HasSpoiler fieldPhoto, _ := UnmarshalInputFile(tmp.Photo) inputMessagePhoto.Photo = fieldPhoto + fieldSelfDestructType, _ := UnmarshalMessageSelfDestructType(tmp.SelfDestructType) + inputMessagePhoto.SelfDestructType = fieldSelfDestructType + return nil } @@ -20383,8 +20553,8 @@ type InputMessageVideo struct { SupportsStreaming bool `json:"supports_streaming"` // Video caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters Caption *FormattedText `json:"caption"` - // Video self-destruct time, in seconds (0-60). A non-zero self-destruct time can be specified only in private chats - SelfDestructTime int32 `json:"self_destruct_time"` + // Video self-destruct type; pass null if none; private chats only + SelfDestructType MessageSelfDestructType `json:"self_destruct_type"` // True, if the video preview must be covered by a spoiler animation; not supported in secret chats HasSpoiler bool `json:"has_spoiler"` } @@ -20419,7 +20589,7 @@ func (inputMessageVideo *InputMessageVideo) UnmarshalJSON(data []byte) error { Height int32 `json:"height"` SupportsStreaming bool `json:"supports_streaming"` Caption *FormattedText `json:"caption"` - SelfDestructTime int32 `json:"self_destruct_time"` + SelfDestructType json.RawMessage `json:"self_destruct_type"` HasSpoiler bool `json:"has_spoiler"` } @@ -20435,12 +20605,14 @@ func (inputMessageVideo *InputMessageVideo) UnmarshalJSON(data []byte) error { inputMessageVideo.Height = tmp.Height inputMessageVideo.SupportsStreaming = tmp.SupportsStreaming inputMessageVideo.Caption = tmp.Caption - inputMessageVideo.SelfDestructTime = tmp.SelfDestructTime inputMessageVideo.HasSpoiler = tmp.HasSpoiler fieldVideo, _ := UnmarshalInputFile(tmp.Video) inputMessageVideo.Video = fieldVideo + fieldSelfDestructType, _ := UnmarshalMessageSelfDestructType(tmp.SelfDestructType) + inputMessageVideo.SelfDestructType = fieldSelfDestructType + return nil } @@ -22347,6 +22519,8 @@ type StoryViewers struct { meta // Approximate total number of story viewers found TotalCount int32 `json:"total_count"` + // Approximate total number of reactions set by found story viewers + TotalReactionCount int32 `json:"total_reaction_count"` // List of story viewers Viewers []*StoryViewer `json:"viewers"` // The offset for the next request. If empty, there are no more results @@ -24909,10 +25083,10 @@ func (*AttachmentMenuBotColor) GetType() string { return TypeAttachmentMenuBotColor } -// Represents a bot, which can be added to attachment menu +// Represents a bot, which can be added to attachment or side menu type AttachmentMenuBot struct { meta - // User identifier of the bot added to attachment menu + // User identifier of the bot BotUserId int64 `json:"bot_user_id"` // True, if the bot supports opening from attachment menu in the chat with the bot SupportsSelfChat bool `json:"supports_self_chat"` @@ -24926,22 +25100,36 @@ type AttachmentMenuBot struct { SupportsChannelChats bool `json:"supports_channel_chats"` // True, if the bot supports "settings_button_pressed" event SupportsSettings bool `json:"supports_settings"` - // True, if the user must be asked for the permission to the bot to send them messages + // True, if the user must be asked for the permission to send messages to the bot RequestWriteAccess bool `json:"request_write_access"` + // 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 `json:"is_added"` + // True, if the bot must be shown in the attachment menu + ShowInAttachmentMenu bool `json:"show_in_attachment_menu"` + // True, if the bot must be shown in the side menu + ShowInSideMenu bool `json:"show_in_side_menu"` + // True, if a disclaimer, why the bot is shown in the side menu, is needed + ShowDisclaimerInSideMenu bool `json:"show_disclaimer_in_side_menu"` // Name for the bot in attachment menu Name string `json:"name"` // Color to highlight selected name of the bot if appropriate; may be null NameColor *AttachmentMenuBotColor `json:"name_color"` - // Default attachment menu icon for the bot in SVG format; may be null + // Default icon for the bot in SVG format; may be null DefaultIcon *File `json:"default_icon"` - // Attachment menu icon for the bot in SVG format for the official iOS app; may be null + // Icon for the bot in SVG format for the official iOS app; may be null IosStaticIcon *File `json:"ios_static_icon"` - // Attachment menu icon for the bot in TGS format for the official iOS app; may be null + // Icon for the bot in TGS format for the official iOS app; may be null IosAnimatedIcon *File `json:"ios_animated_icon"` - // Attachment menu icon for the bot in TGS format for the official Android app; may be null + // Icon for the bot in PNG format for the official iOS app side menu; may be null + IosSideMenuIcon *File `json:"ios_side_menu_icon"` + // Icon for the bot in TGS format for the official Android app; may be null AndroidIcon *File `json:"android_icon"` - // Attachment menu icon for the bot in TGS format for the official native macOS app; may be null + // Icon for the bot in SVG format for the official Android app side menu; may be null + AndroidSideMenuIcon *File `json:"android_side_menu_icon"` + // Icon for the bot in TGS format for the official native macOS app; may be null MacosIcon *File `json:"macos_icon"` + // Icon for the bot in PNG format for the official macOS app side menu; may be null + MacosSideMenuIcon *File `json:"macos_side_menu_icon"` // Color to highlight selected icon of the bot if appropriate; may be null IconColor *AttachmentMenuBotColor `json:"icon_color"` // Default placeholder for opened Web Apps in SVG format; may be null @@ -32097,7 +32285,7 @@ func (*NotificationTypeNewCall) NotificationTypeType() string { // New message was received through a push notification type NotificationTypeNewPushMessage struct { meta - // The message identifier. The message will not be available in the chat history, but the ID can be used in viewMessages, or as a message to reply + // The message identifier. The message will not be available in the chat history, but the identifier can be used in viewMessages, or as a message to reply MessageId int64 `json:"message_id"` // Identifier of the sender of the message. Corresponding user or chat may be inaccessible SenderId MessageSender `json:"sender_id"` @@ -32826,30 +33014,30 @@ func (*StoryPrivacySettingsCloseFriends) StoryPrivacySettingsType() string { } // The story can be viewed by certain specified users -type StoryPrivacySettingsSelectedContacts struct { +type StoryPrivacySettingsSelectedUsers struct { meta // Identifiers of the users; always unknown and empty for non-owned stories UserIds []int64 `json:"user_ids"` } -func (entity *StoryPrivacySettingsSelectedContacts) MarshalJSON() ([]byte, error) { +func (entity *StoryPrivacySettingsSelectedUsers) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub StoryPrivacySettingsSelectedContacts + type stub StoryPrivacySettingsSelectedUsers return json.Marshal((*stub)(entity)) } -func (*StoryPrivacySettingsSelectedContacts) GetClass() string { +func (*StoryPrivacySettingsSelectedUsers) GetClass() string { return ClassStoryPrivacySettings } -func (*StoryPrivacySettingsSelectedContacts) GetType() string { - return TypeStoryPrivacySettingsSelectedContacts +func (*StoryPrivacySettingsSelectedUsers) GetType() string { + return TypeStoryPrivacySettingsSelectedUsers } -func (*StoryPrivacySettingsSelectedContacts) StoryPrivacySettingsType() string { - return TypeStoryPrivacySettingsSelectedContacts +func (*StoryPrivacySettingsSelectedUsers) StoryPrivacySettingsType() string { + return TypeStoryPrivacySettingsSelectedUsers } // A rule to allow all users to do something @@ -33829,6 +34017,8 @@ type Session struct { IsCurrent bool `json:"is_current"` // True, if a 2-step verification password is needed to complete authorization of the session IsPasswordPending bool `json:"is_password_pending"` + // True, if the session wasn't confirmed from another session + IsUnconfirmed bool `json:"is_unconfirmed"` // True, if incoming secret chats can be accepted by the session CanAcceptSecretChats bool `json:"can_accept_secret_chats"` // True, if incoming calls can be accepted by the session @@ -33854,11 +34044,9 @@ type Session struct { // Point in time (Unix timestamp) when the session was last used LastActiveDate int32 `json:"last_active_date"` // IP address from which the session was created, in human-readable format - Ip string `json:"ip"` - // A two-letter country code for the country from which the session was created, based on the IP address - Country string `json:"country"` - // Region code from which the session was created, based on the IP address - Region string `json:"region"` + IpAddress string `json:"ip_address"` + // A human-readable description of the location from which the session was created, based on the IP address + Location string `json:"location"` } func (entity *Session) MarshalJSON() ([]byte, error) { @@ -33882,6 +34070,7 @@ func (session *Session) UnmarshalJSON(data []byte) error { Id JsonInt64 `json:"id"` IsCurrent bool `json:"is_current"` IsPasswordPending bool `json:"is_password_pending"` + IsUnconfirmed bool `json:"is_unconfirmed"` CanAcceptSecretChats bool `json:"can_accept_secret_chats"` CanAcceptCalls bool `json:"can_accept_calls"` Type json.RawMessage `json:"type"` @@ -33894,9 +34083,8 @@ func (session *Session) UnmarshalJSON(data []byte) error { SystemVersion string `json:"system_version"` LogInDate int32 `json:"log_in_date"` LastActiveDate int32 `json:"last_active_date"` - Ip string `json:"ip"` - Country string `json:"country"` - Region string `json:"region"` + IpAddress string `json:"ip_address"` + Location string `json:"location"` } err := json.Unmarshal(data, &tmp) @@ -33907,6 +34095,7 @@ func (session *Session) UnmarshalJSON(data []byte) error { session.Id = tmp.Id session.IsCurrent = tmp.IsCurrent session.IsPasswordPending = tmp.IsPasswordPending + session.IsUnconfirmed = tmp.IsUnconfirmed session.CanAcceptSecretChats = tmp.CanAcceptSecretChats session.CanAcceptCalls = tmp.CanAcceptCalls session.ApiId = tmp.ApiId @@ -33918,9 +34107,8 @@ func (session *Session) UnmarshalJSON(data []byte) error { session.SystemVersion = tmp.SystemVersion session.LogInDate = tmp.LogInDate session.LastActiveDate = tmp.LastActiveDate - session.Ip = tmp.Ip - session.Country = tmp.Country - session.Region = tmp.Region + session.IpAddress = tmp.IpAddress + session.Location = tmp.Location fieldType, _ := UnmarshalSessionType(tmp.Type) session.Type = fieldType @@ -33953,6 +34141,35 @@ func (*Sessions) GetType() string { return TypeSessions } +// Contains information about an unconfirmed session +type UnconfirmedSession struct { + meta + // Session identifier + Id JsonInt64 `json:"id"` + // Point in time (Unix timestamp) when the user has logged in + LogInDate int32 `json:"log_in_date"` + // Model of the device that was used for the session creation, as provided by the application + DeviceModel string `json:"device_model"` + // A human-readable description of the location from which the session was created, based on the IP address + Location string `json:"location"` +} + +func (entity *UnconfirmedSession) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UnconfirmedSession + + return json.Marshal((*stub)(entity)) +} + +func (*UnconfirmedSession) GetClass() string { + return ClassUnconfirmedSession +} + +func (*UnconfirmedSession) GetType() string { + return TypeUnconfirmedSession +} + // Contains information about one website the current user is logged in with Telegram type ConnectedWebsite struct { meta @@ -33971,7 +34188,7 @@ type ConnectedWebsite struct { // Point in time (Unix timestamp) when obtained authorization was last used LastActiveDate int32 `json:"last_active_date"` // IP address from which the user was logged in, in human-readable format - Ip string `json:"ip"` + IpAddress string `json:"ip_address"` // Human-readable description of a country and a region from which the user was logged in, based on the IP address Location string `json:"location"` } @@ -34391,7 +34608,7 @@ func (*InternalLinkTypeActiveSessions) InternalLinkTypeType() string { return TypeInternalLinkTypeActiveSessions } -// The link is a link to an attachment menu bot to be opened in the specified or a chosen chat. Process given target_chat to open the chat. Then, call searchPublicChat with the given bot username, check that the user is a bot and can be added to attachment menu. Then, use getAttachmentMenuBot to receive information about the bot. If the bot isn't added to attachment menu, then user needs to confirm adding the bot to attachment menu. If user confirms adding, then use toggleBotIsAddedToAttachmentMenu to add it. If the attachment menu bot can't be used in the opened chat, show an error to the user. If the bot is added to attachment menu and can be used in the chat, then use openWebApp with the given URL +// The link is a link to an attachment menu bot to be opened in the specified or a chosen chat. Process given target_chat to open the chat. Then, call searchPublicChat with the given bot username, check that the user is a bot and can be added to attachment menu. Then, use getAttachmentMenuBot to receive information about the bot. If the bot isn't added to attachment menu, then show a disclaimer about Mini Apps being a third-party apps, ask the user to accept their Terms of service and confirm adding the bot to side and attachment menu. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. If the attachment menu bot can't be used in the opened chat, show an error to the user. If the bot is added to attachment menu and can be used in the chat, then use openWebApp with the given URL type InternalLinkTypeAttachmentMenuBot struct { meta // Target chat to be opened @@ -35054,7 +35271,7 @@ func (*InternalLinkTypePrivacyAndSecuritySettings) InternalLinkTypeType() string // The link is a link to a proxy. Call addProxy with the given parameters to process the link and add the proxy type InternalLinkTypeProxy struct { meta - // Proxy server IP address + // Proxy server domain or IP address Server string `json:"server"` // Proxy server port Port int32 `json:"port"` @@ -35205,6 +35422,35 @@ func (*InternalLinkTypeSettings) InternalLinkTypeType() string { return TypeInternalLinkTypeSettings } +// The link is a link to a bot, which can be installed to the side menu. Call searchPublicChat with the given bot username, check that the user is a bot and can be added to attachment menu. Then, use getAttachmentMenuBot to receive information about the bot. If the bot isn't added to side menu, then show a disclaimer about Mini Apps being a third-party apps, ask the user to accept their Terms of service and confirm adding the bot to side and attachment menu. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. If the bot is added to side menu, then use getWebAppUrl with the given URL +type InternalLinkTypeSideMenuBot struct { + meta + // Username of the bot + BotUsername string `json:"bot_username"` + // URL to be passed to getWebAppUrl + Url string `json:"url"` +} + +func (entity *InternalLinkTypeSideMenuBot) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeSideMenuBot + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeSideMenuBot) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeSideMenuBot) GetType() string { + return TypeInternalLinkTypeSideMenuBot +} + +func (*InternalLinkTypeSideMenuBot) InternalLinkTypeType() string { + return TypeInternalLinkTypeSideMenuBot +} + // The link is a link to a sticker set. Call searchStickerSet with the given sticker set name to process the link and show the sticker set type InternalLinkTypeStickerSet struct { meta @@ -35452,7 +35698,7 @@ func (*InternalLinkTypeVideoChat) InternalLinkTypeType() string { return TypeInternalLinkTypeVideoChat } -// The link is a link to a Web App. Call searchPublicChat with the given bot username, check that the user is a bot, then call searchWebApp with the received bot and the given web_app_short_name. Process received foundWebApp by showing a confirmation dialog if needed, then calling getWebAppLinkUrl and opening the returned URL +// The link is a link to a Web App. Call searchPublicChat with the given bot username, check that the user is a bot, then call searchWebApp with the received bot and the given web_app_short_name. Process received foundWebApp by showing a confirmation dialog if needed. If the bot can be added to attachment or side menu, but isn't added yet, then show a disclaimer about Mini Apps being a third-party apps instead of the dialog and ask the user to accept their Terms of service. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. Then call getWebAppLinkUrl and open the returned URL as a Web App type InternalLinkTypeWebApp struct { meta // Username of the bot that owns the Web App @@ -37079,6 +37325,31 @@ func (*TopChatCategoryForwardChats) TopChatCategoryType() string { return TypeTopChatCategoryForwardChats } +// Contains 0-based positions of matched objects +type FoundPositions struct { + meta + // Total number of matched objects + TotalCount int32 `json:"total_count"` + // The positions of the matched objects + Positions []int32 `json:"positions"` +} + +func (entity *FoundPositions) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FoundPositions + + return json.Marshal((*stub)(entity)) +} + +func (*FoundPositions) GetClass() string { + return ClassFoundPositions +} + +func (*FoundPositions) GetType() string { + return TypeFoundPositions +} + // A URL linking to a user type TMeUrlTypeUser struct { meta @@ -37744,7 +38015,7 @@ type Proxy struct { meta // Unique identifier of the proxy Id int32 `json:"id"` - // Proxy server IP address + // Proxy server domain or IP address Server string `json:"server"` // Proxy server port Port int32 `json:"port"` @@ -40151,9 +40422,9 @@ type UpdateNotificationGroup struct { NotificationSoundId JsonInt64 `json:"notification_sound_id"` // Total number of unread notifications in the group, can be bigger than number of active notifications TotalCount int32 `json:"total_count"` - // List of added group notifications, sorted by notification ID + // List of added group notifications, sorted by notification identifier AddedNotifications []*Notification `json:"added_notifications"` - // Identifiers of removed group notifications, sorted by notification ID + // Identifiers of removed group notifications, sorted by notification identifier RemovedNotificationIds []int32 `json:"removed_notification_ids"` } @@ -41843,10 +42114,37 @@ func (*UpdateUsersNearby) UpdateType() string { return TypeUpdateUsersNearby } -// The list of bots added to attachment menu has changed +// The first unconfirmed session has changed +type UpdateUnconfirmedSession struct { + meta + // The unconfirmed session; may be null if none + Session *UnconfirmedSession `json:"session"` +} + +func (entity *UpdateUnconfirmedSession) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateUnconfirmedSession + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateUnconfirmedSession) GetClass() string { + return ClassUpdate +} + +func (*UpdateUnconfirmedSession) GetType() string { + return TypeUpdateUnconfirmedSession +} + +func (*UpdateUnconfirmedSession) UpdateType() string { + return TypeUpdateUnconfirmedSession +} + +// The list of bots added to attachment or side menu has changed type UpdateAttachmentMenuBots struct { meta - // The new list of bots added to attachment menu. The bots must not be shown on scheduled messages screen + // The new list of bots. The bots must not be shown on scheduled messages screen Bots []*AttachmentMenuBot `json:"bots"` } diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 695a3d7..21a0f6c 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -729,6 +729,43 @@ func UnmarshalListOfSupergroupMembersFilter(dataList []json.RawMessage) ([]Super return list, nil } +func UnmarshalInviteLinkChatType(data json.RawMessage) (InviteLinkChatType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeInviteLinkChatTypeBasicGroup: + return UnmarshalInviteLinkChatTypeBasicGroup(data) + + case TypeInviteLinkChatTypeSupergroup: + return UnmarshalInviteLinkChatTypeSupergroup(data) + + case TypeInviteLinkChatTypeChannel: + return UnmarshalInviteLinkChatTypeChannel(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfInviteLinkChatType(dataList []json.RawMessage) ([]InviteLinkChatType, error) { + list := []InviteLinkChatType{} + + for _, data := range dataList { + entity, err := UnmarshalInviteLinkChatType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalSecretChatState(data json.RawMessage) (SecretChatState, error) { var meta meta @@ -2552,6 +2589,40 @@ func UnmarshalListOfMessageSchedulingState(dataList []json.RawMessage) ([]Messag return list, nil } +func UnmarshalMessageSelfDestructType(data json.RawMessage) (MessageSelfDestructType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeMessageSelfDestructTypeTimer: + return UnmarshalMessageSelfDestructTypeTimer(data) + + case TypeMessageSelfDestructTypeImmediately: + return UnmarshalMessageSelfDestructTypeImmediately(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfMessageSelfDestructType(dataList []json.RawMessage) ([]MessageSelfDestructType, error) { + list := []MessageSelfDestructType{} + + for _, data := range dataList { + entity, err := UnmarshalMessageSelfDestructType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalInputMessageContent(data json.RawMessage) (InputMessageContent, error) { var meta meta @@ -4759,8 +4830,8 @@ func UnmarshalStoryPrivacySettings(data json.RawMessage) (StoryPrivacySettings, case TypeStoryPrivacySettingsCloseFriends: return UnmarshalStoryPrivacySettingsCloseFriends(data) - case TypeStoryPrivacySettingsSelectedContacts: - return UnmarshalStoryPrivacySettingsSelectedContacts(data) + case TypeStoryPrivacySettingsSelectedUsers: + return UnmarshalStoryPrivacySettingsSelectedUsers(data) default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) @@ -5161,6 +5232,9 @@ func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { case TypeInternalLinkTypeSettings: return UnmarshalInternalLinkTypeSettings(data) + case TypeInternalLinkTypeSideMenuBot: + return UnmarshalInternalLinkTypeSideMenuBot(data) + case TypeInternalLinkTypeStickerSet: return UnmarshalInternalLinkTypeStickerSet(data) @@ -6149,6 +6223,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateUsersNearby: return UnmarshalUpdateUsersNearby(data) + case TypeUpdateUnconfirmedSession: + return UnmarshalUpdateUnconfirmedSession(data) + case TypeUpdateAttachmentMenuBots: return UnmarshalUpdateAttachmentMenuBots(data) @@ -7479,6 +7556,30 @@ func UnmarshalChatInviteLinkMembers(data json.RawMessage) (*ChatInviteLinkMember return &resp, err } +func UnmarshalInviteLinkChatTypeBasicGroup(data json.RawMessage) (*InviteLinkChatTypeBasicGroup, error) { + var resp InviteLinkChatTypeBasicGroup + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInviteLinkChatTypeSupergroup(data json.RawMessage) (*InviteLinkChatTypeSupergroup, error) { + var resp InviteLinkChatTypeSupergroup + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInviteLinkChatTypeChannel(data json.RawMessage) (*InviteLinkChatTypeChannel, error) { + var resp InviteLinkChatTypeChannel + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatInviteLinkInfo(data json.RawMessage) (*ChatInviteLinkInfo, error) { var resp ChatInviteLinkInfo @@ -10535,6 +10636,22 @@ func UnmarshalMessageSchedulingStateSendWhenOnline(data json.RawMessage) (*Messa return &resp, err } +func UnmarshalMessageSelfDestructTypeTimer(data json.RawMessage) (*MessageSelfDestructTypeTimer, error) { + var resp MessageSelfDestructTypeTimer + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageSelfDestructTypeImmediately(data json.RawMessage) (*MessageSelfDestructTypeImmediately, error) { + var resp MessageSelfDestructTypeImmediately + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageSendOptions(data json.RawMessage) (*MessageSendOptions, error) { var resp MessageSendOptions @@ -13703,8 +13820,8 @@ func UnmarshalStoryPrivacySettingsCloseFriends(data json.RawMessage) (*StoryPriv return &resp, err } -func UnmarshalStoryPrivacySettingsSelectedContacts(data json.RawMessage) (*StoryPrivacySettingsSelectedContacts, error) { - var resp StoryPrivacySettingsSelectedContacts +func UnmarshalStoryPrivacySettingsSelectedUsers(data json.RawMessage) (*StoryPrivacySettingsSelectedUsers, error) { + var resp StoryPrivacySettingsSelectedUsers err := json.Unmarshal(data, &resp) @@ -14031,6 +14148,14 @@ func UnmarshalSessions(data json.RawMessage) (*Sessions, error) { return &resp, err } +func UnmarshalUnconfirmedSession(data json.RawMessage) (*UnconfirmedSession, error) { + var resp UnconfirmedSession + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalConnectedWebsite(data json.RawMessage) (*ConnectedWebsite, error) { var resp ConnectedWebsite @@ -14383,6 +14508,14 @@ func UnmarshalInternalLinkTypeSettings(data json.RawMessage) (*InternalLinkTypeS return &resp, err } +func UnmarshalInternalLinkTypeSideMenuBot(data json.RawMessage) (*InternalLinkTypeSideMenuBot, error) { + var resp InternalLinkTypeSideMenuBot + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInternalLinkTypeStickerSet(data json.RawMessage) (*InternalLinkTypeStickerSet, error) { var resp InternalLinkTypeStickerSet @@ -14927,6 +15060,14 @@ func UnmarshalTopChatCategoryForwardChats(data json.RawMessage) (*TopChatCategor return &resp, err } +func UnmarshalFoundPositions(data json.RawMessage) (*FoundPositions, error) { + var resp FoundPositions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalTMeUrlTypeUser(data json.RawMessage) (*TMeUrlTypeUser, error) { var resp TMeUrlTypeUser @@ -16079,6 +16220,14 @@ func UnmarshalUpdateUsersNearby(data json.RawMessage) (*UpdateUsersNearby, error return &resp, err } +func UnmarshalUpdateUnconfirmedSession(data json.RawMessage) (*UpdateUnconfirmedSession, error) { + var resp UpdateUnconfirmedSession + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateAttachmentMenuBots(data json.RawMessage) (*UpdateAttachmentMenuBots, error) { var resp UpdateAttachmentMenuBots @@ -16829,6 +16978,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatInviteLinkMembers: return UnmarshalChatInviteLinkMembers(data) + case TypeInviteLinkChatTypeBasicGroup: + return UnmarshalInviteLinkChatTypeBasicGroup(data) + + case TypeInviteLinkChatTypeSupergroup: + return UnmarshalInviteLinkChatTypeSupergroup(data) + + case TypeInviteLinkChatTypeChannel: + return UnmarshalInviteLinkChatTypeChannel(data) + case TypeChatInviteLinkInfo: return UnmarshalChatInviteLinkInfo(data) @@ -17975,6 +18133,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageSchedulingStateSendWhenOnline: return UnmarshalMessageSchedulingStateSendWhenOnline(data) + case TypeMessageSelfDestructTypeTimer: + return UnmarshalMessageSelfDestructTypeTimer(data) + + case TypeMessageSelfDestructTypeImmediately: + return UnmarshalMessageSelfDestructTypeImmediately(data) + case TypeMessageSendOptions: return UnmarshalMessageSendOptions(data) @@ -19163,8 +19327,8 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStoryPrivacySettingsCloseFriends: return UnmarshalStoryPrivacySettingsCloseFriends(data) - case TypeStoryPrivacySettingsSelectedContacts: - return UnmarshalStoryPrivacySettingsSelectedContacts(data) + case TypeStoryPrivacySettingsSelectedUsers: + return UnmarshalStoryPrivacySettingsSelectedUsers(data) case TypeUserPrivacySettingRuleAllowAll: return UnmarshalUserPrivacySettingRuleAllowAll(data) @@ -19286,6 +19450,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSessions: return UnmarshalSessions(data) + case TypeUnconfirmedSession: + return UnmarshalUnconfirmedSession(data) + case TypeConnectedWebsite: return UnmarshalConnectedWebsite(data) @@ -19418,6 +19585,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInternalLinkTypeSettings: return UnmarshalInternalLinkTypeSettings(data) + case TypeInternalLinkTypeSideMenuBot: + return UnmarshalInternalLinkTypeSideMenuBot(data) + case TypeInternalLinkTypeStickerSet: return UnmarshalInternalLinkTypeStickerSet(data) @@ -19622,6 +19792,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeTopChatCategoryForwardChats: return UnmarshalTopChatCategoryForwardChats(data) + case TypeFoundPositions: + return UnmarshalFoundPositions(data) + case TypeTMeUrlTypeUser: return UnmarshalTMeUrlTypeUser(data) @@ -20054,6 +20227,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateUsersNearby: return UnmarshalUpdateUsersNearby(data) + case TypeUpdateUnconfirmedSession: + return UnmarshalUpdateUnconfirmedSession(data) + case TypeUpdateAttachmentMenuBots: return UnmarshalUpdateAttachmentMenuBots(data) diff --git a/data/td_api.tl b/data/td_api.tl index 9f2eec0..df470f6 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -195,7 +195,7 @@ localFile path:string can_be_downloaded:Bool can_be_deleted:Bool is_downloading_ //@description Represents a remote file //@id Remote file identifier; may be empty. Can be used by the current user across application restarts or even from other devices. Uniquely identifies a file, but a file can have a lot of different valid identifiers. -//-If the ID starts with "http://" or "https://", it represents the HTTP URL of the file. TDLib is currently unable to download files if only their URL is known. +//-If the identifier starts with "http://" or "https://", it represents the HTTP URL of the file. TDLib is currently unable to download files if only their URL is known. //-If downloadFile/addFileToDownloads is called on such a file or if it is sent to a secret chat, TDLib starts a file generation process by sending updateFileGenerationStart to the application with the HTTP URL in the original_path and "#url#" as the conversion string. //-Application must generate the file by downloading it to the specified location //@unique_id Unique file identifier; may be empty if unknown. The unique file identifier which is the same for the same file even for different users and is persistent over time @@ -216,10 +216,10 @@ file id:int32 dc_id:int32 size:int53 expected_size:int53 local:localFile remote: //@class InputFile @description Points to a file -//@description A file defined by its unique ID @id Unique file identifier +//@description A file defined by its unique identifier @id Unique file identifier inputFileId id:int32 = InputFile; -//@description A file defined by its remote ID. The remote ID is guaranteed to be usable only if the corresponding file is still accessible to the user and known to TDLib. +//@description A file defined by its remote identifier. The remote identifier is guaranteed to be usable only if the corresponding file is still accessible to the user and known to TDLib. //-For example, if the file is from a message, then the message must be not deleted and accessible to the user. If the file database is disabled, then the corresponding object with the file must be preloaded by the application //@id Remote file identifier inputFileRemote id:string = InputFile; @@ -556,7 +556,7 @@ userTypeDeleted = UserType; //@is_inline True, if the bot supports inline queries //@inline_query_placeholder Placeholder for inline queries (displayed on the application input field) //@need_location True, if the location of the user is expected to be sent with every inline query to this bot -//@can_be_added_to_attachment_menu True, if the bot can be added to attachment menu +//@can_be_added_to_attachment_menu True, if the bot can be added to attachment or side menu userTypeBot can_be_edited:Bool can_join_groups:Bool can_read_all_group_messages:Bool is_inline:Bool inline_query_placeholder:string need_location:Bool can_be_added_to_attachment_menu:Bool = UserType; //@description No information on the user besides the user identifier is available, yet this user has not been deleted. This object is extremely rare and must be handled like a deleted user. It is not possible to perform any actions on users of this type @@ -907,6 +907,19 @@ chatInviteLinkMember user_id:int53 joined_chat_date:int32 via_chat_folder_invite //@description Contains a list of chat members joined a chat via an invite link @total_count Approximate total number of chat members found @members List of chat members, joined a chat via an invite link chatInviteLinkMembers total_count:int32 members:vector = ChatInviteLinkMembers; + +//@class InviteLinkChatType @description Describes the type of a chat to which points an invite link + +//@description The link is an invite link for a basic group +inviteLinkChatTypeBasicGroup = InviteLinkChatType; + +//@description The link is an invite link for a supergroup +inviteLinkChatTypeSupergroup = InviteLinkChatType; + +//@description The link is an invite link for a channel +inviteLinkChatTypeChannel = InviteLinkChatType; + + //@description Contains information about a chat invite link //@chat_id Chat identifier of the invite link; 0 if the user has no access to the chat before joining //@accessible_for If non-zero, the amount of time for which read access to the chat will remain available, in seconds @@ -918,7 +931,11 @@ chatInviteLinkMembers total_count:int32 members:vector = C //@member_user_ids User identifiers of some chat members that may be known to the current user //@creates_join_request True, if the link only creates join request //@is_public True, if the chat is a public supergroup or channel, i.e. it has a username or it is a location-based supergroup -chatInviteLinkInfo chat_id:int53 accessible_for:int32 type:ChatType title:string photo:chatPhotoInfo description:string member_count:int32 member_user_ids:vector creates_join_request:Bool is_public:Bool = ChatInviteLinkInfo; +//@is_verified True, if the chat is verified +//@is_scam True, if many users reported this chat as a scam +//@is_fake True, if many users reported this chat as a fake account +chatInviteLinkInfo chat_id:int53 accessible_for:int32 type:InviteLinkChatType title:string photo:chatPhotoInfo description:string member_count:int32 member_user_ids:vector creates_join_request:Bool is_public:Bool is_verified:Bool is_scam:Bool is_fake:Bool = ChatInviteLinkInfo; + //@description Describes a user that sent a join request and waits for administrator approval @user_id User identifier @date Point in time (Unix timestamp) when the user sent the join request @bio A short bio of the user chatJoinRequest user_id:int53 date:int32 bio:string = ChatJoinRequest; @@ -1180,16 +1197,16 @@ messageReplyToStory story_sender_chat_id:int53 story_id:int32 = MessageReplyTo; //@unread_reactions Information about unread reactions added to the message //@reply_to Information about the message or the story this message is replying to; may be null if none //@message_thread_id If non-zero, the identifier of the message thread the message belongs to; unique within the chat to which the message belongs -//@self_destruct_time The message's self-destruct time, in seconds; 0 if none. TDLib will send updateDeleteMessages or updateMessageContent once the time expires -//@self_destruct_in Time left before the message self-destruct timer expires, in seconds. If the self-destruct timer isn't started yet, equals to the value of the self_destruct_time field -//@auto_delete_in Time left before the message will be automatically deleted by message_auto_delete_time setting of the chat, in seconds; 0 if never. TDLib will send updateDeleteMessages or updateMessageContent once the time expires +//@self_destruct_type The message's self-destruct type; may be null if none +//@self_destruct_in Time left before the message self-destruct timer expires, in seconds; 0 if self-desctruction isn't scheduled yet +//@auto_delete_in Time left before the message will be automatically deleted by message_auto_delete_time setting of the chat, in seconds; 0 if never //@via_bot_user_id If non-zero, the user identifier of the bot through which this message was sent //@author_signature For channel posts and anonymous group messages, optional author signature //@media_album_id Unique identifier of an album this message belongs to. Only audios, documents, photos and videos can be grouped together in albums //@restriction_reason If non-empty, contains a human-readable description of the reason why access to this message must be restricted //@content Content of the message //@reply_markup Reply markup for the message; may be null if none -message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_saved:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_get_added_reactions:Bool can_get_statistics:Bool can_get_message_thread:Bool can_get_viewers:Bool can_get_media_timestamp_links:Bool can_report_reactions:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo interaction_info:messageInteractionInfo unread_reactions:vector reply_to:MessageReplyTo message_thread_id:int53 self_destruct_time:int32 self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 author_signature:string media_album_id:int64 restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; +message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_saved:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_get_added_reactions:Bool can_get_statistics:Bool can_get_message_thread:Bool can_get_viewers:Bool can_get_media_timestamp_links:Bool can_report_reactions:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo interaction_info:messageInteractionInfo unread_reactions:vector reply_to:MessageReplyTo message_thread_id:int53 self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 author_signature:string media_album_id:int64 restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; //@description Contains a list of messages @total_count Approximate total number of messages found @messages List of messages; messages may be null messages total_count:int32 messages:vector = Messages; @@ -1675,9 +1692,10 @@ loginUrlInfoRequestConfirmation url:string domain:string bot_user_id:int53 reque //@description Contains information about a Web App found by its short name //@web_app The Web App +//@supports_settings True, if the app supports "settings_button_pressed" event //@request_write_access True, if the user must be asked for the permission to the bot to send them messages //@skip_confirmation True, if there is no need to show an ordinary open URL confirmation before opening the Web App. The field must be ignored and confirmation must be shown anyway if the Web App link was hidden -foundWebApp web_app:webApp request_write_access:Bool skip_confirmation:Bool = FoundWebApp; +foundWebApp web_app:webApp supports_settings:Bool request_write_access:Bool skip_confirmation:Bool = FoundWebApp; //@description Contains information about a Web App @launch_id Unique identifier for the Web App launch @url A Web App URL to open in a web view webAppInfo launch_id:int64 url:string = WebAppInfo; @@ -2708,8 +2726,10 @@ messageChatShared chat_id:int53 button_id:int32 = MessageContent; //@description The current user has connected a website by logging in using Telegram Login Widget on it @domain_name Domain name of the connected website messageWebsiteConnected domain_name:string = MessageContent; -//@description The user allowed the bot to send messages @web_app Information about the Web App, which requested the access; may be null if none or the Web App was opened from the attachment menu -messageBotWriteAccessAllowed web_app:webApp = MessageContent; +//@description The user allowed the bot to send messages +//@web_app Information about the Web App, which requested the access; may be null if none or the Web App was opened from the attachment menu +//@by_request True, if user allowed the bot to send messages by an explicit call to allowBotToSendMessages +messageBotWriteAccessAllowed web_app:webApp by_request:Bool = MessageContent; //@description Data from a Web App has been sent to a bot @button_text Text of the keyboardButtonTypeWebApp button, which opened the Web App messageWebAppDataSent button_text:string = MessageContent; @@ -2809,6 +2829,15 @@ messageSchedulingStateSendAtDate send_date:int32 = MessageSchedulingState; messageSchedulingStateSendWhenOnline = MessageSchedulingState; +//@class MessageSelfDestructType @description Describes when a message will be self-destructed + +//@description The message will be self-destructed in the specified time after its content was opened @self_destruct_time The message's self-destruct time, in seconds; must be between 0 and 60 in private chats +messageSelfDestructTypeTimer self_destruct_time:int32 = MessageSelfDestructType; + +//@description The message can be opened only once and will be self-destructed once closed +messageSelfDestructTypeImmediately = MessageSelfDestructType; + + //@description Options to be used when a message is sent //@disable_notification Pass true to disable notification for the message //@from_background Pass true if the message is sent from the background @@ -2867,9 +2896,10 @@ inputMessageDocument document:InputFile thumbnail:inputThumbnail disable_content //@width Photo width //@height Photo height //@caption Photo caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters -//@self_destruct_time Photo self-destruct time, in seconds (0-60). A non-zero self-destruct time can be specified only in private chats +//@self_destruct_type Photo self-destruct type; pass null if none; private chats only //@has_spoiler True, if the photo preview must be covered by a spoiler animation; not supported in secret chats -inputMessagePhoto photo:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector width:int32 height:int32 caption:formattedText self_destruct_time:int32 has_spoiler:Bool = InputMessageContent; +inputMessagePhoto photo:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector width:int32 height:int32 caption:formattedText self_destruct_type:MessageSelfDestructType has_spoiler:Bool = InputMessageContent; + //@description A sticker message //@sticker Sticker to be sent @@ -2888,9 +2918,9 @@ inputMessageSticker sticker:InputFile thumbnail:inputThumbnail width:int32 heigh //@height Video height //@supports_streaming True, if the video is supposed to be streamed //@caption Video caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters -//@self_destruct_time Video self-destruct time, in seconds (0-60). A non-zero self-destruct time can be specified only in private chats +//@self_destruct_type Video self-destruct type; pass null if none; private chats only //@has_spoiler True, if the video preview must be covered by a spoiler animation; not supported in secret chats -inputMessageVideo video:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector duration:int32 width:int32 height:int32 supports_streaming:Bool caption:formattedText self_destruct_time:int32 has_spoiler:Bool = InputMessageContent; +inputMessageVideo video:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector duration:int32 width:int32 height:int32 supports_streaming:Bool caption:formattedText self_destruct_type:MessageSelfDestructType has_spoiler:Bool = InputMessageContent; //@description A video note message //@video_note Video note to be sent @@ -3162,9 +3192,10 @@ storyViewer user_id:int53 view_date:int32 block_list:BlockList chosen_reaction_t //@description Represents a list of story viewers //@total_count Approximate total number of story viewers found +//@total_reaction_count Approximate total number of reactions set by found story viewers //@viewers List of story viewers //@next_offset The offset for the next request. If empty, there are no more results -storyViewers total_count:int32 viewers:vector next_offset:string = StoryViewers; +storyViewers total_count:int32 total_reaction_count:int32 viewers:vector next_offset:string = StoryViewers; //@description Describes position of a clickable rectangle area on a story media @@ -3603,25 +3634,32 @@ speechRecognitionResultError error:error = SpeechRecognitionResult; //@description Describes a color to highlight a bot added to attachment menu @light_color Color in the RGB24 format for light themes @dark_color Color in the RGB24 format for dark themes attachmentMenuBotColor light_color:int32 dark_color:int32 = AttachmentMenuBotColor; -//@description Represents a bot, which can be added to attachment menu -//@bot_user_id User identifier of the bot added to attachment menu +//@description Represents a bot, which can be added to attachment or side menu +//@bot_user_id User identifier of the bot //@supports_self_chat True, if the bot supports opening from attachment menu in the chat with the bot //@supports_user_chats True, if the bot supports opening from attachment menu in private chats with ordinary users //@supports_bot_chats True, if the bot supports opening from attachment menu in private chats with other bots //@supports_group_chats True, if the bot supports opening from attachment menu in basic group and supergroup chats //@supports_channel_chats True, if the bot supports opening from attachment menu in channel chats //@supports_settings True, if the bot supports "settings_button_pressed" event -//@request_write_access True, if the user must be asked for the permission to the bot to send them messages +//@request_write_access True, if the user must be asked for the permission to send messages to the bot +//@is_added 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 +//@show_in_attachment_menu True, if the bot must be shown in the attachment menu +//@show_in_side_menu True, if the bot must be shown in the side menu +//@show_disclaimer_in_side_menu True, if a disclaimer, why the bot is shown in the side menu, is needed //@name Name for the bot in attachment menu //@name_color Color to highlight selected name of the bot if appropriate; may be null -//@default_icon Default attachment menu icon for the bot in SVG format; may be null -//@ios_static_icon Attachment menu icon for the bot in SVG format for the official iOS app; may be null -//@ios_animated_icon Attachment menu icon for the bot in TGS format for the official iOS app; may be null -//@android_icon Attachment menu icon for the bot in TGS format for the official Android app; may be null -//@macos_icon Attachment menu icon for the bot in TGS format for the official native macOS app; may be null +//@default_icon Default icon for the bot in SVG format; may be null +//@ios_static_icon Icon for the bot in SVG format for the official iOS app; may be null +//@ios_animated_icon Icon for the bot in TGS format for the official iOS app; may be null +//@ios_side_menu_icon Icon for the bot in PNG format for the official iOS app side menu; may be null +//@android_icon Icon for the bot in TGS format for the official Android app; may be null +//@android_side_menu_icon Icon for the bot in SVG format for the official Android app side menu; may be null +//@macos_icon Icon for the bot in TGS format for the official native macOS app; may be null +//@macos_side_menu_icon Icon for the bot in PNG format for the official macOS app side menu; may be null //@icon_color Color to highlight selected icon of the bot if appropriate; may be null //@web_app_placeholder Default placeholder for opened Web Apps in SVG format; may be null -attachmentMenuBot bot_user_id:int53 supports_self_chat:Bool supports_user_chats:Bool supports_bot_chats:Bool supports_group_chats:Bool supports_channel_chats:Bool supports_settings:Bool request_write_access:Bool name:string name_color:attachmentMenuBotColor default_icon:file ios_static_icon:file ios_animated_icon:file android_icon:file macos_icon:file icon_color:attachmentMenuBotColor web_app_placeholder:file = AttachmentMenuBot; +attachmentMenuBot bot_user_id:int53 supports_self_chat:Bool supports_user_chats:Bool supports_bot_chats:Bool supports_group_chats:Bool supports_channel_chats:Bool supports_settings:Bool request_write_access:Bool is_added:Bool show_in_attachment_menu:Bool show_in_side_menu:Bool show_disclaimer_in_side_menu:Bool name:string name_color:attachmentMenuBotColor default_icon:file ios_static_icon:file ios_animated_icon:file ios_side_menu_icon:file android_icon:file android_side_menu_icon:file macos_icon:file macos_side_menu_icon:file icon_color:attachmentMenuBotColor web_app_placeholder:file = AttachmentMenuBot; //@description Information about the message sent by answerWebAppQuery @inline_message_id Identifier of the sent inline message, if known sentWebAppMessage inline_message_id:string = SentWebAppMessage; @@ -4611,7 +4649,7 @@ notificationTypeNewSecretChat = NotificationType; notificationTypeNewCall call_id:int32 = NotificationType; //@description New message was received through a push notification -//@message_id The message identifier. The message will not be available in the chat history, but the ID can be used in viewMessages, or as a message to reply +//@message_id The message identifier. The message will not be available in the chat history, but the identifier can be used in viewMessages, or as a message to reply //@sender_id Identifier of the sender of the message. Corresponding user or chat may be inaccessible //@sender_name Name of the sender //@is_outgoing True, if the message is outgoing @@ -4714,7 +4752,7 @@ storyPrivacySettingsContacts except_user_ids:vector = StoryPrivacySetting storyPrivacySettingsCloseFriends = StoryPrivacySettings; //@description The story can be viewed by certain specified users @user_ids Identifiers of the users; always unknown and empty for non-owned stories -storyPrivacySettingsSelectedContacts user_ids:vector = StoryPrivacySettings; +storyPrivacySettingsSelectedUsers user_ids:vector = StoryPrivacySettings; //@class UserPrivacySettingRule @description Represents a single rule for managing user privacy settings @@ -4846,6 +4884,7 @@ sessionTypeXbox = SessionType; //@id Session identifier //@is_current True, if this session is the current session //@is_password_pending True, if a 2-step verification password is needed to complete authorization of the session +//@is_unconfirmed True, if the session wasn't confirmed from another session //@can_accept_secret_chats True, if incoming secret chats can be accepted by the session //@can_accept_calls True, if incoming calls can be accepted by the session //@type Session type based on the system and application version, which can be used to display a corresponding icon @@ -4858,14 +4897,20 @@ sessionTypeXbox = SessionType; //@system_version Version of the operating system the application has been run or is running on, as provided by the application //@log_in_date Point in time (Unix timestamp) when the user has logged in //@last_active_date Point in time (Unix timestamp) when the session was last used -//@ip IP address from which the session was created, in human-readable format -//@country A two-letter country code for the country from which the session was created, based on the IP address -//@region Region code from which the session was created, based on the IP address -session id:int64 is_current:Bool is_password_pending:Bool can_accept_secret_chats:Bool can_accept_calls:Bool type:SessionType api_id:int32 application_name:string application_version:string is_official_application:Bool device_model:string platform:string system_version:string log_in_date:int32 last_active_date:int32 ip:string country:string region:string = Session; +//@ip_address IP address from which the session was created, in human-readable format +//@location A human-readable description of the location from which the session was created, based on the IP address +session id:int64 is_current:Bool is_password_pending:Bool is_unconfirmed:Bool can_accept_secret_chats:Bool can_accept_calls:Bool type:SessionType api_id:int32 application_name:string application_version:string is_official_application:Bool device_model:string platform:string system_version:string log_in_date:int32 last_active_date:int32 ip_address:string location:string = Session; //@description Contains a list of sessions @sessions List of sessions @inactive_session_ttl_days Number of days of inactivity before sessions will automatically be terminated; 1-366 days sessions sessions:vector inactive_session_ttl_days:int32 = Sessions; +//@description Contains information about an unconfirmed session +//@id Session identifier +//@log_in_date Point in time (Unix timestamp) when the user has logged in +//@device_model Model of the device that was used for the session creation, as provided by the application +//@location A human-readable description of the location from which the session was created, based on the IP address +unconfirmedSession id:int64 log_in_date:int32 device_model:string location:string = UnconfirmedSession; + //@description Contains information about one website the current user is logged in with Telegram //@id Website identifier @@ -4875,9 +4920,9 @@ sessions sessions:vector inactive_session_ttl_days:int32 = Sessions; //@platform Operating system the browser is running on //@log_in_date Point in time (Unix timestamp) when the user was logged in //@last_active_date Point in time (Unix timestamp) when obtained authorization was last used -//@ip IP address from which the user was logged in, in human-readable format +//@ip_address IP address from which the user was logged in, in human-readable format //@location Human-readable description of a country and a region from which the user was logged in, based on the IP address -connectedWebsite id:int64 domain_name:string bot_user_id:int53 browser:string platform:string log_in_date:int32 last_active_date:int32 ip:string location:string = ConnectedWebsite; +connectedWebsite id:int64 domain_name:string bot_user_id:int53 browser:string platform:string log_in_date:int32 last_active_date:int32 ip_address:string location:string = ConnectedWebsite; //@description Contains a list of websites the current user is logged in with Telegram @websites List of connected websites connectedWebsites websites:vector = ConnectedWebsites; @@ -4939,7 +4984,8 @@ internalLinkTypeActiveSessions = InternalLinkType; //@description The link is a link to an attachment menu bot to be opened in the specified or a chosen chat. Process given target_chat to open the chat. //-Then, call searchPublicChat with the given bot username, check that the user is a bot and can be added to attachment menu. Then, use getAttachmentMenuBot to receive information about the bot. -//-If the bot isn't added to attachment menu, then user needs to confirm adding the bot to attachment menu. If user confirms adding, then use toggleBotIsAddedToAttachmentMenu to add it. +//-If the bot isn't added to attachment menu, then show a disclaimer about Mini Apps being a third-party apps, ask the user to accept their Terms of service and confirm adding the bot to side and attachment menu. +//-If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. //-If the attachment menu bot can't be used in the opened chat, show an error to the user. If the bot is added to attachment menu and can be used in the chat, then use openWebApp with the given URL //@target_chat Target chat to be opened //@bot_username Username of the bot @@ -5041,7 +5087,7 @@ internalLinkTypePremiumFeatures referrer:string = InternalLinkType; internalLinkTypePrivacyAndSecuritySettings = InternalLinkType; //@description The link is a link to a proxy. Call addProxy with the given parameters to process the link and add the proxy -//@server Proxy server IP address +//@server Proxy server domain or IP address //@port Proxy server port //@type Type of the proxy internalLinkTypeProxy server:string port:int32 type:ProxyType = InternalLinkType; @@ -5059,6 +5105,14 @@ internalLinkTypeRestorePurchases = InternalLinkType; //@description The link is a link to application settings internalLinkTypeSettings = InternalLinkType; +//@description The link is a link to a bot, which can be installed to the side menu. Call searchPublicChat with the given bot username, check that the user is a bot and can be added to attachment menu. +//-Then, use getAttachmentMenuBot to receive information about the bot. If the bot isn't added to side menu, then show a disclaimer about Mini Apps being a third-party apps, +//-ask the user to accept their Terms of service and confirm adding the bot to side and attachment menu. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. +//-If the bot is added to side menu, then use getWebAppUrl with the given URL +//@bot_username Username of the bot +//@url URL to be passed to getWebAppUrl +internalLinkTypeSideMenuBot bot_username:string url:string = InternalLinkType; + //@description The link is a link to a sticker set. Call searchStickerSet with the given sticker set name to process the link and show the sticker set //@sticker_set_name Name of the sticker set //@expect_custom_emoji True, if the sticker set is expected to contain custom emoji @@ -5094,7 +5148,9 @@ internalLinkTypeUserToken token:string = InternalLinkType; internalLinkTypeVideoChat chat_username:string invite_hash:string is_live_stream:Bool = InternalLinkType; //@description The link is a link to a Web App. Call searchPublicChat with the given bot username, check that the user is a bot, then call searchWebApp with the received bot and the given web_app_short_name. -//-Process received foundWebApp by showing a confirmation dialog if needed, then calling getWebAppLinkUrl and opening the returned URL +//-Process received foundWebApp by showing a confirmation dialog if needed. If the bot can be added to attachment or side menu, but isn't added yet, then show a disclaimer about Mini Apps being a third-party apps +//-instead of the dialog and ask the user to accept their Terms of service. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. +//-Then call getWebAppLinkUrl and open the returned URL as a Web App //@bot_username Username of the bot that owns the Web App //@web_app_short_name Short name of the Web App //@start_parameter Start parameter to be passed to getWebAppLinkUrl @@ -5352,6 +5408,10 @@ topChatCategoryCalls = TopChatCategory; topChatCategoryForwardChats = TopChatCategory; +//@description Contains 0-based positions of matched objects @total_count Total number of matched objects @positions The positions of the matched objects +foundPositions total_count:int32 positions:vector = FoundPositions; + + //@class TMeUrlType @description Describes the type of a URL linking to an internal Telegram entity //@description A URL linking to a user @user_id Identifier of the user @@ -5445,7 +5505,7 @@ proxyTypeMtproto secret:string = ProxyType; //@description Contains information about a proxy server //@id Unique identifier of the proxy -//@server Proxy server IP address +//@server Proxy server domain or IP address //@port Proxy server port //@last_used_date Point in time (Unix timestamp) when the proxy was last used; 0 if never //@is_enabled True, if the proxy is enabled now @@ -5765,8 +5825,8 @@ updateNotification notification_group_id:int32 notification:notification = Updat //@notification_settings_chat_id Chat identifier, which notification settings must be applied to the added notifications //@notification_sound_id Identifier of the notification sound to be played; 0 if sound is disabled //@total_count Total number of unread notifications in the group, can be bigger than number of active notifications -//@added_notifications List of added group notifications, sorted by notification ID -//@removed_notification_ids Identifiers of removed group notifications, sorted by notification ID +//@added_notifications List of added group notifications, sorted by notification identifier +//@removed_notification_ids Identifiers of removed group notifications, sorted by notification identifier updateNotificationGroup notification_group_id:int32 type:NotificationGroupType chat_id:int53 notification_settings_chat_id:int53 notification_sound_id:int64 total_count:int32 added_notifications:vector removed_notification_ids:vector = Update; //@description Contains active notifications that was shown on previous application launches. This update is sent only if the message database is used. In that case it comes once before any updateNotification and updateNotificationGroup update @groups Lists of active notification groups @@ -5954,7 +6014,10 @@ updateTermsOfService terms_of_service_id:string terms_of_service:termsOfService //@description The list of users nearby has changed. The update is guaranteed to be sent only 60 seconds after a successful searchChatsNearby request @users_nearby The new list of users nearby updateUsersNearby users_nearby:vector = Update; -//@description The list of bots added to attachment menu has changed @bots The new list of bots added to attachment menu. The bots must not be shown on scheduled messages screen +//@description The first unconfirmed session has changed @session The unconfirmed session; may be null if none +updateUnconfirmedSession session:unconfirmedSession = Update; + +//@description The list of bots added to attachment or side menu has changed @bots The new list of bots. The bots must not be shown on scheduled messages screen updateAttachmentMenuBots bots:vector = Update; //@description A message was sent by an opened Web App, so the Web App needs to be closed @web_app_launch_id Identifier of Web App launch @@ -6340,7 +6403,7 @@ getMessageViewers chat_id:int53 message_id:int53 = MessageViewers; //@description Returns information about a file; this is an offline request @file_id Identifier of the file to get getFile file_id:int32 = File; -//@description Returns information about a file by its remote ID; this is an offline request. Can be used to register a URL as a file for further uploading, or sending as a message. Even the request succeeds, the file can be used only if it is still accessible to the user. +//@description Returns information about a file by its remote identifier; this is an offline request. Can be used to register a URL as a file for further uploading, or sending as a message. Even the request succeeds, the file can be used only if it is still accessible to the user. //-For example, if the file is from a message, then the message must be not deleted and accessible to the user. If the file database is disabled, then the corresponding object with the file must be preloaded by the application //@remote_file_id Remote identifier of the file to get //@file_type File type; pass null if unknown @@ -6400,7 +6463,7 @@ clearRecentlyFoundChats = Ok; //@description Returns recently opened chats; this is an offline request. Returns chats in the order of last opening @limit The maximum number of chats to be returned getRecentlyOpenedChats limit:int32 = Chats; -//@description Checks whether a username can be set for a chat @chat_id Chat identifier; must be identifier of a supergroup chat, or a channel chat, or a private chat with self, or zero if the chat is being created @username Username to be checked +//@description Checks whether a username can be set for a chat @chat_id Chat identifier; must be identifier of a supergroup chat, or a channel chat, or a private chat with self, or 0 if the chat is being created @username Username to be checked checkChatUsername chat_id:int53 username:string = CheckChatUsernameResult; //@description Returns a list of public chats of the specified type, owned by the user @type Type of the public chats to return @@ -7003,9 +7066,9 @@ searchWebApp bot_user_id:int53 web_app_short_name:string = FoundWebApp; //@allow_write_access Pass true if the current user allowed the bot to send them messages getWebAppLinkUrl chat_id:int53 bot_user_id:int53 web_app_short_name:string start_parameter:string theme:themeParameters application_name:string allow_write_access:Bool = HttpUrl; -//@description Returns an HTTPS URL of a Web App to open after keyboardButtonTypeWebApp or inlineQueryResultsButtonTypeWebApp button is pressed +//@description Returns an HTTPS URL of a Web App to open from the side menu, a keyboardButtonTypeWebApp button, an inlineQueryResultsButtonTypeWebApp button, or an internalLinkTypeSideMenuBot link //@bot_user_id Identifier of the target bot -//@url The URL from the keyboardButtonTypeWebApp or inlineQueryResultsButtonTypeWebApp button +//@url The URL from a keyboardButtonTypeWebApp button, inlineQueryResultsButtonTypeWebApp button, an internalLinkTypeSideMenuBot link, or an empty when the bot is opened from the side menu //@theme Preferred Web App theme; pass null to use the default theme //@application_name Short name of the application; 0-64 English letters, digits, and underscores getWebAppUrl bot_user_id:int53 url:string theme:themeParameters application_name:string = HttpUrl; @@ -7016,11 +7079,11 @@ getWebAppUrl bot_user_id:int53 url:string theme:themeParameters application_name //@data The data sendWebAppData bot_user_id:int53 button_text:string data:string = Ok; -//@description Informs TDLib that a Web App is being opened from attachment menu, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an inlineKeyboardButtonTypeWebApp button. +//@description Informs TDLib that a Web App is being opened from the attachment menu, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an inlineKeyboardButtonTypeWebApp button. //-For each bot, a confirmation alert about data sent to the bot must be shown once //@chat_id Identifier of the chat in which the Web App is opened. The Web App can't be opened in secret chats //@bot_user_id Identifier of the bot, providing the Web App -//@url The URL from an inlineKeyboardButtonTypeWebApp button, a botMenuButton button, or an internalLinkTypeAttachmentMenuBot link, or an empty string otherwise +//@url The URL from an inlineKeyboardButtonTypeWebApp button, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an empty string otherwise //@theme Preferred Web App theme; pass null to use the default theme //@application_name Short name of the application; 0-64 English letters, digits, and underscores //@message_thread_id If not 0, a message thread identifier in which the message will be sent @@ -7552,10 +7615,10 @@ reportStory story_sender_chat_id:int53 story_id:int32 reason:ReportReason text:s activateStoryStealthMode = Ok; -//@description Returns information about a bot that can be added to attachment menu @bot_user_id Bot's user identifier +//@description Returns information about a bot that can be added to attachment or side menu @bot_user_id Bot's user identifier getAttachmentMenuBot bot_user_id:int53 = AttachmentMenuBot; -//@description Adds or removes a bot to attachment menu. Bot can be added to attachment menu, only if userTypeBot.can_be_added_to_attachment_menu == true +//@description Adds or removes a bot to attachment and side menu. Bot can be added to the menu, only if userTypeBot.can_be_added_to_attachment_menu == true //@bot_user_id Bot's user identifier //@is_added Pass true to add the bot to attachment menu; pass false to remove the bot from attachment menu //@allow_write_access Pass true if the current user allowed the bot to send them messages. Ignored if is_added is false @@ -8006,6 +8069,13 @@ getUserProfilePhotos user_id:int53 offset:int32 limit:int32 = ChatPhotos; //@chat_id Chat identifier for which to return stickers. Available custom emoji stickers may be different for different chats getStickers sticker_type:StickerType query:string limit:int32 chat_id:int53 = Stickers; +//@description Returns unique emoji that correspond to stickers to be found by the getStickers(sticker_type, query, 1000000, chat_id) +//@sticker_type Type of the stickers to search for +//@query Search query +//@chat_id Chat identifier for which to find stickers +//@return_only_main_emoji Pass true if only main emoji for each found sticker must be included in the result +getAllStickerEmojis sticker_type:StickerType query:string chat_id:int53 return_only_main_emoji:Bool = Emojis; + //@description Searches for stickers from public sticker sets that correspond to any of the given emoji //@sticker_type Type of the stickers to return //@emojis Space-separated list of emoji to search for; must be non-empty @@ -8216,6 +8286,19 @@ setDefaultGroupAdministratorRights default_group_administrator_rights:chatAdmini setDefaultChannelAdministratorRights default_channel_administrator_rights:chatAdministratorRights = Ok; +//@description Checks whether the specified bot can send messages to the user. Returns a 404 error if can't and the access can be granted by call to allowBotToSendMessages @bot_user_id Identifier of the target bot +canBotSendMessages bot_user_id:int53 = Ok; + +//@description Allows the specified bot to send messages to the user @bot_user_id Identifier of the target bot +allowBotToSendMessages bot_user_id:int53 = Ok; + +//@description Sends a custom request from a Web App +//@bot_user_id Identifier of the bot +//@method The method name +//@parameters JSON-serialized method parameters +sendWebAppCustomRequest bot_user_id:int53 method:string parameters:string = CustomRequestResult; + + //@description Sets the name of a bot. Can be called only if userTypeBot.can_be_edited == true //@bot_user_id Identifier of the target bot //@language_code A two-letter ISO 639-1 language code. If empty, the name will be shown to all users for whose languages there is no dedicated name @@ -8271,6 +8354,9 @@ terminateSession session_id:int64 = Ok; //@description Terminates all other sessions of the current user terminateAllOtherSessions = Ok; +//@description Confirms an unconfirmed session of the current user from another device @session_id Session identifier +confirmSession session_id:int64 = Ok; + //@description Toggles whether a session can accept incoming calls @session_id Session identifier @can_accept_calls Pass true to allow accepting incoming calls by the session; pass false otherwise toggleSessionCanAcceptCalls session_id:int64 can_accept_calls:Bool = Ok; @@ -8453,7 +8539,7 @@ synchronizeLanguagePack language_pack_id:string = Ok; addCustomServerLanguagePack language_pack_id:string = Ok; //@description Adds or changes a custom local language pack to the current localization target -//@info Information about the language pack. Language pack ID must start with 'X', consist only of English letters, digits and hyphens, and must not exceed 64 characters. Can be called before authorization +//@info Information about the language pack. Language pack identifier must start with 'X', consist only of English letters, digits and hyphens, and must not exceed 64 characters. Can be called before authorization //@strings Strings of the new language pack setCustomLanguagePack info:languagePackInfo strings:vector = Ok; @@ -8809,6 +8895,14 @@ assignGooglePlayTransaction package_name:string store_product_id:string purchase acceptTermsOfService terms_of_service_id:string = Ok; +//@description Searches specified query by word prefixes in the provided strings. Returns 0-based positions of strings that matched. Can be called synchronously +//@strings The strings to search in for the query +//@query Query to search for +//@limit The maximum number of objects to return +//@return_none_for_empty_query Pass true to receive no results for an empty query +searchStringsByPrefix strings:vector query:string limit:int32 return_none_for_empty_query:Bool = FoundPositions; + + //@description Sends a custom request; for bots only @method The method name @parameters JSON-serialized method parameters sendCustomRequest method:string parameters:string = CustomRequestResult; @@ -8853,7 +8947,7 @@ getApplicationDownloadLink = HttpUrl; //@description Adds a proxy server for network requests. Can be called before authorization -//@server Proxy server IP address +//@server Proxy server domain or IP address //@port Proxy server port //@enable Pass true to immediately enable the proxy //@type Proxy type @@ -8861,7 +8955,7 @@ addProxy server:string port:int32 enable:Bool type:ProxyType = Proxy; //@description Edits an existing proxy server for network requests. Can be called before authorization //@proxy_id Proxy identifier -//@server Proxy server IP address +//@server Proxy server domain or IP address //@port Proxy server port //@enable Pass true to immediately enable the proxy //@type Proxy type @@ -8955,7 +9049,7 @@ testSquareInt x:int32 = TestInt; testNetwork = Ok; //@description Sends a simple network request to the Telegram servers via proxy; for testing only. Can be called before authorization -//@server Proxy server IP address +//@server Proxy server domain or IP address //@port Proxy server port //@type Proxy type //@dc_id Identifier of a datacenter with which to test connection From 9e42c4a4ee285a8cd95823a8f6cbc4ccab756147 Mon Sep 17 00:00:00 2001 From: DukeAnn Date: Mon, 18 Sep 2023 21:22:23 +0800 Subject: [PATCH 03/54] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=8D=95=E8=AF=8D?= =?UTF-8?q?=E6=8B=BC=E5=86=99=EF=BC=8C=E6=9B=B4=E6=96=B0=E6=96=B0=E7=9A=84?= =?UTF-8?q?UUID=E5=8C=85=E3=80=82=EF=BC=88Fix=20word=20spelling,=20update?= =?UTF-8?q?=20new=20UUID=20package=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/extra.go | 18 ++++++------------ go.mod | 5 ++++- go.sum | 46 +++++++++++++++++++++++++++++++++++++++------- 3 files changed, 49 insertions(+), 20 deletions(-) diff --git a/client/extra.go b/client/extra.go index 3b6cd7e..1a82ea9 100644 --- a/client/extra.go +++ b/client/extra.go @@ -1,26 +1,20 @@ package client import ( - "fmt" - "math/rand" "strings" + + "github.com/google/uuid" ) type ExtraGenerator func() string func UuidV4Generator() ExtraGenerator { return func() string { - var uuid [16]byte - rand.Read(uuid[:]) - - uuid[6] = (uuid[6] & 0x0f) | 0x40 - uuid[8] = (uuid[8] & 0x3f) | 0x80 - - return fmt.Sprintf("%08x-%04x-%04x-%04x-%012x", uuid[:4], uuid[4:6], uuid[6:8], uuid[8:10], uuid[10:]) + return uuid.NewString() } } -func IsCommmand(text string) bool { +func IsCommand(text string) bool { if text != "" { if text[0] == '/' { return true @@ -30,7 +24,7 @@ func IsCommmand(text string) bool { } func CheckCommand(text string, entities []*TextEntity) string { - if IsCommmand(text) { + if IsCommand(text) { // Check text entities and make bot happy! if len(entities) >= 1 { // Get first command @@ -61,7 +55,7 @@ func CheckCommand(text string, entities []*TextEntity) string { } func CommandArgument(text string) string { - if IsCommmand(text) { + if IsCommand(text) { // e.g. ["/hello 123", "/hell o 123"] // Result: "123", "o 123" if i := strings.Index(text, " "); i != -1 { diff --git a/go.mod b/go.mod index a591593..204c57c 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,7 @@ module github.com/c0re100/gotdlib go 1.16 -require golang.org/x/crypto v0.0.0-20220128200615-198e4374d7ed +require ( + github.com/google/uuid v1.3.1 + golang.org/x/crypto v0.13.0 +) diff --git a/go.sum b/go.sum index 7062305..26cc704 100644 --- a/go.sum +++ b/go.sum @@ -1,11 +1,43 @@ -golang.org/x/crypto v0.0.0-20220128200615-198e4374d7ed h1:YoWVYYAfvQ4ddHv3OKmIvX7NCAhFGTj62VP2l2kfBbA= -golang.org/x/crypto v0.0.0-20220128200615-198e4374d7ed/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= +github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= +golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.12.0 h1:/ZfYdc3zq+q02Rv9vGqTeSItdzZTSNDmfTi0mBAuidU= +golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= From 9a3301fbd726772c98f0d19f52513679a90b6024 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Tue, 7 Nov 2023 05:47:05 +0800 Subject: [PATCH 04/54] Update to TDLib 1.8.21 --- client/function.go | 663 ++++++++- client/type.go | 2397 +++++++++++++++++++++++++++--- client/unmarshaler.go | 1002 ++++++++++++- data/td_api.tl | 707 +++++++-- example/bot/Bot.go | 2 +- example/command/ReplyCommand.go | 4 +- example/media/Photo_or_Album.go | 4 +- example/pending/PendingUpdate.go | 2 +- 8 files changed, 4319 insertions(+), 462 deletions(-) diff --git a/client/function.go b/client/function.go index 883efd3..52c8bcb 100755 --- a/client/function.go +++ b/client/function.go @@ -2672,41 +2672,6 @@ func (client *Client) GetChatScheduledMessages(req *GetChatScheduledMessagesRequ return UnmarshalMessages(result.Data) } -type GetMessagePublicForwardsRequest struct { - // Chat identifier of the message - ChatId int64 `json:"chat_id"` - // Message identifier - MessageId int64 `json:"message_id"` - // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results - Offset string `json:"offset"` - // The maximum number of messages to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit - Limit int32 `json:"limit"` -} - -// Returns forwarded copies of a channel message to different public channels. For optimal performance, the number of returned messages is chosen by TDLib -func (client *Client) GetMessagePublicForwards(req *GetMessagePublicForwardsRequest) (*FoundMessages, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "getMessagePublicForwards", - }, - Data: map[string]interface{}{ - "chat_id": req.ChatId, - "message_id": req.MessageId, - "offset": req.Offset, - "limit": req.Limit, - }, - }) - if err != nil { - return nil, err - } - - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } - - return UnmarshalFoundMessages(result.Data) -} - type GetChatSponsoredMessagesRequest struct { // Identifier of the chat ChatId int64 `json:"chat_id"` @@ -2825,7 +2790,7 @@ type GetMessageLinkRequest struct { ChatId int64 `json:"chat_id"` // Identifier of the message MessageId int64 `json:"message_id"` - // If not 0, timestamp from which the video/audio/video note/voice note playing must start, in seconds. The media can be in the message content or in its web page preview + // If not 0, timestamp from which the video/audio/video note/voice note/story playing must start, in seconds. The media can be in the message content or in its web page preview MediaTimestamp int32 `json:"media_timestamp"` // Pass true to create a link for the whole media album ForAlbum bool `json:"for_album"` @@ -3098,8 +3063,8 @@ type SendMessageRequest struct { ChatId int64 `json:"chat_id"` // If not 0, a message thread identifier in which the message will be sent MessageThreadId int64 `json:"message_thread_id"` - // Identifier of the replied message or story; pass null if none - ReplyTo MessageReplyTo `json:"reply_to"` + // Information about the message or story to be replied; pass null if none + ReplyTo InputMessageReplyTo `json:"reply_to"` // Options to be used to send the message; pass null to use default options Options *MessageSendOptions `json:"options"` // Markup for replying to the message; pass null if none; for bots only @@ -3139,14 +3104,12 @@ type SendMessageAlbumRequest struct { ChatId int64 `json:"chat_id"` // If not 0, a message thread identifier in which the messages will be sent MessageThreadId int64 `json:"message_thread_id"` - // Identifier of the replied message or story; pass null if none - ReplyTo MessageReplyTo `json:"reply_to"` + // Information about the message or story to be replied; pass null if none + ReplyTo InputMessageReplyTo `json:"reply_to"` // Options to be used to send the messages; pass null to use default options Options *MessageSendOptions `json:"options"` // Contents of messages to be sent. At most 10 messages can be added to an album InputMessageContents []InputMessageContent `json:"input_message_contents"` - // Pass true to get fake messages instead of actually sending them - OnlyPreview bool `json:"only_preview"` } // Sends 2-10 messages grouped together into an album. Currently, only audio, document, photo and video messages can be grouped into an album. Documents and audio files can be only grouped in an album with messages of the same type. Returns sent messages @@ -3161,7 +3124,6 @@ func (client *Client) SendMessageAlbum(req *SendMessageAlbumRequest) (*Messages, "reply_to": req.ReplyTo, "options": req.Options, "input_message_contents": req.InputMessageContents, - "only_preview": req.OnlyPreview, }, }) if err != nil { @@ -3212,8 +3174,8 @@ type SendInlineQueryResultMessageRequest struct { ChatId int64 `json:"chat_id"` // If not 0, a message thread identifier in which the message will be sent MessageThreadId int64 `json:"message_thread_id"` - // Identifier of the replied message or story; pass null if none - ReplyTo MessageReplyTo `json:"reply_to"` + // Information about the message or story to be replied; pass null if none + ReplyTo InputMessageReplyTo `json:"reply_to"` // Options to be used to send the message; pass null to use default options Options *MessageSendOptions `json:"options"` // Identifier of the inline query @@ -3258,7 +3220,7 @@ type ForwardMessagesRequest struct { MessageThreadId int64 `json:"message_thread_id"` // Identifier of the chat from which to forward messages FromChatId int64 `json:"from_chat_id"` - // Identifiers of the messages to forward. Message identifiers must be in a strictly increasing order. At most 100 messages can be forwarded simultaneously + // Identifiers of the messages to forward. Message identifiers must be in a strictly increasing order. At most 100 messages can be forwarded simultaneously. A message can be forwarded only if message.can_be_forwarded MessageIds []int64 `json:"message_ids"` // Options to be used to send the messages; pass null to use default options Options *MessageSendOptions `json:"options"` @@ -3266,8 +3228,6 @@ type ForwardMessagesRequest struct { SendCopy bool `json:"send_copy"` // Pass true to remove media captions of message copies. Ignored if send_copy is false RemoveCaption bool `json:"remove_caption"` - // Pass true to get fake messages instead of actually forwarding them - OnlyPreview bool `json:"only_preview"` } // Forwards previously sent messages. Returns the forwarded messages in the same order as the message identifiers passed in message_ids. If a message can't be forwarded, null will be returned instead of the message @@ -3284,7 +3244,6 @@ func (client *Client) ForwardMessages(req *ForwardMessagesRequest) (*Messages, e "options": req.Options, "send_copy": req.SendCopy, "remove_caption": req.RemoveCaption, - "only_preview": req.OnlyPreview, }, }) if err != nil { @@ -3303,6 +3262,8 @@ type ResendMessagesRequest struct { ChatId int64 `json:"chat_id"` // Identifiers of the messages to resend. Message identifiers must be in a strictly increasing order MessageIds []int64 `json:"message_ids"` + // New manually chosen quote from the message to be replied; pass null if none. Ignored if more than one message is re-sent, or if messageSendingStateFailed.need_another_reply_quote == false + Quote *FormattedText `json:"quote"` } // Resends messages which failed to send. Can be called only for messages for which messageSendingStateFailed.can_retry is true and after specified in messageSendingStateFailed.retry_after time passed. If a message is re-sent, the corresponding failed to send message is deleted. Returns the sent messages in the same order as the message identifiers passed in message_ids. If a message can't be re-sent, null will be returned instead of the message @@ -3314,6 +3275,7 @@ func (client *Client) ResendMessages(req *ResendMessagesRequest) (*Messages, err Data: map[string]interface{}{ "chat_id": req.ChatId, "message_ids": req.MessageIds, + "quote": req.Quote, }, }) if err != nil { @@ -3358,8 +3320,8 @@ type AddLocalMessageRequest struct { ChatId int64 `json:"chat_id"` // Identifier of the sender of the message SenderId MessageSender `json:"sender_id"` - // Identifier of the replied message or story; pass null if none - ReplyTo MessageReplyTo `json:"reply_to"` + // Information about the message or story to be replied; pass null if none + ReplyTo InputMessageReplyTo `json:"reply_to"` // Pass true to disable notification for the message DisableNotification bool `json:"disable_notification"` // The content of the message to be added @@ -4461,6 +4423,43 @@ func (client *Client) SetDefaultReactionType(req *SetDefaultReactionTypeRequest) return UnmarshalOk(result.Data) } +type SearchQuoteRequest struct { + // Text in which to search for the quote + Text *FormattedText `json:"text"` + // Quote to search for + Quote *FormattedText `json:"quote"` + // Approximate quote position in UTF-16 code units + QuotePosition int32 `json:"quote_position"` +} + +// Searches for a given quote in a text. Returns found quote start position in UTF-16 code units. Returns a 404 error if the quote is not found. Can be called synchronously +func SearchQuote(req *SearchQuoteRequest) (*FoundPosition, error) { + result, err := Execute(Request{ + meta: meta{ + Type: "searchQuote", + }, + Data: map[string]interface{}{ + "text": req.Text, + "quote": req.Quote, + "quote_position": req.QuotePosition, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFoundPosition(result.Data) +} + +// deprecated +// Searches for a given quote in a text. Returns found quote start position in UTF-16 code units. Returns a 404 error if the quote is not found. Can be called synchronously +func (client *Client) SearchQuote(req *SearchQuoteRequest) (*FoundPosition, error) { + return SearchQuote(req)} + type GetTextEntitiesRequest struct { // The text in which to look for entities Text string `json:"text"` @@ -4499,7 +4498,7 @@ type ParseTextEntitiesRequest struct { ParseMode TextParseMode `json:"parse_mode"` } -// Parses Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, Code, Pre, PreCode, TextUrl and MentionName entities from a marked-up text. Can be called synchronously +// Parses Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, BlockQuote, Code, Pre, PreCode, TextUrl and MentionName entities from a marked-up text. Can be called synchronously func ParseTextEntities(req *ParseTextEntitiesRequest) (*FormattedText, error) { result, err := Execute(Request{ meta: meta{ @@ -4522,7 +4521,7 @@ func ParseTextEntities(req *ParseTextEntitiesRequest) (*FormattedText, error) { } // deprecated -// Parses Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, Code, Pre, PreCode, TextUrl and MentionName entities from a marked-up text. Can be called synchronously +// Parses Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, BlockQuote, Code, Pre, PreCode, TextUrl and MentionName entities from a marked-up text. Can be called synchronously func (client *Client) ParseTextEntities(req *ParseTextEntitiesRequest) (*FormattedText, error) { return ParseTextEntities(req)} @@ -4926,7 +4925,7 @@ type StopPollRequest struct { ReplyMarkup ReplyMarkup `json:"reply_markup"` } -// Stops a poll. A poll in a message can be stopped when the message has can_be_edited flag set +// Stops a poll. A poll in a message can be stopped when the message has can_be_edited flag is set func (client *Client) StopPoll(req *StopPollRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -5359,8 +5358,8 @@ type OpenWebAppRequest struct { ApplicationName string `json:"application_name"` // If not 0, a message thread identifier in which the message will be sent MessageThreadId int64 `json:"message_thread_id"` - // Identifier of the replied message or story for the message sent by the Web App; pass null if none - ReplyTo MessageReplyTo `json:"reply_to"` + // Information about the message or story to be replied in the message sent by the Web App; pass null if none + ReplyTo InputMessageReplyTo `json:"reply_to"` } // Informs TDLib that a Web App is being opened from the attachment menu, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an inlineKeyboardButtonTypeWebApp button. For each bot, a confirmation alert about data sent to the bot must be shown once @@ -5999,6 +5998,9 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeChangePhoneNumber: return UnmarshalInternalLinkTypeChangePhoneNumber(result.Data) + case TypeInternalLinkTypeChatBoost: + return UnmarshalInternalLinkTypeChatBoost(result.Data) + case TypeInternalLinkTypeChatFolderInvite: return UnmarshalInternalLinkTypeChatFolderInvite(result.Data) @@ -6044,6 +6046,9 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypePremiumFeatures: return UnmarshalInternalLinkTypePremiumFeatures(result.Data) + case TypeInternalLinkTypePremiumGiftCode: + return UnmarshalInternalLinkTypePremiumGiftCode(result.Data) + case TypeInternalLinkTypePrivacyAndSecuritySettings: return UnmarshalInternalLinkTypePrivacyAndSecuritySettings(result.Data) @@ -6432,7 +6437,7 @@ type CreateNewSupergroupChatRequest struct { Location *ChatLocation `json:"location"` // Message auto-delete time value, in seconds; must be from 0 up to 365 * 86400 and be divisible by 86400. If 0, then messages aren't deleted automatically MessageAutoDeleteTime int32 `json:"message_auto_delete_time"` - // Pass true to create a supergroup for importing messages using importMessage + // Pass true to create a supergroup for importing messages using importMessages ForImport bool `json:"for_import"` } @@ -7172,6 +7177,38 @@ func (client *Client) SetChatPhoto(req *SetChatPhotoRequest) (*Ok, error) { return UnmarshalOk(result.Data) } +type SetChatAccentColorRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Identifier of the accent color to use + AccentColorId int32 `json:"accent_color_id"` + // Identifier of a custom emoji to be shown on the reply header background; 0 if none + BackgroundCustomEmojiId JsonInt64 `json:"background_custom_emoji_id"` +} + +// Changes accent color and background custom emoji of a chat. Supported only for channels with getOption("channel_custom_accent_color_boost_level_min") boost level. Requires can_change_info administrator right +func (client *Client) SetChatAccentColor(req *SetChatAccentColorRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setChatAccentColor", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "accent_color_id": req.AccentColorId, + "background_custom_emoji_id": req.BackgroundCustomEmojiId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type SetChatMessageAutoDeleteTimeRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -8445,13 +8482,39 @@ func (client *Client) GetStory(req *GetStoryRequest) (*Story, error) { return UnmarshalStory(result.Data) } -// Checks whether the current user can send a story -func (client *Client) CanSendStory() (CanSendStoryResult, error) { +// Returns channel chats in which the current user has the right to post stories. The chats must be rechecked with canSendStory before actually trying to post a story there +func (client *Client) GetChatsToSendStories() (*Chats, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatsToSendStories", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChats(result.Data) +} + +type CanSendStoryRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` +} + +// Checks whether the current user can send a story on behalf of a chat; requires can_post_stories rights for channel chats +func (client *Client) CanSendStory(req *CanSendStoryRequest) (CanSendStoryResult, error) { result, err := client.Send(Request{ meta: meta{ Type: "canSendStory", }, - Data: map[string]interface{}{}, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, }) if err != nil { return nil, err @@ -8468,6 +8531,9 @@ func (client *Client) CanSendStory() (CanSendStoryResult, error) { case TypeCanSendStoryResultPremiumNeeded: return UnmarshalCanSendStoryResultPremiumNeeded(result.Data) + case TypeCanSendStoryResultBoostNeeded: + return UnmarshalCanSendStoryResultBoostNeeded(result.Data) + case TypeCanSendStoryResultActiveStoryLimitExceeded: return UnmarshalCanSendStoryResultActiveStoryLimitExceeded(result.Data) @@ -8483,6 +8549,8 @@ func (client *Client) CanSendStory() (CanSendStoryResult, error) { } type SendStoryRequest struct { + // Identifier of the chat that will post the story + ChatId int64 `json:"chat_id"` // Content of the story Content InputStoryContent `json:"content"` // Clickable rectangle areas to be shown on the story media; pass null if none @@ -8499,13 +8567,14 @@ type SendStoryRequest struct { ProtectContent bool `json:"protect_content"` } -// Sends a new story. Returns a temporary story +// Sends a new story to a chat; requires can_post_stories rights for channel chats. Returns a temporary story func (client *Client) SendStory(req *SendStoryRequest) (*Story, error) { result, err := client.Send(Request{ meta: meta{ Type: "sendStory", }, Data: map[string]interface{}{ + "chat_id": req.ChatId, "content": req.Content, "areas": req.Areas, "caption": req.Caption, @@ -8527,6 +8596,8 @@ func (client *Client) SendStory(req *SendStoryRequest) (*Story, error) { } type EditStoryRequest struct { + // Identifier of the chat that posted the story + StorySenderChatId int64 `json:"story_sender_chat_id"` // Identifier of the story to edit StoryId int32 `json:"story_id"` // New content of the story; pass null to keep the current content @@ -8537,13 +8608,14 @@ type EditStoryRequest struct { Caption *FormattedText `json:"caption"` } -// Changes content and caption of a previously sent story +// Changes content and caption of a story. Can be called only if story.can_be_edited == true func (client *Client) EditStory(req *EditStoryRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ Type: "editStory", }, Data: map[string]interface{}{ + "story_sender_chat_id": req.StorySenderChatId, "story_id": req.StoryId, "content": req.Content, "areas": req.Areas, @@ -8562,19 +8634,22 @@ func (client *Client) EditStory(req *EditStoryRequest) (*Ok, error) { } type SetStoryPrivacySettingsRequest struct { + // Identifier of the chat that posted the story + StorySenderChatId int64 `json:"story_sender_chat_id"` // Identifier of the story StoryId int32 `json:"story_id"` // The new privacy settigs for the story PrivacySettings StoryPrivacySettings `json:"privacy_settings"` } -// Changes privacy settings of a previously sent story +// Changes privacy settings of a story. Can be called only if story.can_be_edited == true func (client *Client) SetStoryPrivacySettings(req *SetStoryPrivacySettingsRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ Type: "setStoryPrivacySettings", }, Data: map[string]interface{}{ + "story_sender_chat_id": req.StorySenderChatId, "story_id": req.StoryId, "privacy_settings": req.PrivacySettings, }, @@ -8591,19 +8666,22 @@ func (client *Client) SetStoryPrivacySettings(req *SetStoryPrivacySettingsReques } type ToggleStoryIsPinnedRequest struct { + // Identifier of the chat that posted the story + StorySenderChatId int64 `json:"story_sender_chat_id"` // Identifier of the story StoryId int32 `json:"story_id"` // Pass true to make the story accessible after expiration; pass false to make it private IsPinned bool `json:"is_pinned"` } -// Toggles whether a story is accessible after expiration +// Toggles whether a story is accessible after expiration. Can be called only if story.can_toggle_is_pinned == true func (client *Client) ToggleStoryIsPinned(req *ToggleStoryIsPinnedRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ Type: "toggleStoryIsPinned", }, Data: map[string]interface{}{ + "story_sender_chat_id": req.StorySenderChatId, "story_id": req.StoryId, "is_pinned": req.IsPinned, }, @@ -8620,17 +8698,20 @@ func (client *Client) ToggleStoryIsPinned(req *ToggleStoryIsPinnedRequest) (*Ok, } type DeleteStoryRequest struct { + // Identifier of the chat that posted the story + StorySenderChatId int64 `json:"story_sender_chat_id"` // Identifier of the story to delete StoryId int32 `json:"story_id"` } -// Deletes a previously sent story +// Deletes a previously sent story. Can be called only if story.can_be_deleted == true func (client *Client) DeleteStory(req *DeleteStoryRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ Type: "deleteStory", }, Data: map[string]interface{}{ + "story_sender_chat_id": req.StorySenderChatId, "story_id": req.StoryId, }, }) @@ -8777,20 +8858,23 @@ func (client *Client) GetChatPinnedStories(req *GetChatPinnedStoriesRequest) (*S return UnmarshalStories(result.Data) } -type GetArchivedStoriesRequest struct { +type GetChatArchivedStoriesRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` // Identifier of the story starting from which stories must be returned; use 0 to get results from the last story FromStoryId int32 `json:"from_story_id"` // The maximum number of stories to be returned For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit Limit int32 `json:"limit"` } -// Returns the list of all stories of the current user. The stories are returned in a reverse chronological order (i.e., in order of decreasing story_id). For optimal performance, the number of returned stories is chosen by TDLib -func (client *Client) GetArchivedStories(req *GetArchivedStoriesRequest) (*Stories, error) { +// Returns the list of all stories posted by the given chat; requires can_edit_stories rights for channel chats. The stories are returned in a reverse chronological order (i.e., in order of decreasing story_id). For optimal performance, the number of returned stories is chosen by TDLib +func (client *Client) GetChatArchivedStories(req *GetChatArchivedStoriesRequest) (*Stories, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getArchivedStories", + Type: "getChatArchivedStories", }, Data: map[string]interface{}{ + "chat_id": req.ChatId, "from_story_id": req.FromStoryId, "limit": req.Limit, }, @@ -8940,7 +9024,7 @@ type GetStoryViewersRequest struct { Limit int32 `json:"limit"` } -// Returns viewers of a story. The method can be called if story.can_get_viewers == true +// Returns viewers of a story. The method can be called only for stories posted on behalf of the current user func (client *Client) GetStoryViewers(req *GetStoryViewersRequest) (*StoryViewers, error) { result, err := client.Send(Request{ meta: meta{ @@ -9020,6 +9104,196 @@ func (client *Client) ActivateStoryStealthMode() (*Ok, error) { return UnmarshalOk(result.Data) } +// Returns the list of available chat boost slots for the current user +func (client *Client) GetAvailableChatBoostSlots() (*ChatBoostSlots, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getAvailableChatBoostSlots", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatBoostSlots(result.Data) +} + +type GetChatBoostStatusRequest struct { + // Identifier of the channel chat + ChatId int64 `json:"chat_id"` +} + +// Returns the current boost status for a channel chat +func (client *Client) GetChatBoostStatus(req *GetChatBoostStatusRequest) (*ChatBoostStatus, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatBoostStatus", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatBoostStatus(result.Data) +} + +type BoostChatRequest struct { + // Identifier of the chat + ChatId int64 `json:"chat_id"` + // Identifiers of boost slots of the current user from which to apply boosts to the chat + SlotIds []int32 `json:"slot_ids"` +} + +// Boosts a chat and returns the list of available chat boost slots for the current user after the boost +func (client *Client) BoostChat(req *BoostChatRequest) (*ChatBoostSlots, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "boostChat", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "slot_ids": req.SlotIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatBoostSlots(result.Data) +} + +type GetChatBoostLinkRequest struct { + // Identifier of the chat + ChatId int64 `json:"chat_id"` +} + +// Returns an HTTPS link to boost the specified channel chat +func (client *Client) GetChatBoostLink(req *GetChatBoostLinkRequest) (*ChatBoostLink, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatBoostLink", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatBoostLink(result.Data) +} + +type GetChatBoostLinkInfoRequest struct { + // The link to boost a chat + Url string `json:"url"` +} + +// Returns information about a link to boost a chat. Can be called for any internal link of the type internalLinkTypeChatBoost +func (client *Client) GetChatBoostLinkInfo(req *GetChatBoostLinkInfoRequest) (*ChatBoostLinkInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatBoostLinkInfo", + }, + Data: map[string]interface{}{ + "url": req.Url, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatBoostLinkInfo(result.Data) +} + +type GetChatBoostsRequest struct { + // Identifier of the chat + ChatId int64 `json:"chat_id"` + // Pass true to receive only boosts received from gift codes and giveaways created by the chat + OnlyGiftCodes bool `json:"only_gift_codes"` + // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results + Offset string `json:"offset"` + // The maximum number of boosts to be returned; up to 100. For optimal performance, the number of returned boosts can be smaller than the specified limit + Limit int32 `json:"limit"` +} + +// Returns list of boosts applied to a chat; requires administrator rights in the channel chat +func (client *Client) GetChatBoosts(req *GetChatBoostsRequest) (*FoundChatBoosts, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatBoosts", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "only_gift_codes": req.OnlyGiftCodes, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFoundChatBoosts(result.Data) +} + +type GetUserChatBoostsRequest struct { + // Identifier of the chat + ChatId int64 `json:"chat_id"` + // Identifier of the user + UserId int64 `json:"user_id"` +} + +// Returns list of boosts applied to a chat by a given user; requires administrator rights in the channel chat; for bots only +func (client *Client) GetUserChatBoosts(req *GetUserChatBoostsRequest) (*FoundChatBoosts, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getUserChatBoosts", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "user_id": req.UserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFoundChatBoosts(result.Data) +} + type GetAttachmentMenuBotRequest struct { // Bot's user identifier BotUserId int64 `json:"bot_user_id"` @@ -10890,7 +11164,7 @@ type InviteGroupCallParticipantsRequest struct { UserIds []int64 `json:"user_ids"` } -// Invites users to an active group call. Sends a service message of type messageInviteToGroupCall for video chats +// Invites users to an active group call. Sends a service message of type messageInviteVideoChatParticipants for video chats func (client *Client) InviteGroupCallParticipants(req *InviteGroupCallParticipantsRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -12657,6 +12931,25 @@ func (client *Client) GetDefaultProfilePhotoCustomEmojiStickers() (*Stickers, er return UnmarshalStickers(result.Data) } +// Returns default list of custom emoji stickers for reply background +func (client *Client) GetDefaultBackgroundCustomEmojiStickers() (*Stickers, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getDefaultBackgroundCustomEmojiStickers", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStickers(result.Data) +} + // Returns saved animations func (client *Client) GetSavedAnimations() (*Animations, error) { result, err := client.Send(Request{ @@ -12805,9 +13098,11 @@ func (client *Client) RemoveRecentHashtag(req *RemoveRecentHashtagRequest) (*Ok, type GetWebPagePreviewRequest struct { // Message text with formatting Text *FormattedText `json:"text"` + // Options to be used for generation of the link preview; pass null to use default link preview options + LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options"` } -// Returns a web page preview by the text of the message. Do not call this function too often. Returns a 404 error if the web page has no preview +// Returns a link preview by the text of a message. Do not call this function too often. Returns a 404 error if the text has no link preview func (client *Client) GetWebPagePreview(req *GetWebPagePreviewRequest) (*WebPage, error) { result, err := client.Send(Request{ meta: meta{ @@ -12815,6 +13110,7 @@ func (client *Client) GetWebPagePreview(req *GetWebPagePreviewRequest) (*WebPage }, Data: map[string]interface{}{ "text": req.Text, + "link_preview_options": req.LinkPreviewOptions, }, }) if err != nil { @@ -12912,6 +13208,35 @@ func (client *Client) DeleteProfilePhoto(req *DeleteProfilePhotoRequest) (*Ok, e return UnmarshalOk(result.Data) } +type SetAccentColorRequest struct { + // Identifier of the accent color to use + AccentColorId int32 `json:"accent_color_id"` + // Identifier of a custom emoji to be shown on the reply header background; 0 if none + BackgroundCustomEmojiId JsonInt64 `json:"background_custom_emoji_id"` +} + +// Changes accent color and background custom emoji for the current user; for Telegram Premium users only +func (client *Client) SetAccentColor(req *SetAccentColorRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setAccentColor", + }, + Data: map[string]interface{}{ + "accent_color_id": req.AccentColorId, + "background_custom_emoji_id": req.BackgroundCustomEmojiId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type SetNameRequest struct { // The new value of the first name for the current user; 1-64 characters FirstName string `json:"first_name"` @@ -14552,7 +14877,7 @@ type GetPaymentFormRequest struct { Theme *ThemeParameters `json:"theme"` } -// Returns an invoice payment form. This method must be called when the user presses inlineKeyboardButtonBuy +// Returns an invoice payment form. This method must be called when the user presses inline button of the type inlineKeyboardButtonTypeBuy func (client *Client) GetPaymentForm(req *GetPaymentFormRequest) (*PaymentForm, error) { result, err := client.Send(Request{ meta: meta{ @@ -15738,6 +16063,41 @@ func (client *Client) GetMessageStatistics(req *GetMessageStatisticsRequest) (*M return UnmarshalMessageStatistics(result.Data) } +type GetMessagePublicForwardsRequest struct { + // Chat identifier of the message + ChatId int64 `json:"chat_id"` + // Message identifier + MessageId int64 `json:"message_id"` + // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results + Offset string `json:"offset"` + // The maximum number of messages to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit + Limit int32 `json:"limit"` +} + +// Returns forwarded copies of a channel message to different public channels. Can be used only if message.can_get_statistics == true. For optimal performance, the number of returned messages is chosen by TDLib +func (client *Client) GetMessagePublicForwards(req *GetMessagePublicForwardsRequest) (*FoundMessages, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getMessagePublicForwards", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFoundMessages(result.Data) +} + type GetStatisticalGraphRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -17336,6 +17696,151 @@ func (client *Client) GetPremiumState() (*PremiumState, error) { return UnmarshalPremiumState(result.Data) } +type GetPremiumGiftCodePaymentOptionsRequest struct { + // Identifier of the channel chat, which will be automatically boosted by receivers of the gift codes and which is administered by the user; 0 if none + BoostedChatId int64 `json:"boosted_chat_id"` +} + +// Returns available options for Telegram Premium gift code or giveaway creation +func (client *Client) GetPremiumGiftCodePaymentOptions(req *GetPremiumGiftCodePaymentOptionsRequest) (*PremiumGiftCodePaymentOptions, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getPremiumGiftCodePaymentOptions", + }, + Data: map[string]interface{}{ + "boosted_chat_id": req.BoostedChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPremiumGiftCodePaymentOptions(result.Data) +} + +type CheckPremiumGiftCodeRequest struct { + // The code to check + Code string `json:"code"` +} + +// Return information about a Telegram Premium gift code +func (client *Client) CheckPremiumGiftCode(req *CheckPremiumGiftCodeRequest) (*PremiumGiftCodeInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "checkPremiumGiftCode", + }, + Data: map[string]interface{}{ + "code": req.Code, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPremiumGiftCodeInfo(result.Data) +} + +type ApplyPremiumGiftCodeRequest struct { + // The code to apply + Code string `json:"code"` +} + +// Applies a Telegram Premium gift code +func (client *Client) ApplyPremiumGiftCode(req *ApplyPremiumGiftCodeRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "applyPremiumGiftCode", + }, + Data: map[string]interface{}{ + "code": req.Code, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type LaunchPrepaidPremiumGiveawayRequest struct { + // Unique identifier of the prepaid giveaway + GiveawayId JsonInt64 `json:"giveaway_id"` + // Giveaway parameters + Parameters *PremiumGiveawayParameters `json:"parameters"` +} + +// Launches a prepaid Telegram Premium giveaway for subscribers of channel chats; requires can_post_messages rights in the channels +func (client *Client) LaunchPrepaidPremiumGiveaway(req *LaunchPrepaidPremiumGiveawayRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "launchPrepaidPremiumGiveaway", + }, + Data: map[string]interface{}{ + "giveaway_id": req.GiveawayId, + "parameters": req.Parameters, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetPremiumGiveawayInfoRequest struct { + // Identifier of the channel chat which started the giveaway + ChatId int64 `json:"chat_id"` + // Identifier of the giveaway message in the chat + MessageId int64 `json:"message_id"` +} + +// Returns information about a Telegram Premium giveaway +func (client *Client) GetPremiumGiveawayInfo(req *GetPremiumGiveawayInfoRequest) (PremiumGiveawayInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getPremiumGiveawayInfo", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypePremiumGiveawayInfoOngoing: + return UnmarshalPremiumGiveawayInfoOngoing(result.Data) + + case TypePremiumGiveawayInfoCompleted: + return UnmarshalPremiumGiveawayInfoCompleted(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + type CanPurchasePremiumRequest struct { // Transaction purpose Purpose StorePaymentPurpose `json:"purpose"` @@ -18693,6 +19198,12 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateChatPhoto: return UnmarshalUpdateChatPhoto(result.Data) + case TypeUpdateChatAccentColor: + return UnmarshalUpdateChatAccentColor(result.Data) + + case TypeUpdateChatBackgroundCustomEmoji: + return UnmarshalUpdateChatBackgroundCustomEmoji(result.Data) + case TypeUpdateChatPermissions: return UnmarshalUpdateChatPermissions(result.Data) @@ -18915,6 +19426,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateChatThemes: return UnmarshalUpdateChatThemes(result.Data) + case TypeUpdateAccentColors: + return UnmarshalUpdateAccentColors(result.Data) + case TypeUpdateLanguagePackStrings: return UnmarshalUpdateLanguagePackStrings(result.Data) @@ -18996,6 +19510,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateNewChatJoinRequest: return UnmarshalUpdateNewChatJoinRequest(result.Data) + case TypeUpdateChatBoost: + return UnmarshalUpdateChatBoost(result.Data) + default: return nil, errors.New("invalid type") } diff --git a/client/type.go b/client/type.go index eba7be1..1c74660 100755 --- a/client/type.go +++ b/client/type.go @@ -21,16 +21,19 @@ const ( ClassUserType = "UserType" ClassChatPhotoStickerType = "ChatPhotoStickerType" ClassInputChatPhoto = "InputChatPhoto" + ClassPremiumGiveawayParticipantStatus = "PremiumGiveawayParticipantStatus" + ClassPremiumGiveawayInfo = "PremiumGiveawayInfo" ClassChatMemberStatus = "ChatMemberStatus" ClassChatMembersFilter = "ChatMembersFilter" ClassSupergroupMembersFilter = "SupergroupMembersFilter" ClassInviteLinkChatType = "InviteLinkChatType" ClassSecretChatState = "SecretChatState" ClassMessageSender = "MessageSender" - ClassMessageForwardOrigin = "MessageForwardOrigin" + ClassMessageOrigin = "MessageOrigin" ClassReactionType = "ReactionType" ClassMessageSendingState = "MessageSendingState" ClassMessageReplyTo = "MessageReplyTo" + ClassInputMessageReplyTo = "InputMessageReplyTo" ClassMessageSource = "MessageSource" ClassMessageSponsorType = "MessageSponsorType" ClassNotificationSettingsScope = "NotificationSettingsScope" @@ -71,6 +74,7 @@ const ( ClassStoryContent = "StoryContent" ClassInputStoryContent = "InputStoryContent" ClassStoryList = "StoryList" + ClassChatBoostSource = "ChatBoostSource" ClassCallDiscardReason = "CallDiscardReason" ClassCallServerType = "CallServerType" ClassCallState = "CallState" @@ -79,6 +83,7 @@ const ( ClassFirebaseAuthenticationSettings = "FirebaseAuthenticationSettings" ClassDiceStickers = "DiceStickers" ClassSpeechRecognitionResult = "SpeechRecognitionResult" + ClassBotWriteAccessAllowReason = "BotWriteAccessAllowReason" ClassInputInlineQueryResult = "InputInlineQueryResult" ClassInlineQueryResult = "InlineQueryResult" ClassInlineQueryResultsButtonType = "InlineQueryResultsButtonType" @@ -90,6 +95,7 @@ const ( ClassPremiumStoryFeature = "PremiumStoryFeature" ClassPremiumSource = "PremiumSource" ClassStorePaymentPurpose = "StorePaymentPurpose" + ClassTelegramPaymentPurpose = "TelegramPaymentPurpose" ClassDeviceToken = "DeviceToken" ClassBackgroundFill = "BackgroundFill" ClassBackgroundType = "BackgroundType" @@ -181,6 +187,10 @@ const ( ClassChatAdministratorRights = "ChatAdministratorRights" ClassPremiumPaymentOption = "PremiumPaymentOption" ClassPremiumStatePaymentOption = "PremiumStatePaymentOption" + ClassPremiumGiftCodePaymentOption = "PremiumGiftCodePaymentOption" + ClassPremiumGiftCodePaymentOptions = "PremiumGiftCodePaymentOptions" + ClassPremiumGiftCodeInfo = "PremiumGiftCodeInfo" + ClassAccentColor = "AccentColor" ClassEmojiStatus = "EmojiStatus" ClassEmojiStatuses = "EmojiStatuses" ClassUsernames = "Usernames" @@ -213,6 +223,7 @@ const ( ClassMessageViewer = "MessageViewer" ClassMessageViewers = "MessageViewers" ClassMessageForwardInfo = "MessageForwardInfo" + ClassMessageImportInfo = "MessageImportInfo" ClassMessageReplyInfo = "MessageReplyInfo" ClassMessageReaction = "MessageReaction" ClassMessageInteractionInfo = "MessageInteractionInfo" @@ -259,6 +270,7 @@ const ( ClassForumTopicInfo = "ForumTopicInfo" ClassForumTopic = "ForumTopic" ClassForumTopics = "ForumTopics" + ClassLinkPreviewOptions = "LinkPreviewOptions" ClassPageBlockCaption = "PageBlockCaption" ClassPageBlockListItem = "PageBlockListItem" ClassPageBlockTableCell = "PageBlockTableCell" @@ -282,6 +294,7 @@ const ( ClassValidatedOrderInfo = "ValidatedOrderInfo" ClassPaymentResult = "PaymentResult" ClassPaymentReceipt = "PaymentReceipt" + ClassPremiumGiveawayParameters = "PremiumGiveawayParameters" ClassDatedFile = "DatedFile" ClassDate = "Date" ClassPersonalDetails = "PersonalDetails" @@ -321,6 +334,12 @@ const ( ClassStories = "Stories" ClassStoryInfo = "StoryInfo" ClassChatActiveStories = "ChatActiveStories" + ClassPrepaidPremiumGiveaway = "PrepaidPremiumGiveaway" + ClassChatBoostStatus = "ChatBoostStatus" + ClassChatBoost = "ChatBoost" + ClassFoundChatBoosts = "FoundChatBoosts" + ClassChatBoostSlot = "ChatBoostSlot" + ClassChatBoostSlots = "ChatBoostSlots" ClassCallProtocol = "CallProtocol" ClassCallServer = "CallServer" ClassCallId = "CallId" @@ -383,6 +402,8 @@ const ( ClassConnectedWebsites = "ConnectedWebsites" ClassMessageLink = "MessageLink" ClassMessageLinkInfo = "MessageLinkInfo" + ClassChatBoostLink = "ChatBoostLink" + ClassChatBoostLinkInfo = "ChatBoostLinkInfo" ClassFilePart = "FilePart" ClassStorageStatisticsByFileType = "StorageStatisticsByFileType" ClassStorageStatisticsByChat = "StorageStatisticsByChat" @@ -395,6 +416,7 @@ const ( ClassScopeAutosaveSettings = "ScopeAutosaveSettings" ClassAutosaveSettingsException = "AutosaveSettingsException" ClassAutosaveSettings = "AutosaveSettings" + ClassFoundPosition = "FoundPosition" ClassFoundPositions = "FoundPositions" ClassTMeUrl = "TMeUrl" ClassTMeUrls = "TMeUrls" @@ -541,6 +563,17 @@ const ( TypeChatAdministratorRights = "chatAdministratorRights" TypePremiumPaymentOption = "premiumPaymentOption" TypePremiumStatePaymentOption = "premiumStatePaymentOption" + TypePremiumGiftCodePaymentOption = "premiumGiftCodePaymentOption" + TypePremiumGiftCodePaymentOptions = "premiumGiftCodePaymentOptions" + TypePremiumGiftCodeInfo = "premiumGiftCodeInfo" + TypePremiumGiveawayParticipantStatusEligible = "premiumGiveawayParticipantStatusEligible" + TypePremiumGiveawayParticipantStatusParticipating = "premiumGiveawayParticipantStatusParticipating" + TypePremiumGiveawayParticipantStatusAlreadyWasMember = "premiumGiveawayParticipantStatusAlreadyWasMember" + TypePremiumGiveawayParticipantStatusAdministrator = "premiumGiveawayParticipantStatusAdministrator" + TypePremiumGiveawayParticipantStatusDisallowedCountry = "premiumGiveawayParticipantStatusDisallowedCountry" + TypePremiumGiveawayInfoOngoing = "premiumGiveawayInfoOngoing" + TypePremiumGiveawayInfoCompleted = "premiumGiveawayInfoCompleted" + TypeAccentColor = "accentColor" TypeEmojiStatus = "emojiStatus" TypeEmojiStatuses = "emojiStatuses" TypeUsernames = "usernames" @@ -601,14 +634,14 @@ const ( TypeChatMessageSenders = "chatMessageSenders" TypeMessageViewer = "messageViewer" TypeMessageViewers = "messageViewers" - TypeMessageForwardOriginUser = "messageForwardOriginUser" - TypeMessageForwardOriginChat = "messageForwardOriginChat" - TypeMessageForwardOriginHiddenUser = "messageForwardOriginHiddenUser" - TypeMessageForwardOriginChannel = "messageForwardOriginChannel" - TypeMessageForwardOriginMessageImport = "messageForwardOriginMessageImport" + TypeMessageOriginUser = "messageOriginUser" + TypeMessageOriginHiddenUser = "messageOriginHiddenUser" + TypeMessageOriginChat = "messageOriginChat" + TypeMessageOriginChannel = "messageOriginChannel" TypeReactionTypeEmoji = "reactionTypeEmoji" TypeReactionTypeCustomEmoji = "reactionTypeCustomEmoji" TypeMessageForwardInfo = "messageForwardInfo" + TypeMessageImportInfo = "messageImportInfo" TypeMessageReplyInfo = "messageReplyInfo" TypeMessageReaction = "messageReaction" TypeMessageInteractionInfo = "messageInteractionInfo" @@ -617,6 +650,8 @@ const ( TypeMessageSendingStateFailed = "messageSendingStateFailed" TypeMessageReplyToMessage = "messageReplyToMessage" TypeMessageReplyToStory = "messageReplyToStory" + TypeInputMessageReplyToMessage = "inputMessageReplyToMessage" + TypeInputMessageReplyToStory = "inputMessageReplyToStory" TypeMessage = "message" TypeMessages = "messages" TypeFoundMessages = "foundMessages" @@ -718,6 +753,7 @@ const ( TypeForumTopicInfo = "forumTopicInfo" TypeForumTopic = "forumTopic" TypeForumTopics = "forumTopics" + TypeLinkPreviewOptions = "linkPreviewOptions" TypeRichTextPlain = "richTextPlain" TypeRichTextBold = "richTextBold" TypeRichTextItalic = "richTextItalic" @@ -802,10 +838,12 @@ const ( TypePaymentReceipt = "paymentReceipt" TypeInputInvoiceMessage = "inputInvoiceMessage" TypeInputInvoiceName = "inputInvoiceName" + TypeInputInvoiceTelegram = "inputInvoiceTelegram" TypeMessageExtendedMediaPreview = "messageExtendedMediaPreview" TypeMessageExtendedMediaPhoto = "messageExtendedMediaPhoto" TypeMessageExtendedMediaVideo = "messageExtendedMediaVideo" TypeMessageExtendedMediaUnsupported = "messageExtendedMediaUnsupported" + TypePremiumGiveawayParameters = "premiumGiveawayParameters" TypeDatedFile = "datedFile" TypePassportElementTypePersonalDetails = "passportElementTypePersonalDetails" TypePassportElementTypePassport = "passportElementTypePassport" @@ -930,10 +968,12 @@ const ( TypeMessagePaymentSuccessful = "messagePaymentSuccessful" TypeMessagePaymentSuccessfulBot = "messagePaymentSuccessfulBot" TypeMessageGiftedPremium = "messageGiftedPremium" + TypeMessagePremiumGiftCode = "messagePremiumGiftCode" + TypeMessagePremiumGiveawayCreated = "messagePremiumGiveawayCreated" + TypeMessagePremiumGiveaway = "messagePremiumGiveaway" TypeMessageContactRegistered = "messageContactRegistered" TypeMessageUserShared = "messageUserShared" TypeMessageChatShared = "messageChatShared" - TypeMessageWebsiteConnected = "messageWebsiteConnected" TypeMessageBotWriteAccessAllowed = "messageBotWriteAccessAllowed" TypeMessageWebAppDataSent = "messageWebAppDataSent" TypeMessageWebAppDataReceived = "messageWebAppDataReceived" @@ -957,6 +997,7 @@ const ( TypeTextEntityTypeCode = "textEntityTypeCode" TypeTextEntityTypePre = "textEntityTypePre" TypeTextEntityTypePreCode = "textEntityTypePreCode" + TypeTextEntityTypeBlockQuote = "textEntityTypeBlockQuote" TypeTextEntityTypeTextUrl = "textEntityTypeTextUrl" TypeTextEntityTypeMentionName = "textEntityTypeMentionName" TypeTextEntityTypeCustomEmoji = "textEntityTypeCustomEmoji" @@ -1040,10 +1081,12 @@ const ( TypeStoryAreaPosition = "storyAreaPosition" TypeStoryAreaTypeLocation = "storyAreaTypeLocation" TypeStoryAreaTypeVenue = "storyAreaTypeVenue" + TypeStoryAreaTypeSuggestedReaction = "storyAreaTypeSuggestedReaction" TypeStoryArea = "storyArea" TypeInputStoryAreaTypeLocation = "inputStoryAreaTypeLocation" TypeInputStoryAreaTypeFoundVenue = "inputStoryAreaTypeFoundVenue" TypeInputStoryAreaTypePreviousVenue = "inputStoryAreaTypePreviousVenue" + TypeInputStoryAreaTypeSuggestedReaction = "inputStoryAreaTypeSuggestedReaction" TypeInputStoryArea = "inputStoryArea" TypeInputStoryAreas = "inputStoryAreas" TypeStoryVideo = "storyVideo" @@ -1059,6 +1102,15 @@ const ( TypeStories = "stories" TypeStoryInfo = "storyInfo" TypeChatActiveStories = "chatActiveStories" + TypeChatBoostSourceGiftCode = "chatBoostSourceGiftCode" + TypeChatBoostSourceGiveaway = "chatBoostSourceGiveaway" + TypeChatBoostSourcePremium = "chatBoostSourcePremium" + TypePrepaidPremiumGiveaway = "prepaidPremiumGiveaway" + TypeChatBoostStatus = "chatBoostStatus" + TypeChatBoost = "chatBoost" + TypeFoundChatBoosts = "foundChatBoosts" + TypeChatBoostSlot = "chatBoostSlot" + TypeChatBoostSlots = "chatBoostSlots" TypeCallDiscardReasonEmpty = "callDiscardReasonEmpty" TypeCallDiscardReasonMissed = "callDiscardReasonMissed" TypeCallDiscardReasonDeclined = "callDiscardReasonDeclined" @@ -1115,6 +1167,10 @@ const ( TypeAttachmentMenuBotColor = "attachmentMenuBotColor" TypeAttachmentMenuBot = "attachmentMenuBot" TypeSentWebAppMessage = "sentWebAppMessage" + TypeBotWriteAccessAllowReasonConnectedWebsite = "botWriteAccessAllowReasonConnectedWebsite" + TypeBotWriteAccessAllowReasonAddedToAttachmentMenu = "botWriteAccessAllowReasonAddedToAttachmentMenu" + TypeBotWriteAccessAllowReasonLaunchedWebApp = "botWriteAccessAllowReasonLaunchedWebApp" + TypeBotWriteAccessAllowReasonAcceptedRequest = "botWriteAccessAllowReasonAcceptedRequest" TypeHttpUrl = "httpUrl" TypeUserLink = "userLink" TypeInputInlineQueryResultAnimation = "inputInlineQueryResultAnimation" @@ -1176,6 +1232,8 @@ const ( TypeChatEventTitleChanged = "chatEventTitleChanged" TypeChatEventUsernameChanged = "chatEventUsernameChanged" TypeChatEventActiveUsernamesChanged = "chatEventActiveUsernamesChanged" + TypeChatEventAccentColorChanged = "chatEventAccentColorChanged" + TypeChatEventBackgroundCustomEmojiChanged = "chatEventBackgroundCustomEmojiChanged" TypeChatEventHasProtectedContentToggled = "chatEventHasProtectedContentToggled" TypeChatEventInvitesToggled = "chatEventInvitesToggled" TypeChatEventIsAllHistoryAvailableToggled = "chatEventIsAllHistoryAvailableToggled" @@ -1222,6 +1280,7 @@ const ( TypePremiumLimitTypeWeeklySentStoryCount = "premiumLimitTypeWeeklySentStoryCount" TypePremiumLimitTypeMonthlySentStoryCount = "premiumLimitTypeMonthlySentStoryCount" TypePremiumLimitTypeStoryCaptionLength = "premiumLimitTypeStoryCaptionLength" + TypePremiumLimitTypeStorySuggestedReactionAreaCount = "premiumLimitTypeStorySuggestedReactionAreaCount" TypePremiumFeatureIncreasedLimits = "premiumFeatureIncreasedLimits" TypePremiumFeatureIncreasedUploadFileSize = "premiumFeatureIncreasedUploadFileSize" TypePremiumFeatureImprovedDownloadSpeed = "premiumFeatureImprovedDownloadSpeed" @@ -1238,6 +1297,8 @@ const ( TypePremiumFeatureAppIcons = "premiumFeatureAppIcons" TypePremiumFeatureRealTimeChatTranslation = "premiumFeatureRealTimeChatTranslation" TypePremiumFeatureUpgradedStories = "premiumFeatureUpgradedStories" + TypePremiumFeatureChatBoost = "premiumFeatureChatBoost" + TypePremiumFeatureAccentColor = "premiumFeatureAccentColor" TypePremiumStoryFeaturePriorityOrder = "premiumStoryFeaturePriorityOrder" TypePremiumStoryFeatureStealthMode = "premiumStoryFeatureStealthMode" TypePremiumStoryFeaturePermanentViewsHistory = "premiumStoryFeaturePermanentViewsHistory" @@ -1255,6 +1316,10 @@ const ( TypePremiumState = "premiumState" TypeStorePaymentPurposePremiumSubscription = "storePaymentPurposePremiumSubscription" TypeStorePaymentPurposeGiftedPremium = "storePaymentPurposeGiftedPremium" + TypeStorePaymentPurposePremiumGiftCodes = "storePaymentPurposePremiumGiftCodes" + TypeStorePaymentPurposePremiumGiveaway = "storePaymentPurposePremiumGiveaway" + TypeTelegramPaymentPurposePremiumGiftCodes = "telegramPaymentPurposePremiumGiftCodes" + TypeTelegramPaymentPurposePremiumGiveaway = "telegramPaymentPurposePremiumGiveaway" TypeDeviceTokenFirebaseCloudMessaging = "deviceTokenFirebaseCloudMessaging" TypeDeviceTokenApplePush = "deviceTokenApplePush" TypeDeviceTokenApplePushVoIP = "deviceTokenApplePushVoIP" @@ -1282,6 +1347,7 @@ const ( TypeHashtags = "hashtags" TypeCanSendStoryResultOk = "canSendStoryResultOk" TypeCanSendStoryResultPremiumNeeded = "canSendStoryResultPremiumNeeded" + TypeCanSendStoryResultBoostNeeded = "canSendStoryResultBoostNeeded" TypeCanSendStoryResultActiveStoryLimitExceeded = "canSendStoryResultActiveStoryLimitExceeded" TypeCanSendStoryResultWeeklyLimitExceeded = "canSendStoryResultWeeklyLimitExceeded" TypeCanSendStoryResultMonthlyLimitExceeded = "canSendStoryResultMonthlyLimitExceeded" @@ -1316,6 +1382,8 @@ const ( TypePushMessageContentLocation = "pushMessageContentLocation" TypePushMessageContentPhoto = "pushMessageContentPhoto" TypePushMessageContentPoll = "pushMessageContentPoll" + TypePushMessageContentPremiumGiftCode = "pushMessageContentPremiumGiftCode" + TypePushMessageContentPremiumGiveaway = "pushMessageContentPremiumGiveaway" TypePushMessageContentScreenshotTaken = "pushMessageContentScreenshotTaken" TypePushMessageContentSticker = "pushMessageContentSticker" TypePushMessageContentStory = "pushMessageContentStory" @@ -1427,6 +1495,7 @@ const ( TypeInternalLinkTypeBotStart = "internalLinkTypeBotStart" TypeInternalLinkTypeBotStartInGroup = "internalLinkTypeBotStartInGroup" TypeInternalLinkTypeChangePhoneNumber = "internalLinkTypeChangePhoneNumber" + TypeInternalLinkTypeChatBoost = "internalLinkTypeChatBoost" TypeInternalLinkTypeChatFolderInvite = "internalLinkTypeChatFolderInvite" TypeInternalLinkTypeChatFolderSettings = "internalLinkTypeChatFolderSettings" TypeInternalLinkTypeChatInvite = "internalLinkTypeChatInvite" @@ -1442,6 +1511,7 @@ const ( TypeInternalLinkTypePassportDataRequest = "internalLinkTypePassportDataRequest" TypeInternalLinkTypePhoneNumberConfirmation = "internalLinkTypePhoneNumberConfirmation" TypeInternalLinkTypePremiumFeatures = "internalLinkTypePremiumFeatures" + TypeInternalLinkTypePremiumGiftCode = "internalLinkTypePremiumGiftCode" TypeInternalLinkTypePrivacyAndSecuritySettings = "internalLinkTypePrivacyAndSecuritySettings" TypeInternalLinkTypeProxy = "internalLinkTypeProxy" TypeInternalLinkTypePublicChat = "internalLinkTypePublicChat" @@ -1461,6 +1531,8 @@ const ( TypeInternalLinkTypeWebApp = "internalLinkTypeWebApp" TypeMessageLink = "messageLink" TypeMessageLinkInfo = "messageLinkInfo" + TypeChatBoostLink = "chatBoostLink" + TypeChatBoostLinkInfo = "chatBoostLinkInfo" TypeBlockListMain = "blockListMain" TypeBlockListStories = "blockListStories" TypeFilePart = "filePart" @@ -1517,6 +1589,7 @@ const ( TypeTopChatCategoryInlineBots = "topChatCategoryInlineBots" TypeTopChatCategoryCalls = "topChatCategoryCalls" TypeTopChatCategoryForwardChats = "topChatCategoryForwardChats" + TypeFoundPosition = "foundPosition" TypeFoundPositions = "foundPositions" TypeTMeUrlTypeUser = "tMeUrlTypeUser" TypeTMeUrlTypeSupergroup = "tMeUrlTypeSupergroup" @@ -1584,6 +1657,8 @@ const ( TypeUpdateNewChat = "updateNewChat" TypeUpdateChatTitle = "updateChatTitle" TypeUpdateChatPhoto = "updateChatPhoto" + TypeUpdateChatAccentColor = "updateChatAccentColor" + TypeUpdateChatBackgroundCustomEmoji = "updateChatBackgroundCustomEmoji" TypeUpdateChatPermissions = "updateChatPermissions" TypeUpdateChatLastMessage = "updateChatLastMessage" TypeUpdateChatPosition = "updateChatPosition" @@ -1658,6 +1733,7 @@ const ( TypeUpdateSavedNotificationSounds = "updateSavedNotificationSounds" TypeUpdateSelectedBackground = "updateSelectedBackground" TypeUpdateChatThemes = "updateChatThemes" + TypeUpdateAccentColors = "updateAccentColors" TypeUpdateLanguagePackStrings = "updateLanguagePackStrings" TypeUpdateConnectionState = "updateConnectionState" TypeUpdateTermsOfService = "updateTermsOfService" @@ -1685,6 +1761,7 @@ const ( TypeUpdatePollAnswer = "updatePollAnswer" TypeUpdateChatMember = "updateChatMember" TypeUpdateNewChatJoinRequest = "updateNewChatJoinRequest" + TypeUpdateChatBoost = "updateChatBoost" TypeUpdates = "updates" TypeLogStreamDefault = "logStreamDefault" TypeLogStreamFile = "logStreamFile" @@ -1771,6 +1848,16 @@ type InputChatPhoto interface { InputChatPhotoType() string } +// Contains information about status of a user in a Telegram Premium giveaway +type PremiumGiveawayParticipantStatus interface { + PremiumGiveawayParticipantStatusType() string +} + +// Contains information about Telegram Premium giveaway +type PremiumGiveawayInfo interface { + PremiumGiveawayInfoType() string +} + // Provides information about the status of a member in a chat type ChatMemberStatus interface { ChatMemberStatusType() string @@ -1801,9 +1888,9 @@ type MessageSender interface { MessageSenderType() string } -// Contains information about the origin of a forwarded message -type MessageForwardOrigin interface { - MessageForwardOriginType() string +// Contains information about the origin of a message +type MessageOrigin interface { + MessageOriginType() string } // Describes type of message reaction @@ -1821,6 +1908,11 @@ type MessageReplyTo interface { MessageReplyToType() string } +// Contains information about the message or the story to be replied +type InputMessageReplyTo interface { + InputMessageReplyToType() string +} + // Describes source of a message type MessageSource interface { MessageSourceType() string @@ -2021,6 +2113,11 @@ type StoryList interface { StoryListType() string } +// Describes source of a chat boost +type ChatBoostSource interface { + ChatBoostSourceType() string +} + // Describes the reason why a call was discarded type CallDiscardReason interface { CallDiscardReasonType() string @@ -2061,6 +2158,11 @@ type SpeechRecognitionResult interface { SpeechRecognitionResultType() string } +// Describes a reason why a bot was allowed to write messages to the current user +type BotWriteAccessAllowReason interface { + BotWriteAccessAllowReasonType() string +} + // Represents a single result of an inline query; for bots only type InputInlineQueryResult interface { InputInlineQueryResultType() string @@ -2116,6 +2218,11 @@ type StorePaymentPurpose interface { StorePaymentPurposeType() string } +// Describes a purpose of a payment toward Telegram +type TelegramPaymentPurpose interface { + TelegramPaymentPurposeType() string +} + // Represents a data needed to subscribe for push notifications through registerDevice method. To use specific push notification service, the correct application platform must be specified and a valid server authentication data must be uploaded at https://my.telegram.org type DeviceToken interface { DeviceTokenType() string @@ -2136,7 +2243,7 @@ type InputBackground interface { InputBackgroundType() string } -// Represents result of checking whether the current user can send a story +// Represents result of checking whether the current user can send a story in the specific chat type CanSendStoryResult interface { CanSendStoryResultType() string } @@ -2873,7 +2980,7 @@ type FormattedText struct { meta // The text Text string `json:"text"` - // Entities contained in the text. Entities can be nested, but must not mutually intersect with each other. Pre, Code and PreCode entities can't contain other entities. Bold, Italic, Underline, Strikethrough, and Spoiler entities can contain and can be part of any other entities. All other entities can't contain each other + // Entities contained in the text. Entities can be nested, but must not mutually intersect with each other. Pre, Code and PreCode entities can't contain other entities. BlockQuote entities can't contain other BlockQuote entities. Bold, Italic, Underline, Strikethrough, and Spoiler entities can contain and can be part of any other entities. All other entities can't contain each other Entities []*TextEntity `json:"entities"` } @@ -5724,15 +5831,15 @@ func (*InputChatPhotoSticker) InputChatPhotoType() string { // Describes actions that a user is allowed to take in a chat type ChatPermissions struct { meta - // True, if the user can send text messages, contacts, invoices, locations, and venues + // True, if the user can send text messages, contacts, giveaways, invoices, locations, and venues CanSendBasicMessages bool `json:"can_send_basic_messages"` // True, if the user can send music files CanSendAudios bool `json:"can_send_audios"` // True, if the user can send documents CanSendDocuments bool `json:"can_send_documents"` - // True, if the user can send audio photos + // True, if the user can send photos CanSendPhotos bool `json:"can_send_photos"` - // True, if the user can send audio videos + // True, if the user can send videos CanSendVideos bool `json:"can_send_videos"` // True, if the user can send video notes CanSendVideoNotes bool `json:"can_send_video_notes"` @@ -5779,11 +5886,11 @@ func (*ChatPermissions) GetType() string { // Describes rights of the administrator type ChatAdministratorRights struct { meta - // True, if the administrator can get chat event log, get chat statistics, get message statistics in channels, get channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other privilege; applicable to supergroups and channels only + // True, if the administrator can get chat event log, get chat boosts in channels, get channel members, report supergroup spam messages, see anonymous administrators in supergroups and ignore slow mode. Implied by any other privilege; applicable to supergroups and channels only CanManageChat bool `json:"can_manage_chat"` // True, if the administrator can change the chat title, photo, and other settings CanChangeInfo bool `json:"can_change_info"` - // True, if the administrator can create channel posts; applicable to channels only + // True, if the administrator can create channel posts or view channel statistics; applicable to channels only CanPostMessages bool `json:"can_post_messages"` // True, if the administrator can edit messages of other users and pin messages; applicable to channels only CanEditMessages bool `json:"can_edit_messages"` @@ -5791,7 +5898,7 @@ type ChatAdministratorRights struct { CanDeleteMessages bool `json:"can_delete_messages"` // True, if the administrator can invite new users to the chat CanInviteUsers bool `json:"can_invite_users"` - // True, if the administrator can restrict, ban, or unban chat members; always true for channels + // True, if the administrator can restrict, ban, or unban chat members or view supergroup statistics; always true for channels CanRestrictMembers bool `json:"can_restrict_members"` // True, if the administrator can pin messages; applicable to basic groups and supergroups only CanPinMessages bool `json:"can_pin_messages"` @@ -5801,6 +5908,12 @@ type ChatAdministratorRights struct { CanPromoteMembers bool `json:"can_promote_members"` // True, if the administrator can manage video chats CanManageVideoChats bool `json:"can_manage_video_chats"` + // True, if the administrator can create new channel stories, or edit and delete posted stories; applicable to channels only + CanPostStories bool `json:"can_post_stories"` + // True, if the administrator can edit stories posted by other users, pin stories and access story archive; applicable to channels only + CanEditStories bool `json:"can_edit_stories"` + // True, if the administrator can delete stories posted by other users; applicable to channels only + CanDeleteStories bool `json:"can_delete_stories"` // True, if the administrator isn't shown in the chat member list and sends messages anonymously; applicable to supergroups only IsAnonymous bool `json:"is_anonymous"` } @@ -5910,6 +6023,375 @@ func (*PremiumStatePaymentOption) GetType() string { return TypePremiumStatePaymentOption } +// Describes an option for creating Telegram Premium gift codes +type PremiumGiftCodePaymentOption struct { + meta + // ISO 4217 currency code for Telegram Premium gift code payment + Currency string `json:"currency"` + // The amount to pay, in the smallest units of the currency + Amount int64 `json:"amount"` + // Number of users which will be able to activate the gift codes + UserCount int32 `json:"user_count"` + // Number of month the Telegram Premium subscription will be active + MonthCount int32 `json:"month_count"` + // Identifier of the store product associated with the option; may be empty if none + StoreProductId string `json:"store_product_id"` + // Number of times the store product must be paid + StoreProductQuantity int32 `json:"store_product_quantity"` +} + +func (entity *PremiumGiftCodePaymentOption) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumGiftCodePaymentOption + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumGiftCodePaymentOption) GetClass() string { + return ClassPremiumGiftCodePaymentOption +} + +func (*PremiumGiftCodePaymentOption) GetType() string { + return TypePremiumGiftCodePaymentOption +} + +// Contains a list of options for creating Telegram Premium gift codes +type PremiumGiftCodePaymentOptions struct { + meta + // The list of options + Options []*PremiumGiftCodePaymentOption `json:"options"` +} + +func (entity *PremiumGiftCodePaymentOptions) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumGiftCodePaymentOptions + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumGiftCodePaymentOptions) GetClass() string { + return ClassPremiumGiftCodePaymentOptions +} + +func (*PremiumGiftCodePaymentOptions) GetType() string { + return TypePremiumGiftCodePaymentOptions +} + +// Contains information about a Telegram Premium gift code +type PremiumGiftCodeInfo struct { + meta + // Identifier of a chat or a user that created the gift code + CreatorId MessageSender `json:"creator_id"` + // Point in time (Unix timestamp) when the code was created + CreationDate int32 `json:"creation_date"` + // True, if the gift code was created for a giveaway + IsFromGiveaway bool `json:"is_from_giveaway"` + // Identifier of the corresponding giveaway message; can be 0 or an identifier of a deleted message + GiveawayMessageId int64 `json:"giveaway_message_id"` + // Number of month the Telegram Premium subscription will be active after code activation + MonthCount int32 `json:"month_count"` + // Identifier of a user for which the code was created; 0 if none + UserId int64 `json:"user_id"` + // Point in time (Unix timestamp) when the code was activated; 0 if none + UseDate int32 `json:"use_date"` +} + +func (entity *PremiumGiftCodeInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumGiftCodeInfo + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumGiftCodeInfo) GetClass() string { + return ClassPremiumGiftCodeInfo +} + +func (*PremiumGiftCodeInfo) GetType() string { + return TypePremiumGiftCodeInfo +} + +func (premiumGiftCodeInfo *PremiumGiftCodeInfo) UnmarshalJSON(data []byte) error { + var tmp struct { + CreatorId json.RawMessage `json:"creator_id"` + CreationDate int32 `json:"creation_date"` + IsFromGiveaway bool `json:"is_from_giveaway"` + GiveawayMessageId int64 `json:"giveaway_message_id"` + MonthCount int32 `json:"month_count"` + UserId int64 `json:"user_id"` + UseDate int32 `json:"use_date"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + premiumGiftCodeInfo.CreationDate = tmp.CreationDate + premiumGiftCodeInfo.IsFromGiveaway = tmp.IsFromGiveaway + premiumGiftCodeInfo.GiveawayMessageId = tmp.GiveawayMessageId + premiumGiftCodeInfo.MonthCount = tmp.MonthCount + premiumGiftCodeInfo.UserId = tmp.UserId + premiumGiftCodeInfo.UseDate = tmp.UseDate + + fieldCreatorId, _ := UnmarshalMessageSender(tmp.CreatorId) + premiumGiftCodeInfo.CreatorId = fieldCreatorId + + return nil +} + +// The user is eligible for the giveaway +type PremiumGiveawayParticipantStatusEligible struct{ + meta +} + +func (entity *PremiumGiveawayParticipantStatusEligible) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumGiveawayParticipantStatusEligible + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumGiveawayParticipantStatusEligible) GetClass() string { + return ClassPremiumGiveawayParticipantStatus +} + +func (*PremiumGiveawayParticipantStatusEligible) GetType() string { + return TypePremiumGiveawayParticipantStatusEligible +} + +func (*PremiumGiveawayParticipantStatusEligible) PremiumGiveawayParticipantStatusType() string { + return TypePremiumGiveawayParticipantStatusEligible +} + +// The user participates in the giveaway +type PremiumGiveawayParticipantStatusParticipating struct{ + meta +} + +func (entity *PremiumGiveawayParticipantStatusParticipating) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumGiveawayParticipantStatusParticipating + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumGiveawayParticipantStatusParticipating) GetClass() string { + return ClassPremiumGiveawayParticipantStatus +} + +func (*PremiumGiveawayParticipantStatusParticipating) GetType() string { + return TypePremiumGiveawayParticipantStatusParticipating +} + +func (*PremiumGiveawayParticipantStatusParticipating) PremiumGiveawayParticipantStatusType() string { + return TypePremiumGiveawayParticipantStatusParticipating +} + +// The user can't participate in the giveaway, because they have already been member of the chat +type PremiumGiveawayParticipantStatusAlreadyWasMember struct { + meta + // Point in time (Unix timestamp) when the user joined the chat + JoinedChatDate int32 `json:"joined_chat_date"` +} + +func (entity *PremiumGiveawayParticipantStatusAlreadyWasMember) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumGiveawayParticipantStatusAlreadyWasMember + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumGiveawayParticipantStatusAlreadyWasMember) GetClass() string { + return ClassPremiumGiveawayParticipantStatus +} + +func (*PremiumGiveawayParticipantStatusAlreadyWasMember) GetType() string { + return TypePremiumGiveawayParticipantStatusAlreadyWasMember +} + +func (*PremiumGiveawayParticipantStatusAlreadyWasMember) PremiumGiveawayParticipantStatusType() string { + return TypePremiumGiveawayParticipantStatusAlreadyWasMember +} + +// The user can't participate in the giveaway, because they are an administrator in one of the chats that created the giveaway +type PremiumGiveawayParticipantStatusAdministrator struct { + meta + // Identifier of the chat administered by the user + ChatId int64 `json:"chat_id"` +} + +func (entity *PremiumGiveawayParticipantStatusAdministrator) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumGiveawayParticipantStatusAdministrator + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumGiveawayParticipantStatusAdministrator) GetClass() string { + return ClassPremiumGiveawayParticipantStatus +} + +func (*PremiumGiveawayParticipantStatusAdministrator) GetType() string { + return TypePremiumGiveawayParticipantStatusAdministrator +} + +func (*PremiumGiveawayParticipantStatusAdministrator) PremiumGiveawayParticipantStatusType() string { + return TypePremiumGiveawayParticipantStatusAdministrator +} + +// The user can't participate in the giveaway, because they phone number is from a disallowed country +type PremiumGiveawayParticipantStatusDisallowedCountry struct { + meta + // A two-letter ISO 3166-1 alpha-2 country code of the user's country + UserCountryCode string `json:"user_country_code"` +} + +func (entity *PremiumGiveawayParticipantStatusDisallowedCountry) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumGiveawayParticipantStatusDisallowedCountry + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumGiveawayParticipantStatusDisallowedCountry) GetClass() string { + return ClassPremiumGiveawayParticipantStatus +} + +func (*PremiumGiveawayParticipantStatusDisallowedCountry) GetType() string { + return TypePremiumGiveawayParticipantStatusDisallowedCountry +} + +func (*PremiumGiveawayParticipantStatusDisallowedCountry) PremiumGiveawayParticipantStatusType() string { + return TypePremiumGiveawayParticipantStatusDisallowedCountry +} + +// Describes an ongoing giveaway +type PremiumGiveawayInfoOngoing struct { + meta + // Point in time (Unix timestamp) when the giveaway was created + CreationDate int32 `json:"creation_date"` + // Status of the current user in the giveaway + Status PremiumGiveawayParticipantStatus `json:"status"` + // True, if the giveaway has ended and results are being prepared + IsEnded bool `json:"is_ended"` +} + +func (entity *PremiumGiveawayInfoOngoing) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumGiveawayInfoOngoing + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumGiveawayInfoOngoing) GetClass() string { + return ClassPremiumGiveawayInfo +} + +func (*PremiumGiveawayInfoOngoing) GetType() string { + return TypePremiumGiveawayInfoOngoing +} + +func (*PremiumGiveawayInfoOngoing) PremiumGiveawayInfoType() string { + return TypePremiumGiveawayInfoOngoing +} + +func (premiumGiveawayInfoOngoing *PremiumGiveawayInfoOngoing) UnmarshalJSON(data []byte) error { + var tmp struct { + CreationDate int32 `json:"creation_date"` + Status json.RawMessage `json:"status"` + IsEnded bool `json:"is_ended"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + premiumGiveawayInfoOngoing.CreationDate = tmp.CreationDate + premiumGiveawayInfoOngoing.IsEnded = tmp.IsEnded + + fieldStatus, _ := UnmarshalPremiumGiveawayParticipantStatus(tmp.Status) + premiumGiveawayInfoOngoing.Status = fieldStatus + + return nil +} + +// Describes a completed giveaway +type PremiumGiveawayInfoCompleted struct { + meta + // Point in time (Unix timestamp) when the giveaway was created + CreationDate int32 `json:"creation_date"` + // Point in time (Unix timestamp) when the winners were selected. May be bigger than winners selection date specified in parameters of the giveaway + ActualWinnersSelectionDate int32 `json:"actual_winners_selection_date"` + // True, if the giveaway was canceled and was fully refunded + WasRefunded bool `json:"was_refunded"` + // Number of winners in the giveaway + WinnerCount int32 `json:"winner_count"` + // Number of winners, which activated their gift codes + ActivationCount int32 `json:"activation_count"` + // Telegram Premium gift code that was received by the current user; empty if the user isn't a winner in the giveaway + GiftCode string `json:"gift_code"` +} + +func (entity *PremiumGiveawayInfoCompleted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumGiveawayInfoCompleted + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumGiveawayInfoCompleted) GetClass() string { + return ClassPremiumGiveawayInfo +} + +func (*PremiumGiveawayInfoCompleted) GetType() string { + return TypePremiumGiveawayInfoCompleted +} + +func (*PremiumGiveawayInfoCompleted) PremiumGiveawayInfoType() string { + return TypePremiumGiveawayInfoCompleted +} + +// Contains information about supported accent color for user/chat name, background of empty chat photo, replies to messages and link previews +type AccentColor struct { + meta + // Accent color identifier + Id int32 `json:"id"` + // Identifier of a built-in color to use in places, where only one color is needed; 0-6 + BuiltInAccentColorId int32 `json:"built_in_accent_color_id"` + // The list of 1-3 colors in RGB format, describing the accent color, as expected to be shown in light themes + LightThemeColors []int32 `json:"light_theme_colors"` + // The list of 1-3 colors in RGB format, describing the accent color, as expected to be shown in dark themes + DarkThemeColors []int32 `json:"dark_theme_colors"` +} + +func (entity *AccentColor) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AccentColor + + return json.Marshal((*stub)(entity)) +} + +func (*AccentColor) GetClass() string { + return ClassAccentColor +} + +func (*AccentColor) GetType() string { + return TypeAccentColor +} + // Describes a custom emoji to be shown instead of the Telegram Premium badge type EmojiStatus struct { meta @@ -6004,6 +6486,10 @@ type User struct { Status UserStatus `json:"status"` // Profile photo of the user; may be null ProfilePhoto *ProfilePhoto `json:"profile_photo"` + // Identifier of the accent color for name, and backgrounds of profile photo, reply header, and link preview + AccentColorId int32 `json:"accent_color_id"` + // Identifier of a custom emoji to be shown on the reply header background; 0 if none. For Telegram Premium users only + BackgroundCustomEmojiId JsonInt64 `json:"background_custom_emoji_id"` // Emoji status to be shown instead of the default Telegram Premium badge; may be null. For Telegram Premium users only EmojiStatus *EmojiStatus `json:"emoji_status"` // The user is a contact of the current user @@ -6064,6 +6550,8 @@ func (user *User) UnmarshalJSON(data []byte) error { PhoneNumber string `json:"phone_number"` Status json.RawMessage `json:"status"` ProfilePhoto *ProfilePhoto `json:"profile_photo"` + AccentColorId int32 `json:"accent_color_id"` + BackgroundCustomEmojiId JsonInt64 `json:"background_custom_emoji_id"` EmojiStatus *EmojiStatus `json:"emoji_status"` IsContact bool `json:"is_contact"` IsMutualContact bool `json:"is_mutual_contact"` @@ -6094,6 +6582,8 @@ func (user *User) UnmarshalJSON(data []byte) error { user.Usernames = tmp.Usernames user.PhoneNumber = tmp.PhoneNumber user.ProfilePhoto = tmp.ProfilePhoto + user.AccentColorId = tmp.AccentColorId + user.BackgroundCustomEmojiId = tmp.BackgroundCustomEmojiId user.EmojiStatus = tmp.EmojiStatus user.IsContact = tmp.IsContact user.IsMutualContact = tmp.IsMutualContact @@ -7280,6 +7770,8 @@ type ChatInviteLinkInfo struct { Title string `json:"title"` // Chat photo; may be null Photo *ChatPhotoInfo `json:"photo"` + // Identifier of the accent color for chat title and background of chat photo + AccentColorId int32 `json:"accent_color_id"` // Chat description Description string `json:"description"` // Number of members in the chat @@ -7321,6 +7813,7 @@ func (chatInviteLinkInfo *ChatInviteLinkInfo) UnmarshalJSON(data []byte) error { Type json.RawMessage `json:"type"` Title string `json:"title"` Photo *ChatPhotoInfo `json:"photo"` + AccentColorId int32 `json:"accent_color_id"` Description string `json:"description"` MemberCount int32 `json:"member_count"` MemberUserIds []int64 `json:"member_user_ids"` @@ -7340,6 +7833,7 @@ func (chatInviteLinkInfo *ChatInviteLinkInfo) UnmarshalJSON(data []byte) error { chatInviteLinkInfo.AccessibleFor = tmp.AccessibleFor chatInviteLinkInfo.Title = tmp.Title chatInviteLinkInfo.Photo = tmp.Photo + chatInviteLinkInfo.AccentColorId = tmp.AccentColorId chatInviteLinkInfo.Description = tmp.Description chatInviteLinkInfo.MemberCount = tmp.MemberCount chatInviteLinkInfo.MemberUserIds = tmp.MemberUserIds @@ -7570,6 +8064,10 @@ type Supergroup struct { IsScam bool `json:"is_scam"` // True, if many users reported this supergroup or channel as a fake account IsFake bool `json:"is_fake"` + // True, if the channel has non-expired stories available to the current user + HasActiveStories bool `json:"has_active_stories"` + // True, if the channel has unread non-expired stories available to the current user + HasUnreadActiveStories bool `json:"has_unread_active_stories"` } func (entity *Supergroup) MarshalJSON() ([]byte, error) { @@ -7609,6 +8107,8 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { RestrictionReason string `json:"restriction_reason"` IsScam bool `json:"is_scam"` IsFake bool `json:"is_fake"` + HasActiveStories bool `json:"has_active_stories"` + HasUnreadActiveStories bool `json:"has_unread_active_stories"` } err := json.Unmarshal(data, &tmp) @@ -7634,6 +8134,8 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { supergroup.RestrictionReason = tmp.RestrictionReason supergroup.IsScam = tmp.IsScam supergroup.IsFake = tmp.IsFake + supergroup.HasActiveStories = tmp.HasActiveStories + supergroup.HasUnreadActiveStories = tmp.HasUnreadActiveStories fieldStatus, _ := UnmarshalChatMemberStatus(tmp.Status) supergroup.Status = fieldStatus @@ -7680,6 +8182,8 @@ type SupergroupFullInfo struct { IsAllHistoryAvailable bool `json:"is_all_history_available"` // True, if aggressive anti-spam checks are enabled in the supergroup. The value of this field is only available to chat administrators HasAggressiveAntiSpamEnabled bool `json:"has_aggressive_anti_spam_enabled"` + // True, if the channel has pinned stories + HasPinnedStories bool `json:"has_pinned_stories"` // Identifier of the supergroup sticker set; 0 if none StickerSetId JsonInt64 `json:"sticker_set_id"` // Location to which the supergroup is connected; may be null if none @@ -8059,34 +8563,61 @@ func (*MessageViewers) GetType() string { } // The message was originally sent by a known user -type MessageForwardOriginUser struct { +type MessageOriginUser struct { meta // Identifier of the user that originally sent the message SenderUserId int64 `json:"sender_user_id"` } -func (entity *MessageForwardOriginUser) MarshalJSON() ([]byte, error) { +func (entity *MessageOriginUser) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub MessageForwardOriginUser + type stub MessageOriginUser return json.Marshal((*stub)(entity)) } -func (*MessageForwardOriginUser) GetClass() string { - return ClassMessageForwardOrigin +func (*MessageOriginUser) GetClass() string { + return ClassMessageOrigin } -func (*MessageForwardOriginUser) GetType() string { - return TypeMessageForwardOriginUser +func (*MessageOriginUser) GetType() string { + return TypeMessageOriginUser } -func (*MessageForwardOriginUser) MessageForwardOriginType() string { - return TypeMessageForwardOriginUser +func (*MessageOriginUser) MessageOriginType() string { + return TypeMessageOriginUser +} + +// The message was originally sent by a user, which is hidden by their privacy settings +type MessageOriginHiddenUser struct { + meta + // Name of the sender + SenderName string `json:"sender_name"` +} + +func (entity *MessageOriginHiddenUser) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageOriginHiddenUser + + return json.Marshal((*stub)(entity)) +} + +func (*MessageOriginHiddenUser) GetClass() string { + return ClassMessageOrigin +} + +func (*MessageOriginHiddenUser) GetType() string { + return TypeMessageOriginHiddenUser +} + +func (*MessageOriginHiddenUser) MessageOriginType() string { + return TypeMessageOriginHiddenUser } // The message was originally sent on behalf of a chat -type MessageForwardOriginChat struct { +type MessageOriginChat struct { meta // Identifier of the chat that originally sent the message SenderChatId int64 `json:"sender_chat_id"` @@ -8094,57 +8625,30 @@ type MessageForwardOriginChat struct { AuthorSignature string `json:"author_signature"` } -func (entity *MessageForwardOriginChat) MarshalJSON() ([]byte, error) { +func (entity *MessageOriginChat) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub MessageForwardOriginChat + type stub MessageOriginChat return json.Marshal((*stub)(entity)) } -func (*MessageForwardOriginChat) GetClass() string { - return ClassMessageForwardOrigin +func (*MessageOriginChat) GetClass() string { + return ClassMessageOrigin } -func (*MessageForwardOriginChat) GetType() string { - return TypeMessageForwardOriginChat +func (*MessageOriginChat) GetType() string { + return TypeMessageOriginChat } -func (*MessageForwardOriginChat) MessageForwardOriginType() string { - return TypeMessageForwardOriginChat -} - -// The message was originally sent by a user, which is hidden by their privacy settings -type MessageForwardOriginHiddenUser struct { - meta - // Name of the sender - SenderName string `json:"sender_name"` -} - -func (entity *MessageForwardOriginHiddenUser) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageForwardOriginHiddenUser - - return json.Marshal((*stub)(entity)) -} - -func (*MessageForwardOriginHiddenUser) GetClass() string { - return ClassMessageForwardOrigin -} - -func (*MessageForwardOriginHiddenUser) GetType() string { - return TypeMessageForwardOriginHiddenUser -} - -func (*MessageForwardOriginHiddenUser) MessageForwardOriginType() string { - return TypeMessageForwardOriginHiddenUser +func (*MessageOriginChat) MessageOriginType() string { + return TypeMessageOriginChat } // The message was originally a post in a channel -type MessageForwardOriginChannel struct { +type MessageOriginChannel struct { meta - // Identifier of the chat from which the message was originally forwarded + // Identifier of the channel chat to which the message was originally sent ChatId int64 `json:"chat_id"` // Message identifier of the original message MessageId int64 `json:"message_id"` @@ -8152,51 +8656,24 @@ type MessageForwardOriginChannel struct { AuthorSignature string `json:"author_signature"` } -func (entity *MessageForwardOriginChannel) MarshalJSON() ([]byte, error) { +func (entity *MessageOriginChannel) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub MessageForwardOriginChannel + type stub MessageOriginChannel return json.Marshal((*stub)(entity)) } -func (*MessageForwardOriginChannel) GetClass() string { - return ClassMessageForwardOrigin +func (*MessageOriginChannel) GetClass() string { + return ClassMessageOrigin } -func (*MessageForwardOriginChannel) GetType() string { - return TypeMessageForwardOriginChannel +func (*MessageOriginChannel) GetType() string { + return TypeMessageOriginChannel } -func (*MessageForwardOriginChannel) MessageForwardOriginType() string { - return TypeMessageForwardOriginChannel -} - -// The message was imported from an exported message history -type MessageForwardOriginMessageImport struct { - meta - // Name of the sender - SenderName string `json:"sender_name"` -} - -func (entity *MessageForwardOriginMessageImport) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageForwardOriginMessageImport - - return json.Marshal((*stub)(entity)) -} - -func (*MessageForwardOriginMessageImport) GetClass() string { - return ClassMessageForwardOrigin -} - -func (*MessageForwardOriginMessageImport) GetType() string { - return TypeMessageForwardOriginMessageImport -} - -func (*MessageForwardOriginMessageImport) MessageForwardOriginType() string { - return TypeMessageForwardOriginMessageImport +func (*MessageOriginChannel) MessageOriginType() string { + return TypeMessageOriginChannel } // A reaction with an emoji @@ -8256,8 +8733,8 @@ func (*ReactionTypeCustomEmoji) ReactionTypeType() string { // Contains information about a forwarded message type MessageForwardInfo struct { meta - // Origin of a forwarded message - Origin MessageForwardOrigin `json:"origin"` + // Origin of the forwarded message + Origin MessageOrigin `json:"origin"` // Point in time (Unix timestamp) when the message was originally sent Date int32 `json:"date"` // The type of a public service announcement for the forwarded message @@ -8303,12 +8780,37 @@ func (messageForwardInfo *MessageForwardInfo) UnmarshalJSON(data []byte) error { messageForwardInfo.FromChatId = tmp.FromChatId messageForwardInfo.FromMessageId = tmp.FromMessageId - fieldOrigin, _ := UnmarshalMessageForwardOrigin(tmp.Origin) + fieldOrigin, _ := UnmarshalMessageOrigin(tmp.Origin) messageForwardInfo.Origin = fieldOrigin return nil } +// Contains information about a message created with importMessages +type MessageImportInfo struct { + meta + // Name of the original sender + SenderName string `json:"sender_name"` + // Point in time (Unix timestamp) when the message was originally sent + Date int32 `json:"date"` +} + +func (entity *MessageImportInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageImportInfo + + return json.Marshal((*stub)(entity)) +} + +func (*MessageImportInfo) GetClass() string { + return ClassMessageImportInfo +} + +func (*MessageImportInfo) GetType() string { + return TypeMessageImportInfo +} + // Contains information about replies to a message type MessageReplyInfo struct { meta @@ -8374,6 +8876,8 @@ type MessageReaction struct { TotalCount int32 `json:"total_count"` // True, if the reaction is chosen by the current user IsChosen bool `json:"is_chosen"` + // Identifier of the message sender used by the current user to add the reaction; null if unknown or the reaction isn't chosen + UsedSenderId MessageSender `json:"used_sender_id"` // Identifiers of at most 3 recent message senders, added the reaction; available in private, basic group and supergroup chats RecentSenderIds []MessageSender `json:"recent_sender_ids"` } @@ -8399,6 +8903,7 @@ func (messageReaction *MessageReaction) UnmarshalJSON(data []byte) error { Type json.RawMessage `json:"type"` TotalCount int32 `json:"total_count"` IsChosen bool `json:"is_chosen"` + UsedSenderId json.RawMessage `json:"used_sender_id"` RecentSenderIds []json.RawMessage `json:"recent_sender_ids"` } @@ -8413,6 +8918,9 @@ func (messageReaction *MessageReaction) UnmarshalJSON(data []byte) error { fieldType, _ := UnmarshalReactionType(tmp.Type) messageReaction.Type = fieldType + fieldUsedSenderId, _ := UnmarshalMessageSender(tmp.UsedSenderId) + messageReaction.UsedSenderId = fieldUsedSenderId + fieldRecentSenderIds, _ := UnmarshalListOfMessageSender(tmp.RecentSenderIds) messageReaction.RecentSenderIds = fieldRecentSenderIds @@ -8528,14 +9036,16 @@ func (*MessageSendingStatePending) MessageSendingStateType() string { // The message failed to be sent type MessageSendingStateFailed struct { meta - // An error code; 0 if unknown - ErrorCode int32 `json:"error_code"` - // Error message - ErrorMessage string `json:"error_message"` + // The cause of the message sending failure + Error *Error `json:"error"` // True, if the message can be re-sent CanRetry bool `json:"can_retry"` // True, if the message can be re-sent only on behalf of a different sender NeedAnotherSender bool `json:"need_another_sender"` + // True, if the message can be re-sent only if another quote is chosen in the message that is replied by the given message + NeedAnotherReplyQuote bool `json:"need_another_reply_quote"` + // True, if the message can be re-sent only if the message to be replied is removed. This will be done automatically by resendMessages + NeedDropReply bool `json:"need_drop_reply"` // Time left before the message can be re-sent, in seconds. No update is sent when this field changes RetryAfter float64 `json:"retry_after"` } @@ -8560,13 +9070,23 @@ func (*MessageSendingStateFailed) MessageSendingStateType() string { return TypeMessageSendingStateFailed } -// Describes a replied message +// Describes a message replied by a given message type MessageReplyToMessage struct { meta - // The identifier of the chat to which the replied message belongs; ignored for outgoing replies. For example, messages in the Replies chat are replies to messages in different chats + // The identifier of the chat to which the message belongs; may be 0 if the replied message is in unknown chat ChatId int64 `json:"chat_id"` - // The identifier of the replied message + // The identifier of the message; may be 0 if the replied message is in unknown chat MessageId int64 `json:"message_id"` + // Manually or automatically chosen quote from the replied message; may be null if none. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities can be present in the quote + Quote *FormattedText `json:"quote"` + // True, if the quote was manually chosen by the message sender + IsQuoteManual bool `json:"is_quote_manual"` + // Information about origin of the message if the message was replied from another chat; may be null for messages from the same chat + Origin MessageOrigin `json:"origin"` + // Point in time (Unix timestamp) when the message was sent if the message was replied from another chat; 0 for messages from the same chat + OriginSendDate int32 `json:"origin_send_date"` + // Media content of the message if the message was replied from another chat; may be null for messages from the same chat and messages without media. Can be only one of the following types: messageAnimation, messageAudio, messageContact, messageDice, messageDocument, messageGame, messageInvoice, messageLocation, messagePhoto, messagePoll, messagePremiumGiveaway, messageSticker, messageStory, messageText (for link preview), messageVenue, messageVideo, messageVideoNote, or messageVoiceNote + Content MessageContent `json:"content"` } func (entity *MessageReplyToMessage) MarshalJSON() ([]byte, error) { @@ -8589,12 +9109,43 @@ func (*MessageReplyToMessage) MessageReplyToType() string { return TypeMessageReplyToMessage } -// Describes a replied story +func (messageReplyToMessage *MessageReplyToMessage) UnmarshalJSON(data []byte) error { + var tmp struct { + ChatId int64 `json:"chat_id"` + MessageId int64 `json:"message_id"` + Quote *FormattedText `json:"quote"` + IsQuoteManual bool `json:"is_quote_manual"` + Origin json.RawMessage `json:"origin"` + OriginSendDate int32 `json:"origin_send_date"` + Content json.RawMessage `json:"content"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageReplyToMessage.ChatId = tmp.ChatId + messageReplyToMessage.MessageId = tmp.MessageId + messageReplyToMessage.Quote = tmp.Quote + messageReplyToMessage.IsQuoteManual = tmp.IsQuoteManual + messageReplyToMessage.OriginSendDate = tmp.OriginSendDate + + fieldOrigin, _ := UnmarshalMessageOrigin(tmp.Origin) + messageReplyToMessage.Origin = fieldOrigin + + fieldContent, _ := UnmarshalMessageContent(tmp.Content) + messageReplyToMessage.Content = fieldContent + + return nil +} + +// Describes a story replied by a given message type MessageReplyToStory struct { meta - // The identifier of the sender of the replied story. Currently, stories can be replied only in the sender's chat + // The identifier of the sender of the story StorySenderChatId int64 `json:"story_sender_chat_id"` - // The identifier of the replied story + // The identifier of the story StoryId int32 `json:"story_id"` } @@ -8618,6 +9169,66 @@ func (*MessageReplyToStory) MessageReplyToType() string { return TypeMessageReplyToStory } +// Describes a message to be replied +type InputMessageReplyToMessage struct { + meta + // The identifier of the chat to which the message to be replied belongs; pass 0 if the message to be replied is in the same chat. Must always be 0 for replies in secret chats. A message can be replied in another chat only if message.can_be_replied_in_another_chat + ChatId int64 `json:"chat_id"` + // The identifier of the message to be replied in the same or the specified chat + MessageId int64 `json:"message_id"` + // Manually chosen quote from the message to be replied; pass null if none; 0-getOption("message_reply_quote_length_max") characters. Must always be null for replies in secret chats. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed to be kept and must be kept in the quote + Quote *FormattedText `json:"quote"` +} + +func (entity *InputMessageReplyToMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputMessageReplyToMessage + + return json.Marshal((*stub)(entity)) +} + +func (*InputMessageReplyToMessage) GetClass() string { + return ClassInputMessageReplyTo +} + +func (*InputMessageReplyToMessage) GetType() string { + return TypeInputMessageReplyToMessage +} + +func (*InputMessageReplyToMessage) InputMessageReplyToType() string { + return TypeInputMessageReplyToMessage +} + +// Describes a story to be replied +type InputMessageReplyToStory struct { + meta + // The identifier of the sender of the story. Currently, stories can be replied only in the sender's chat + StorySenderChatId int64 `json:"story_sender_chat_id"` + // The identifier of the story + StoryId int32 `json:"story_id"` +} + +func (entity *InputMessageReplyToStory) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputMessageReplyToStory + + return json.Marshal((*stub)(entity)) +} + +func (*InputMessageReplyToStory) GetClass() string { + return ClassInputMessageReplyTo +} + +func (*InputMessageReplyToStory) GetType() string { + return TypeInputMessageReplyToStory +} + +func (*InputMessageReplyToStory) InputMessageReplyToType() string { + return TypeInputMessageReplyToStory +} + // Describes a message type Message struct { meta @@ -8639,6 +9250,8 @@ type Message struct { CanBeEdited bool `json:"can_be_edited"` // True, if the message can be forwarded CanBeForwarded bool `json:"can_be_forwarded"` + // True, if the message can be replied in another chat + CanBeRepliedInAnotherChat bool `json:"can_be_replied_in_another_chat"` // True, if content of the message can be saved locally or copied CanBeSaved bool `json:"can_be_saved"` // True, if the message can be deleted only for the current user while other users will continue to see it @@ -8671,6 +9284,8 @@ type Message struct { EditDate int32 `json:"edit_date"` // Information about the initial message sender; may be null if none or unknown ForwardInfo *MessageForwardInfo `json:"forward_info"` + // Information about the initial message for messages created with importMessages; may be null if the message isn't imported + ImportInfo *MessageImportInfo `json:"import_info"` // Information about interactions with the message; may be null if none InteractionInfo *MessageInteractionInfo `json:"interaction_info"` // Information about unread reactions added to the message @@ -8681,7 +9296,7 @@ type Message struct { MessageThreadId int64 `json:"message_thread_id"` // The message's self-destruct type; may be null if none SelfDestructType MessageSelfDestructType `json:"self_destruct_type"` - // Time left before the message self-destruct timer expires, in seconds; 0 if self-desctruction isn't scheduled yet + // Time left before the message self-destruct timer expires, in seconds; 0 if self-destruction isn't scheduled yet SelfDestructIn float64 `json:"self_destruct_in"` // Time left before the message will be automatically deleted by message_auto_delete_time setting of the chat, in seconds; 0 if never AutoDeleteIn float64 `json:"auto_delete_in"` @@ -8726,6 +9341,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { IsPinned bool `json:"is_pinned"` CanBeEdited bool `json:"can_be_edited"` CanBeForwarded bool `json:"can_be_forwarded"` + CanBeRepliedInAnotherChat bool `json:"can_be_replied_in_another_chat"` CanBeSaved bool `json:"can_be_saved"` CanBeDeletedOnlyForSelf bool `json:"can_be_deleted_only_for_self"` CanBeDeletedForAllUsers bool `json:"can_be_deleted_for_all_users"` @@ -8742,6 +9358,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { Date int32 `json:"date"` EditDate int32 `json:"edit_date"` ForwardInfo *MessageForwardInfo `json:"forward_info"` + ImportInfo *MessageImportInfo `json:"import_info"` InteractionInfo *MessageInteractionInfo `json:"interaction_info"` UnreadReactions []*UnreadReaction `json:"unread_reactions"` ReplyTo json.RawMessage `json:"reply_to"` @@ -8768,6 +9385,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { message.IsPinned = tmp.IsPinned message.CanBeEdited = tmp.CanBeEdited message.CanBeForwarded = tmp.CanBeForwarded + message.CanBeRepliedInAnotherChat = tmp.CanBeRepliedInAnotherChat message.CanBeSaved = tmp.CanBeSaved message.CanBeDeletedOnlyForSelf = tmp.CanBeDeletedOnlyForSelf message.CanBeDeletedForAllUsers = tmp.CanBeDeletedForAllUsers @@ -8784,6 +9402,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { message.Date = tmp.Date message.EditDate = tmp.EditDate message.ForwardInfo = tmp.ForwardInfo + message.ImportInfo = tmp.ImportInfo message.InteractionInfo = tmp.InteractionInfo message.UnreadReactions = tmp.UnreadReactions message.MessageThreadId = tmp.MessageThreadId @@ -9787,8 +10406,8 @@ func (*ScopeNotificationSettings) GetType() string { // Contains information about a message draft type DraftMessage struct { meta - // Identifier of the replied message; 0 if none - ReplyToMessageId int64 `json:"reply_to_message_id"` + // Information about the message to be replied; must be of the type inputMessageReplyToMessage; may be null if none + ReplyTo InputMessageReplyTo `json:"reply_to"` // Point in time (Unix timestamp) when the draft was created Date int32 `json:"date"` // Content of the message draft; must be of the type inputMessageText @@ -9813,7 +10432,7 @@ func (*DraftMessage) GetType() string { func (draftMessage *DraftMessage) UnmarshalJSON(data []byte) error { var tmp struct { - ReplyToMessageId int64 `json:"reply_to_message_id"` + ReplyTo json.RawMessage `json:"reply_to"` Date int32 `json:"date"` InputMessageText json.RawMessage `json:"input_message_text"` } @@ -9823,9 +10442,11 @@ func (draftMessage *DraftMessage) UnmarshalJSON(data []byte) error { return err } - draftMessage.ReplyToMessageId = tmp.ReplyToMessageId draftMessage.Date = tmp.Date + fieldReplyTo, _ := UnmarshalInputMessageReplyTo(tmp.ReplyTo) + draftMessage.ReplyTo = fieldReplyTo + fieldInputMessageText, _ := UnmarshalInputMessageContent(tmp.InputMessageText) draftMessage.InputMessageText = fieldInputMessageText @@ -10550,6 +11171,10 @@ type Chat struct { Title string `json:"title"` // Chat photo; may be null Photo *ChatPhotoInfo `json:"photo"` + // Identifier of the accent color for message sender name, and backgrounds of chat photo, reply header, and link preview + AccentColorId int32 `json:"accent_color_id"` + // Identifier of a custom emoji to be shown on the reply header background in replies to messages sent by the chat; 0 if none + BackgroundCustomEmojiId JsonInt64 `json:"background_custom_emoji_id"` // Actions that non-administrator chat members are allowed to take in the chat Permissions *ChatPermissions `json:"permissions"` // Last message in the chat; may be null if none or unknown @@ -10632,6 +11257,8 @@ func (chat *Chat) UnmarshalJSON(data []byte) error { Type json.RawMessage `json:"type"` Title string `json:"title"` Photo *ChatPhotoInfo `json:"photo"` + AccentColorId int32 `json:"accent_color_id"` + BackgroundCustomEmojiId JsonInt64 `json:"background_custom_emoji_id"` Permissions *ChatPermissions `json:"permissions"` LastMessage *Message `json:"last_message"` Positions []*ChatPosition `json:"positions"` @@ -10671,6 +11298,8 @@ func (chat *Chat) UnmarshalJSON(data []byte) error { chat.Id = tmp.Id chat.Title = tmp.Title chat.Photo = tmp.Photo + chat.AccentColorId = tmp.AccentColorId + chat.BackgroundCustomEmojiId = tmp.BackgroundCustomEmojiId chat.Permissions = tmp.Permissions chat.LastMessage = tmp.LastMessage chat.Positions = tmp.Positions @@ -11777,8 +12406,6 @@ type FoundWebApp struct { meta // The Web App WebApp *WebApp `json:"web_app"` - // True, if the app supports "settings_button_pressed" event - SupportsSettings bool `json:"supports_settings"` // True, if the user must be asked for the permission to the bot to send them messages RequestWriteAccess bool `json:"request_write_access"` // True, if there is no need to show an ordinary open URL confirmation before opening the Web App. The field must be ignored and confirmation must be shown anyway if the Web App link was hidden @@ -12028,6 +12655,37 @@ func (*ForumTopics) GetType() string { return TypeForumTopics } +// Options to be used for generation of a link preview +type LinkPreviewOptions struct { + meta + // True, if link preview must be disabled + IsDisabled bool `json:"is_disabled"` + // URL to use for link preview. If empty, then the first URL found in the message text will be used + Url string `json:"url"` + // True, if shown media preview must be small; ignored in secret chats or if the URL isn't explicitly specified + ForceSmallMedia bool `json:"force_small_media"` + // True, if shown media preview must be large; ignored in secret chats or if the URL isn't explicitly specified + ForceLargeMedia bool `json:"force_large_media"` + // True, if link preview must be shown above message text; otherwise, the link preview will be shown below the message text; ignored in secret chats + ShowAboveText bool `json:"show_above_text"` +} + +func (entity *LinkPreviewOptions) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewOptions + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewOptions) GetClass() string { + return ClassLinkPreviewOptions +} + +func (*LinkPreviewOptions) GetType() string { + return TypeLinkPreviewOptions +} + // A plain text type RichTextPlain struct { meta @@ -14066,6 +14724,8 @@ type PageBlockChatLink struct { Title string `json:"title"` // Chat photo; may be null Photo *ChatPhotoInfo `json:"photo"` + // Identifier of the accent color for chat title and background of chat photo + AccentColorId int32 `json:"accent_color_id"` // Chat username by which all other information about the chat can be resolved Username string `json:"username"` } @@ -14345,7 +15005,7 @@ func (webPageInstantView *WebPageInstantView) UnmarshalJSON(data []byte) error { return nil } -// Describes a web page preview +// Describes a link preview type WebPage struct { meta // Original URL of the link @@ -14374,6 +15034,14 @@ type WebPage struct { Duration int32 `json:"duration"` // Author of the content Author string `json:"author"` + // True, if the preview has large media and its appearance can be changed + HasLargeMedia bool `json:"has_large_media"` + // True, if large media preview must be shown + ShowLargeMedia bool `json:"show_large_media"` + // True, if there is no need to show an ordinary open URL confirmation, when opening the URL from the preview, because the URL is shown in the message text in clear + SkipConfirmation bool `json:"skip_confirmation"` + // True, if the link preview must be shown above message text; otherwise, the link preview must be shown below the message text + ShowAboveText bool `json:"show_above_text"` // Preview of the content as an animation, if available; may be null Animation *Animation `json:"animation"` // Preview of the content as an audio file, if available; may be null @@ -14585,8 +15253,20 @@ type ThemeParameters struct { BackgroundColor int32 `json:"background_color"` // A secondary color for the background in the RGB24 format SecondaryBackgroundColor int32 `json:"secondary_background_color"` + // A color of the header background in the RGB24 format + HeaderBackgroundColor int32 `json:"header_background_color"` + // A color of the section background in the RGB24 format + SectionBackgroundColor int32 `json:"section_background_color"` // A color of text in the RGB24 format TextColor int32 `json:"text_color"` + // An accent color of the text in the RGB24 format + AccentTextColor int32 `json:"accent_text_color"` + // A color of text on the section headers in the RGB24 format + SectionHeaderTextColor int32 `json:"section_header_text_color"` + // A color of the subtitle text in the RGB24 format + SubtitleTextColor int32 `json:"subtitle_text_color"` + // A color of the text for destructive actions in the RGB24 format + DestructiveTextColor int32 `json:"destructive_text_color"` // A color of hints in the RGB24 format HintColor int32 `json:"hint_color"` // A color of links in the RGB24 format @@ -14651,6 +15331,8 @@ type Invoice struct { SuggestedTipAmounts []int64 `json:"suggested_tip_amounts"` // An HTTP URL with terms of service for recurring payments. If non-empty, the invoice payment will result in recurring payments and the user must accept the terms of service before allowed to pay RecurringPaymentTermsOfServiceUrl string `json:"recurring_payment_terms_of_service_url"` + // An HTTP URL with terms of service for non-recurring payments. If non-empty, then the user must accept the terms of service before allowed to pay + TermsOfServiceUrl string `json:"terms_of_service_url"` // True, if the payment is a test payment IsTest bool `json:"is_test"` // True, if the user's name is needed for payment @@ -15225,6 +15907,49 @@ func (*InputInvoiceName) InputInvoiceType() string { return TypeInputInvoiceName } +// An invoice for a payment toward Telegram; must not be used in the in-store apps +type InputInvoiceTelegram struct { + meta + // Transaction purpose + Purpose TelegramPaymentPurpose `json:"purpose"` +} + +func (entity *InputInvoiceTelegram) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputInvoiceTelegram + + return json.Marshal((*stub)(entity)) +} + +func (*InputInvoiceTelegram) GetClass() string { + return ClassInputInvoice +} + +func (*InputInvoiceTelegram) GetType() string { + return TypeInputInvoiceTelegram +} + +func (*InputInvoiceTelegram) InputInvoiceType() string { + return TypeInputInvoiceTelegram +} + +func (inputInvoiceTelegram *InputInvoiceTelegram) UnmarshalJSON(data []byte) error { + var tmp struct { + Purpose json.RawMessage `json:"purpose"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldPurpose, _ := UnmarshalTelegramPaymentPurpose(tmp.Purpose) + inputInvoiceTelegram.Purpose = fieldPurpose + + return nil +} + // The media is hidden until the invoice is paid type MessageExtendedMediaPreview struct { meta @@ -15345,6 +16070,37 @@ func (*MessageExtendedMediaUnsupported) MessageExtendedMediaType() string { return TypeMessageExtendedMediaUnsupported } +// Describes parameters of a Telegram Premium giveaway +type PremiumGiveawayParameters struct { + meta + // Identifier of the channel chat, which will be automatically boosted by the winners of the giveaway for duration of the Premium subscription + BoostedChatId int64 `json:"boosted_chat_id"` + // Identifiers of other channel chats that must be subscribed by the users to be eligible for the giveaway. There can be up to getOption("giveaway_additional_chat_count_max") additional chats + AdditionalChatIds []int64 `json:"additional_chat_ids"` + // Point in time (Unix timestamp) when the giveaway is expected to be performed; must be 60-getOption("giveaway_duration_max") seconds in the future in scheduled giveaways + WinnersSelectionDate int32 `json:"winners_selection_date"` + // True, if only new subscribers of the chats will be eligible for the giveaway + OnlyNewMembers bool `json:"only_new_members"` + // The list of two-letter ISO 3166-1 alpha-2 codes of countries, users from which will be eligible for the giveaway. If empty, then all users can participate in the giveaway. There can be up to getOption("giveaway_country_count_max") chosen countries. Users with phone number that was bought on Fragment can participate in any giveaway and the country code "FT" must not be specified in the list + CountryCodes []string `json:"country_codes"` +} + +func (entity *PremiumGiveawayParameters) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumGiveawayParameters + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumGiveawayParameters) GetClass() string { + return ClassPremiumGiveawayParameters +} + +func (*PremiumGiveawayParameters) GetType() string { + return TypePremiumGiveawayParameters +} + // File with the date it was uploaded type DatedFile struct { meta @@ -17499,8 +18255,10 @@ type MessageText struct { meta // Text of the message Text *FormattedText `json:"text"` - // A preview of the web page that's mentioned in the text; may be null + // A link preview attached to the message; may be null WebPage *WebPage `json:"web_page"` + // Options which was used for generation of the link preview; may be null if default options were used + LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options"` } func (entity *MessageText) MarshalJSON() ([]byte, error) { @@ -19082,6 +19840,128 @@ func (*MessageGiftedPremium) MessageContentType() string { return TypeMessageGiftedPremium } +// A Telegram Premium gift code was created for the user +type MessagePremiumGiftCode struct { + meta + // Identifier of a chat or a user that created the gift code + CreatorId MessageSender `json:"creator_id"` + // True, if the gift code was created for a giveaway + IsFromGiveaway bool `json:"is_from_giveaway"` + // True, if the winner for the corresponding Telegram Premium subscription wasn't chosen + IsUnclaimed bool `json:"is_unclaimed"` + // Number of month the Telegram Premium subscription will be active after code activation + MonthCount int32 `json:"month_count"` + // A sticker to be shown in the message; may be null if unknown + Sticker *Sticker `json:"sticker"` + // The gift code + Code string `json:"code"` +} + +func (entity *MessagePremiumGiftCode) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessagePremiumGiftCode + + return json.Marshal((*stub)(entity)) +} + +func (*MessagePremiumGiftCode) GetClass() string { + return ClassMessageContent +} + +func (*MessagePremiumGiftCode) GetType() string { + return TypeMessagePremiumGiftCode +} + +func (*MessagePremiumGiftCode) MessageContentType() string { + return TypeMessagePremiumGiftCode +} + +func (messagePremiumGiftCode *MessagePremiumGiftCode) UnmarshalJSON(data []byte) error { + var tmp struct { + CreatorId json.RawMessage `json:"creator_id"` + IsFromGiveaway bool `json:"is_from_giveaway"` + IsUnclaimed bool `json:"is_unclaimed"` + MonthCount int32 `json:"month_count"` + Sticker *Sticker `json:"sticker"` + Code string `json:"code"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messagePremiumGiftCode.IsFromGiveaway = tmp.IsFromGiveaway + messagePremiumGiftCode.IsUnclaimed = tmp.IsUnclaimed + messagePremiumGiftCode.MonthCount = tmp.MonthCount + messagePremiumGiftCode.Sticker = tmp.Sticker + messagePremiumGiftCode.Code = tmp.Code + + fieldCreatorId, _ := UnmarshalMessageSender(tmp.CreatorId) + messagePremiumGiftCode.CreatorId = fieldCreatorId + + return nil +} + +// A Telegram Premium giveaway was created for the chat +type MessagePremiumGiveawayCreated struct{ + meta +} + +func (entity *MessagePremiumGiveawayCreated) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessagePremiumGiveawayCreated + + return json.Marshal((*stub)(entity)) +} + +func (*MessagePremiumGiveawayCreated) GetClass() string { + return ClassMessageContent +} + +func (*MessagePremiumGiveawayCreated) GetType() string { + return TypeMessagePremiumGiveawayCreated +} + +func (*MessagePremiumGiveawayCreated) MessageContentType() string { + return TypeMessagePremiumGiveawayCreated +} + +// A Telegram Premium giveaway +type MessagePremiumGiveaway struct { + meta + // Giveaway parameters + Parameters *PremiumGiveawayParameters `json:"parameters"` + // Number of users which will receive Telegram Premium subscription gift codes + WinnerCount int32 `json:"winner_count"` + // Number of month the Telegram Premium subscription will be active after code activation + MonthCount int32 `json:"month_count"` + // A sticker to be shown in the message; may be null if unknown + Sticker *Sticker `json:"sticker"` +} + +func (entity *MessagePremiumGiveaway) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessagePremiumGiveaway + + return json.Marshal((*stub)(entity)) +} + +func (*MessagePremiumGiveaway) GetClass() string { + return ClassMessageContent +} + +func (*MessagePremiumGiveaway) GetType() string { + return TypeMessagePremiumGiveaway +} + +func (*MessagePremiumGiveaway) MessageContentType() string { + return TypeMessagePremiumGiveaway +} + // A contact has registered with Telegram type MessageContactRegistered struct{ meta @@ -19165,40 +20045,11 @@ func (*MessageChatShared) MessageContentType() string { return TypeMessageChatShared } -// The current user has connected a website by logging in using Telegram Login Widget on it -type MessageWebsiteConnected struct { - meta - // Domain name of the connected website - DomainName string `json:"domain_name"` -} - -func (entity *MessageWebsiteConnected) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageWebsiteConnected - - return json.Marshal((*stub)(entity)) -} - -func (*MessageWebsiteConnected) GetClass() string { - return ClassMessageContent -} - -func (*MessageWebsiteConnected) GetType() string { - return TypeMessageWebsiteConnected -} - -func (*MessageWebsiteConnected) MessageContentType() string { - return TypeMessageWebsiteConnected -} - // The user allowed the bot to send messages type MessageBotWriteAccessAllowed struct { meta - // Information about the Web App, which requested the access; may be null if none or the Web App was opened from the attachment menu - WebApp *WebApp `json:"web_app"` - // True, if user allowed the bot to send messages by an explicit call to allowBotToSendMessages - ByRequest bool `json:"by_request"` + // The reason why the bot was allowed to write messages + Reason BotWriteAccessAllowReason `json:"reason"` } func (entity *MessageBotWriteAccessAllowed) MarshalJSON() ([]byte, error) { @@ -19221,6 +20072,22 @@ func (*MessageBotWriteAccessAllowed) MessageContentType() string { return TypeMessageBotWriteAccessAllowed } +func (messageBotWriteAccessAllowed *MessageBotWriteAccessAllowed) UnmarshalJSON(data []byte) error { + var tmp struct { + Reason json.RawMessage `json:"reason"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldReason, _ := UnmarshalBotWriteAccessAllowReason(tmp.Reason) + messageBotWriteAccessAllowed.Reason = fieldReason + + return nil +} + // Data from a Web App has been sent to a bot type MessageWebAppDataSent struct { meta @@ -19830,6 +20697,31 @@ func (*TextEntityTypePreCode) TextEntityTypeType() string { return TypeTextEntityTypePreCode } +// Text that must be formatted as if inside a blockquote HTML tag +type TextEntityTypeBlockQuote struct{ + meta +} + +func (entity *TextEntityTypeBlockQuote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TextEntityTypeBlockQuote + + return json.Marshal((*stub)(entity)) +} + +func (*TextEntityTypeBlockQuote) GetClass() string { + return ClassTextEntityType +} + +func (*TextEntityTypeBlockQuote) GetType() string { + return TypeTextEntityTypeBlockQuote +} + +func (*TextEntityTypeBlockQuote) TextEntityTypeType() string { + return TypeTextEntityTypeBlockQuote +} + // A text description shown instead of a raw URL type TextEntityTypeTextUrl struct { meta @@ -19914,7 +20806,7 @@ func (*TextEntityTypeCustomEmoji) TextEntityTypeType() string { // A media timestamp type TextEntityTypeMediaTimestamp struct { meta - // Timestamp from which a video/audio/video note/voice note playing must start, in seconds. The media can be in the content or the web page preview of the current message, or in the same places in the replied message + // Timestamp from which a video/audio/video note/voice note/story playing must start, in seconds. The media can be in the content or the web page preview of the current message, or in the same places in the replied message MediaTimestamp int32 `json:"media_timestamp"` } @@ -20105,6 +20997,8 @@ type MessageSendOptions struct { SchedulingState MessageSchedulingState `json:"scheduling_state"` // Non-persistent identifier, which will be returned back in messageSendingStatePending object and can be used to match sent messages and corresponding updateNewMessage updates SendingId int32 `json:"sending_id"` + // Pass true to get a fake message instead of actually sending them + OnlyPreview bool `json:"only_preview"` } func (entity *MessageSendOptions) MarshalJSON() ([]byte, error) { @@ -20131,6 +21025,7 @@ func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { UpdateOrderOfInstalledStickerSets bool `json:"update_order_of_installed_sticker_sets"` SchedulingState json.RawMessage `json:"scheduling_state"` SendingId int32 `json:"sending_id"` + OnlyPreview bool `json:"only_preview"` } err := json.Unmarshal(data, &tmp) @@ -20143,6 +21038,7 @@ func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { messageSendOptions.ProtectContent = tmp.ProtectContent messageSendOptions.UpdateOrderOfInstalledStickerSets = tmp.UpdateOrderOfInstalledStickerSets messageSendOptions.SendingId = tmp.SendingId + messageSendOptions.OnlyPreview = tmp.OnlyPreview fieldSchedulingState, _ := UnmarshalMessageSchedulingState(tmp.SchedulingState) messageSendOptions.SchedulingState = fieldSchedulingState @@ -20150,7 +21046,7 @@ func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { return nil } -// Options to be used when a message content is copied without reference to the original sender. Service messages and messageInvoice can't be copied +// Options to be used when a message content is copied without reference to the original sender. Service messages, and messages with messageInvoice or messagePremiumGiveaway content can't be copied type MessageCopyOptions struct { meta // True, if content of the message needs to be copied without reference to the original sender. Always true if the message is forwarded to a secret chat or is local @@ -20180,10 +21076,10 @@ func (*MessageCopyOptions) GetType() string { // A text message type InputMessageText struct { meta - // Formatted text to be sent; 1-getOption("message_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, Code, Pre, PreCode, TextUrl and MentionName entities are allowed to be specified manually + // Formatted text to be sent; 0-getOption("message_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, BlockQuote, Code, Pre, PreCode, TextUrl and MentionName entities are allowed to be specified manually Text *FormattedText `json:"text"` - // True, if rich web page previews for URLs in the message text must be disabled - DisableWebPagePreview bool `json:"disable_web_page_preview"` + // Options to be used for generation of a link preview; pass null to use default link preview options + LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options"` // True, if a chat message draft must be deleted ClearDraft bool `json:"clear_draft"` } @@ -21063,7 +21959,7 @@ type InputMessageForwarded struct { meta // Identifier for the chat this forwarded message came from FromChatId int64 `json:"from_chat_id"` - // Identifier of the message to forward + // Identifier of the message to forward. A message can be forwarded only if message.can_be_forwarded MessageId int64 `json:"message_id"` // True, if a game message is being shared from a launched game; applies only to game messages InGameShare bool `json:"in_game_share"` @@ -22126,6 +23022,8 @@ type StickerSet struct { StickerFormat StickerFormat `json:"sticker_format"` // Type of the stickers in the set StickerType StickerType `json:"sticker_type"` + // True, if stickers in the sticker set are custom emoji that must be repainted; for custom emoji sticker sets only + NeedsRepainting bool `json:"needs_repainting"` // True for already viewed trending sticker sets IsViewed bool `json:"is_viewed"` // List of stickers in this set @@ -22162,6 +23060,7 @@ func (stickerSet *StickerSet) UnmarshalJSON(data []byte) error { IsOfficial bool `json:"is_official"` StickerFormat json.RawMessage `json:"sticker_format"` StickerType json.RawMessage `json:"sticker_type"` + NeedsRepainting bool `json:"needs_repainting"` IsViewed bool `json:"is_viewed"` Stickers []*Sticker `json:"stickers"` Emojis []*Emojis `json:"emojis"` @@ -22180,6 +23079,7 @@ func (stickerSet *StickerSet) UnmarshalJSON(data []byte) error { stickerSet.IsInstalled = tmp.IsInstalled stickerSet.IsArchived = tmp.IsArchived stickerSet.IsOfficial = tmp.IsOfficial + stickerSet.NeedsRepainting = tmp.NeedsRepainting stickerSet.IsViewed = tmp.IsViewed stickerSet.Stickers = tmp.Stickers stickerSet.Emojis = tmp.Emojis @@ -22216,6 +23116,8 @@ type StickerSetInfo struct { StickerFormat StickerFormat `json:"sticker_format"` // Type of the stickers in the set StickerType StickerType `json:"sticker_type"` + // True, if stickers in the sticker set are custom emoji that must be repainted; for custom emoji sticker sets only + NeedsRepainting bool `json:"needs_repainting"` // True for already viewed trending sticker sets IsViewed bool `json:"is_viewed"` // Total number of stickers in the set @@ -22252,6 +23154,7 @@ func (stickerSetInfo *StickerSetInfo) UnmarshalJSON(data []byte) error { IsOfficial bool `json:"is_official"` StickerFormat json.RawMessage `json:"sticker_format"` StickerType json.RawMessage `json:"sticker_type"` + NeedsRepainting bool `json:"needs_repainting"` IsViewed bool `json:"is_viewed"` Size int32 `json:"size"` Covers []*Sticker `json:"covers"` @@ -22270,6 +23173,7 @@ func (stickerSetInfo *StickerSetInfo) UnmarshalJSON(data []byte) error { stickerSetInfo.IsInstalled = tmp.IsInstalled stickerSetInfo.IsArchived = tmp.IsArchived stickerSetInfo.IsOfficial = tmp.IsOfficial + stickerSetInfo.NeedsRepainting = tmp.NeedsRepainting stickerSetInfo.IsViewed = tmp.IsViewed stickerSetInfo.Size = tmp.Size stickerSetInfo.Covers = tmp.Covers @@ -22552,7 +23456,7 @@ type StoryAreaPosition struct { YPercentage float64 `json:"y_percentage"` // The width of the rectangle, as a percentage of the media width WidthPercentage float64 `json:"width_percentage"` - // The ordinate of the rectangle's center, as a percentage of the media height + // The height of the rectangle, as a percentage of the media height HeightPercentage float64 `json:"height_percentage"` // Clockwise rotation angle of the rectangle, in degrees; 0-360 RotationAngle float64 `json:"rotation_angle"` @@ -22628,6 +23532,62 @@ func (*StoryAreaTypeVenue) StoryAreaTypeType() string { return TypeStoryAreaTypeVenue } +// An area pointing to a suggested reaction. App needs to show a clickable reaction on the area and call setStoryReaction when the are is clicked +type StoryAreaTypeSuggestedReaction struct { + meta + // Type of the reaction + ReactionType ReactionType `json:"reaction_type"` + // Number of times the reaction was added + TotalCount int32 `json:"total_count"` + // True, if reaction has a dark background + IsDark bool `json:"is_dark"` + // True, if reaction corner is flipped + IsFlipped bool `json:"is_flipped"` +} + +func (entity *StoryAreaTypeSuggestedReaction) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryAreaTypeSuggestedReaction + + return json.Marshal((*stub)(entity)) +} + +func (*StoryAreaTypeSuggestedReaction) GetClass() string { + return ClassStoryAreaType +} + +func (*StoryAreaTypeSuggestedReaction) GetType() string { + return TypeStoryAreaTypeSuggestedReaction +} + +func (*StoryAreaTypeSuggestedReaction) StoryAreaTypeType() string { + return TypeStoryAreaTypeSuggestedReaction +} + +func (storyAreaTypeSuggestedReaction *StoryAreaTypeSuggestedReaction) UnmarshalJSON(data []byte) error { + var tmp struct { + ReactionType json.RawMessage `json:"reaction_type"` + TotalCount int32 `json:"total_count"` + IsDark bool `json:"is_dark"` + IsFlipped bool `json:"is_flipped"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + storyAreaTypeSuggestedReaction.TotalCount = tmp.TotalCount + storyAreaTypeSuggestedReaction.IsDark = tmp.IsDark + storyAreaTypeSuggestedReaction.IsFlipped = tmp.IsFlipped + + fieldReactionType, _ := UnmarshalReactionType(tmp.ReactionType) + storyAreaTypeSuggestedReaction.ReactionType = fieldReactionType + + return nil +} + // Describes a clickable rectangle area on a story media type StoryArea struct { meta @@ -22757,6 +23717,58 @@ func (*InputStoryAreaTypePreviousVenue) InputStoryAreaTypeType() string { return TypeInputStoryAreaTypePreviousVenue } +// An area pointing to a suggested reaction +type InputStoryAreaTypeSuggestedReaction struct { + meta + // Type of the reaction + ReactionType ReactionType `json:"reaction_type"` + // True, if reaction has a dark background + IsDark bool `json:"is_dark"` + // True, if reaction corner is flipped + IsFlipped bool `json:"is_flipped"` +} + +func (entity *InputStoryAreaTypeSuggestedReaction) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputStoryAreaTypeSuggestedReaction + + return json.Marshal((*stub)(entity)) +} + +func (*InputStoryAreaTypeSuggestedReaction) GetClass() string { + return ClassInputStoryAreaType +} + +func (*InputStoryAreaTypeSuggestedReaction) GetType() string { + return TypeInputStoryAreaTypeSuggestedReaction +} + +func (*InputStoryAreaTypeSuggestedReaction) InputStoryAreaTypeType() string { + return TypeInputStoryAreaTypeSuggestedReaction +} + +func (inputStoryAreaTypeSuggestedReaction *InputStoryAreaTypeSuggestedReaction) UnmarshalJSON(data []byte) error { + var tmp struct { + ReactionType json.RawMessage `json:"reaction_type"` + IsDark bool `json:"is_dark"` + IsFlipped bool `json:"is_flipped"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + inputStoryAreaTypeSuggestedReaction.IsDark = tmp.IsDark + inputStoryAreaTypeSuggestedReaction.IsFlipped = tmp.IsFlipped + + fieldReactionType, _ := UnmarshalReactionType(tmp.ReactionType) + inputStoryAreaTypeSuggestedReaction.ReactionType = fieldReactionType + + return nil +} + // Describes a clickable rectangle area on a story media to be added type InputStoryArea struct { meta @@ -23103,7 +24115,9 @@ type StoryInteractionInfo struct { meta // Number of times the story was viewed ViewCount int32 `json:"view_count"` - // Number of reactions added to the story + // Number of times the story was forwarded; 0 if none or unknown + ForwardCount int32 `json:"forward_count"` + // Number of reactions added to the story; 0 if none or unknown ReactionCount int32 `json:"reaction_count"` // Identifiers of at most 3 recent viewers of the story RecentViewerUserIds []int64 `json:"recent_viewer_user_ids"` @@ -23144,10 +24158,16 @@ type Story struct { IsPinned bool `json:"is_pinned"` // True, if the story is visible only for the current user IsVisibleOnlyForSelf bool `json:"is_visible_only_for_self"` + // True, if the story can be deleted + CanBeDeleted bool `json:"can_be_deleted"` + // True, if the story can be edited + CanBeEdited bool `json:"can_be_edited"` // True, if the story can be forwarded as a message. Otherwise, screenshots and saving of the story content must be also forbidden CanBeForwarded bool `json:"can_be_forwarded"` // True, if the story can be replied in the chat with the story sender CanBeReplied bool `json:"can_be_replied"` + // True, if the story's is_pinned value can be changed + CanToggleIsPinned bool `json:"can_toggle_is_pinned"` // True, if users viewed the story can be received through getStoryViewers CanGetViewers bool `json:"can_get_viewers"` // True, if users viewed the story can't be received, because the story has expired more than getOption("story_viewers_expiration_delay") seconds ago @@ -23192,8 +24212,11 @@ func (story *Story) UnmarshalJSON(data []byte) error { IsEdited bool `json:"is_edited"` IsPinned bool `json:"is_pinned"` IsVisibleOnlyForSelf bool `json:"is_visible_only_for_self"` + CanBeDeleted bool `json:"can_be_deleted"` + CanBeEdited bool `json:"can_be_edited"` CanBeForwarded bool `json:"can_be_forwarded"` CanBeReplied bool `json:"can_be_replied"` + CanToggleIsPinned bool `json:"can_toggle_is_pinned"` CanGetViewers bool `json:"can_get_viewers"` HasExpiredViewers bool `json:"has_expired_viewers"` InteractionInfo *StoryInteractionInfo `json:"interaction_info"` @@ -23217,8 +24240,11 @@ func (story *Story) UnmarshalJSON(data []byte) error { story.IsEdited = tmp.IsEdited story.IsPinned = tmp.IsPinned story.IsVisibleOnlyForSelf = tmp.IsVisibleOnlyForSelf + story.CanBeDeleted = tmp.CanBeDeleted + story.CanBeEdited = tmp.CanBeEdited story.CanBeForwarded = tmp.CanBeForwarded story.CanBeReplied = tmp.CanBeReplied + story.CanToggleIsPinned = tmp.CanToggleIsPinned story.CanGetViewers = tmp.CanGetViewers story.HasExpiredViewers = tmp.HasExpiredViewers story.InteractionInfo = tmp.InteractionInfo @@ -23345,6 +24371,302 @@ func (chatActiveStories *ChatActiveStories) UnmarshalJSON(data []byte) error { return nil } +// The chat created a Telegram Premium gift code for a user +type ChatBoostSourceGiftCode struct { + meta + // Identifier of a user, for which the gift code was created + UserId int64 `json:"user_id"` + // The created Telegram Premium gift code, which is known only if this is a gift code for the current user, or it has already been claimed + GiftCode string `json:"gift_code"` +} + +func (entity *ChatBoostSourceGiftCode) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatBoostSourceGiftCode + + return json.Marshal((*stub)(entity)) +} + +func (*ChatBoostSourceGiftCode) GetClass() string { + return ClassChatBoostSource +} + +func (*ChatBoostSourceGiftCode) GetType() string { + return TypeChatBoostSourceGiftCode +} + +func (*ChatBoostSourceGiftCode) ChatBoostSourceType() string { + return TypeChatBoostSourceGiftCode +} + +// The chat created a Telegram Premium giveaway +type ChatBoostSourceGiveaway struct { + meta + // Identifier of a user that won in the giveaway; 0 if none + UserId int64 `json:"user_id"` + // The created Telegram Premium gift code if it was used by the user or can be claimed by the current user; an empty string otherwise + GiftCode string `json:"gift_code"` + // Identifier of the corresponding giveaway message; can be an identifier of a deleted message + GiveawayMessageId int64 `json:"giveaway_message_id"` + // True, if the winner for the corresponding Telegram Premium subscription wasn't chosen, because there were not enough participants + IsUnclaimed bool `json:"is_unclaimed"` +} + +func (entity *ChatBoostSourceGiveaway) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatBoostSourceGiveaway + + return json.Marshal((*stub)(entity)) +} + +func (*ChatBoostSourceGiveaway) GetClass() string { + return ClassChatBoostSource +} + +func (*ChatBoostSourceGiveaway) GetType() string { + return TypeChatBoostSourceGiveaway +} + +func (*ChatBoostSourceGiveaway) ChatBoostSourceType() string { + return TypeChatBoostSourceGiveaway +} + +// A user with Telegram Premium subscription or gifted Telegram Premium boosted the chat +type ChatBoostSourcePremium struct { + meta + // Identifier of the user + UserId int64 `json:"user_id"` +} + +func (entity *ChatBoostSourcePremium) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatBoostSourcePremium + + return json.Marshal((*stub)(entity)) +} + +func (*ChatBoostSourcePremium) GetClass() string { + return ClassChatBoostSource +} + +func (*ChatBoostSourcePremium) GetType() string { + return TypeChatBoostSourcePremium +} + +func (*ChatBoostSourcePremium) ChatBoostSourceType() string { + return TypeChatBoostSourcePremium +} + +// Describes a prepaid Telegram Premium giveaway +type PrepaidPremiumGiveaway struct { + meta + // Unique identifier of the prepaid giveaway + Id JsonInt64 `json:"id"` + // Number of users which will receive Telegram Premium subscription gift codes + WinnerCount int32 `json:"winner_count"` + // Number of month the Telegram Premium subscription will be active after code activation + MonthCount int32 `json:"month_count"` + // Point in time (Unix timestamp) when the giveaway was paid + PaymentDate int32 `json:"payment_date"` +} + +func (entity *PrepaidPremiumGiveaway) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PrepaidPremiumGiveaway + + return json.Marshal((*stub)(entity)) +} + +func (*PrepaidPremiumGiveaway) GetClass() string { + return ClassPrepaidPremiumGiveaway +} + +func (*PrepaidPremiumGiveaway) GetType() string { + return TypePrepaidPremiumGiveaway +} + +// Describes current boost status of a chat +type ChatBoostStatus struct { + meta + // An HTTP URL, which can be used to boost the chat + BoostUrl string `json:"boost_url"` + // Identifiers of boost slots of the current user applied to the chat + AppliedSlotIds []int32 `json:"applied_slot_ids"` + // Current boost level of the chat + Level int32 `json:"level"` + // The number of boosts received by the chat from created Telegram Premium gift codes and giveaways; always 0 if the current user isn't an administrator in the chat + GiftCodeBoostCount int32 `json:"gift_code_boost_count"` + // The number of boosts received by the chat + BoostCount int32 `json:"boost_count"` + // The number of boosts added to reach the current level + CurrentLevelBoostCount int32 `json:"current_level_boost_count"` + // The number of boosts needed to reach the next level; 0 if the next level isn't available + NextLevelBoostCount int32 `json:"next_level_boost_count"` + // Approximate number of Telegram Premium subscribers joined the chat; always 0 if the current user isn't an administrator in the chat + PremiumMemberCount int32 `json:"premium_member_count"` + // A percentage of Telegram Premium subscribers joined the chat; always 0 if the current user isn't an administrator in the chat + PremiumMemberPercentage float64 `json:"premium_member_percentage"` + // The list of prepaid giveaways available for the chat; only for chat administrators + PrepaidGiveaways []*PrepaidPremiumGiveaway `json:"prepaid_giveaways"` +} + +func (entity *ChatBoostStatus) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatBoostStatus + + return json.Marshal((*stub)(entity)) +} + +func (*ChatBoostStatus) GetClass() string { + return ClassChatBoostStatus +} + +func (*ChatBoostStatus) GetType() string { + return TypeChatBoostStatus +} + +// Describes a boost applied to a chat +type ChatBoost struct { + meta + // Unique identifier of the boost + Id string `json:"id"` + // The number of identical boosts applied + Count int32 `json:"count"` + // Source of the boost + Source ChatBoostSource `json:"source"` + // Point in time (Unix timestamp) when the chat was boosted + StartDate int32 `json:"start_date"` + // Point in time (Unix timestamp) when the boost will expire + ExpirationDate int32 `json:"expiration_date"` +} + +func (entity *ChatBoost) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatBoost + + return json.Marshal((*stub)(entity)) +} + +func (*ChatBoost) GetClass() string { + return ClassChatBoost +} + +func (*ChatBoost) GetType() string { + return TypeChatBoost +} + +func (chatBoost *ChatBoost) UnmarshalJSON(data []byte) error { + var tmp struct { + Id string `json:"id"` + Count int32 `json:"count"` + Source json.RawMessage `json:"source"` + StartDate int32 `json:"start_date"` + ExpirationDate int32 `json:"expiration_date"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + chatBoost.Id = tmp.Id + chatBoost.Count = tmp.Count + chatBoost.StartDate = tmp.StartDate + chatBoost.ExpirationDate = tmp.ExpirationDate + + fieldSource, _ := UnmarshalChatBoostSource(tmp.Source) + chatBoost.Source = fieldSource + + return nil +} + +// Contains a list of boosts applied to a chat +type FoundChatBoosts struct { + meta + // Total number of boosts applied to the chat + TotalCount int32 `json:"total_count"` + // List of boosts + Boosts []*ChatBoost `json:"boosts"` + // The offset for the next request. If empty, there are no more results + NextOffset string `json:"next_offset"` +} + +func (entity *FoundChatBoosts) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FoundChatBoosts + + return json.Marshal((*stub)(entity)) +} + +func (*FoundChatBoosts) GetClass() string { + return ClassFoundChatBoosts +} + +func (*FoundChatBoosts) GetType() string { + return TypeFoundChatBoosts +} + +// Describes a slot for chat boost +type ChatBoostSlot struct { + meta + // Unique identifier of the slot + SlotId int32 `json:"slot_id"` + // Identifier of the currently boosted chat; 0 if none + CurrentlyBoostedChatId int64 `json:"currently_boosted_chat_id"` + // Point in time (Unix timestamp) when the chat was boosted; 0 if none + StartDate int32 `json:"start_date"` + // Point in time (Unix timestamp) when the boost will expire + ExpirationDate int32 `json:"expiration_date"` + // Point in time (Unix timestamp) after which the boost can be used for another chat + CooldownUntilDate int32 `json:"cooldown_until_date"` +} + +func (entity *ChatBoostSlot) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatBoostSlot + + return json.Marshal((*stub)(entity)) +} + +func (*ChatBoostSlot) GetClass() string { + return ClassChatBoostSlot +} + +func (*ChatBoostSlot) GetType() string { + return TypeChatBoostSlot +} + +// Contains a list of chat boost slots +type ChatBoostSlots struct { + meta + // List of boost slots + Slots []*ChatBoostSlot `json:"slots"` +} + +func (entity *ChatBoostSlots) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatBoostSlots + + return json.Marshal((*stub)(entity)) +} + +func (*ChatBoostSlots) GetClass() string { + return ClassChatBoostSlots +} + +func (*ChatBoostSlots) GetType() string { + return TypeChatBoostSlots +} + // The call wasn't discarded, or the reason is unknown type CallDiscardReasonEmpty struct{ meta @@ -23784,7 +25106,7 @@ func (*CallStateHangingUp) CallStateType() string { // The call has ended successfully type CallStateDiscarded struct { meta - // The reason, why the call has ended + // The reason why the call has ended Reason CallDiscardReason `json:"reason"` // True, if the call rating must be sent to the server NeedRating bool `json:"need_rating"` @@ -24683,6 +26005,8 @@ type AddedReaction struct { Type ReactionType `json:"type"` // Identifier of the chat member, applied the reaction SenderId MessageSender `json:"sender_id"` + // True, if the reaction was added by the current user + IsOutgoing bool `json:"is_outgoing"` // Point in time (Unix timestamp) when the reaction was added Date int32 `json:"date"` } @@ -24707,6 +26031,7 @@ func (addedReaction *AddedReaction) UnmarshalJSON(data []byte) error { var tmp struct { Type json.RawMessage `json:"type"` SenderId json.RawMessage `json:"sender_id"` + IsOutgoing bool `json:"is_outgoing"` Date int32 `json:"date"` } @@ -24715,6 +26040,7 @@ func (addedReaction *AddedReaction) UnmarshalJSON(data []byte) error { return err } + addedReaction.IsOutgoing = tmp.IsOutgoing addedReaction.Date = tmp.Date fieldType, _ := UnmarshalReactionType(tmp.Type) @@ -25098,8 +26424,6 @@ type AttachmentMenuBot struct { SupportsGroupChats bool `json:"supports_group_chats"` // True, if the bot supports opening from attachment menu in channel chats SupportsChannelChats bool `json:"supports_channel_chats"` - // True, if the bot supports "settings_button_pressed" event - SupportsSettings bool `json:"supports_settings"` // True, if the user must be asked for the permission to send messages to the bot RequestWriteAccess bool `json:"request_write_access"` // 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 @@ -25175,6 +26499,110 @@ func (*SentWebAppMessage) GetType() string { return TypeSentWebAppMessage } +// The user connected a website by logging in using Telegram Login Widget on it +type BotWriteAccessAllowReasonConnectedWebsite struct { + meta + // Domain name of the connected website + DomainName string `json:"domain_name"` +} + +func (entity *BotWriteAccessAllowReasonConnectedWebsite) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BotWriteAccessAllowReasonConnectedWebsite + + return json.Marshal((*stub)(entity)) +} + +func (*BotWriteAccessAllowReasonConnectedWebsite) GetClass() string { + return ClassBotWriteAccessAllowReason +} + +func (*BotWriteAccessAllowReasonConnectedWebsite) GetType() string { + return TypeBotWriteAccessAllowReasonConnectedWebsite +} + +func (*BotWriteAccessAllowReasonConnectedWebsite) BotWriteAccessAllowReasonType() string { + return TypeBotWriteAccessAllowReasonConnectedWebsite +} + +// The user added the bot to attachment or side menu using toggleBotIsAddedToAttachmentMenu +type BotWriteAccessAllowReasonAddedToAttachmentMenu struct{ + meta +} + +func (entity *BotWriteAccessAllowReasonAddedToAttachmentMenu) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BotWriteAccessAllowReasonAddedToAttachmentMenu + + return json.Marshal((*stub)(entity)) +} + +func (*BotWriteAccessAllowReasonAddedToAttachmentMenu) GetClass() string { + return ClassBotWriteAccessAllowReason +} + +func (*BotWriteAccessAllowReasonAddedToAttachmentMenu) GetType() string { + return TypeBotWriteAccessAllowReasonAddedToAttachmentMenu +} + +func (*BotWriteAccessAllowReasonAddedToAttachmentMenu) BotWriteAccessAllowReasonType() string { + return TypeBotWriteAccessAllowReasonAddedToAttachmentMenu +} + +// The user launched a Web App using getWebAppLinkUrl +type BotWriteAccessAllowReasonLaunchedWebApp struct { + meta + // Information about the Web App + WebApp *WebApp `json:"web_app"` +} + +func (entity *BotWriteAccessAllowReasonLaunchedWebApp) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BotWriteAccessAllowReasonLaunchedWebApp + + return json.Marshal((*stub)(entity)) +} + +func (*BotWriteAccessAllowReasonLaunchedWebApp) GetClass() string { + return ClassBotWriteAccessAllowReason +} + +func (*BotWriteAccessAllowReasonLaunchedWebApp) GetType() string { + return TypeBotWriteAccessAllowReasonLaunchedWebApp +} + +func (*BotWriteAccessAllowReasonLaunchedWebApp) BotWriteAccessAllowReasonType() string { + return TypeBotWriteAccessAllowReasonLaunchedWebApp +} + +// The user accepted bot's request to send messages with allowBotToSendMessages +type BotWriteAccessAllowReasonAcceptedRequest struct{ + meta +} + +func (entity *BotWriteAccessAllowReasonAcceptedRequest) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BotWriteAccessAllowReasonAcceptedRequest + + return json.Marshal((*stub)(entity)) +} + +func (*BotWriteAccessAllowReasonAcceptedRequest) GetClass() string { + return ClassBotWriteAccessAllowReason +} + +func (*BotWriteAccessAllowReasonAcceptedRequest) GetType() string { + return TypeBotWriteAccessAllowReasonAcceptedRequest +} + +func (*BotWriteAccessAllowReasonAcceptedRequest) BotWriteAccessAllowReasonType() string { + return TypeBotWriteAccessAllowReasonAcceptedRequest +} + // Contains an HTTP URL type HttpUrl struct { meta @@ -27598,6 +29026,64 @@ func (*ChatEventActiveUsernamesChanged) ChatEventActionType() string { return TypeChatEventActiveUsernamesChanged } +// The chat accent color was changed +type ChatEventAccentColorChanged struct { + meta + // Previous identifier of chat accent color + OldAccentColorId int32 `json:"old_accent_color_id"` + // New identifier of chat accent color + NewAccentColorId int32 `json:"new_accent_color_id"` +} + +func (entity *ChatEventAccentColorChanged) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventAccentColorChanged + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventAccentColorChanged) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventAccentColorChanged) GetType() string { + return TypeChatEventAccentColorChanged +} + +func (*ChatEventAccentColorChanged) ChatEventActionType() string { + return TypeChatEventAccentColorChanged +} + +// The chat's custom emoji for reply background was changed +type ChatEventBackgroundCustomEmojiChanged struct { + meta + // Previous identifier of the custom emoji; 0 if none + OldBackgroundCustomEmojiId JsonInt64 `json:"old_background_custom_emoji_id"` + // New identifier of the custom emoji; 0 if none + NewBackgroundCustomEmojiId JsonInt64 `json:"new_background_custom_emoji_id"` +} + +func (entity *ChatEventBackgroundCustomEmojiChanged) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventBackgroundCustomEmojiChanged + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventBackgroundCustomEmojiChanged) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventBackgroundCustomEmojiChanged) GetType() string { + return TypeChatEventBackgroundCustomEmojiChanged +} + +func (*ChatEventBackgroundCustomEmojiChanged) ChatEventActionType() string { + return TypeChatEventBackgroundCustomEmojiChanged +} + // The has_protected_content setting of a channel was toggled type ChatEventHasProtectedContentToggled struct { meta @@ -28936,6 +30422,31 @@ func (*PremiumLimitTypeStoryCaptionLength) PremiumLimitTypeType() string { return TypePremiumLimitTypeStoryCaptionLength } +// The maximum number of suggested reaction areas on a story +type PremiumLimitTypeStorySuggestedReactionAreaCount struct{ + meta +} + +func (entity *PremiumLimitTypeStorySuggestedReactionAreaCount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumLimitTypeStorySuggestedReactionAreaCount + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumLimitTypeStorySuggestedReactionAreaCount) GetClass() string { + return ClassPremiumLimitType +} + +func (*PremiumLimitTypeStorySuggestedReactionAreaCount) GetType() string { + return TypePremiumLimitTypeStorySuggestedReactionAreaCount +} + +func (*PremiumLimitTypeStorySuggestedReactionAreaCount) PremiumLimitTypeType() string { + return TypePremiumLimitTypeStorySuggestedReactionAreaCount +} + // Increased limits type PremiumFeatureIncreasedLimits struct{ meta @@ -29336,7 +30847,57 @@ func (*PremiumFeatureUpgradedStories) PremiumFeatureType() string { return TypePremiumFeatureUpgradedStories } -// User stories are displayed before stories of non-premium contacts +// The ability to boost chats +type PremiumFeatureChatBoost struct{ + meta +} + +func (entity *PremiumFeatureChatBoost) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumFeatureChatBoost + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumFeatureChatBoost) GetClass() string { + return ClassPremiumFeature +} + +func (*PremiumFeatureChatBoost) GetType() string { + return TypePremiumFeatureChatBoost +} + +func (*PremiumFeatureChatBoost) PremiumFeatureType() string { + return TypePremiumFeatureChatBoost +} + +// The ability to choose accent color +type PremiumFeatureAccentColor struct{ + meta +} + +func (entity *PremiumFeatureAccentColor) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumFeatureAccentColor + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumFeatureAccentColor) GetClass() string { + return ClassPremiumFeature +} + +func (*PremiumFeatureAccentColor) GetType() string { + return TypePremiumFeatureAccentColor +} + +func (*PremiumFeatureAccentColor) PremiumFeatureType() string { + return TypePremiumFeatureAccentColor +} + +// User stories are displayed before stories of non-premium contacts and channels type PremiumStoryFeaturePriorityOrder struct{ meta } @@ -29836,7 +31397,7 @@ func (*PremiumState) GetType() string { return TypePremiumState } -// The user subscribed to Telegram Premium +// The user subscribing to Telegram Premium type StorePaymentPurposePremiumSubscription struct { meta // Pass true if this is a restore of a Telegram Premium purchase; only for App Store @@ -29865,10 +31426,10 @@ func (*StorePaymentPurposePremiumSubscription) StorePaymentPurposeType() string return TypeStorePaymentPurposePremiumSubscription } -// The user gifted Telegram Premium to another user +// The user gifting Telegram Premium to another user type StorePaymentPurposeGiftedPremium struct { meta - // Identifier of the user for which Premium was gifted + // Identifier of the user to which Premium was gifted UserId int64 `json:"user_id"` // ISO 4217 currency code of the payment currency Currency string `json:"currency"` @@ -29896,6 +31457,140 @@ func (*StorePaymentPurposeGiftedPremium) StorePaymentPurposeType() string { return TypeStorePaymentPurposeGiftedPremium } +// The user creating Telegram Premium gift codes for other users +type StorePaymentPurposePremiumGiftCodes struct { + meta + // Identifier of the channel chat, which will be automatically boosted by the users for duration of the Premium subscription and which is administered by the user; 0 if none + BoostedChatId int64 `json:"boosted_chat_id"` + // ISO 4217 currency code of the payment currency + Currency string `json:"currency"` + // Paid amount, in the smallest units of the currency + Amount int64 `json:"amount"` + // Identifiers of the users which can activate the gift codes + UserIds []int64 `json:"user_ids"` +} + +func (entity *StorePaymentPurposePremiumGiftCodes) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StorePaymentPurposePremiumGiftCodes + + return json.Marshal((*stub)(entity)) +} + +func (*StorePaymentPurposePremiumGiftCodes) GetClass() string { + return ClassStorePaymentPurpose +} + +func (*StorePaymentPurposePremiumGiftCodes) GetType() string { + return TypeStorePaymentPurposePremiumGiftCodes +} + +func (*StorePaymentPurposePremiumGiftCodes) StorePaymentPurposeType() string { + return TypeStorePaymentPurposePremiumGiftCodes +} + +// The user creating a Telegram Premium giveaway for subscribers of channel chats; requires can_post_messages rights in the channels +type StorePaymentPurposePremiumGiveaway struct { + meta + // Giveaway parameters + Parameters *PremiumGiveawayParameters `json:"parameters"` + // ISO 4217 currency code of the payment currency + Currency string `json:"currency"` + // Paid amount, in the smallest units of the currency + Amount int64 `json:"amount"` +} + +func (entity *StorePaymentPurposePremiumGiveaway) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StorePaymentPurposePremiumGiveaway + + return json.Marshal((*stub)(entity)) +} + +func (*StorePaymentPurposePremiumGiveaway) GetClass() string { + return ClassStorePaymentPurpose +} + +func (*StorePaymentPurposePremiumGiveaway) GetType() string { + return TypeStorePaymentPurposePremiumGiveaway +} + +func (*StorePaymentPurposePremiumGiveaway) StorePaymentPurposeType() string { + return TypeStorePaymentPurposePremiumGiveaway +} + +// The user creating Telegram Premium gift codes for other users +type TelegramPaymentPurposePremiumGiftCodes struct { + meta + // Identifier of the channel chat, which will be automatically boosted by the users for duration of the Premium subscription and which is administered by the user; 0 if none + BoostedChatId int64 `json:"boosted_chat_id"` + // ISO 4217 currency code of the payment currency + Currency string `json:"currency"` + // Paid amount, in the smallest units of the currency + Amount int64 `json:"amount"` + // Identifiers of the users which can activate the gift codes + UserIds []int64 `json:"user_ids"` + // Number of month the Telegram Premium subscription will be active for the users + MonthCount int32 `json:"month_count"` +} + +func (entity *TelegramPaymentPurposePremiumGiftCodes) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TelegramPaymentPurposePremiumGiftCodes + + return json.Marshal((*stub)(entity)) +} + +func (*TelegramPaymentPurposePremiumGiftCodes) GetClass() string { + return ClassTelegramPaymentPurpose +} + +func (*TelegramPaymentPurposePremiumGiftCodes) GetType() string { + return TypeTelegramPaymentPurposePremiumGiftCodes +} + +func (*TelegramPaymentPurposePremiumGiftCodes) TelegramPaymentPurposeType() string { + return TypeTelegramPaymentPurposePremiumGiftCodes +} + +// The user creating a Telegram Premium giveaway for subscribers of channel chats; requires can_post_messages rights in the channels +type TelegramPaymentPurposePremiumGiveaway struct { + meta + // Giveaway parameters + Parameters *PremiumGiveawayParameters `json:"parameters"` + // ISO 4217 currency code of the payment currency + Currency string `json:"currency"` + // Paid amount, in the smallest units of the currency + Amount int64 `json:"amount"` + // Number of users which will be able to activate the gift codes + WinnerCount int32 `json:"winner_count"` + // Number of month the Telegram Premium subscription will be active for the users + MonthCount int32 `json:"month_count"` +} + +func (entity *TelegramPaymentPurposePremiumGiveaway) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TelegramPaymentPurposePremiumGiveaway + + return json.Marshal((*stub)(entity)) +} + +func (*TelegramPaymentPurposePremiumGiveaway) GetClass() string { + return ClassTelegramPaymentPurpose +} + +func (*TelegramPaymentPurposePremiumGiveaway) GetType() string { + return TypeTelegramPaymentPurposePremiumGiveaway +} + +func (*TelegramPaymentPurposePremiumGiveaway) TelegramPaymentPurposeType() string { + return TypeTelegramPaymentPurposePremiumGiveaway +} + // A token for Firebase Cloud Messaging type DeviceTokenFirebaseCloudMessaging struct { meta @@ -30723,6 +32418,31 @@ func (*CanSendStoryResultPremiumNeeded) CanSendStoryResultType() string { return TypeCanSendStoryResultPremiumNeeded } +// The channel chat must be boosted first by Telegram Premium subscribers to post more stories. Call getChatBoostStatus to get current boost status of the chat +type CanSendStoryResultBoostNeeded struct{ + meta +} + +func (entity *CanSendStoryResultBoostNeeded) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CanSendStoryResultBoostNeeded + + return json.Marshal((*stub)(entity)) +} + +func (*CanSendStoryResultBoostNeeded) GetClass() string { + return ClassCanSendStoryResult +} + +func (*CanSendStoryResultBoostNeeded) GetType() string { + return TypeCanSendStoryResultBoostNeeded +} + +func (*CanSendStoryResultBoostNeeded) CanSendStoryResultType() string { + return TypeCanSendStoryResultBoostNeeded +} + // The limit for the number of active stories exceeded. The user can buy Telegram Premium, delete an active story, or wait for the oldest story to expire type CanSendStoryResultActiveStoryLimitExceeded struct{ meta @@ -31641,6 +33361,64 @@ func (*PushMessageContentPoll) PushMessageContentType() string { return TypePushMessageContentPoll } +// A message with a Telegram Premium gift code created for the user +type PushMessageContentPremiumGiftCode struct { + meta + // Number of month the Telegram Premium subscription will be active after code activation + MonthCount int32 `json:"month_count"` +} + +func (entity *PushMessageContentPremiumGiftCode) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentPremiumGiftCode + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentPremiumGiftCode) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentPremiumGiftCode) GetType() string { + return TypePushMessageContentPremiumGiftCode +} + +func (*PushMessageContentPremiumGiftCode) PushMessageContentType() string { + return TypePushMessageContentPremiumGiftCode +} + +// A message with a Telegram Premium giveaway +type PushMessageContentPremiumGiveaway struct { + meta + // Number of users which will receive Telegram Premium subscription gift codes; 0 for pinned message + WinnerCount int32 `json:"winner_count"` + // Number of month the Telegram Premium subscription will be active after code activation; 0 for pinned message + MonthCount int32 `json:"month_count"` + // True, if the message is a pinned message with the specified content + IsPinned bool `json:"is_pinned"` +} + +func (entity *PushMessageContentPremiumGiveaway) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentPremiumGiveaway + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentPremiumGiveaway) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentPremiumGiveaway) GetType() string { + return TypePushMessageContentPremiumGiveaway +} + +func (*PushMessageContentPremiumGiveaway) PushMessageContentType() string { + return TypePushMessageContentPremiumGiveaway +} + // A screenshot of a message in the chat has been taken type PushMessageContentScreenshotTaken struct{ meta @@ -32285,7 +34063,7 @@ func (*NotificationTypeNewCall) NotificationTypeType() string { // New message was received through a push notification type NotificationTypeNewPushMessage struct { meta - // The message identifier. The message will not be available in the chat history, but the identifier can be used in viewMessages, or as a message to reply + // The message identifier. The message will not be available in the chat history, but the identifier can be used in viewMessages, or as a message to be replied in the same chat MessageId int64 `json:"message_id"` // Identifier of the sender of the message. Corresponding user or chat may be inaccessible SenderId MessageSender `json:"sender_id"` @@ -34830,6 +36608,33 @@ func (*InternalLinkTypeChangePhoneNumber) InternalLinkTypeType() string { return TypeInternalLinkTypeChangePhoneNumber } +// The link is a link to boost a Telegram chat. Call getChatBoostLinkInfo with the given URL to process the link. If the chat is found, then call getChatBoostStatus and getAvailableChatBoostSlots to get the current boost status and check whether the chat can be boosted. If the user wants to boost the chat and the chat can be boosted, then call boostChat +type InternalLinkTypeChatBoost struct { + meta + // URL to be passed to getChatBoostLinkInfo + Url string `json:"url"` +} + +func (entity *InternalLinkTypeChatBoost) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeChatBoost + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeChatBoost) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeChatBoost) GetType() string { + return TypeInternalLinkTypeChatBoost +} + +func (*InternalLinkTypeChatBoost) InternalLinkTypeType() string { + return TypeInternalLinkTypeChatBoost +} + // The link is an invite link to a chat folder. Call checkChatFolderInviteLink with the given invite link to process the link type InternalLinkTypeChatFolderInvite struct { meta @@ -35243,6 +37048,33 @@ func (*InternalLinkTypePremiumFeatures) InternalLinkTypeType() string { return TypeInternalLinkTypePremiumFeatures } +// The link is a link with a Telegram Premium gift code. Call checkPremiumGiftCode with the given code to process the link. If the code is valid and the user wants to apply it, then call applyPremiumGiftCode +type InternalLinkTypePremiumGiftCode struct { + meta + // The Telegram Premium gift code + Code string `json:"code"` +} + +func (entity *InternalLinkTypePremiumGiftCode) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypePremiumGiftCode + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypePremiumGiftCode) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypePremiumGiftCode) GetType() string { + return TypeInternalLinkTypePremiumGiftCode +} + +func (*InternalLinkTypePremiumGiftCode) InternalLinkTypeType() string { + return TypeInternalLinkTypePremiumGiftCode +} + // The link is a link to the privacy and security section of the app settings type InternalLinkTypePrivacyAndSecuritySettings struct{ meta @@ -35698,7 +37530,7 @@ func (*InternalLinkTypeVideoChat) InternalLinkTypeType() string { return TypeInternalLinkTypeVideoChat } -// The link is a link to a Web App. Call searchPublicChat with the given bot username, check that the user is a bot, then call searchWebApp with the received bot and the given web_app_short_name. Process received foundWebApp by showing a confirmation dialog if needed. If the bot can be added to attachment or side menu, but isn't added yet, then show a disclaimer about Mini Apps being a third-party apps instead of the dialog and ask the user to accept their Terms of service. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. Then call getWebAppLinkUrl and open the returned URL as a Web App +// The link is a link to a Web App. Call searchPublicChat with the given bot username, check that the user is a bot, then call searchWebApp with the received bot and the given web_app_short_name. Process received foundWebApp by showing a confirmation dialog if needed. If the bot can be added to attachment or side menu, but isn't added yet, then show a disclaimer about Mini Apps being a third-party apps instead of the dialog and ask the user to accept their Terms of service. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. Then, call getWebAppLinkUrl and open the returned URL as a Web App type InternalLinkTypeWebApp struct { meta // Username of the bot that owns the Web App @@ -35765,7 +37597,7 @@ type MessageLinkInfo struct { MessageThreadId int64 `json:"message_thread_id"` // If found, the linked message; may be null Message *Message `json:"message"` - // Timestamp from which the video/audio/video note/voice note playing must start, in seconds; 0 if not specified. The media can be in the message content or in its web page preview + // Timestamp from which the video/audio/video note/voice note/story playing must start, in seconds; 0 if not specified. The media can be in the message content or in its web page preview MediaTimestamp int32 `json:"media_timestamp"` // True, if the whole media album to which the message belongs is linked ForAlbum bool `json:"for_album"` @@ -35787,6 +37619,56 @@ func (*MessageLinkInfo) GetType() string { return TypeMessageLinkInfo } +// Contains an HTTPS link to boost a chat +type ChatBoostLink struct { + meta + // The link + Link string `json:"link"` + // True, if the link will work for non-members of the chat + IsPublic bool `json:"is_public"` +} + +func (entity *ChatBoostLink) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatBoostLink + + return json.Marshal((*stub)(entity)) +} + +func (*ChatBoostLink) GetClass() string { + return ClassChatBoostLink +} + +func (*ChatBoostLink) GetType() string { + return TypeChatBoostLink +} + +// Contains information about a link to boost a chat +type ChatBoostLinkInfo struct { + meta + // True, if the link will work for non-members of the chat + IsPublic bool `json:"is_public"` + // Identifier of the chat to which the link points; 0 if the chat isn't found + ChatId int64 `json:"chat_id"` +} + +func (entity *ChatBoostLinkInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatBoostLinkInfo + + return json.Marshal((*stub)(entity)) +} + +func (*ChatBoostLinkInfo) GetClass() string { + return ClassChatBoostLinkInfo +} + +func (*ChatBoostLinkInfo) GetType() string { + return TypeChatBoostLinkInfo +} + // The main block list that disallows writing messages to the current user, receiving their status and photo, viewing of stories, and some other actions type BlockListMain struct{ meta @@ -37325,6 +39207,29 @@ func (*TopChatCategoryForwardChats) TopChatCategoryType() string { return TypeTopChatCategoryForwardChats } +// Contains 0-based match position +type FoundPosition struct { + meta + // The position of the match + Position int32 `json:"position"` +} + +func (entity *FoundPosition) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FoundPosition + + return json.Marshal((*stub)(entity)) +} + +func (*FoundPosition) GetClass() string { + return ClassFoundPosition +} + +func (*FoundPosition) GetType() string { + return TypeFoundPosition +} + // Contains 0-based positions of matched objects type FoundPositions struct { meta @@ -38517,7 +40422,7 @@ type ChatStatisticsChannel struct { MeanViewCount *StatisticalValue `json:"mean_view_count"` // Mean number of times the recently sent messages was shared MeanShareCount *StatisticalValue `json:"mean_share_count"` - // A percentage of users with enabled notifications for the chat + // A percentage of users with enabled notifications for the chat; 0-100 EnabledNotificationsPercentage float64 `json:"enabled_notifications_percentage"` // A graph containing number of members in the chat MemberCountGraph StatisticalGraph `json:"member_count_graph"` @@ -39062,10 +40967,8 @@ type UpdateMessageSendFailed struct { Message *Message `json:"message"` // The previous temporary message identifier OldMessageId int64 `json:"old_message_id"` - // An error code - ErrorCode int32 `json:"error_code"` - // Error message - ErrorMessage string `json:"error_message"` + // The cause of the message sending failure + Error *Error `json:"error"` } func (entity *UpdateMessageSendFailed) MarshalJSON() ([]byte, error) { @@ -39465,6 +41368,64 @@ func (*UpdateChatPhoto) UpdateType() string { return TypeUpdateChatPhoto } +// A chat accent color has changed +type UpdateChatAccentColor struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // The new chat accent color identifier + AccentColorId int32 `json:"accent_color_id"` +} + +func (entity *UpdateChatAccentColor) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateChatAccentColor + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateChatAccentColor) GetClass() string { + return ClassUpdate +} + +func (*UpdateChatAccentColor) GetType() string { + return TypeUpdateChatAccentColor +} + +func (*UpdateChatAccentColor) UpdateType() string { + return TypeUpdateChatAccentColor +} + +// A chat's custom emoji for reply background has changed +type UpdateChatBackgroundCustomEmoji struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // The new tdentifier of a custom emoji to be shown on the reply header background + BackgroundCustomEmojiId JsonInt64 `json:"background_custom_emoji_id"` +} + +func (entity *UpdateChatBackgroundCustomEmoji) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateChatBackgroundCustomEmoji + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateChatBackgroundCustomEmoji) GetClass() string { + return ClassUpdate +} + +func (*UpdateChatBackgroundCustomEmoji) GetType() string { + return TypeUpdateChatBackgroundCustomEmoji +} + +func (*UpdateChatBackgroundCustomEmoji) UpdateType() string { + return TypeUpdateChatBackgroundCustomEmoji +} + // Chat permissions was changed type UpdateChatPermissions struct { meta @@ -39494,12 +41455,12 @@ func (*UpdateChatPermissions) UpdateType() string { return TypeUpdateChatPermissions } -// The last message of a chat was changed. If last_message is null, then the last message in the chat became unknown. Some new unknown messages might be added to the chat in this case +// The last message of a chat was changed type UpdateChatLastMessage struct { meta // Chat identifier ChatId int64 `json:"chat_id"` - // The new last message in the chat; may be null + // The new last message in the chat; may be null if the last message became unknown. While the last message is unknown, new messages can be added to the chat without corresponding updateNewMessage update LastMessage *Message `json:"last_message"` // The new chat positions in the chat lists Positions []*ChatPosition `json:"positions"` @@ -41492,12 +43453,10 @@ type UpdateStorySendFailed struct { meta // The failed to send story Story *Story `json:"story"` - // The cause of the failure; may be null if unknown - Error CanSendStoryResult `json:"error"` - // An error code - ErrorCode int32 `json:"error_code"` - // Error message - ErrorMessage string `json:"error_message"` + // The cause of the story sending failure + Error *Error `json:"error"` + // Type of the error; may be null if unknown + ErrorType CanSendStoryResult `json:"error_type"` } func (entity *UpdateStorySendFailed) MarshalJSON() ([]byte, error) { @@ -41523,9 +43482,8 @@ func (*UpdateStorySendFailed) UpdateType() string { func (updateStorySendFailed *UpdateStorySendFailed) UnmarshalJSON(data []byte) error { var tmp struct { Story *Story `json:"story"` - Error json.RawMessage `json:"error"` - ErrorCode int32 `json:"error_code"` - ErrorMessage string `json:"error_message"` + Error *Error `json:"error"` + ErrorType json.RawMessage `json:"error_type"` } err := json.Unmarshal(data, &tmp) @@ -41534,11 +43492,10 @@ func (updateStorySendFailed *UpdateStorySendFailed) UnmarshalJSON(data []byte) e } updateStorySendFailed.Story = tmp.Story - updateStorySendFailed.ErrorCode = tmp.ErrorCode - updateStorySendFailed.ErrorMessage = tmp.ErrorMessage + updateStorySendFailed.Error = tmp.Error - fieldError, _ := UnmarshalCanSendStoryResult(tmp.Error) - updateStorySendFailed.Error = fieldError + fieldErrorType, _ := UnmarshalCanSendStoryResult(tmp.ErrorType) + updateStorySendFailed.ErrorType = fieldErrorType return nil } @@ -41984,6 +43941,35 @@ func (*UpdateChatThemes) UpdateType() string { return TypeUpdateChatThemes } +// The list of supported accent colors has changed +type UpdateAccentColors struct { + meta + // Information about supported colors; colors with identifiers 0 (red), 1 (orange), 2 (purple/violet), 3 (green), 4 (cyan), 5 (blue), 6 (pink) must always be supported and aren't included in the list. The exact colors for the accent colors with identifiers 0-6 must be taken from the app theme + Colors []*AccentColor `json:"colors"` + // The list of accent color identifiers, which can be set through setAccentColor and setChatAccentColor. The colors must be shown in the specififed order + AvailableAccentColorIds []int32 `json:"available_accent_color_ids"` +} + +func (entity *UpdateAccentColors) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateAccentColors + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateAccentColors) GetClass() string { + return ClassUpdate +} + +func (*UpdateAccentColors) GetType() string { + return TypeUpdateAccentColors +} + +func (*UpdateAccentColors) UpdateType() string { + return TypeUpdateAccentColors +} + // Some language pack strings have been updated type UpdateLanguagePackStrings struct { meta @@ -42982,6 +44968,35 @@ func (*UpdateNewChatJoinRequest) UpdateType() string { return TypeUpdateNewChatJoinRequest } +// A chat boost has changed; for bots only +type UpdateChatBoost struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // New information about the boost + Boost *ChatBoost `json:"boost"` +} + +func (entity *UpdateChatBoost) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateChatBoost + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateChatBoost) GetClass() string { + return ClassUpdate +} + +func (*UpdateChatBoost) GetType() string { + return TypeUpdateChatBoost +} + +func (*UpdateChatBoost) UpdateType() string { + return TypeUpdateChatBoost +} + // Contains a list of updates type Updates struct { meta diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 21a0f6c..3af611e 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -582,6 +582,83 @@ func UnmarshalListOfInputChatPhoto(dataList []json.RawMessage) ([]InputChatPhoto return list, nil } +func UnmarshalPremiumGiveawayParticipantStatus(data json.RawMessage) (PremiumGiveawayParticipantStatus, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypePremiumGiveawayParticipantStatusEligible: + return UnmarshalPremiumGiveawayParticipantStatusEligible(data) + + case TypePremiumGiveawayParticipantStatusParticipating: + return UnmarshalPremiumGiveawayParticipantStatusParticipating(data) + + case TypePremiumGiveawayParticipantStatusAlreadyWasMember: + return UnmarshalPremiumGiveawayParticipantStatusAlreadyWasMember(data) + + case TypePremiumGiveawayParticipantStatusAdministrator: + return UnmarshalPremiumGiveawayParticipantStatusAdministrator(data) + + case TypePremiumGiveawayParticipantStatusDisallowedCountry: + return UnmarshalPremiumGiveawayParticipantStatusDisallowedCountry(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfPremiumGiveawayParticipantStatus(dataList []json.RawMessage) ([]PremiumGiveawayParticipantStatus, error) { + list := []PremiumGiveawayParticipantStatus{} + + for _, data := range dataList { + entity, err := UnmarshalPremiumGiveawayParticipantStatus(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalPremiumGiveawayInfo(data json.RawMessage) (PremiumGiveawayInfo, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypePremiumGiveawayInfoOngoing: + return UnmarshalPremiumGiveawayInfoOngoing(data) + + case TypePremiumGiveawayInfoCompleted: + return UnmarshalPremiumGiveawayInfoCompleted(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfPremiumGiveawayInfo(dataList []json.RawMessage) ([]PremiumGiveawayInfo, error) { + list := []PremiumGiveawayInfo{} + + for _, data := range dataList { + entity, err := UnmarshalPremiumGiveawayInfo(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalChatMemberStatus(data json.RawMessage) (ChatMemberStatus, error) { var meta meta @@ -837,7 +914,7 @@ func UnmarshalListOfMessageSender(dataList []json.RawMessage) ([]MessageSender, return list, nil } -func UnmarshalMessageForwardOrigin(data json.RawMessage) (MessageForwardOrigin, error) { +func UnmarshalMessageOrigin(data json.RawMessage) (MessageOrigin, error) { var meta meta err := json.Unmarshal(data, &meta) @@ -846,31 +923,28 @@ func UnmarshalMessageForwardOrigin(data json.RawMessage) (MessageForwardOrigin, } switch meta.Type { - case TypeMessageForwardOriginUser: - return UnmarshalMessageForwardOriginUser(data) + case TypeMessageOriginUser: + return UnmarshalMessageOriginUser(data) - case TypeMessageForwardOriginChat: - return UnmarshalMessageForwardOriginChat(data) + case TypeMessageOriginHiddenUser: + return UnmarshalMessageOriginHiddenUser(data) - case TypeMessageForwardOriginHiddenUser: - return UnmarshalMessageForwardOriginHiddenUser(data) + case TypeMessageOriginChat: + return UnmarshalMessageOriginChat(data) - case TypeMessageForwardOriginChannel: - return UnmarshalMessageForwardOriginChannel(data) - - case TypeMessageForwardOriginMessageImport: - return UnmarshalMessageForwardOriginMessageImport(data) + case TypeMessageOriginChannel: + return UnmarshalMessageOriginChannel(data) default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } } -func UnmarshalListOfMessageForwardOrigin(dataList []json.RawMessage) ([]MessageForwardOrigin, error) { - list := []MessageForwardOrigin{} +func UnmarshalListOfMessageOrigin(dataList []json.RawMessage) ([]MessageOrigin, error) { + list := []MessageOrigin{} for _, data := range dataList { - entity, err := UnmarshalMessageForwardOrigin(data) + entity, err := UnmarshalMessageOrigin(data) if err != nil { return nil, err } @@ -982,6 +1056,40 @@ func UnmarshalListOfMessageReplyTo(dataList []json.RawMessage) ([]MessageReplyTo return list, nil } +func UnmarshalInputMessageReplyTo(data json.RawMessage) (InputMessageReplyTo, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeInputMessageReplyToMessage: + return UnmarshalInputMessageReplyToMessage(data) + + case TypeInputMessageReplyToStory: + return UnmarshalInputMessageReplyToStory(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfInputMessageReplyTo(dataList []json.RawMessage) ([]InputMessageReplyTo, error) { + list := []InputMessageReplyTo{} + + for _, data := range dataList { + entity, err := UnmarshalInputMessageReplyTo(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalMessageSource(data json.RawMessage) (MessageSource, error) { var meta meta @@ -1883,6 +1991,9 @@ func UnmarshalInputInvoice(data json.RawMessage) (InputInvoice, error) { case TypeInputInvoiceName: return UnmarshalInputInvoiceName(data) + case TypeInputInvoiceTelegram: + return UnmarshalInputInvoiceTelegram(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -2415,6 +2526,15 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessageGiftedPremium: return UnmarshalMessageGiftedPremium(data) + case TypeMessagePremiumGiftCode: + return UnmarshalMessagePremiumGiftCode(data) + + case TypeMessagePremiumGiveawayCreated: + return UnmarshalMessagePremiumGiveawayCreated(data) + + case TypeMessagePremiumGiveaway: + return UnmarshalMessagePremiumGiveaway(data) + case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) @@ -2424,9 +2544,6 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessageChatShared: return UnmarshalMessageChatShared(data) - case TypeMessageWebsiteConnected: - return UnmarshalMessageWebsiteConnected(data) - case TypeMessageBotWriteAccessAllowed: return UnmarshalMessageBotWriteAccessAllowed(data) @@ -2524,6 +2641,9 @@ func UnmarshalTextEntityType(data json.RawMessage) (TextEntityType, error) { case TypeTextEntityTypePreCode: return UnmarshalTextEntityTypePreCode(data) + case TypeTextEntityTypeBlockQuote: + return UnmarshalTextEntityTypeBlockQuote(data) + case TypeTextEntityTypeTextUrl: return UnmarshalTextEntityTypeTextUrl(data) @@ -2955,6 +3075,9 @@ func UnmarshalStoryAreaType(data json.RawMessage) (StoryAreaType, error) { case TypeStoryAreaTypeVenue: return UnmarshalStoryAreaTypeVenue(data) + case TypeStoryAreaTypeSuggestedReaction: + return UnmarshalStoryAreaTypeSuggestedReaction(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -2992,6 +3115,9 @@ func UnmarshalInputStoryAreaType(data json.RawMessage) (InputStoryAreaType, erro case TypeInputStoryAreaTypePreviousVenue: return UnmarshalInputStoryAreaTypePreviousVenue(data) + case TypeInputStoryAreaTypeSuggestedReaction: + return UnmarshalInputStoryAreaTypeSuggestedReaction(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -3116,6 +3242,43 @@ func UnmarshalListOfStoryList(dataList []json.RawMessage) ([]StoryList, error) { return list, nil } +func UnmarshalChatBoostSource(data json.RawMessage) (ChatBoostSource, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeChatBoostSourceGiftCode: + return UnmarshalChatBoostSourceGiftCode(data) + + case TypeChatBoostSourceGiveaway: + return UnmarshalChatBoostSourceGiveaway(data) + + case TypeChatBoostSourcePremium: + return UnmarshalChatBoostSourcePremium(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfChatBoostSource(dataList []json.RawMessage) ([]ChatBoostSource, error) { + list := []ChatBoostSource{} + + for _, data := range dataList { + entity, err := UnmarshalChatBoostSource(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalCallDiscardReason(data json.RawMessage) (CallDiscardReason, error) { var meta meta @@ -3436,6 +3599,46 @@ func UnmarshalListOfSpeechRecognitionResult(dataList []json.RawMessage) ([]Speec return list, nil } +func UnmarshalBotWriteAccessAllowReason(data json.RawMessage) (BotWriteAccessAllowReason, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeBotWriteAccessAllowReasonConnectedWebsite: + return UnmarshalBotWriteAccessAllowReasonConnectedWebsite(data) + + case TypeBotWriteAccessAllowReasonAddedToAttachmentMenu: + return UnmarshalBotWriteAccessAllowReasonAddedToAttachmentMenu(data) + + case TypeBotWriteAccessAllowReasonLaunchedWebApp: + return UnmarshalBotWriteAccessAllowReasonLaunchedWebApp(data) + + case TypeBotWriteAccessAllowReasonAcceptedRequest: + return UnmarshalBotWriteAccessAllowReasonAcceptedRequest(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfBotWriteAccessAllowReason(dataList []json.RawMessage) ([]BotWriteAccessAllowReason, error) { + list := []BotWriteAccessAllowReason{} + + for _, data := range dataList { + entity, err := UnmarshalBotWriteAccessAllowReason(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalInputInlineQueryResult(data json.RawMessage) (InputInlineQueryResult, error) { var meta meta @@ -3716,6 +3919,12 @@ func UnmarshalChatEventAction(data json.RawMessage) (ChatEventAction, error) { case TypeChatEventActiveUsernamesChanged: return UnmarshalChatEventActiveUsernamesChanged(data) + case TypeChatEventAccentColorChanged: + return UnmarshalChatEventAccentColorChanged(data) + + case TypeChatEventBackgroundCustomEmojiChanged: + return UnmarshalChatEventBackgroundCustomEmojiChanged(data) + case TypeChatEventHasProtectedContentToggled: return UnmarshalChatEventHasProtectedContentToggled(data) @@ -3889,6 +4098,9 @@ func UnmarshalPremiumLimitType(data json.RawMessage) (PremiumLimitType, error) { case TypePremiumLimitTypeStoryCaptionLength: return UnmarshalPremiumLimitTypeStoryCaptionLength(data) + case TypePremiumLimitTypeStorySuggestedReactionAreaCount: + return UnmarshalPremiumLimitTypeStorySuggestedReactionAreaCount(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -3965,6 +4177,12 @@ func UnmarshalPremiumFeature(data json.RawMessage) (PremiumFeature, error) { case TypePremiumFeatureUpgradedStories: return UnmarshalPremiumFeatureUpgradedStories(data) + case TypePremiumFeatureChatBoost: + return UnmarshalPremiumFeatureChatBoost(data) + + case TypePremiumFeatureAccentColor: + return UnmarshalPremiumFeatureAccentColor(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -4088,6 +4306,12 @@ func UnmarshalStorePaymentPurpose(data json.RawMessage) (StorePaymentPurpose, er case TypeStorePaymentPurposeGiftedPremium: return UnmarshalStorePaymentPurposeGiftedPremium(data) + case TypeStorePaymentPurposePremiumGiftCodes: + return UnmarshalStorePaymentPurposePremiumGiftCodes(data) + + case TypeStorePaymentPurposePremiumGiveaway: + return UnmarshalStorePaymentPurposePremiumGiveaway(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -4107,6 +4331,40 @@ func UnmarshalListOfStorePaymentPurpose(dataList []json.RawMessage) ([]StorePaym return list, nil } +func UnmarshalTelegramPaymentPurpose(data json.RawMessage) (TelegramPaymentPurpose, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeTelegramPaymentPurposePremiumGiftCodes: + return UnmarshalTelegramPaymentPurposePremiumGiftCodes(data) + + case TypeTelegramPaymentPurposePremiumGiveaway: + return UnmarshalTelegramPaymentPurposePremiumGiveaway(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfTelegramPaymentPurpose(dataList []json.RawMessage) ([]TelegramPaymentPurpose, error) { + list := []TelegramPaymentPurpose{} + + for _, data := range dataList { + entity, err := UnmarshalTelegramPaymentPurpose(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalDeviceToken(data json.RawMessage) (DeviceToken, error) { var meta meta @@ -4297,6 +4555,9 @@ func UnmarshalCanSendStoryResult(data json.RawMessage) (CanSendStoryResult, erro case TypeCanSendStoryResultPremiumNeeded: return UnmarshalCanSendStoryResultPremiumNeeded(data) + case TypeCanSendStoryResultBoostNeeded: + return UnmarshalCanSendStoryResultBoostNeeded(data) + case TypeCanSendStoryResultActiveStoryLimitExceeded: return UnmarshalCanSendStoryResultActiveStoryLimitExceeded(data) @@ -4567,6 +4828,12 @@ func UnmarshalPushMessageContent(data json.RawMessage) (PushMessageContent, erro case TypePushMessageContentPoll: return UnmarshalPushMessageContentPoll(data) + case TypePushMessageContentPremiumGiftCode: + return UnmarshalPushMessageContentPremiumGiftCode(data) + + case TypePushMessageContentPremiumGiveaway: + return UnmarshalPushMessageContentPremiumGiveaway(data) + case TypePushMessageContentScreenshotTaken: return UnmarshalPushMessageContentScreenshotTaken(data) @@ -5169,6 +5436,9 @@ func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { case TypeInternalLinkTypeChangePhoneNumber: return UnmarshalInternalLinkTypeChangePhoneNumber(data) + case TypeInternalLinkTypeChatBoost: + return UnmarshalInternalLinkTypeChatBoost(data) + case TypeInternalLinkTypeChatFolderInvite: return UnmarshalInternalLinkTypeChatFolderInvite(data) @@ -5214,6 +5484,9 @@ func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { case TypeInternalLinkTypePremiumFeatures: return UnmarshalInternalLinkTypePremiumFeatures(data) + case TypeInternalLinkTypePremiumGiftCode: + return UnmarshalInternalLinkTypePremiumGiftCode(data) + case TypeInternalLinkTypePrivacyAndSecuritySettings: return UnmarshalInternalLinkTypePrivacyAndSecuritySettings(data) @@ -5989,6 +6262,12 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateChatPhoto: return UnmarshalUpdateChatPhoto(data) + case TypeUpdateChatAccentColor: + return UnmarshalUpdateChatAccentColor(data) + + case TypeUpdateChatBackgroundCustomEmoji: + return UnmarshalUpdateChatBackgroundCustomEmoji(data) + case TypeUpdateChatPermissions: return UnmarshalUpdateChatPermissions(data) @@ -6211,6 +6490,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateChatThemes: return UnmarshalUpdateChatThemes(data) + case TypeUpdateAccentColors: + return UnmarshalUpdateAccentColors(data) + case TypeUpdateLanguagePackStrings: return UnmarshalUpdateLanguagePackStrings(data) @@ -6292,6 +6574,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateNewChatJoinRequest: return UnmarshalUpdateNewChatJoinRequest(data) + case TypeUpdateChatBoost: + return UnmarshalUpdateChatBoost(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -7252,6 +7537,94 @@ func UnmarshalPremiumStatePaymentOption(data json.RawMessage) (*PremiumStatePaym return &resp, err } +func UnmarshalPremiumGiftCodePaymentOption(data json.RawMessage) (*PremiumGiftCodePaymentOption, error) { + var resp PremiumGiftCodePaymentOption + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPremiumGiftCodePaymentOptions(data json.RawMessage) (*PremiumGiftCodePaymentOptions, error) { + var resp PremiumGiftCodePaymentOptions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPremiumGiftCodeInfo(data json.RawMessage) (*PremiumGiftCodeInfo, error) { + var resp PremiumGiftCodeInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPremiumGiveawayParticipantStatusEligible(data json.RawMessage) (*PremiumGiveawayParticipantStatusEligible, error) { + var resp PremiumGiveawayParticipantStatusEligible + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPremiumGiveawayParticipantStatusParticipating(data json.RawMessage) (*PremiumGiveawayParticipantStatusParticipating, error) { + var resp PremiumGiveawayParticipantStatusParticipating + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPremiumGiveawayParticipantStatusAlreadyWasMember(data json.RawMessage) (*PremiumGiveawayParticipantStatusAlreadyWasMember, error) { + var resp PremiumGiveawayParticipantStatusAlreadyWasMember + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPremiumGiveawayParticipantStatusAdministrator(data json.RawMessage) (*PremiumGiveawayParticipantStatusAdministrator, error) { + var resp PremiumGiveawayParticipantStatusAdministrator + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPremiumGiveawayParticipantStatusDisallowedCountry(data json.RawMessage) (*PremiumGiveawayParticipantStatusDisallowedCountry, error) { + var resp PremiumGiveawayParticipantStatusDisallowedCountry + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPremiumGiveawayInfoOngoing(data json.RawMessage) (*PremiumGiveawayInfoOngoing, error) { + var resp PremiumGiveawayInfoOngoing + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPremiumGiveawayInfoCompleted(data json.RawMessage) (*PremiumGiveawayInfoCompleted, error) { + var resp PremiumGiveawayInfoCompleted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAccentColor(data json.RawMessage) (*AccentColor, error) { + var resp AccentColor + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalEmojiStatus(data json.RawMessage) (*EmojiStatus, error) { var resp EmojiStatus @@ -7732,40 +8105,32 @@ func UnmarshalMessageViewers(data json.RawMessage) (*MessageViewers, error) { return &resp, err } -func UnmarshalMessageForwardOriginUser(data json.RawMessage) (*MessageForwardOriginUser, error) { - var resp MessageForwardOriginUser +func UnmarshalMessageOriginUser(data json.RawMessage) (*MessageOriginUser, error) { + var resp MessageOriginUser err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalMessageForwardOriginChat(data json.RawMessage) (*MessageForwardOriginChat, error) { - var resp MessageForwardOriginChat +func UnmarshalMessageOriginHiddenUser(data json.RawMessage) (*MessageOriginHiddenUser, error) { + var resp MessageOriginHiddenUser err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalMessageForwardOriginHiddenUser(data json.RawMessage) (*MessageForwardOriginHiddenUser, error) { - var resp MessageForwardOriginHiddenUser +func UnmarshalMessageOriginChat(data json.RawMessage) (*MessageOriginChat, error) { + var resp MessageOriginChat err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalMessageForwardOriginChannel(data json.RawMessage) (*MessageForwardOriginChannel, error) { - var resp MessageForwardOriginChannel - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalMessageForwardOriginMessageImport(data json.RawMessage) (*MessageForwardOriginMessageImport, error) { - var resp MessageForwardOriginMessageImport +func UnmarshalMessageOriginChannel(data json.RawMessage) (*MessageOriginChannel, error) { + var resp MessageOriginChannel err := json.Unmarshal(data, &resp) @@ -7796,6 +8161,14 @@ func UnmarshalMessageForwardInfo(data json.RawMessage) (*MessageForwardInfo, err return &resp, err } +func UnmarshalMessageImportInfo(data json.RawMessage) (*MessageImportInfo, error) { + var resp MessageImportInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageReplyInfo(data json.RawMessage) (*MessageReplyInfo, error) { var resp MessageReplyInfo @@ -7860,6 +8233,22 @@ func UnmarshalMessageReplyToStory(data json.RawMessage) (*MessageReplyToStory, e return &resp, err } +func UnmarshalInputMessageReplyToMessage(data json.RawMessage) (*InputMessageReplyToMessage, error) { + var resp InputMessageReplyToMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputMessageReplyToStory(data json.RawMessage) (*InputMessageReplyToStory, error) { + var resp InputMessageReplyToStory + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessage(data json.RawMessage) (*Message, error) { var resp Message @@ -8668,6 +9057,14 @@ func UnmarshalForumTopics(data json.RawMessage) (*ForumTopics, error) { return &resp, err } +func UnmarshalLinkPreviewOptions(data json.RawMessage) (*LinkPreviewOptions, error) { + var resp LinkPreviewOptions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalRichTextPlain(data json.RawMessage) (*RichTextPlain, error) { var resp RichTextPlain @@ -9340,6 +9737,14 @@ func UnmarshalInputInvoiceName(data json.RawMessage) (*InputInvoiceName, error) return &resp, err } +func UnmarshalInputInvoiceTelegram(data json.RawMessage) (*InputInvoiceTelegram, error) { + var resp InputInvoiceTelegram + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageExtendedMediaPreview(data json.RawMessage) (*MessageExtendedMediaPreview, error) { var resp MessageExtendedMediaPreview @@ -9372,6 +9777,14 @@ func UnmarshalMessageExtendedMediaUnsupported(data json.RawMessage) (*MessageExt return &resp, err } +func UnmarshalPremiumGiveawayParameters(data json.RawMessage) (*PremiumGiveawayParameters, error) { + var resp PremiumGiveawayParameters + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalDatedFile(data json.RawMessage) (*DatedFile, error) { var resp DatedFile @@ -10364,6 +10777,30 @@ func UnmarshalMessageGiftedPremium(data json.RawMessage) (*MessageGiftedPremium, return &resp, err } +func UnmarshalMessagePremiumGiftCode(data json.RawMessage) (*MessagePremiumGiftCode, error) { + var resp MessagePremiumGiftCode + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessagePremiumGiveawayCreated(data json.RawMessage) (*MessagePremiumGiveawayCreated, error) { + var resp MessagePremiumGiveawayCreated + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessagePremiumGiveaway(data json.RawMessage) (*MessagePremiumGiveaway, error) { + var resp MessagePremiumGiveaway + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageContactRegistered(data json.RawMessage) (*MessageContactRegistered, error) { var resp MessageContactRegistered @@ -10388,14 +10825,6 @@ func UnmarshalMessageChatShared(data json.RawMessage) (*MessageChatShared, error return &resp, err } -func UnmarshalMessageWebsiteConnected(data json.RawMessage) (*MessageWebsiteConnected, error) { - var resp MessageWebsiteConnected - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - func UnmarshalMessageBotWriteAccessAllowed(data json.RawMessage) (*MessageBotWriteAccessAllowed, error) { var resp MessageBotWriteAccessAllowed @@ -10580,6 +11009,14 @@ func UnmarshalTextEntityTypePreCode(data json.RawMessage) (*TextEntityTypePreCod return &resp, err } +func UnmarshalTextEntityTypeBlockQuote(data json.RawMessage) (*TextEntityTypeBlockQuote, error) { + var resp TextEntityTypeBlockQuote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalTextEntityTypeTextUrl(data json.RawMessage) (*TextEntityTypeTextUrl, error) { var resp TextEntityTypeTextUrl @@ -11244,6 +11681,14 @@ func UnmarshalStoryAreaTypeVenue(data json.RawMessage) (*StoryAreaTypeVenue, err return &resp, err } +func UnmarshalStoryAreaTypeSuggestedReaction(data json.RawMessage) (*StoryAreaTypeSuggestedReaction, error) { + var resp StoryAreaTypeSuggestedReaction + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStoryArea(data json.RawMessage) (*StoryArea, error) { var resp StoryArea @@ -11276,6 +11721,14 @@ func UnmarshalInputStoryAreaTypePreviousVenue(data json.RawMessage) (*InputStory return &resp, err } +func UnmarshalInputStoryAreaTypeSuggestedReaction(data json.RawMessage) (*InputStoryAreaTypeSuggestedReaction, error) { + var resp InputStoryAreaTypeSuggestedReaction + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInputStoryArea(data json.RawMessage) (*InputStoryArea, error) { var resp InputStoryArea @@ -11396,6 +11849,78 @@ func UnmarshalChatActiveStories(data json.RawMessage) (*ChatActiveStories, error return &resp, err } +func UnmarshalChatBoostSourceGiftCode(data json.RawMessage) (*ChatBoostSourceGiftCode, error) { + var resp ChatBoostSourceGiftCode + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatBoostSourceGiveaway(data json.RawMessage) (*ChatBoostSourceGiveaway, error) { + var resp ChatBoostSourceGiveaway + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatBoostSourcePremium(data json.RawMessage) (*ChatBoostSourcePremium, error) { + var resp ChatBoostSourcePremium + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPrepaidPremiumGiveaway(data json.RawMessage) (*PrepaidPremiumGiveaway, error) { + var resp PrepaidPremiumGiveaway + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatBoostStatus(data json.RawMessage) (*ChatBoostStatus, error) { + var resp ChatBoostStatus + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatBoost(data json.RawMessage) (*ChatBoost, error) { + var resp ChatBoost + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFoundChatBoosts(data json.RawMessage) (*FoundChatBoosts, error) { + var resp FoundChatBoosts + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatBoostSlot(data json.RawMessage) (*ChatBoostSlot, error) { + var resp ChatBoostSlot + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatBoostSlots(data json.RawMessage) (*ChatBoostSlots, error) { + var resp ChatBoostSlots + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalCallDiscardReasonEmpty(data json.RawMessage) (*CallDiscardReasonEmpty, error) { var resp CallDiscardReasonEmpty @@ -11844,6 +12369,38 @@ func UnmarshalSentWebAppMessage(data json.RawMessage) (*SentWebAppMessage, error return &resp, err } +func UnmarshalBotWriteAccessAllowReasonConnectedWebsite(data json.RawMessage) (*BotWriteAccessAllowReasonConnectedWebsite, error) { + var resp BotWriteAccessAllowReasonConnectedWebsite + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBotWriteAccessAllowReasonAddedToAttachmentMenu(data json.RawMessage) (*BotWriteAccessAllowReasonAddedToAttachmentMenu, error) { + var resp BotWriteAccessAllowReasonAddedToAttachmentMenu + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBotWriteAccessAllowReasonLaunchedWebApp(data json.RawMessage) (*BotWriteAccessAllowReasonLaunchedWebApp, error) { + var resp BotWriteAccessAllowReasonLaunchedWebApp + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBotWriteAccessAllowReasonAcceptedRequest(data json.RawMessage) (*BotWriteAccessAllowReasonAcceptedRequest, error) { + var resp BotWriteAccessAllowReasonAcceptedRequest + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalHttpUrl(data json.RawMessage) (*HttpUrl, error) { var resp HttpUrl @@ -12332,6 +12889,22 @@ func UnmarshalChatEventActiveUsernamesChanged(data json.RawMessage) (*ChatEventA return &resp, err } +func UnmarshalChatEventAccentColorChanged(data json.RawMessage) (*ChatEventAccentColorChanged, error) { + var resp ChatEventAccentColorChanged + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatEventBackgroundCustomEmojiChanged(data json.RawMessage) (*ChatEventBackgroundCustomEmojiChanged, error) { + var resp ChatEventBackgroundCustomEmojiChanged + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatEventHasProtectedContentToggled(data json.RawMessage) (*ChatEventHasProtectedContentToggled, error) { var resp ChatEventHasProtectedContentToggled @@ -12700,6 +13273,14 @@ func UnmarshalPremiumLimitTypeStoryCaptionLength(data json.RawMessage) (*Premium return &resp, err } +func UnmarshalPremiumLimitTypeStorySuggestedReactionAreaCount(data json.RawMessage) (*PremiumLimitTypeStorySuggestedReactionAreaCount, error) { + var resp PremiumLimitTypeStorySuggestedReactionAreaCount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPremiumFeatureIncreasedLimits(data json.RawMessage) (*PremiumFeatureIncreasedLimits, error) { var resp PremiumFeatureIncreasedLimits @@ -12828,6 +13409,22 @@ func UnmarshalPremiumFeatureUpgradedStories(data json.RawMessage) (*PremiumFeatu return &resp, err } +func UnmarshalPremiumFeatureChatBoost(data json.RawMessage) (*PremiumFeatureChatBoost, error) { + var resp PremiumFeatureChatBoost + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPremiumFeatureAccentColor(data json.RawMessage) (*PremiumFeatureAccentColor, error) { + var resp PremiumFeatureAccentColor + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPremiumStoryFeaturePriorityOrder(data json.RawMessage) (*PremiumStoryFeaturePriorityOrder, error) { var resp PremiumStoryFeaturePriorityOrder @@ -12964,6 +13561,38 @@ func UnmarshalStorePaymentPurposeGiftedPremium(data json.RawMessage) (*StorePaym return &resp, err } +func UnmarshalStorePaymentPurposePremiumGiftCodes(data json.RawMessage) (*StorePaymentPurposePremiumGiftCodes, error) { + var resp StorePaymentPurposePremiumGiftCodes + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStorePaymentPurposePremiumGiveaway(data json.RawMessage) (*StorePaymentPurposePremiumGiveaway, error) { + var resp StorePaymentPurposePremiumGiveaway + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTelegramPaymentPurposePremiumGiftCodes(data json.RawMessage) (*TelegramPaymentPurposePremiumGiftCodes, error) { + var resp TelegramPaymentPurposePremiumGiftCodes + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTelegramPaymentPurposePremiumGiveaway(data json.RawMessage) (*TelegramPaymentPurposePremiumGiveaway, error) { + var resp TelegramPaymentPurposePremiumGiveaway + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalDeviceTokenFirebaseCloudMessaging(data json.RawMessage) (*DeviceTokenFirebaseCloudMessaging, error) { var resp DeviceTokenFirebaseCloudMessaging @@ -13180,6 +13809,14 @@ func UnmarshalCanSendStoryResultPremiumNeeded(data json.RawMessage) (*CanSendSto return &resp, err } +func UnmarshalCanSendStoryResultBoostNeeded(data json.RawMessage) (*CanSendStoryResultBoostNeeded, error) { + var resp CanSendStoryResultBoostNeeded + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalCanSendStoryResultActiveStoryLimitExceeded(data json.RawMessage) (*CanSendStoryResultActiveStoryLimitExceeded, error) { var resp CanSendStoryResultActiveStoryLimitExceeded @@ -13452,6 +14089,22 @@ func UnmarshalPushMessageContentPoll(data json.RawMessage) (*PushMessageContentP return &resp, err } +func UnmarshalPushMessageContentPremiumGiftCode(data json.RawMessage) (*PushMessageContentPremiumGiftCode, error) { + var resp PushMessageContentPremiumGiftCode + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentPremiumGiveaway(data json.RawMessage) (*PushMessageContentPremiumGiveaway, error) { + var resp PushMessageContentPremiumGiveaway + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPushMessageContentScreenshotTaken(data json.RawMessage) (*PushMessageContentScreenshotTaken, error) { var resp PushMessageContentScreenshotTaken @@ -14340,6 +14993,14 @@ func UnmarshalInternalLinkTypeChangePhoneNumber(data json.RawMessage) (*Internal return &resp, err } +func UnmarshalInternalLinkTypeChatBoost(data json.RawMessage) (*InternalLinkTypeChatBoost, error) { + var resp InternalLinkTypeChatBoost + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInternalLinkTypeChatFolderInvite(data json.RawMessage) (*InternalLinkTypeChatFolderInvite, error) { var resp InternalLinkTypeChatFolderInvite @@ -14460,6 +15121,14 @@ func UnmarshalInternalLinkTypePremiumFeatures(data json.RawMessage) (*InternalLi return &resp, err } +func UnmarshalInternalLinkTypePremiumGiftCode(data json.RawMessage) (*InternalLinkTypePremiumGiftCode, error) { + var resp InternalLinkTypePremiumGiftCode + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInternalLinkTypePrivacyAndSecuritySettings(data json.RawMessage) (*InternalLinkTypePrivacyAndSecuritySettings, error) { var resp InternalLinkTypePrivacyAndSecuritySettings @@ -14612,6 +15281,22 @@ func UnmarshalMessageLinkInfo(data json.RawMessage) (*MessageLinkInfo, error) { return &resp, err } +func UnmarshalChatBoostLink(data json.RawMessage) (*ChatBoostLink, error) { + var resp ChatBoostLink + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatBoostLinkInfo(data json.RawMessage) (*ChatBoostLinkInfo, error) { + var resp ChatBoostLinkInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalBlockListMain(data json.RawMessage) (*BlockListMain, error) { var resp BlockListMain @@ -15060,6 +15745,14 @@ func UnmarshalTopChatCategoryForwardChats(data json.RawMessage) (*TopChatCategor return &resp, err } +func UnmarshalFoundPosition(data json.RawMessage) (*FoundPosition, error) { + var resp FoundPosition + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalFoundPositions(data json.RawMessage) (*FoundPositions, error) { var resp FoundPositions @@ -15596,6 +16289,22 @@ func UnmarshalUpdateChatPhoto(data json.RawMessage) (*UpdateChatPhoto, error) { return &resp, err } +func UnmarshalUpdateChatAccentColor(data json.RawMessage) (*UpdateChatAccentColor, error) { + var resp UpdateChatAccentColor + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateChatBackgroundCustomEmoji(data json.RawMessage) (*UpdateChatBackgroundCustomEmoji, error) { + var resp UpdateChatBackgroundCustomEmoji + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateChatPermissions(data json.RawMessage) (*UpdateChatPermissions, error) { var resp UpdateChatPermissions @@ -16188,6 +16897,14 @@ func UnmarshalUpdateChatThemes(data json.RawMessage) (*UpdateChatThemes, error) return &resp, err } +func UnmarshalUpdateAccentColors(data json.RawMessage) (*UpdateAccentColors, error) { + var resp UpdateAccentColors + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateLanguagePackStrings(data json.RawMessage) (*UpdateLanguagePackStrings, error) { var resp UpdateLanguagePackStrings @@ -16404,6 +17121,14 @@ func UnmarshalUpdateNewChatJoinRequest(data json.RawMessage) (*UpdateNewChatJoin return &resp, err } +func UnmarshalUpdateChatBoost(data json.RawMessage) (*UpdateChatBoost, error) { + var resp UpdateChatBoost + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdates(data json.RawMessage) (*Updates, error) { var resp Updates @@ -16864,6 +17589,39 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePremiumStatePaymentOption: return UnmarshalPremiumStatePaymentOption(data) + case TypePremiumGiftCodePaymentOption: + return UnmarshalPremiumGiftCodePaymentOption(data) + + case TypePremiumGiftCodePaymentOptions: + return UnmarshalPremiumGiftCodePaymentOptions(data) + + case TypePremiumGiftCodeInfo: + return UnmarshalPremiumGiftCodeInfo(data) + + case TypePremiumGiveawayParticipantStatusEligible: + return UnmarshalPremiumGiveawayParticipantStatusEligible(data) + + case TypePremiumGiveawayParticipantStatusParticipating: + return UnmarshalPremiumGiveawayParticipantStatusParticipating(data) + + case TypePremiumGiveawayParticipantStatusAlreadyWasMember: + return UnmarshalPremiumGiveawayParticipantStatusAlreadyWasMember(data) + + case TypePremiumGiveawayParticipantStatusAdministrator: + return UnmarshalPremiumGiveawayParticipantStatusAdministrator(data) + + case TypePremiumGiveawayParticipantStatusDisallowedCountry: + return UnmarshalPremiumGiveawayParticipantStatusDisallowedCountry(data) + + case TypePremiumGiveawayInfoOngoing: + return UnmarshalPremiumGiveawayInfoOngoing(data) + + case TypePremiumGiveawayInfoCompleted: + return UnmarshalPremiumGiveawayInfoCompleted(data) + + case TypeAccentColor: + return UnmarshalAccentColor(data) + case TypeEmojiStatus: return UnmarshalEmojiStatus(data) @@ -17044,20 +17802,17 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageViewers: return UnmarshalMessageViewers(data) - case TypeMessageForwardOriginUser: - return UnmarshalMessageForwardOriginUser(data) + case TypeMessageOriginUser: + return UnmarshalMessageOriginUser(data) - case TypeMessageForwardOriginChat: - return UnmarshalMessageForwardOriginChat(data) + case TypeMessageOriginHiddenUser: + return UnmarshalMessageOriginHiddenUser(data) - case TypeMessageForwardOriginHiddenUser: - return UnmarshalMessageForwardOriginHiddenUser(data) + case TypeMessageOriginChat: + return UnmarshalMessageOriginChat(data) - case TypeMessageForwardOriginChannel: - return UnmarshalMessageForwardOriginChannel(data) - - case TypeMessageForwardOriginMessageImport: - return UnmarshalMessageForwardOriginMessageImport(data) + case TypeMessageOriginChannel: + return UnmarshalMessageOriginChannel(data) case TypeReactionTypeEmoji: return UnmarshalReactionTypeEmoji(data) @@ -17068,6 +17823,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageForwardInfo: return UnmarshalMessageForwardInfo(data) + case TypeMessageImportInfo: + return UnmarshalMessageImportInfo(data) + case TypeMessageReplyInfo: return UnmarshalMessageReplyInfo(data) @@ -17092,6 +17850,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageReplyToStory: return UnmarshalMessageReplyToStory(data) + case TypeInputMessageReplyToMessage: + return UnmarshalInputMessageReplyToMessage(data) + + case TypeInputMessageReplyToStory: + return UnmarshalInputMessageReplyToStory(data) + case TypeMessage: return UnmarshalMessage(data) @@ -17395,6 +18159,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeForumTopics: return UnmarshalForumTopics(data) + case TypeLinkPreviewOptions: + return UnmarshalLinkPreviewOptions(data) + case TypeRichTextPlain: return UnmarshalRichTextPlain(data) @@ -17647,6 +18414,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInputInvoiceName: return UnmarshalInputInvoiceName(data) + case TypeInputInvoiceTelegram: + return UnmarshalInputInvoiceTelegram(data) + case TypeMessageExtendedMediaPreview: return UnmarshalMessageExtendedMediaPreview(data) @@ -17659,6 +18429,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageExtendedMediaUnsupported: return UnmarshalMessageExtendedMediaUnsupported(data) + case TypePremiumGiveawayParameters: + return UnmarshalPremiumGiveawayParameters(data) + case TypeDatedFile: return UnmarshalDatedFile(data) @@ -18031,6 +18804,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageGiftedPremium: return UnmarshalMessageGiftedPremium(data) + case TypeMessagePremiumGiftCode: + return UnmarshalMessagePremiumGiftCode(data) + + case TypeMessagePremiumGiveawayCreated: + return UnmarshalMessagePremiumGiveawayCreated(data) + + case TypeMessagePremiumGiveaway: + return UnmarshalMessagePremiumGiveaway(data) + case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) @@ -18040,9 +18822,6 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageChatShared: return UnmarshalMessageChatShared(data) - case TypeMessageWebsiteConnected: - return UnmarshalMessageWebsiteConnected(data) - case TypeMessageBotWriteAccessAllowed: return UnmarshalMessageBotWriteAccessAllowed(data) @@ -18112,6 +18891,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeTextEntityTypePreCode: return UnmarshalTextEntityTypePreCode(data) + case TypeTextEntityTypeBlockQuote: + return UnmarshalTextEntityTypeBlockQuote(data) + case TypeTextEntityTypeTextUrl: return UnmarshalTextEntityTypeTextUrl(data) @@ -18361,6 +19143,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStoryAreaTypeVenue: return UnmarshalStoryAreaTypeVenue(data) + case TypeStoryAreaTypeSuggestedReaction: + return UnmarshalStoryAreaTypeSuggestedReaction(data) + case TypeStoryArea: return UnmarshalStoryArea(data) @@ -18373,6 +19158,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInputStoryAreaTypePreviousVenue: return UnmarshalInputStoryAreaTypePreviousVenue(data) + case TypeInputStoryAreaTypeSuggestedReaction: + return UnmarshalInputStoryAreaTypeSuggestedReaction(data) + case TypeInputStoryArea: return UnmarshalInputStoryArea(data) @@ -18418,6 +19206,33 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatActiveStories: return UnmarshalChatActiveStories(data) + case TypeChatBoostSourceGiftCode: + return UnmarshalChatBoostSourceGiftCode(data) + + case TypeChatBoostSourceGiveaway: + return UnmarshalChatBoostSourceGiveaway(data) + + case TypeChatBoostSourcePremium: + return UnmarshalChatBoostSourcePremium(data) + + case TypePrepaidPremiumGiveaway: + return UnmarshalPrepaidPremiumGiveaway(data) + + case TypeChatBoostStatus: + return UnmarshalChatBoostStatus(data) + + case TypeChatBoost: + return UnmarshalChatBoost(data) + + case TypeFoundChatBoosts: + return UnmarshalFoundChatBoosts(data) + + case TypeChatBoostSlot: + return UnmarshalChatBoostSlot(data) + + case TypeChatBoostSlots: + return UnmarshalChatBoostSlots(data) + case TypeCallDiscardReasonEmpty: return UnmarshalCallDiscardReasonEmpty(data) @@ -18586,6 +19401,18 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSentWebAppMessage: return UnmarshalSentWebAppMessage(data) + case TypeBotWriteAccessAllowReasonConnectedWebsite: + return UnmarshalBotWriteAccessAllowReasonConnectedWebsite(data) + + case TypeBotWriteAccessAllowReasonAddedToAttachmentMenu: + return UnmarshalBotWriteAccessAllowReasonAddedToAttachmentMenu(data) + + case TypeBotWriteAccessAllowReasonLaunchedWebApp: + return UnmarshalBotWriteAccessAllowReasonLaunchedWebApp(data) + + case TypeBotWriteAccessAllowReasonAcceptedRequest: + return UnmarshalBotWriteAccessAllowReasonAcceptedRequest(data) + case TypeHttpUrl: return UnmarshalHttpUrl(data) @@ -18769,6 +19596,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatEventActiveUsernamesChanged: return UnmarshalChatEventActiveUsernamesChanged(data) + case TypeChatEventAccentColorChanged: + return UnmarshalChatEventAccentColorChanged(data) + + case TypeChatEventBackgroundCustomEmojiChanged: + return UnmarshalChatEventBackgroundCustomEmojiChanged(data) + case TypeChatEventHasProtectedContentToggled: return UnmarshalChatEventHasProtectedContentToggled(data) @@ -18907,6 +19740,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePremiumLimitTypeStoryCaptionLength: return UnmarshalPremiumLimitTypeStoryCaptionLength(data) + case TypePremiumLimitTypeStorySuggestedReactionAreaCount: + return UnmarshalPremiumLimitTypeStorySuggestedReactionAreaCount(data) + case TypePremiumFeatureIncreasedLimits: return UnmarshalPremiumFeatureIncreasedLimits(data) @@ -18955,6 +19791,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePremiumFeatureUpgradedStories: return UnmarshalPremiumFeatureUpgradedStories(data) + case TypePremiumFeatureChatBoost: + return UnmarshalPremiumFeatureChatBoost(data) + + case TypePremiumFeatureAccentColor: + return UnmarshalPremiumFeatureAccentColor(data) + case TypePremiumStoryFeaturePriorityOrder: return UnmarshalPremiumStoryFeaturePriorityOrder(data) @@ -19006,6 +19848,18 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStorePaymentPurposeGiftedPremium: return UnmarshalStorePaymentPurposeGiftedPremium(data) + case TypeStorePaymentPurposePremiumGiftCodes: + return UnmarshalStorePaymentPurposePremiumGiftCodes(data) + + case TypeStorePaymentPurposePremiumGiveaway: + return UnmarshalStorePaymentPurposePremiumGiveaway(data) + + case TypeTelegramPaymentPurposePremiumGiftCodes: + return UnmarshalTelegramPaymentPurposePremiumGiftCodes(data) + + case TypeTelegramPaymentPurposePremiumGiveaway: + return UnmarshalTelegramPaymentPurposePremiumGiveaway(data) + case TypeDeviceTokenFirebaseCloudMessaging: return UnmarshalDeviceTokenFirebaseCloudMessaging(data) @@ -19087,6 +19941,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeCanSendStoryResultPremiumNeeded: return UnmarshalCanSendStoryResultPremiumNeeded(data) + case TypeCanSendStoryResultBoostNeeded: + return UnmarshalCanSendStoryResultBoostNeeded(data) + case TypeCanSendStoryResultActiveStoryLimitExceeded: return UnmarshalCanSendStoryResultActiveStoryLimitExceeded(data) @@ -19189,6 +20046,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePushMessageContentPoll: return UnmarshalPushMessageContentPoll(data) + case TypePushMessageContentPremiumGiftCode: + return UnmarshalPushMessageContentPremiumGiftCode(data) + + case TypePushMessageContentPremiumGiveaway: + return UnmarshalPushMessageContentPremiumGiveaway(data) + case TypePushMessageContentScreenshotTaken: return UnmarshalPushMessageContentScreenshotTaken(data) @@ -19522,6 +20385,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInternalLinkTypeChangePhoneNumber: return UnmarshalInternalLinkTypeChangePhoneNumber(data) + case TypeInternalLinkTypeChatBoost: + return UnmarshalInternalLinkTypeChatBoost(data) + case TypeInternalLinkTypeChatFolderInvite: return UnmarshalInternalLinkTypeChatFolderInvite(data) @@ -19567,6 +20433,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInternalLinkTypePremiumFeatures: return UnmarshalInternalLinkTypePremiumFeatures(data) + case TypeInternalLinkTypePremiumGiftCode: + return UnmarshalInternalLinkTypePremiumGiftCode(data) + case TypeInternalLinkTypePrivacyAndSecuritySettings: return UnmarshalInternalLinkTypePrivacyAndSecuritySettings(data) @@ -19624,6 +20493,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageLinkInfo: return UnmarshalMessageLinkInfo(data) + case TypeChatBoostLink: + return UnmarshalChatBoostLink(data) + + case TypeChatBoostLinkInfo: + return UnmarshalChatBoostLinkInfo(data) + case TypeBlockListMain: return UnmarshalBlockListMain(data) @@ -19792,6 +20667,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeTopChatCategoryForwardChats: return UnmarshalTopChatCategoryForwardChats(data) + case TypeFoundPosition: + return UnmarshalFoundPosition(data) + case TypeFoundPositions: return UnmarshalFoundPositions(data) @@ -19993,6 +20871,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateChatPhoto: return UnmarshalUpdateChatPhoto(data) + case TypeUpdateChatAccentColor: + return UnmarshalUpdateChatAccentColor(data) + + case TypeUpdateChatBackgroundCustomEmoji: + return UnmarshalUpdateChatBackgroundCustomEmoji(data) + case TypeUpdateChatPermissions: return UnmarshalUpdateChatPermissions(data) @@ -20215,6 +21099,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateChatThemes: return UnmarshalUpdateChatThemes(data) + case TypeUpdateAccentColors: + return UnmarshalUpdateAccentColors(data) + case TypeUpdateLanguagePackStrings: return UnmarshalUpdateLanguagePackStrings(data) @@ -20296,6 +21183,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateNewChatJoinRequest: return UnmarshalUpdateNewChatJoinRequest(data) + case TypeUpdateChatBoost: + return UnmarshalUpdateChatBoost(data) + case TypeUpdates: return UnmarshalUpdates(data) diff --git a/data/td_api.tl b/data/td_api.tl index df470f6..b14df9a 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -105,7 +105,7 @@ textEntity offset:int32 length:int32 type:TextEntityType = TextEntity; textEntities entities:vector = TextEntities; //@description A text with some entities @text The text @entities Entities contained in the text. Entities can be nested, but must not mutually intersect with each other. -//-Pre, Code and PreCode entities can't contain other entities. Bold, Italic, Underline, Strikethrough, and Spoiler entities can contain and can be part of any other entities. All other entities can't contain each other +//-Pre, Code and PreCode entities can't contain other entities. BlockQuote entities can't contain other BlockQuote entities. Bold, Italic, Underline, Strikethrough, and Spoiler entities can contain and can be part of any other entities. All other entities can't contain each other formattedText text:string entities:vector = FormattedText; @@ -633,11 +633,11 @@ inputChatPhotoSticker sticker:chatPhotoSticker = InputChatPhoto; //@description Describes actions that a user is allowed to take in a chat -//@can_send_basic_messages True, if the user can send text messages, contacts, invoices, locations, and venues +//@can_send_basic_messages True, if the user can send text messages, contacts, giveaways, invoices, locations, and venues //@can_send_audios True, if the user can send music files //@can_send_documents True, if the user can send documents -//@can_send_photos True, if the user can send audio photos -//@can_send_videos True, if the user can send audio videos +//@can_send_photos True, if the user can send photos +//@can_send_videos True, if the user can send videos //@can_send_video_notes True, if the user can send video notes //@can_send_voice_notes True, if the user can send voice notes //@can_send_polls True, if the user can send polls @@ -653,19 +653,22 @@ inputChatPhotoSticker sticker:chatPhotoSticker = InputChatPhoto; chatPermissions can_send_basic_messages:Bool can_send_audios:Bool can_send_documents:Bool can_send_photos:Bool can_send_videos:Bool can_send_video_notes:Bool can_send_voice_notes:Bool can_send_polls:Bool can_send_stickers:Bool can_send_animations:Bool can_send_games:Bool can_use_inline_bots:Bool can_add_web_page_previews:Bool can_change_info:Bool can_invite_users:Bool can_pin_messages:Bool can_manage_topics:Bool = ChatPermissions; //@description Describes rights of the administrator -//@can_manage_chat True, if the administrator can get chat event log, get chat statistics, get message statistics in channels, get channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other privilege; applicable to supergroups and channels only +//@can_manage_chat True, if the administrator can get chat event log, get chat boosts in channels, get channel members, report supergroup spam messages, see anonymous administrators in supergroups and ignore slow mode. Implied by any other privilege; applicable to supergroups and channels only //@can_change_info True, if the administrator can change the chat title, photo, and other settings -//@can_post_messages True, if the administrator can create channel posts; applicable to channels only +//@can_post_messages True, if the administrator can create channel posts or view channel statistics; applicable to channels only //@can_edit_messages True, if the administrator can edit messages of other users and pin messages; applicable to channels only //@can_delete_messages True, if the administrator can delete messages of other users //@can_invite_users True, if the administrator can invite new users to the chat -//@can_restrict_members True, if the administrator can restrict, ban, or unban chat members; always true for channels +//@can_restrict_members True, if the administrator can restrict, ban, or unban chat members or view supergroup statistics; always true for channels //@can_pin_messages True, if the administrator can pin messages; applicable to basic groups and supergroups only //@can_manage_topics True, if the administrator can manage topics; applicable to forum supergroups only //@can_promote_members True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that were directly or indirectly promoted by them //@can_manage_video_chats True, if the administrator can manage video chats +//@can_post_stories True, if the administrator can create new channel stories, or edit and delete posted stories; applicable to channels only +//@can_edit_stories True, if the administrator can edit stories posted by other users, pin stories and access story archive; applicable to channels only +//@can_delete_stories True, if the administrator can delete stories posted by other users; applicable to channels only //@is_anonymous True, if the administrator isn't shown in the chat member list and sends messages anonymously; applicable to supergroups only -chatAdministratorRights can_manage_chat:Bool can_change_info:Bool can_post_messages:Bool can_edit_messages:Bool can_delete_messages:Bool can_invite_users:Bool can_restrict_members:Bool can_pin_messages:Bool can_manage_topics:Bool can_promote_members:Bool can_manage_video_chats:Bool is_anonymous:Bool = ChatAdministratorRights; +chatAdministratorRights can_manage_chat:Bool can_change_info:Bool can_post_messages:Bool can_edit_messages:Bool can_delete_messages:Bool can_invite_users:Bool can_restrict_members:Bool can_pin_messages:Bool can_manage_topics:Bool can_promote_members:Bool can_manage_video_chats:Bool can_post_stories:Bool can_edit_stories:Bool can_delete_stories:Bool is_anonymous:Bool = ChatAdministratorRights; //@description Describes an option for buying Telegram Premium to a user @@ -684,6 +687,72 @@ premiumPaymentOption currency:string amount:int53 discount_percentage:int32 mont //@last_transaction_id Identifier of the last in-store transaction for the currently used option premiumStatePaymentOption payment_option:premiumPaymentOption is_current:Bool is_upgrade:Bool last_transaction_id:string = PremiumStatePaymentOption; +//@description Describes an option for creating Telegram Premium gift codes +//@currency ISO 4217 currency code for Telegram Premium gift code payment +//@amount The amount to pay, in the smallest units of the currency +//@user_count Number of users which will be able to activate the gift codes +//@month_count Number of month the Telegram Premium subscription will be active +//@store_product_id Identifier of the store product associated with the option; may be empty if none +//@store_product_quantity Number of times the store product must be paid +premiumGiftCodePaymentOption currency:string amount:int53 user_count:int32 month_count:int32 store_product_id:string store_product_quantity:int32 = PremiumGiftCodePaymentOption; + +//@description Contains a list of options for creating Telegram Premium gift codes @options The list of options +premiumGiftCodePaymentOptions options:vector = PremiumGiftCodePaymentOptions; + +//@description Contains information about a Telegram Premium gift code +//@creator_id Identifier of a chat or a user that created the gift code +//@creation_date Point in time (Unix timestamp) when the code was created +//@is_from_giveaway True, if the gift code was created for a giveaway +//@giveaway_message_id Identifier of the corresponding giveaway message; can be 0 or an identifier of a deleted message +//@month_count Number of month the Telegram Premium subscription will be active after code activation +//@user_id Identifier of a user for which the code was created; 0 if none +//@use_date Point in time (Unix timestamp) when the code was activated; 0 if none +premiumGiftCodeInfo creator_id:MessageSender creation_date:int32 is_from_giveaway:Bool giveaway_message_id:int53 month_count:int32 user_id:int53 use_date:int32 = PremiumGiftCodeInfo; + + +//@class PremiumGiveawayParticipantStatus @description Contains information about status of a user in a Telegram Premium giveaway + +//@description The user is eligible for the giveaway +premiumGiveawayParticipantStatusEligible = PremiumGiveawayParticipantStatus; + +//@description The user participates in the giveaway +premiumGiveawayParticipantStatusParticipating = PremiumGiveawayParticipantStatus; + +//@description The user can't participate in the giveaway, because they have already been member of the chat +//@joined_chat_date Point in time (Unix timestamp) when the user joined the chat +premiumGiveawayParticipantStatusAlreadyWasMember joined_chat_date:int32 = PremiumGiveawayParticipantStatus; + +//@description The user can't participate in the giveaway, because they are an administrator in one of the chats that created the giveaway @chat_id Identifier of the chat administered by the user +premiumGiveawayParticipantStatusAdministrator chat_id:int53 = PremiumGiveawayParticipantStatus; + +//@description The user can't participate in the giveaway, because they phone number is from a disallowed country @user_country_code A two-letter ISO 3166-1 alpha-2 country code of the user's country +premiumGiveawayParticipantStatusDisallowedCountry user_country_code:string = PremiumGiveawayParticipantStatus; + + +//@class PremiumGiveawayInfo @description Contains information about Telegram Premium giveaway + +//@description Describes an ongoing giveaway +//@creation_date Point in time (Unix timestamp) when the giveaway was created +//@status Status of the current user in the giveaway +//@is_ended True, if the giveaway has ended and results are being prepared +premiumGiveawayInfoOngoing creation_date:int32 status:PremiumGiveawayParticipantStatus is_ended:Bool = PremiumGiveawayInfo; + +//@description Describes a completed giveaway +//@creation_date Point in time (Unix timestamp) when the giveaway was created +//@actual_winners_selection_date Point in time (Unix timestamp) when the winners were selected. May be bigger than winners selection date specified in parameters of the giveaway +//@was_refunded True, if the giveaway was canceled and was fully refunded +//@winner_count Number of winners in the giveaway +//@activation_count Number of winners, which activated their gift codes +//@gift_code Telegram Premium gift code that was received by the current user; empty if the user isn't a winner in the giveaway +premiumGiveawayInfoCompleted creation_date:int32 actual_winners_selection_date:int32 was_refunded:Bool winner_count:int32 activation_count:int32 gift_code:string = PremiumGiveawayInfo; + + +//@description Contains information about supported accent color for user/chat name, background of empty chat photo, replies to messages and link previews +//@id Accent color identifier +//@built_in_accent_color_id Identifier of a built-in color to use in places, where only one color is needed; 0-6 +//@light_theme_colors The list of 1-3 colors in RGB format, describing the accent color, as expected to be shown in light themes +//@dark_theme_colors The list of 1-3 colors in RGB format, describing the accent color, as expected to be shown in dark themes +accentColor id:int32 built_in_accent_color_id:int32 light_theme_colors:vector dark_theme_colors:vector = AccentColor; //@description Describes a custom emoji to be shown instead of the Telegram Premium badge //@custom_emoji_id Identifier of the custom emoji in stickerFormatTgs format @@ -710,6 +779,8 @@ usernames active_usernames:vector disabled_usernames:vector edit //@phone_number Phone number of the user //@status Current online status of the user //@profile_photo Profile photo of the user; may be null +//@accent_color_id Identifier of the accent color for name, and backgrounds of profile photo, reply header, and link preview +//@background_custom_emoji_id Identifier of a custom emoji to be shown on the reply header background; 0 if none. For Telegram Premium users only //@emoji_status Emoji status to be shown instead of the default Telegram Premium badge; may be null. For Telegram Premium users only //@is_contact The user is a contact of the current user //@is_mutual_contact The user is a contact of the current user and the current user is a contact of the user @@ -726,7 +797,7 @@ usernames active_usernames:vector disabled_usernames:vector edit //@type Type of the user //@language_code IETF language tag of the user's language; only available to bots //@added_to_attachment_menu True, if the user added the current bot to attachment menu; only available to bots -user id:int53 access_hash:int64 first_name:string last_name:string usernames:usernames phone_number:string status:UserStatus profile_photo:profilePhoto emoji_status:emojiStatus is_contact:Bool is_mutual_contact:Bool is_close_friend:Bool is_verified:Bool is_premium:Bool is_support:Bool restriction_reason:string is_scam:Bool is_fake:Bool has_active_stories:Bool has_unread_active_stories:Bool have_access:Bool type:UserType language_code:string added_to_attachment_menu:Bool = User; +user id:int53 access_hash:int64 first_name:string last_name:string usernames:usernames phone_number:string status:UserStatus profile_photo:profilePhoto accent_color_id:int32 background_custom_emoji_id:int64 emoji_status:emojiStatus is_contact:Bool is_mutual_contact:Bool is_close_friend:Bool is_verified:Bool is_premium:Bool is_support:Bool restriction_reason:string is_scam:Bool is_fake:Bool has_active_stories:Bool has_unread_active_stories:Bool have_access:Bool type:UserType language_code:string added_to_attachment_menu:Bool = User; //@description Contains information about a bot @@ -926,6 +997,7 @@ inviteLinkChatTypeChannel = InviteLinkChatType; //@type Type of the chat //@title Title of the chat //@photo Chat photo; may be null +//@accent_color_id Identifier of the accent color for chat title and background of chat photo //@param_description Chat description //@member_count Number of members in the chat //@member_user_ids User identifiers of some chat members that may be known to the current user @@ -934,7 +1006,7 @@ inviteLinkChatTypeChannel = InviteLinkChatType; //@is_verified True, if the chat is verified //@is_scam True, if many users reported this chat as a scam //@is_fake True, if many users reported this chat as a fake account -chatInviteLinkInfo chat_id:int53 accessible_for:int32 type:InviteLinkChatType title:string photo:chatPhotoInfo description:string member_count:int32 member_user_ids:vector creates_join_request:Bool is_public:Bool is_verified:Bool is_scam:Bool is_fake:Bool = ChatInviteLinkInfo; +chatInviteLinkInfo chat_id:int53 accessible_for:int32 type:InviteLinkChatType title:string photo:chatPhotoInfo accent_color_id:int32 description:string member_count:int32 member_user_ids:vector creates_join_request:Bool is_public:Bool is_verified:Bool is_scam:Bool is_fake:Bool = ChatInviteLinkInfo; //@description Describes a user that sent a join request and waits for administrator approval @user_id User identifier @date Point in time (Unix timestamp) when the user sent the join request @bio A short bio of the user @@ -991,7 +1063,9 @@ basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int53 memb //@restriction_reason If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted //@is_scam True, if many users reported this supergroup or channel as a scam //@is_fake True, if many users reported this supergroup or channel as a fake account -supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 has_linked_chat:Bool has_location:Bool sign_messages:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool is_verified:Bool restriction_reason:string is_scam:Bool is_fake:Bool = Supergroup; +//@has_active_stories True, if the channel has non-expired stories available to the current user +//@has_unread_active_stories True, if the channel has unread non-expired stories available to the current user +supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 has_linked_chat:Bool has_location:Bool sign_messages:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool is_verified:Bool restriction_reason:string is_scam:Bool is_fake:Bool has_active_stories:Bool has_unread_active_stories:Bool = Supergroup; //@description Contains full information about a supergroup or channel //@photo Chat photo; may be null if empty or unknown. If non-null, then it is the same photo as in chat.photo @@ -1013,13 +1087,14 @@ supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:Chat //@is_all_history_available 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, //-so this option affects only private non-forum supergroups without a linked chat. The value of this field is only available to chat administrators //@has_aggressive_anti_spam_enabled True, if aggressive anti-spam checks are enabled in the supergroup. The value of this field is only available to chat administrators +//@has_pinned_stories True, if the channel has pinned stories //@sticker_set_id Identifier of the supergroup sticker set; 0 if none //@location Location to which the supergroup is connected; may be null if none //@invite_link Primary invite link for the chat; may be null. For chat administrators with can_invite_users right only //@bot_commands List of commands of bots in the group //@upgraded_from_basic_group_id Identifier of the basic group from which supergroup was upgraded; 0 if none //@upgraded_from_max_message_id Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none -supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool has_aggressive_anti_spam_enabled:Bool sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; +supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool has_aggressive_anti_spam_enabled:Bool has_pinned_stories:Bool sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; //@class SecretChatState @description Describes the current secret chat state @@ -1073,27 +1148,24 @@ messageViewer user_id:int53 view_date:int32 = MessageViewer; messageViewers viewers:vector = MessageViewers; -//@class MessageForwardOrigin @description Contains information about the origin of a forwarded message +//@class MessageOrigin @description Contains information about the origin of a message //@description The message was originally sent by a known user @sender_user_id Identifier of the user that originally sent the message -messageForwardOriginUser sender_user_id:int53 = MessageForwardOrigin; +messageOriginUser sender_user_id:int53 = MessageOrigin; + +//@description The message was originally sent by a user, which is hidden by their privacy settings @sender_name Name of the sender +messageOriginHiddenUser sender_name:string = MessageOrigin; //@description The message was originally sent on behalf of a chat //@sender_chat_id Identifier of the chat that originally sent the message //@author_signature For messages originally sent by an anonymous chat administrator, original message author signature -messageForwardOriginChat sender_chat_id:int53 author_signature:string = MessageForwardOrigin; - -//@description The message was originally sent by a user, which is hidden by their privacy settings @sender_name Name of the sender -messageForwardOriginHiddenUser sender_name:string = MessageForwardOrigin; +messageOriginChat sender_chat_id:int53 author_signature:string = MessageOrigin; //@description The message was originally a post in a channel -//@chat_id Identifier of the chat from which the message was originally forwarded +//@chat_id Identifier of the channel chat to which the message was originally sent //@message_id Message identifier of the original message //@author_signature Original post author signature -messageForwardOriginChannel chat_id:int53 message_id:int53 author_signature:string = MessageForwardOrigin; - -//@description The message was imported from an exported message history @sender_name Name of the sender -messageForwardOriginMessageImport sender_name:string = MessageForwardOrigin; +messageOriginChannel chat_id:int53 message_id:int53 author_signature:string = MessageOrigin; //@class ReactionType @description Describes type of message reaction @@ -1106,12 +1178,17 @@ reactionTypeCustomEmoji custom_emoji_id:int64 = ReactionType; //@description Contains information about a forwarded message -//@origin Origin of a forwarded message +//@origin Origin of the forwarded message //@date Point in time (Unix timestamp) when the message was originally sent //@public_service_announcement_type The type of a public service announcement for the forwarded message //@from_chat_id For messages forwarded to the chat with the current user (Saved Messages), to the Replies bot chat, or to the channel's discussion group, the identifier of the chat from which the message was forwarded last time; 0 if unknown //@from_message_id For messages forwarded to the chat with the current user (Saved Messages), to the Replies bot chat, or to the channel's discussion group, the identifier of the original message from which the new message was forwarded last time; 0 if unknown -messageForwardInfo origin:MessageForwardOrigin date:int32 public_service_announcement_type:string from_chat_id:int53 from_message_id:int53 = MessageForwardInfo; +messageForwardInfo origin:MessageOrigin date:int32 public_service_announcement_type:string from_chat_id:int53 from_message_id:int53 = MessageForwardInfo; + +//@description Contains information about a message created with importMessages +//@sender_name Name of the original sender +//@date Point in time (Unix timestamp) when the message was originally sent +messageImportInfo sender_name:string date:int32 = MessageImportInfo; //@description Contains information about replies to a message //@reply_count Number of times the message was directly or indirectly replied @@ -1125,8 +1202,10 @@ messageReplyInfo reply_count:int32 recent_replier_ids:vector last //@type Type of the reaction //@total_count Number of times the reaction was added //@is_chosen True, if the reaction is chosen by the current user +//@used_sender_id Identifier of the message sender used by the current user to add the reaction; null if unknown or the reaction isn't chosen //@recent_sender_ids Identifiers of at most 3 recent message senders, added the reaction; available in private, basic group and supergroup chats -messageReaction type:ReactionType total_count:int32 is_chosen:Bool recent_sender_ids:vector = MessageReaction; +messageReaction type:ReactionType total_count:int32 is_chosen:Bool used_sender_id:MessageSender recent_sender_ids:vector = MessageReaction; + //@description Contains information about interactions with a message //@view_count Number of times the message was viewed @@ -1148,25 +1227,46 @@ unreadReaction type:ReactionType sender_id:MessageSender is_big:Bool = UnreadRea messageSendingStatePending sending_id:int32 = MessageSendingState; //@description The message failed to be sent -//@error_code An error code; 0 if unknown -//@error_message Error message +//@error The cause of the message sending failure //@can_retry True, if the message can be re-sent //@need_another_sender True, if the message can be re-sent only on behalf of a different sender +//@need_another_reply_quote True, if the message can be re-sent only if another quote is chosen in the message that is replied by the given message +//@need_drop_reply True, if the message can be re-sent only if the message to be replied is removed. This will be done automatically by resendMessages //@retry_after Time left before the message can be re-sent, in seconds. No update is sent when this field changes -messageSendingStateFailed error_code:int32 error_message:string can_retry:Bool need_another_sender:Bool retry_after:double = MessageSendingState; +messageSendingStateFailed error:error can_retry:Bool need_another_sender:Bool need_another_reply_quote:Bool need_drop_reply:Bool retry_after:double = MessageSendingState; //@class MessageReplyTo @description Contains information about the message or the story a message is replying to -//@description Describes a replied message -//@chat_id The identifier of the chat to which the replied message belongs; ignored for outgoing replies. For example, messages in the Replies chat are replies to messages in different chats -//@message_id The identifier of the replied message -messageReplyToMessage chat_id:int53 message_id:int53 = MessageReplyTo; +//@description Describes a message replied by a given message +//@chat_id The identifier of the chat to which the message belongs; may be 0 if the replied message is in unknown chat +//@message_id The identifier of the message; may be 0 if the replied message is in unknown chat +//@quote Manually or automatically chosen quote from the replied message; may be null if none. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities can be present in the quote +//@is_quote_manual True, if the quote was manually chosen by the message sender +//@origin Information about origin of the message if the message was replied from another chat; may be null for messages from the same chat +//@origin_send_date Point in time (Unix timestamp) when the message was sent if the message was replied from another chat; 0 for messages from the same chat +//@content Media content of the message if the message was replied from another chat; may be null for messages from the same chat and messages without media. +//-Can be only one of the following types: messageAnimation, messageAudio, messageContact, messageDice, messageDocument, messageGame, messageInvoice, messageLocation, +//-messagePhoto, messagePoll, messagePremiumGiveaway, messageSticker, messageStory, messageText (for link preview), messageVenue, messageVideo, messageVideoNote, or messageVoiceNote +messageReplyToMessage chat_id:int53 message_id:int53 quote:formattedText is_quote_manual:Bool origin:MessageOrigin origin_send_date:int32 content:MessageContent = MessageReplyTo; -//@description Describes a replied story @story_sender_chat_id The identifier of the sender of the replied story. Currently, stories can be replied only in the sender's chat @story_id The identifier of the replied story +//@description Describes a story replied by a given message @story_sender_chat_id The identifier of the sender of the story @story_id The identifier of the story messageReplyToStory story_sender_chat_id:int53 story_id:int32 = MessageReplyTo; +//@class InputMessageReplyTo @description Contains information about the message or the story to be replied + +//@description Describes a message to be replied +//@chat_id The identifier of the chat to which the message to be replied belongs; pass 0 if the message to be replied is in the same chat. Must always be 0 for replies in secret chats. A message can be replied in another chat only if message.can_be_replied_in_another_chat +//@message_id The identifier of the message to be replied in the same or the specified chat +//@quote Manually chosen quote from the message to be replied; pass null if none; 0-getOption("message_reply_quote_length_max") characters. Must always be null for replies in secret chats. +//-Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed to be kept and must be kept in the quote +inputMessageReplyToMessage chat_id:int53 message_id:int53 quote:formattedText = InputMessageReplyTo; + +//@description Describes a story to be replied @story_sender_chat_id The identifier of the sender of the story. Currently, stories can be replied only in the sender's chat @story_id The identifier of the story +inputMessageReplyToStory story_sender_chat_id:int53 story_id:int32 = InputMessageReplyTo; + + //@description Describes a message //@id Message identifier; unique for the chat to which the message belongs //@sender_id Identifier of the sender of the message @@ -1177,6 +1277,7 @@ messageReplyToStory story_sender_chat_id:int53 story_id:int32 = MessageReplyTo; //@is_pinned True, if the message is pinned //@can_be_edited True, if the message can be edited. For live location and poll messages this fields shows whether editMessageLiveLocation or stopPoll can be used with this message by the application //@can_be_forwarded True, if the message can be forwarded +//@can_be_replied_in_another_chat True, if the message can be replied in another chat //@can_be_saved True, if content of the message can be saved locally or copied //@can_be_deleted_only_for_self True, if the message can be deleted only for the current user while other users will continue to see it //@can_be_deleted_for_all_users True, if the message can be deleted for all users @@ -1193,12 +1294,13 @@ messageReplyToStory story_sender_chat_id:int53 story_id:int32 = MessageReplyTo; //@date Point in time (Unix timestamp) when the message was sent //@edit_date Point in time (Unix timestamp) when the message was last edited //@forward_info Information about the initial message sender; may be null if none or unknown +//@import_info Information about the initial message for messages created with importMessages; may be null if the message isn't imported //@interaction_info Information about interactions with the message; may be null if none //@unread_reactions Information about unread reactions added to the message //@reply_to Information about the message or the story this message is replying to; may be null if none //@message_thread_id If non-zero, the identifier of the message thread the message belongs to; unique within the chat to which the message belongs //@self_destruct_type The message's self-destruct type; may be null if none -//@self_destruct_in Time left before the message self-destruct timer expires, in seconds; 0 if self-desctruction isn't scheduled yet +//@self_destruct_in Time left before the message self-destruct timer expires, in seconds; 0 if self-destruction isn't scheduled yet //@auto_delete_in Time left before the message will be automatically deleted by message_auto_delete_time setting of the chat, in seconds; 0 if never //@via_bot_user_id If non-zero, the user identifier of the bot through which this message was sent //@author_signature For channel posts and anonymous group messages, optional author signature @@ -1206,7 +1308,7 @@ messageReplyToStory story_sender_chat_id:int53 story_id:int32 = MessageReplyTo; //@restriction_reason If non-empty, contains a human-readable description of the reason why access to this message must be restricted //@content Content of the message //@reply_markup Reply markup for the message; may be null if none -message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_saved:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_get_added_reactions:Bool can_get_statistics:Bool can_get_message_thread:Bool can_get_viewers:Bool can_get_media_timestamp_links:Bool can_report_reactions:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo interaction_info:messageInteractionInfo unread_reactions:vector reply_to:MessageReplyTo message_thread_id:int53 self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 author_signature:string media_album_id:int64 restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; +message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_get_added_reactions:Bool can_get_statistics:Bool can_get_message_thread:Bool can_get_viewers:Bool can_get_media_timestamp_links:Bool can_report_reactions:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector reply_to:MessageReplyTo message_thread_id:int53 self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 author_signature:string media_album_id:int64 restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; //@description Contains a list of messages @total_count Approximate total number of messages found @messages List of messages; messages may be null messages total_count:int32 messages:vector = Messages; @@ -1362,10 +1464,10 @@ scopeNotificationSettings mute_for:int32 sound_id:int64 show_preview:Bool use_de //@description Contains information about a message draft -//@reply_to_message_id Identifier of the replied message; 0 if none +//@reply_to Information about the message to be replied; must be of the type inputMessageReplyToMessage; may be null if none //@date Point in time (Unix timestamp) when the draft was created //@input_message_text Content of the message draft; must be of the type inputMessageText -draftMessage reply_to_message_id:int53 date:int32 input_message_text:InputMessageContent = DraftMessage; +draftMessage reply_to:InputMessageReplyTo date:int32 input_message_text:InputMessageContent = DraftMessage; //@class ChatType @description Describes the type of a chat @@ -1493,6 +1595,8 @@ videoChat group_call_id:int32 has_participants:Bool default_participant_id:Messa //@type Type of the chat //@title Chat title //@photo Chat photo; may be null +//@accent_color_id Identifier of the accent color for message sender name, and backgrounds of chat photo, reply header, and link preview +//@background_custom_emoji_id Identifier of a custom emoji to be shown on the reply header background in replies to messages sent by the chat; 0 if none //@permissions Actions that non-administrator chat members are allowed to take in the chat //@last_message Last message in the chat; may be null if none or unknown //@positions Positions of the chat in chat lists @@ -1522,7 +1626,7 @@ videoChat group_call_id:int32 has_participants:Bool default_participant_id:Messa //@reply_markup_message_id Identifier of the message from which reply markup needs to be used; 0 if there is no default custom reply markup in the chat //@draft_message A draft of a message in the chat; may be null if none //@client_data 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 -chat id:int53 type:ChatType title:string photo:chatPhotoInfo permissions:chatPermissions last_message:message positions:vector message_sender_id:MessageSender block_list:BlockList has_protected_content:Bool is_translatable:Bool is_marked_as_unread:Bool has_scheduled_messages:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_reported:Bool default_disable_notification:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 unread_reaction_count:int32 notification_settings:chatNotificationSettings available_reactions:ChatAvailableReactions message_auto_delete_time:int32 background:chatBackground theme_name:string action_bar:ChatActionBar video_chat:videoChat pending_join_requests:chatJoinRequestsInfo reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat; +chat id:int53 type:ChatType title:string photo:chatPhotoInfo accent_color_id:int32 background_custom_emoji_id:int64 permissions:chatPermissions last_message:message positions:vector message_sender_id:MessageSender block_list:BlockList has_protected_content:Bool is_translatable:Bool is_marked_as_unread:Bool has_scheduled_messages:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_reported:Bool default_disable_notification:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 unread_reaction_count:int32 notification_settings:chatNotificationSettings available_reactions:ChatAvailableReactions message_auto_delete_time:int32 background:chatBackground theme_name:string action_bar:ChatActionBar video_chat:videoChat pending_join_requests:chatJoinRequestsInfo reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat; //@description Represents a list of chats @total_count Approximate total number of chats found @chat_ids List of chat identifiers chats total_count:int32 chat_ids:vector = Chats; @@ -1692,10 +1796,9 @@ loginUrlInfoRequestConfirmation url:string domain:string bot_user_id:int53 reque //@description Contains information about a Web App found by its short name //@web_app The Web App -//@supports_settings True, if the app supports "settings_button_pressed" event //@request_write_access True, if the user must be asked for the permission to the bot to send them messages //@skip_confirmation True, if there is no need to show an ordinary open URL confirmation before opening the Web App. The field must be ignored and confirmation must be shown anyway if the Web App link was hidden -foundWebApp web_app:webApp supports_settings:Bool request_write_access:Bool skip_confirmation:Bool = FoundWebApp; +foundWebApp web_app:webApp request_write_access:Bool skip_confirmation:Bool = FoundWebApp; //@description Contains information about a Web App @launch_id Unique identifier for the Web App launch @url A Web App URL to open in a web view webAppInfo launch_id:int64 url:string = WebAppInfo; @@ -1748,6 +1851,15 @@ forumTopic info:forumTopicInfo last_message:message is_pinned:Bool unread_count: forumTopics total_count:int32 topics:vector next_offset_date:int32 next_offset_message_id:int53 next_offset_message_thread_id:int53 = ForumTopics; +//@description Options to be used for generation of a link preview +//@is_disabled True, if link preview must be disabled +//@url URL to use for link preview. If empty, then the first URL found in the message text will be used +//@force_small_media True, if shown media preview must be small; ignored in secret chats or if the URL isn't explicitly specified +//@force_large_media True, if shown media preview must be large; ignored in secret chats or if the URL isn't explicitly specified +//@show_above_text True, if link preview must be shown above message text; otherwise, the link preview will be shown below the message text; ignored in secret chats +linkPreviewOptions is_disabled:Bool url:string force_small_media:Bool force_large_media:Bool show_above_text:Bool = LinkPreviewOptions; + + //@class RichText @description Describes a text object inside an instant-view web page //@description A plain text @text Text @@ -1966,8 +2078,9 @@ pageBlockSlideshow page_blocks:vector caption:pageBlockCaption = Page //@description A link to a chat //@title Chat title //@photo Chat photo; may be null +//@accent_color_id Identifier of the accent color for chat title and background of chat photo //@username Chat username by which all other information about the chat can be resolved -pageBlockChatLink title:string photo:chatPhotoInfo username:string = PageBlock; +pageBlockChatLink title:string photo:chatPhotoInfo accent_color_id:int32 username:string = PageBlock; //@description A table //@caption Table caption @@ -2006,7 +2119,7 @@ pageBlockMap location:location zoom:int32 width:int32 height:int32 caption:pageB webPageInstantView page_blocks:vector view_count:int32 version:int32 is_rtl:Bool is_full:Bool feedback_link:InternalLinkType = WebPageInstantView; -//@description Describes a web page preview +//@description Describes a link preview //@url Original URL of the link //@display_url URL to display //@type Type of the web page. Can be: article, photo, audio, video, document, profile, app, or something else @@ -2020,6 +2133,10 @@ webPageInstantView page_blocks:vector view_count:int32 version:int32 //@embed_height Height of the embedded preview //@duration Duration of the content, in seconds //@author Author of the content +//@has_large_media True, if the preview has large media and its appearance can be changed +//@show_large_media True, if large media preview must be shown +//@skip_confirmation True, if there is no need to show an ordinary open URL confirmation, when opening the URL from the preview, because the URL is shown in the message text in clear +//@show_above_text True, if the link preview must be shown above message text; otherwise, the link preview must be shown below the message text //@animation Preview of the content as an animation, if available; may be null //@audio Preview of the content as an audio file, if available; may be null //@document Preview of the content as a document, if available; may be null @@ -2030,7 +2147,7 @@ webPageInstantView page_blocks:vector view_count:int32 version:int32 //@story_sender_chat_id The identifier of the sender of the previewed story; 0 if none //@story_id The identifier of the previewed story; 0 if none //@instant_view_version Version of web page instant view (currently, can be 1 or 2); 0 if none -webPage url:string display_url:string type:string site_name:string title:string description:formattedText photo:photo embed_url:string embed_type:string embed_width:int32 embed_height:int32 duration:int32 author:string animation:animation audio:audio document:document sticker:sticker video:video video_note:videoNote voice_note:voiceNote story_sender_chat_id:int53 story_id:int32 instant_view_version:int32 = WebPage; +webPage url:string display_url:string type:string site_name:string title:string description:formattedText photo:photo embed_url:string embed_type:string embed_width:int32 embed_height:int32 duration:int32 author:string has_large_media:Bool show_large_media:Bool skip_confirmation:Bool show_above_text:Bool animation:animation audio:audio document:document sticker:sticker video:video video_note:videoNote voice_note:voiceNote story_sender_chat_id:int53 story_id:int32 instant_view_version:int32 = WebPage; //@description Contains information about a country @@ -2072,12 +2189,18 @@ address country_code:string state:string city:string street_line1:string street_ //@description Contains parameters of the application theme //@background_color A color of the background in the RGB24 format //@secondary_background_color A secondary color for the background in the RGB24 format +//@header_background_color A color of the header background in the RGB24 format +//@section_background_color A color of the section background in the RGB24 format //@text_color A color of text in the RGB24 format +//@accent_text_color An accent color of the text in the RGB24 format +//@section_header_text_color A color of text on the section headers in the RGB24 format +//@subtitle_text_color A color of the subtitle text in the RGB24 format +//@destructive_text_color A color of the text for destructive actions in the RGB24 format //@hint_color A color of hints in the RGB24 format //@link_color A color of links in the RGB24 format //@button_color A color of the buttons in the RGB24 format //@button_text_color A color of text on the buttons in the RGB24 format -themeParameters background_color:int32 secondary_background_color:int32 text_color:int32 hint_color:int32 link_color:int32 button_color:int32 button_text_color:int32 = ThemeParameters; +themeParameters background_color:int32 secondary_background_color:int32 header_background_color:int32 section_background_color:int32 text_color:int32 accent_text_color:int32 section_header_text_color:int32 subtitle_text_color:int32 destructive_text_color:int32 hint_color:int32 link_color:int32 button_color:int32 button_text_color:int32 = ThemeParameters; //@description Portion of the price of a product (e.g., "delivery cost", "tax amount") @label Label for this portion of the product price @amount Currency amount in the smallest units of the currency @@ -2089,6 +2212,7 @@ labeledPricePart label:string amount:int53 = LabeledPricePart; //@max_tip_amount The maximum allowed amount of tip in the smallest units of the currency //@suggested_tip_amounts Suggested amounts of tip in the smallest units of the currency //@recurring_payment_terms_of_service_url An HTTP URL with terms of service for recurring payments. If non-empty, the invoice payment will result in recurring payments and the user must accept the terms of service before allowed to pay +//@terms_of_service_url An HTTP URL with terms of service for non-recurring payments. If non-empty, then the user must accept the terms of service before allowed to pay //@is_test True, if the payment is a test payment //@need_name True, if the user's name is needed for payment //@need_phone_number True, if the user's phone number is needed for payment @@ -2097,7 +2221,7 @@ labeledPricePart label:string amount:int53 = LabeledPricePart; //@send_phone_number_to_provider True, if the user's phone number will be sent to the provider //@send_email_address_to_provider True, if the user's email address will be sent to the provider //@is_flexible True, if the total price depends on the shipping method -invoice currency:string price_parts:vector max_tip_amount:int53 suggested_tip_amounts:vector recurring_payment_terms_of_service_url:string is_test:Bool need_name:Bool need_phone_number:Bool need_email_address:Bool need_shipping_address:Bool send_phone_number_to_provider:Bool send_email_address_to_provider:Bool is_flexible:Bool = Invoice; +invoice currency:string price_parts:vector max_tip_amount:int53 suggested_tip_amounts:vector recurring_payment_terms_of_service_url:string terms_of_service_url:string is_test:Bool need_name:Bool need_phone_number:Bool need_email_address:Bool need_shipping_address:Bool send_phone_number_to_provider:Bool send_email_address_to_provider:Bool is_flexible:Bool = Invoice; //@description Order information //@name Name of the user @@ -2196,6 +2320,9 @@ inputInvoiceMessage chat_id:int53 message_id:int53 = InputInvoice; //@description An invoice from a link of the type internalLinkTypeInvoice @name Name of the invoice inputInvoiceName name:string = InputInvoice; +//@description An invoice for a payment toward Telegram; must not be used in the in-store apps @purpose Transaction purpose +inputInvoiceTelegram purpose:TelegramPaymentPurpose = InputInvoice; + //@class MessageExtendedMedia @description Describes a media, which is attached to an invoice @@ -2217,6 +2344,15 @@ messageExtendedMediaVideo video:video caption:formattedText = MessageExtendedMed messageExtendedMediaUnsupported caption:formattedText = MessageExtendedMedia; +//@description Describes parameters of a Telegram Premium giveaway +//@boosted_chat_id Identifier of the channel chat, which will be automatically boosted by the winners of the giveaway for duration of the Premium subscription +//@additional_chat_ids Identifiers of other channel chats that must be subscribed by the users to be eligible for the giveaway. There can be up to getOption("giveaway_additional_chat_count_max") additional chats +//@winners_selection_date Point in time (Unix timestamp) when the giveaway is expected to be performed; must be 60-getOption("giveaway_duration_max") seconds in the future in scheduled giveaways +//@only_new_members True, if only new subscribers of the chats will be eligible for the giveaway +//@country_codes The list of two-letter ISO 3166-1 alpha-2 codes of countries, users from which will be eligible for the giveaway. If empty, then all users can participate in the giveaway. +//-There can be up to getOption("giveaway_country_count_max") chosen countries. Users with phone number that was bought on Fragment can participate in any giveaway and the country code "FT" must not be specified in the list +premiumGiveawayParameters boosted_chat_id:int53 additional_chat_ids:vector winners_selection_date:int32 only_new_members:Bool country_codes:vector = PremiumGiveawayParameters; + //@description File with the date it was uploaded @file The file @date Point in time (Unix timestamp) when the file was uploaded datedFile file:file date:int32 = DatedFile; @@ -2500,8 +2636,11 @@ inputPassportElementError type:PassportElementType message:string source:InputPa //@class MessageContent @description Contains the content of a message -//@description A text message @text Text of the message @web_page A preview of the web page that's mentioned in the text; may be null -messageText text:formattedText web_page:webPage = MessageContent; +//@description A text message +//@text Text of the message +//@web_page A link preview attached to the message; may be null +//@link_preview_options Options which was used for generation of the link preview; may be null if default options were used +messageText text:formattedText web_page:webPage link_preview_options:linkPreviewOptions = MessageContent; //@description An animation message (GIF-style). //@animation The animation description @@ -2714,6 +2853,25 @@ messagePaymentSuccessfulBot currency:string total_amount:int53 is_recurring:Bool //@sticker A sticker to be shown in the message; may be null if unknown messageGiftedPremium gifter_user_id:int53 currency:string amount:int53 cryptocurrency:string cryptocurrency_amount:int64 month_count:int32 sticker:sticker = MessageContent; +//@description A Telegram Premium gift code was created for the user +//@creator_id Identifier of a chat or a user that created the gift code +//@is_from_giveaway True, if the gift code was created for a giveaway +//@is_unclaimed True, if the winner for the corresponding Telegram Premium subscription wasn't chosen +//@month_count Number of month the Telegram Premium subscription will be active after code activation +//@sticker A sticker to be shown in the message; may be null if unknown +//@code The gift code +messagePremiumGiftCode creator_id:MessageSender is_from_giveaway:Bool is_unclaimed:Bool month_count:int32 sticker:sticker code:string = MessageContent; + +//@description A Telegram Premium giveaway was created for the chat +messagePremiumGiveawayCreated = MessageContent; + +//@description A Telegram Premium giveaway +//@parameters Giveaway parameters +//@winner_count Number of users which will receive Telegram Premium subscription gift codes +//@month_count Number of month the Telegram Premium subscription will be active after code activation +//@sticker A sticker to be shown in the message; may be null if unknown +messagePremiumGiveaway parameters:premiumGiveawayParameters winner_count:int32 month_count:int32 sticker:sticker = MessageContent; + //@description A contact has registered with Telegram messageContactRegistered = MessageContent; @@ -2723,13 +2881,8 @@ messageUserShared user_id:int53 button_id:int32 = MessageContent; //@description The current user shared a chat, which was requested by the bot @chat_id Identifier of the shared chat @button_id Identifier of the keyboard button with the request messageChatShared chat_id:int53 button_id:int32 = MessageContent; -//@description The current user has connected a website by logging in using Telegram Login Widget on it @domain_name Domain name of the connected website -messageWebsiteConnected domain_name:string = MessageContent; - -//@description The user allowed the bot to send messages -//@web_app Information about the Web App, which requested the access; may be null if none or the Web App was opened from the attachment menu -//@by_request True, if user allowed the bot to send messages by an explicit call to allowBotToSendMessages -messageBotWriteAccessAllowed web_app:webApp by_request:Bool = MessageContent; +//@description The user allowed the bot to send messages @reason The reason why the bot was allowed to write messages +messageBotWriteAccessAllowed reason:BotWriteAccessAllowReason = MessageContent; //@description Data from a Web App has been sent to a bot @button_text Text of the keyboardButtonTypeWebApp button, which opened the Web App messageWebAppDataSent button_text:string = MessageContent; @@ -2800,6 +2953,9 @@ textEntityTypePre = TextEntityType; //@description Text that must be formatted as if inside pre, and code HTML tags @language Programming language of the code; as defined by the sender textEntityTypePreCode language:string = TextEntityType; +//@description Text that must be formatted as if inside a blockquote HTML tag +textEntityTypeBlockQuote = TextEntityType; + //@description A text description shown instead of a raw URL @url HTTP or tg:// URL to be opened when the link is clicked textEntityTypeTextUrl url:string = TextEntityType; @@ -2809,7 +2965,7 @@ textEntityTypeMentionName user_id:int53 = TextEntityType; //@description A custom emoji. The text behind a custom emoji must be an emoji. Only premium users can use premium custom emoji @custom_emoji_id Unique identifier of the custom emoji textEntityTypeCustomEmoji custom_emoji_id:int64 = TextEntityType; -//@description A media timestamp @media_timestamp Timestamp from which a video/audio/video note/voice note playing must start, in seconds. The media can be in the content or the web page preview of the current message, or in the same places in the replied message +//@description A media timestamp @media_timestamp Timestamp from which a video/audio/video note/voice note/story playing must start, in seconds. The media can be in the content or the web page preview of the current message, or in the same places in the replied message textEntityTypeMediaTimestamp media_timestamp:int32 = TextEntityType; @@ -2845,9 +3001,10 @@ messageSelfDestructTypeImmediately = MessageSelfDestructType; //@update_order_of_installed_sticker_sets Pass true if the user explicitly chosen a sticker or a custom emoji from an installed sticker set; applicable only to sendMessage and sendMessageAlbum //@scheduling_state Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, live location messages and self-destructing messages can't be scheduled //@sending_id Non-persistent identifier, which will be returned back in messageSendingStatePending object and can be used to match sent messages and corresponding updateNewMessage updates -messageSendOptions disable_notification:Bool from_background:Bool protect_content:Bool update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState sending_id:int32 = MessageSendOptions; +//@only_preview Pass true to get a fake message instead of actually sending them +messageSendOptions disable_notification:Bool from_background:Bool protect_content:Bool update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState sending_id:int32 only_preview:Bool = MessageSendOptions; -//@description Options to be used when a message content is copied without reference to the original sender. Service messages and messageInvoice can't be copied +//@description Options to be used when a message content is copied without reference to the original sender. Service messages, and messages with messageInvoice or messagePremiumGiveaway content can't be copied //@send_copy True, if content of the message needs to be copied without reference to the original sender. Always true if the message is forwarded to a secret chat or is local //@replace_caption True, if media caption of the message copy needs to be replaced. Ignored if send_copy is false //@new_caption New message caption; pass null to copy message without caption. Ignored if replace_caption is false @@ -2857,10 +3014,10 @@ messageCopyOptions send_copy:Bool replace_caption:Bool new_caption:formattedText //@class InputMessageContent @description The content of a message to send //@description A text message -//@text Formatted text to be sent; 1-getOption("message_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, Code, Pre, PreCode, TextUrl and MentionName entities are allowed to be specified manually -//@disable_web_page_preview True, if rich web page previews for URLs in the message text must be disabled +//@text Formatted text to be sent; 0-getOption("message_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, BlockQuote, Code, Pre, PreCode, TextUrl and MentionName entities are allowed to be specified manually +//@link_preview_options Options to be used for generation of a link preview; pass null to use default link preview options //@clear_draft True, if a chat message draft must be deleted -inputMessageText text:formattedText disable_web_page_preview:Bool clear_draft:Bool = InputMessageContent; +inputMessageText text:formattedText link_preview_options:linkPreviewOptions clear_draft:Bool = InputMessageContent; //@description An animation message (GIF-style). //@animation Animation file to be sent @@ -2987,7 +3144,7 @@ inputMessageStory story_sender_chat_id:int53 story_id:int32 = InputMessageConten //@description A forwarded message //@from_chat_id Identifier for the chat this forwarded message came from -//@message_id Identifier of the message to forward +//@message_id Identifier of the message to forward. A message can be forwarded only if message.can_be_forwarded //@in_game_share True, if a game message is being shared from a launched game; applies only to game messages //@copy_options Options to be used to copy content of the message without reference to the original sender; pass null to forward the message as usual inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool copy_options:messageCopyOptions = InputMessageContent; @@ -3133,10 +3290,11 @@ emojis emojis:vector = Emojis; //@is_official True, if the sticker set is official //@sticker_format Format of the stickers in the set //@sticker_type Type of the stickers in the set +//@needs_repainting True, if stickers in the sticker set are custom emoji that must be repainted; for custom emoji sticker sets only //@is_viewed True for already viewed trending sticker sets //@stickers List of stickers in this set //@emojis A list of emoji corresponding to the stickers in the same order. The list is only for informational purposes, because a sticker is always sent with a fixed emoji from the corresponding Sticker object -stickerSet id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:vector is_installed:Bool is_archived:Bool is_official:Bool sticker_format:StickerFormat sticker_type:StickerType is_viewed:Bool stickers:vector emojis:vector = StickerSet; +stickerSet id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:vector is_installed:Bool is_archived:Bool is_official:Bool sticker_format:StickerFormat sticker_type:StickerType needs_repainting:Bool is_viewed:Bool stickers:vector emojis:vector = StickerSet; //@description Represents short information about a sticker set //@id Identifier of the sticker set @@ -3149,10 +3307,11 @@ stickerSet id:int64 title:string name:string thumbnail:thumbnail thumbnail_outli //@is_official True, if the sticker set is official //@sticker_format Format of the stickers in the set //@sticker_type Type of the stickers in the set +//@needs_repainting True, if stickers in the sticker set are custom emoji that must be repainted; for custom emoji sticker sets only //@is_viewed True for already viewed trending sticker sets //@size Total number of stickers in the set //@covers Up to the first 5 stickers from the set, depending on the context. If the application needs more stickers the full sticker set needs to be requested -stickerSetInfo id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:vector is_installed:Bool is_archived:Bool is_official:Bool sticker_format:StickerFormat sticker_type:StickerType is_viewed:Bool size:int32 covers:vector = StickerSetInfo; +stickerSetInfo id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:vector is_installed:Bool is_archived:Bool is_official:Bool sticker_format:StickerFormat sticker_type:StickerType needs_repainting:Bool is_viewed:Bool size:int32 covers:vector = StickerSetInfo; //@description Represents a list of sticker sets @total_count Approximate total number of sticker sets found @sets List of sticker sets stickerSets total_count:int32 sets:vector = StickerSets; @@ -3202,7 +3361,7 @@ storyViewers total_count:int32 total_reaction_count:int32 viewers:vector = StoryInteractionInfo; +storyInteractionInfo view_count:int32 forward_count:int32 reaction_count:int32 recent_viewer_user_ids:vector = StoryInteractionInfo; //@description Represents a story //@id Unique story identifier among stories of the given sender @@ -3307,8 +3480,11 @@ storyInteractionInfo view_count:int32 reaction_count:int32 recent_viewer_user_id //@is_edited True, if the story was edited //@is_pinned True, if the story is saved in the sender's profile and will be available there after expiration //@is_visible_only_for_self True, if the story is visible only for the current user +//@can_be_deleted True, if the story can be deleted +//@can_be_edited True, if the story can be edited //@can_be_forwarded True, if the story can be forwarded as a message. Otherwise, screenshots and saving of the story content must be also forbidden //@can_be_replied True, if the story can be replied in the chat with the story sender +//@can_toggle_is_pinned True, if the story's is_pinned value can be changed //@can_get_viewers True, if users viewed the story can be received through getStoryViewers //@has_expired_viewers True, if users viewed the story can't be received, because the story has expired more than getOption("story_viewers_expiration_delay") seconds ago //@interaction_info Information about interactions with the story; may be null if the story isn't owned or there were no interactions @@ -3317,7 +3493,7 @@ storyInteractionInfo view_count:int32 reaction_count:int32 recent_viewer_user_id //@content Content of the story //@areas Clickable areas to be shown on the story content //@caption Caption of the story -story id:int32 sender_chat_id:int53 date:int32 is_being_sent:Bool is_being_edited:Bool is_edited:Bool is_pinned:Bool is_visible_only_for_self:Bool can_be_forwarded:Bool can_be_replied:Bool can_get_viewers:Bool has_expired_viewers:Bool interaction_info:storyInteractionInfo chosen_reaction_type:ReactionType privacy_settings:StoryPrivacySettings content:StoryContent areas:vector caption:formattedText = Story; +story id:int32 sender_chat_id:int53 date:int32 is_being_sent:Bool is_being_edited:Bool is_edited:Bool is_pinned:Bool is_visible_only_for_self:Bool can_be_deleted:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied:Bool can_toggle_is_pinned:Bool can_get_viewers:Bool has_expired_viewers:Bool interaction_info:storyInteractionInfo chosen_reaction_type:ReactionType privacy_settings:StoryPrivacySettings content:StoryContent areas:vector caption:formattedText = Story; //@description Represents a list of stories @total_count Approximate total number of stories found @stories The list of stories stories total_count:int32 stories:vector = Stories; @@ -3337,6 +3513,68 @@ storyInfo story_id:int32 date:int32 is_for_close_friends:Bool = StoryInfo; chatActiveStories chat_id:int53 list:StoryList order:int53 max_read_story_id:int32 stories:vector = ChatActiveStories; +//@class ChatBoostSource @description Describes source of a chat boost + +//@description The chat created a Telegram Premium gift code for a user +//@user_id Identifier of a user, for which the gift code was created +//@gift_code The created Telegram Premium gift code, which is known only if this is a gift code for the current user, or it has already been claimed +chatBoostSourceGiftCode user_id:int53 gift_code:string = ChatBoostSource; + +//@description The chat created a Telegram Premium giveaway +//@user_id Identifier of a user that won in the giveaway; 0 if none +//@gift_code The created Telegram Premium gift code if it was used by the user or can be claimed by the current user; an empty string otherwise +//@giveaway_message_id Identifier of the corresponding giveaway message; can be an identifier of a deleted message +//@is_unclaimed True, if the winner for the corresponding Telegram Premium subscription wasn't chosen, because there were not enough participants +chatBoostSourceGiveaway user_id:int53 gift_code:string giveaway_message_id:int53 is_unclaimed:Bool = ChatBoostSource; + +//@description A user with Telegram Premium subscription or gifted Telegram Premium boosted the chat +//@user_id Identifier of the user +chatBoostSourcePremium user_id:int53 = ChatBoostSource; + + +//@description Describes a prepaid Telegram Premium giveaway +//@id Unique identifier of the prepaid giveaway +//@winner_count Number of users which will receive Telegram Premium subscription gift codes +//@month_count Number of month the Telegram Premium subscription will be active after code activation +//@payment_date Point in time (Unix timestamp) when the giveaway was paid +prepaidPremiumGiveaway id:int64 winner_count:int32 month_count:int32 payment_date:int32 = PrepaidPremiumGiveaway; + +//@description Describes current boost status of a chat +//@boost_url An HTTP URL, which can be used to boost the chat +//@applied_slot_ids Identifiers of boost slots of the current user applied to the chat +//@level Current boost level of the chat +//@gift_code_boost_count The number of boosts received by the chat from created Telegram Premium gift codes and giveaways; always 0 if the current user isn't an administrator in the chat +//@boost_count The number of boosts received by the chat +//@current_level_boost_count The number of boosts added to reach the current level +//@next_level_boost_count The number of boosts needed to reach the next level; 0 if the next level isn't available +//@premium_member_count Approximate number of Telegram Premium subscribers joined the chat; always 0 if the current user isn't an administrator in the chat +//@premium_member_percentage A percentage of Telegram Premium subscribers joined the chat; always 0 if the current user isn't an administrator in the chat +//@prepaid_giveaways The list of prepaid giveaways available for the chat; only for chat administrators +chatBoostStatus boost_url:string applied_slot_ids:vector level:int32 gift_code_boost_count:int32 boost_count:int32 current_level_boost_count:int32 next_level_boost_count:int32 premium_member_count:int32 premium_member_percentage:double prepaid_giveaways:vector = ChatBoostStatus; + +//@description Describes a boost applied to a chat +//@id Unique identifier of the boost +//@count The number of identical boosts applied +//@source Source of the boost +//@start_date Point in time (Unix timestamp) when the chat was boosted +//@expiration_date Point in time (Unix timestamp) when the boost will expire +chatBoost id:string count:int32 source:ChatBoostSource start_date:int32 expiration_date:int32 = ChatBoost; + +//@description Contains a list of boosts applied to a chat @total_count Total number of boosts applied to the chat @boosts List of boosts @next_offset The offset for the next request. If empty, there are no more results +foundChatBoosts total_count:int32 boosts:vector next_offset:string = FoundChatBoosts; + +//@description Describes a slot for chat boost +//@slot_id Unique identifier of the slot +//@currently_boosted_chat_id Identifier of the currently boosted chat; 0 if none +//@start_date Point in time (Unix timestamp) when the chat was boosted; 0 if none +//@expiration_date Point in time (Unix timestamp) when the boost will expire +//@cooldown_until_date Point in time (Unix timestamp) after which the boost can be used for another chat +chatBoostSlot slot_id:int32 currently_boosted_chat_id:int53 start_date:int32 expiration_date:int32 cooldown_until_date:int32 = ChatBoostSlot; + +//@description Contains a list of chat boost slots @slots List of boost slots +chatBoostSlots slots:vector = ChatBoostSlots; + + //@class CallDiscardReason @description Describes the reason why a call was discarded //@description The call wasn't discarded, or the reason is unknown @@ -3414,7 +3652,7 @@ callStateReady protocol:callProtocol servers:vector config:string en callStateHangingUp = CallState; //@description The call has ended successfully -//@reason The reason, why the call has ended +//@reason The reason why the call has ended //@need_rating True, if the call rating must be sent to the server //@need_debug_information True, if the call debug information must be sent to the server //@need_log True, if the call log must be sent to the server @@ -3565,8 +3803,12 @@ firebaseAuthenticationSettingsIos device_token:string is_app_sandbox:Bool = Fire phoneNumberAuthenticationSettings allow_flash_call:Bool allow_missed_call:Bool is_current_phone_number:Bool allow_sms_retriever_api:Bool firebase_authentication_settings:FirebaseAuthenticationSettings authentication_tokens:vector = PhoneNumberAuthenticationSettings; -//@description Represents a reaction applied to a message @type Type of the reaction @sender_id Identifier of the chat member, applied the reaction @date Point in time (Unix timestamp) when the reaction was added -addedReaction type:ReactionType sender_id:MessageSender date:int32 = AddedReaction; +//@description Represents a reaction applied to a message +//@type Type of the reaction +//@sender_id Identifier of the chat member, applied the reaction +//@is_outgoing True, if the reaction was added by the current user +//@date Point in time (Unix timestamp) when the reaction was added +addedReaction type:ReactionType sender_id:MessageSender is_outgoing:Bool date:int32 = AddedReaction; //@description Represents a list of reactions added to a message @total_count The total number of found reactions @reactions The list of added reactions @next_offset The offset for the next request. If empty, there are no more results addedReactions total_count:int32 reactions:vector next_offset:string = AddedReactions; @@ -3641,7 +3883,6 @@ attachmentMenuBotColor light_color:int32 dark_color:int32 = AttachmentMenuBotCol //@supports_bot_chats True, if the bot supports opening from attachment menu in private chats with other bots //@supports_group_chats True, if the bot supports opening from attachment menu in basic group and supergroup chats //@supports_channel_chats True, if the bot supports opening from attachment menu in channel chats -//@supports_settings True, if the bot supports "settings_button_pressed" event //@request_write_access True, if the user must be asked for the permission to send messages to the bot //@is_added 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 //@show_in_attachment_menu True, if the bot must be shown in the attachment menu @@ -3659,12 +3900,27 @@ attachmentMenuBotColor light_color:int32 dark_color:int32 = AttachmentMenuBotCol //@macos_side_menu_icon Icon for the bot in PNG format for the official macOS app side menu; may be null //@icon_color Color to highlight selected icon of the bot if appropriate; may be null //@web_app_placeholder Default placeholder for opened Web Apps in SVG format; may be null -attachmentMenuBot bot_user_id:int53 supports_self_chat:Bool supports_user_chats:Bool supports_bot_chats:Bool supports_group_chats:Bool supports_channel_chats:Bool supports_settings:Bool request_write_access:Bool is_added:Bool show_in_attachment_menu:Bool show_in_side_menu:Bool show_disclaimer_in_side_menu:Bool name:string name_color:attachmentMenuBotColor default_icon:file ios_static_icon:file ios_animated_icon:file ios_side_menu_icon:file android_icon:file android_side_menu_icon:file macos_icon:file macos_side_menu_icon:file icon_color:attachmentMenuBotColor web_app_placeholder:file = AttachmentMenuBot; +attachmentMenuBot bot_user_id:int53 supports_self_chat:Bool supports_user_chats:Bool supports_bot_chats:Bool supports_group_chats:Bool supports_channel_chats:Bool request_write_access:Bool is_added:Bool show_in_attachment_menu:Bool show_in_side_menu:Bool show_disclaimer_in_side_menu:Bool name:string name_color:attachmentMenuBotColor default_icon:file ios_static_icon:file ios_animated_icon:file ios_side_menu_icon:file android_icon:file android_side_menu_icon:file macos_icon:file macos_side_menu_icon:file icon_color:attachmentMenuBotColor web_app_placeholder:file = AttachmentMenuBot; //@description Information about the message sent by answerWebAppQuery @inline_message_id Identifier of the sent inline message, if known sentWebAppMessage inline_message_id:string = SentWebAppMessage; +//@class BotWriteAccessAllowReason @description Describes a reason why a bot was allowed to write messages to the current user + +//@description The user connected a website by logging in using Telegram Login Widget on it @domain_name Domain name of the connected website +botWriteAccessAllowReasonConnectedWebsite domain_name:string = BotWriteAccessAllowReason; + +//@description The user added the bot to attachment or side menu using toggleBotIsAddedToAttachmentMenu +botWriteAccessAllowReasonAddedToAttachmentMenu = BotWriteAccessAllowReason; + +//@description The user launched a Web App using getWebAppLinkUrl @web_app Information about the Web App +botWriteAccessAllowReasonLaunchedWebApp web_app:webApp = BotWriteAccessAllowReason; + +//@description The user accepted bot's request to send messages with allowBotToSendMessages +botWriteAccessAllowReasonAcceptedRequest = BotWriteAccessAllowReason; + + //@description Contains an HTTP URL @url The URL httpUrl url:string = HttpUrl; @@ -4010,6 +4266,12 @@ chatEventUsernameChanged old_username:string new_username:string = ChatEventActi //@description The chat active usernames were changed @old_usernames Previous list of active usernames @new_usernames New list of active usernames chatEventActiveUsernamesChanged old_usernames:vector new_usernames:vector = ChatEventAction; +//@description The chat accent color was changed @old_accent_color_id Previous identifier of chat accent color @new_accent_color_id New identifier of chat accent color +chatEventAccentColorChanged old_accent_color_id:int32 new_accent_color_id:int32 = ChatEventAction; + +//@description The chat's custom emoji for reply background was changed @old_background_custom_emoji_id Previous identifier of the custom emoji; 0 if none @new_background_custom_emoji_id New identifier of the custom emoji; 0 if none +chatEventBackgroundCustomEmojiChanged old_background_custom_emoji_id:int64 new_background_custom_emoji_id:int64 = ChatEventAction; + //@description The has_protected_content setting of a channel was toggled @has_protected_content New value of has_protected_content chatEventHasProtectedContentToggled has_protected_content:Bool = ChatEventAction; @@ -4191,6 +4453,9 @@ premiumLimitTypeMonthlySentStoryCount = PremiumLimitType; //@description The maximum length of captions of sent stories premiumLimitTypeStoryCaptionLength = PremiumLimitType; +//@description The maximum number of suggested reaction areas on a story +premiumLimitTypeStorySuggestedReactionAreaCount = PremiumLimitType; + //@class PremiumFeature @description Describes a feature available to Premium users @@ -4242,10 +4507,16 @@ premiumFeatureRealTimeChatTranslation = PremiumFeature; //@description Allowed to use many additional features for stories premiumFeatureUpgradedStories = PremiumFeature; +//@description The ability to boost chats +premiumFeatureChatBoost = PremiumFeature; + +//@description The ability to choose accent color +premiumFeatureAccentColor = PremiumFeature; + //@class PremiumStoryFeature @description Describes a story feature available to Premium users -//@description User stories are displayed before stories of non-premium contacts +//@description User stories are displayed before stories of non-premium contacts and channels premiumStoryFeaturePriorityOrder = PremiumStoryFeature; //@description The ability to hide the fact that the user viewed other's stories @@ -4304,12 +4575,44 @@ premiumState state:formattedText payment_options:vector = StorePaymentPurpose; + +//@description The user creating a Telegram Premium giveaway for subscribers of channel chats; requires can_post_messages rights in the channels +//@parameters Giveaway parameters +//@currency ISO 4217 currency code of the payment currency +//@amount Paid amount, in the smallest units of the currency +storePaymentPurposePremiumGiveaway parameters:premiumGiveawayParameters currency:string amount:int53 = StorePaymentPurpose; + + +//@class TelegramPaymentPurpose @description Describes a purpose of a payment toward Telegram + +//@description The user creating Telegram Premium gift codes for other users +//@boosted_chat_id Identifier of the channel chat, which will be automatically boosted by the users for duration of the Premium subscription and which is administered by the user; 0 if none +//@currency ISO 4217 currency code of the payment currency +//@amount Paid amount, in the smallest units of the currency +//@user_ids Identifiers of the users which can activate the gift codes +//@month_count Number of month the Telegram Premium subscription will be active for the users +telegramPaymentPurposePremiumGiftCodes boosted_chat_id:int53 currency:string amount:int53 user_ids:vector month_count:int32 = TelegramPaymentPurpose; + +//@description The user creating a Telegram Premium giveaway for subscribers of channel chats; requires can_post_messages rights in the channels +//@parameters Giveaway parameters +//@currency ISO 4217 currency code of the payment currency +//@amount Paid amount, in the smallest units of the currency +//@winner_count Number of users which will be able to activate the gift codes +//@month_count Number of month the Telegram Premium subscription will be active for the users +telegramPaymentPurposePremiumGiveaway parameters:premiumGiveawayParameters currency:string amount:int53 winner_count:int32 month_count:int32 = TelegramPaymentPurpose; + //@class DeviceToken @description Represents a data needed to subscribe for push notifications through registerDevice method. To use specific push notification service, the correct application platform must be specified and a valid server authentication data must be uploaded at https://my.telegram.org @@ -4423,7 +4726,7 @@ chatTheme name:string light_settings:themeSettings dark_settings:themeSettings = hashtags hashtags:vector = Hashtags; -//@class CanSendStoryResult @description Represents result of checking whether the current user can send a story +//@class CanSendStoryResult @description Represents result of checking whether the current user can send a story in the specific chat //@description A story can be sent canSendStoryResultOk = CanSendStoryResult; @@ -4431,6 +4734,9 @@ canSendStoryResultOk = CanSendStoryResult; //@description The user must subscribe to Telegram Premium to be able to post stories canSendStoryResultPremiumNeeded = CanSendStoryResult; +//@description The channel chat must be boosted first by Telegram Premium subscribers to post more stories. Call getChatBoostStatus to get current boost status of the chat +canSendStoryResultBoostNeeded = CanSendStoryResult; + //@description The limit for the number of active stories exceeded. The user can buy Telegram Premium, delete an active story, or wait for the oldest story to expire canSendStoryResultActiveStoryLimitExceeded = CanSendStoryResult; @@ -4558,6 +4864,15 @@ pushMessageContentPhoto photo:photo caption:string is_secret:Bool is_pinned:Bool //@is_pinned True, if the message is a pinned message with the specified content pushMessageContentPoll question:string is_regular:Bool is_pinned:Bool = PushMessageContent; +//@description A message with a Telegram Premium gift code created for the user @month_count Number of month the Telegram Premium subscription will be active after code activation +pushMessageContentPremiumGiftCode month_count:int32 = PushMessageContent; + +//@description A message with a Telegram Premium giveaway +//@winner_count Number of users which will receive Telegram Premium subscription gift codes; 0 for pinned message +//@month_count Number of month the Telegram Premium subscription will be active after code activation; 0 for pinned message +//@is_pinned True, if the message is a pinned message with the specified content +pushMessageContentPremiumGiveaway winner_count:int32 month_count:int32 is_pinned:Bool = PushMessageContent; + //@description A screenshot of a message in the chat has been taken pushMessageContentScreenshotTaken = PushMessageContent; @@ -4649,7 +4964,7 @@ notificationTypeNewSecretChat = NotificationType; notificationTypeNewCall call_id:int32 = NotificationType; //@description New message was received through a push notification -//@message_id The message identifier. The message will not be available in the chat history, but the identifier can be used in viewMessages, or as a message to reply +//@message_id The message identifier. The message will not be available in the chat history, but the identifier can be used in viewMessages, or as a message to be replied in the same chat //@sender_id Identifier of the sender of the message. Corresponding user or chat may be inaccessible //@sender_name Name of the sender //@is_outgoing True, if the message is outgoing @@ -5026,6 +5341,12 @@ internalLinkTypeBotStartInGroup bot_username:string start_parameter:string admin //@description The link is a link to the change phone number section of the app internalLinkTypeChangePhoneNumber = InternalLinkType; +//@description The link is a link to boost a Telegram chat. Call getChatBoostLinkInfo with the given URL to process the link. +//-If the chat is found, then call getChatBoostStatus and getAvailableChatBoostSlots to get the current boost status and check whether the chat can be boosted. +//-If the user wants to boost the chat and the chat can be boosted, then call boostChat +//@url URL to be passed to getChatBoostLinkInfo +internalLinkTypeChatBoost url:string = InternalLinkType; + //@description The link is an invite link to a chat folder. Call checkChatFolderInviteLink with the given invite link to process the link @invite_link Internal representation of the invite link internalLinkTypeChatFolderInvite invite_link:string = InternalLinkType; @@ -5083,6 +5404,10 @@ internalLinkTypePhoneNumberConfirmation hash:string phone_number:string = Intern //@description The link is a link to the Premium features screen of the application from which the user can subscribe to Telegram Premium. Call getPremiumFeatures with the given referrer to process the link @referrer Referrer specified in the link internalLinkTypePremiumFeatures referrer:string = InternalLinkType; +//@description The link is a link with a Telegram Premium gift code. Call checkPremiumGiftCode with the given code to process the link. If the code is valid and the user wants to apply it, then call applyPremiumGiftCode +//@code The Telegram Premium gift code +internalLinkTypePremiumGiftCode code:string = InternalLinkType; + //@description The link is a link to the privacy and security section of the app settings internalLinkTypePrivacyAndSecuritySettings = InternalLinkType; @@ -5150,7 +5475,7 @@ internalLinkTypeVideoChat chat_username:string invite_hash:string is_live_stream //@description The link is a link to a Web App. Call searchPublicChat with the given bot username, check that the user is a bot, then call searchWebApp with the received bot and the given web_app_short_name. //-Process received foundWebApp by showing a confirmation dialog if needed. If the bot can be added to attachment or side menu, but isn't added yet, then show a disclaimer about Mini Apps being a third-party apps //-instead of the dialog and ask the user to accept their Terms of service. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. -//-Then call getWebAppLinkUrl and open the returned URL as a Web App +//-Then, call getWebAppLinkUrl and open the returned URL as a Web App //@bot_username Username of the bot that owns the Web App //@web_app_short_name Short name of the Web App //@start_parameter Start parameter to be passed to getWebAppLinkUrl @@ -5165,11 +5490,20 @@ messageLink link:string is_public:Bool = MessageLink; //@chat_id If found, identifier of the chat to which the link points, 0 otherwise //@message_thread_id If found, identifier of the message thread in which to open the message, or a forum topic to open if the message is missing //@message If found, the linked message; may be null -//@media_timestamp Timestamp from which the video/audio/video note/voice note playing must start, in seconds; 0 if not specified. The media can be in the message content or in its web page preview +//@media_timestamp Timestamp from which the video/audio/video note/voice note/story playing must start, in seconds; 0 if not specified. The media can be in the message content or in its web page preview //@for_album True, if the whole media album to which the message belongs is linked messageLinkInfo is_public:Bool chat_id:int53 message_thread_id:int53 message:message media_timestamp:int32 for_album:Bool = MessageLinkInfo; +//@description Contains an HTTPS link to boost a chat @link The link @is_public True, if the link will work for non-members of the chat +chatBoostLink link:string is_public:Bool = ChatBoostLink; + +//@description Contains information about a link to boost a chat +//@is_public True, if the link will work for non-members of the chat +//@chat_id Identifier of the chat to which the link points; 0 if the chat isn't found +chatBoostLinkInfo is_public:Bool chat_id:int53 = ChatBoostLinkInfo; + + //@class BlockList @description Describes a type of a block list //@description The main block list that disallows writing messages to the current user, receiving their status and photo, viewing of stories, and some other actions @@ -5408,6 +5742,9 @@ topChatCategoryCalls = TopChatCategory; topChatCategoryForwardChats = TopChatCategory; +//@description Contains 0-based match position @position The position of the match +foundPosition position:int32 = FoundPosition; + //@description Contains 0-based positions of matched objects @total_count Total number of matched objects @positions The positions of the matched objects foundPositions total_count:int32 positions:vector = FoundPositions; @@ -5596,7 +5933,7 @@ chatStatisticsSupergroup period:dateRange member_count:statisticalValue message_ //@member_count Number of members in the chat //@mean_view_count Mean number of times the recently sent messages was viewed //@mean_share_count Mean number of times the recently sent messages was shared -//@enabled_notifications_percentage A percentage of users with enabled notifications for the chat +//@enabled_notifications_percentage A percentage of users with enabled notifications for the chat; 0-100 //@member_count_graph A graph containing number of members in the chat //@join_graph A graph containing number of members joined and left the chat //@mute_graph A graph containing number of members muted and unmuted the chat @@ -5671,9 +6008,8 @@ updateMessageSendSucceeded message:message old_message_id:int53 = Update; //@description A message failed to send. Be aware that some messages being sent can be irrecoverably deleted, in which case updateDeleteMessages will be received instead of this update //@message The failed to send message //@old_message_id The previous temporary message identifier -//@error_code An error code -//@error_message Error message -updateMessageSendFailed message:message old_message_id:int53 error_code:int32 error_message:string = Update; +//@error The cause of the message sending failure +updateMessageSendFailed message:message old_message_id:int53 error:error = Update; //@description The message content has changed @chat_id Chat identifier @message_id Message identifier @new_content New message content updateMessageContent chat_id:int53 message_id:int53 new_content:MessageContent = Update; @@ -5718,12 +6054,18 @@ updateChatTitle chat_id:int53 title:string = Update; //@description A chat photo was changed @chat_id Chat identifier @photo The new chat photo; may be null updateChatPhoto chat_id:int53 photo:chatPhotoInfo = Update; +//@description A chat accent color has changed @chat_id Chat identifier @accent_color_id The new chat accent color identifier +updateChatAccentColor chat_id:int53 accent_color_id:int32 = Update; + +//@description A chat's custom emoji for reply background has changed @chat_id Chat identifier @background_custom_emoji_id The new tdentifier of a custom emoji to be shown on the reply header background +updateChatBackgroundCustomEmoji chat_id:int53 background_custom_emoji_id:int64 = Update; + //@description Chat permissions was changed @chat_id Chat identifier @permissions The new chat permissions updateChatPermissions chat_id:int53 permissions:chatPermissions = Update; -//@description The last message of a chat was changed. If last_message is null, then the last message in the chat became unknown. Some new unknown messages might be added to the chat in this case +//@description The last message of a chat was changed //@chat_id Chat identifier -//@last_message The new last message in the chat; may be null +//@last_message The new last message in the chat; may be null if the last message became unknown. While the last message is unknown, new messages can be added to the chat without corresponding updateNewMessage update //@positions The new chat positions in the chat lists updateChatLastMessage chat_id:int53 last_message:message positions:vector = Update; @@ -5955,10 +6297,9 @@ updateStorySendSucceeded story:story old_story_id:int32 = Update; //@description A story failed to send. If the story sending is canceled, then updateStoryDeleted will be received instead of this update //@story The failed to send story -//@error The cause of the failure; may be null if unknown -//@error_code An error code -//@error_message Error message -updateStorySendFailed story:story error:CanSendStoryResult error_code:int32 error_message:string = Update; +//@error The cause of the story sending failure +//@error_type Type of the error; may be null if unknown +updateStorySendFailed story:story error:error error_type:CanSendStoryResult = Update; //@description The list of active stories posted by a specific chat has changed //@active_stories The new list of active stories @@ -6002,6 +6343,12 @@ updateSelectedBackground for_dark_theme:Bool background:background = Update; //@description The list of available chat themes has changed @chat_themes The new list of chat themes updateChatThemes chat_themes:vector = Update; +//@description The list of supported accent colors has changed +//@colors Information about supported colors; colors with identifiers 0 (red), 1 (orange), 2 (purple/violet), 3 (green), 4 (cyan), 5 (blue), 6 (pink) must always be supported +//-and aren't included in the list. The exact colors for the accent colors with identifiers 0-6 must be taken from the app theme +//@available_accent_color_ids The list of accent color identifiers, which can be set through setAccentColor and setChatAccentColor. The colors must be shown in the specififed order +updateAccentColors colors:vector available_accent_color_ids:vector = Update; + //@description Some language pack strings have been updated @localization_target Localization target to which the language pack belongs @language_pack_id Identifier of the updated language pack @strings List of changed language pack strings; empty if all strings have changed updateLanguagePackStrings localization_target:string language_pack_id:string strings:vector = Update; @@ -6133,6 +6480,11 @@ updateChatMember chat_id:int53 actor_user_id:int53 date:int32 invite_link:chatIn //@invite_link The invite link, which was used to send join request; may be null updateNewChatJoinRequest chat_id:int53 request:chatJoinRequest user_chat_id:int53 invite_link:chatInviteLink = Update; +//@description A chat boost has changed; for bots only +//@chat_id Chat identifier +//@boost New information about the boost +updateChatBoost chat_id:int53 boost:chatBoost = Update; + //@description Contains a list of updates @updates List of updates updates updates:vector = Updates; @@ -6604,13 +6956,6 @@ getChatMessagePosition chat_id:int53 message_id:int53 filter:SearchMessagesFilte //@description Returns all scheduled messages in a chat. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id) @chat_id Chat identifier getChatScheduledMessages chat_id:int53 = Messages; -//@description Returns forwarded copies of a channel message to different public channels. For optimal performance, the number of returned messages is chosen by TDLib -//@chat_id Chat identifier of the message -//@message_id Message identifier -//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results -//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit -getMessagePublicForwards chat_id:int53 message_id:int53 offset:string limit:int32 = FoundMessages; - //@description Returns sponsored messages to be shown in a chat; for channel chats only @chat_id Identifier of the chat getChatSponsoredMessages chat_id:int53 = SponsoredMessages; @@ -6630,7 +6975,7 @@ removeNotificationGroup notification_group_id:int32 max_notification_id:int32 = //@description Returns an HTTPS link to a message in a chat. Available only for already sent messages in supergroups and channels, or if message.can_get_media_timestamp_links and a media timestamp link is generated. This is an offline request //@chat_id Identifier of the chat to which the message belongs //@message_id Identifier of the message -//@media_timestamp If not 0, timestamp from which the video/audio/video note/voice note playing must start, in seconds. The media can be in the message content or in its web page preview +//@media_timestamp If not 0, timestamp from which the video/audio/video note/voice note/story playing must start, in seconds. The media can be in the message content or in its web page preview //@for_album Pass true to create a link for the whole media album //@in_message_thread Pass true to create a link to the message as a channel post comment, in a message thread, or a forum topic getMessageLink chat_id:int53 message_id:int53 media_timestamp:int32 for_album:Bool in_message_thread:Bool = MessageLink; @@ -6682,20 +7027,19 @@ setChatMessageSender chat_id:int53 message_sender_id:MessageSender = Ok; //@description Sends a message. Returns the sent message //@chat_id Target chat //@message_thread_id If not 0, a message thread identifier in which the message will be sent -//@reply_to Identifier of the replied message or story; pass null if none +//@reply_to Information about the message or story to be replied; pass null if none //@options Options to be used to send the message; pass null to use default options //@reply_markup Markup for replying to the message; pass null if none; for bots only //@input_message_content The content of the message to be sent -sendMessage chat_id:int53 message_thread_id:int53 reply_to:MessageReplyTo options:messageSendOptions reply_markup:ReplyMarkup input_message_content:InputMessageContent = Message; +sendMessage chat_id:int53 message_thread_id:int53 reply_to:InputMessageReplyTo options:messageSendOptions reply_markup:ReplyMarkup input_message_content:InputMessageContent = Message; //@description Sends 2-10 messages grouped together into an album. Currently, only audio, document, photo and video messages can be grouped into an album. Documents and audio files can be only grouped in an album with messages of the same type. Returns sent messages //@chat_id Target chat //@message_thread_id If not 0, a message thread identifier in which the messages will be sent -//@reply_to Identifier of the replied message or story; pass null if none +//@reply_to Information about the message or story to be replied; pass null if none //@options Options to be used to send the messages; pass null to use default options //@input_message_contents Contents of messages to be sent. At most 10 messages can be added to an album -//@only_preview Pass true to get fake messages instead of actually sending them -sendMessageAlbum chat_id:int53 message_thread_id:int53 reply_to:MessageReplyTo options:messageSendOptions input_message_contents:vector only_preview:Bool = Messages; +sendMessageAlbum chat_id:int53 message_thread_id:int53 reply_to:InputMessageReplyTo options:messageSendOptions input_message_contents:vector = Messages; //@description Invites a bot to a chat (if it is not yet a member) and sends it the /start command. Bots can't be invited to a private chat other than the chat with the bot. Bots can't be invited to channels (although they can be added as admins) and secret chats. Returns the sent message //@bot_user_id Identifier of the bot @@ -6706,29 +7050,29 @@ sendBotStartMessage bot_user_id:int53 chat_id:int53 parameter:string = Message; //@description Sends the result of an inline query as a message. Returns the sent message. Always clears a chat draft message //@chat_id Target chat //@message_thread_id If not 0, a message thread identifier in which the message will be sent -//@reply_to Identifier of the replied message or story; pass null if none +//@reply_to Information about the message or story to be replied; pass null if none //@options Options to be used to send the message; pass null to use default options //@query_id Identifier of the inline query //@result_id Identifier of the inline query result //@hide_via_bot Pass true to hide the bot, via which the message is sent. Can be used only for bots getOption("animation_search_bot_username"), getOption("photo_search_bot_username"), and getOption("venue_search_bot_username") -sendInlineQueryResultMessage chat_id:int53 message_thread_id:int53 reply_to:MessageReplyTo options:messageSendOptions query_id:int64 result_id:string hide_via_bot:Bool = Message; +sendInlineQueryResultMessage chat_id:int53 message_thread_id:int53 reply_to:InputMessageReplyTo options:messageSendOptions query_id:int64 result_id:string hide_via_bot:Bool = Message; //@description Forwards previously sent messages. Returns the forwarded messages in the same order as the message identifiers passed in message_ids. If a message can't be forwarded, null will be returned instead of the message //@chat_id Identifier of the chat to which to forward messages //@message_thread_id If not 0, a message thread identifier in which the message will be sent; for forum threads only //@from_chat_id Identifier of the chat from which to forward messages -//@message_ids Identifiers of the messages to forward. Message identifiers must be in a strictly increasing order. At most 100 messages can be forwarded simultaneously +//@message_ids Identifiers of the messages to forward. Message identifiers must be in a strictly increasing order. At most 100 messages can be forwarded simultaneously. A message can be forwarded only if message.can_be_forwarded //@options Options to be used to send the messages; pass null to use default options //@send_copy Pass true to copy content of the messages without reference to the original sender. Always true if the messages are forwarded to a secret chat or are local //@remove_caption Pass true to remove media captions of message copies. Ignored if send_copy is false -//@only_preview Pass true to get fake messages instead of actually forwarding them -forwardMessages chat_id:int53 message_thread_id:int53 from_chat_id:int53 message_ids:vector options:messageSendOptions send_copy:Bool remove_caption:Bool only_preview:Bool = Messages; +forwardMessages chat_id:int53 message_thread_id:int53 from_chat_id:int53 message_ids:vector options:messageSendOptions send_copy:Bool remove_caption:Bool = Messages; //@description Resends messages which failed to send. Can be called only for messages for which messageSendingStateFailed.can_retry is true and after specified in messageSendingStateFailed.retry_after time passed. //-If a message is re-sent, the corresponding failed to send message is deleted. Returns the sent messages in the same order as the message identifiers passed in message_ids. If a message can't be re-sent, null will be returned instead of the message //@chat_id Identifier of the chat to send messages //@message_ids Identifiers of the messages to resend. Message identifiers must be in a strictly increasing order -resendMessages chat_id:int53 message_ids:vector = Messages; +//@quote New manually chosen quote from the message to be replied; pass null if none. Ignored if more than one message is re-sent, or if messageSendingStateFailed.need_another_reply_quote == false +resendMessages chat_id:int53 message_ids:vector quote:formattedText = Messages; //@description Sends a notification about a screenshot taken in a chat. Supported only in private and secret chats @chat_id Chat identifier sendChatScreenshotTakenNotification chat_id:int53 = Ok; @@ -6736,10 +7080,10 @@ sendChatScreenshotTakenNotification chat_id:int53 = Ok; //@description Adds a local message to a chat. The message is persistent across application restarts only if the message database is used. Returns the added message //@chat_id Target chat //@sender_id Identifier of the sender of the message -//@reply_to Identifier of the replied message or story; pass null if none +//@reply_to Information about the message or story to be replied; pass null if none //@disable_notification Pass true to disable notification for the message //@input_message_content The content of the message to be added -addLocalMessage chat_id:int53 sender_id:MessageSender reply_to:MessageReplyTo disable_notification:Bool input_message_content:InputMessageContent = Message; +addLocalMessage chat_id:int53 sender_id:MessageSender reply_to:InputMessageReplyTo disable_notification:Bool input_message_content:InputMessageContent = Message; //@description Deletes messages @chat_id Chat identifier @message_ids Identifiers of the messages to be deleted @revoke Pass true to delete messages for all chat members. Always true for supergroups, channels and secret chats deleteMessages chat_id:int53 message_ids:vector revoke:Bool = Ok; @@ -6935,10 +7279,16 @@ getMessageAddedReactions chat_id:int53 message_id:int53 reaction_type:ReactionTy setDefaultReactionType reaction_type:ReactionType = Ok; +//@description Searches for a given quote in a text. Returns found quote start position in UTF-16 code units. Returns a 404 error if the quote is not found. Can be called synchronously +//@text Text in which to search for the quote +//@quote Quote to search for +//@quote_position Approximate quote position in UTF-16 code units +searchQuote text:formattedText quote:formattedText quote_position:int32 = FoundPosition; + //@description Returns all entities (mentions, hashtags, cashtags, bot commands, bank card numbers, URLs, and email addresses) found in the text. Can be called synchronously @text The text in which to look for entities getTextEntities text:string = TextEntities; -//@description Parses Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, Code, Pre, PreCode, TextUrl and MentionName entities from a marked-up text. Can be called synchronously @text The text to parse @parse_mode Text parse mode +//@description Parses Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, BlockQuote, Code, Pre, PreCode, TextUrl and MentionName entities from a marked-up text. Can be called synchronously @text The text to parse @parse_mode Text parse mode parseTextEntities text:string parse_mode:TextParseMode = FormattedText; //@description Parses Markdown entities in a human-friendly format, ignoring markup errors. Can be called synchronously @@ -6988,7 +7338,7 @@ setPollAnswer chat_id:int53 message_id:int53 option_ids:vector = Ok; //@limit The maximum number of voters to be returned; must be positive and can't be greater than 50. For optimal performance, the number of returned voters is chosen by TDLib and can be smaller than the specified limit, even if the end of the voter list has not been reached getPollVoters chat_id:int53 message_id:int53 option_id:int32 offset:int32 limit:int32 = MessageSenders; -//@description Stops a poll. A poll in a message can be stopped when the message has can_be_edited flag set +//@description Stops a poll. A poll in a message can be stopped when the message has can_be_edited flag is set //@chat_id Identifier of the chat to which the poll belongs //@message_id Identifier of the message containing the poll //@reply_markup The new message reply markup; pass null if none; for bots only @@ -7087,8 +7437,8 @@ sendWebAppData bot_user_id:int53 button_text:string data:string = Ok; //@theme Preferred Web App theme; pass null to use the default theme //@application_name Short name of the application; 0-64 English letters, digits, and underscores //@message_thread_id If not 0, a message thread identifier in which the message will be sent -//@reply_to Identifier of the replied message or story for the message sent by the Web App; pass null if none -openWebApp chat_id:int53 bot_user_id:int53 url:string theme:themeParameters application_name:string message_thread_id:int53 reply_to:MessageReplyTo = WebAppInfo; +//@reply_to Information about the message or story to be replied in the message sent by the Web App; pass null if none +openWebApp chat_id:int53 bot_user_id:int53 url:string theme:themeParameters application_name:string message_thread_id:int53 reply_to:InputMessageReplyTo = WebAppInfo; //@description Informs TDLib that a previously opened Web App was closed @web_app_launch_id Identifier of Web App launch, received from openWebApp closeWebApp web_app_launch_id:int64 = Ok; @@ -7231,7 +7581,7 @@ createNewBasicGroupChat user_ids:vector title:string message_auto_delete_ //@param_description Chat description; 0-255 characters //@location Chat location if a location-based supergroup is being created; pass null to create an ordinary supergroup chat //@message_auto_delete_time Message auto-delete time value, in seconds; must be from 0 up to 365 * 86400 and be divisible by 86400. If 0, then messages aren't deleted automatically -//@for_import Pass true to create a supergroup for importing messages using importMessage +//@for_import Pass true to create a supergroup for importing messages using importMessages createNewSupergroupChat title:string is_forum:Bool is_channel:Bool description:string location:chatLocation message_auto_delete_time:int32 for_import:Bool = Chat; //@description Creates a new secret chat. Returns the newly created chat @user_id Identifier of the target user @@ -7329,6 +7679,12 @@ setChatTitle chat_id:int53 title:string = Ok; //@photo New chat photo; pass null to delete the chat photo setChatPhoto chat_id:int53 photo:InputChatPhoto = Ok; +//@description Changes accent color and background custom emoji of a chat. Supported only for channels with getOption("channel_custom_accent_color_boost_level_min") boost level. Requires can_change_info administrator right +//@chat_id Chat identifier +//@accent_color_id Identifier of the accent color to use +//@background_custom_emoji_id Identifier of a custom emoji to be shown on the reply header background; 0 if none +setChatAccentColor chat_id:int53 accent_color_id:int32 background_custom_emoji_id:int64 = Ok; + //@description Changes the message auto-delete or self-destruct (for secret chats) time in a chat. Requires change_info administrator right in basic groups, supergroups and channels //-Message auto-delete time can't be changed in a chat with the current user (Saved Messages) and the chat 777000 (Telegram). //@chat_id Chat identifier @@ -7516,10 +7872,14 @@ readChatList chat_list:ChatList = Ok; //@only_local Pass true to get only locally available information without sending network requests getStory story_sender_chat_id:int53 story_id:int32 only_local:Bool = Story; -//@description Checks whether the current user can send a story -canSendStory = CanSendStoryResult; +//@description Returns channel chats in which the current user has the right to post stories. The chats must be rechecked with canSendStory before actually trying to post a story there +getChatsToSendStories = Chats; -//@description Sends a new story. Returns a temporary story +//@description Checks whether the current user can send a story on behalf of a chat; requires can_post_stories rights for channel chats @chat_id Chat identifier +canSendStory chat_id:int53 = CanSendStoryResult; + +//@description Sends a new story to a chat; requires can_post_stories rights for channel chats. Returns a temporary story +//@chat_id Identifier of the chat that will post the story //@content Content of the story //@areas Clickable rectangle areas to be shown on the story media; pass null if none //@caption Story caption; pass null to use an empty caption; 0-getOption("story_caption_length_max") characters @@ -7527,23 +7887,32 @@ canSendStory = CanSendStoryResult; //@active_period Period after which the story is moved to archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400 for Telegram Premium users, and 86400 otherwise //@is_pinned Pass true to keep the story accessible after expiration //@protect_content Pass true if the content of the story must be protected from forwarding and screenshotting -sendStory content:InputStoryContent areas:inputStoryAreas caption:formattedText privacy_settings:StoryPrivacySettings active_period:int32 is_pinned:Bool protect_content:Bool = Story; +sendStory chat_id:int53 content:InputStoryContent areas:inputStoryAreas caption:formattedText privacy_settings:StoryPrivacySettings active_period:int32 is_pinned:Bool protect_content:Bool = Story; -//@description Changes content and caption of a previously sent story +//@description Changes content and caption of a story. Can be called only if story.can_be_edited == true +//@story_sender_chat_id Identifier of the chat that posted the story //@story_id Identifier of the story to edit //@content New content of the story; pass null to keep the current content //@areas New clickable rectangle areas to be shown on the story media; pass null to keep the current areas. Areas can't be edited if story content isn't changed //@caption New story caption; pass null to keep the current caption -editStory story_id:int32 content:InputStoryContent areas:inputStoryAreas caption:formattedText = Ok; +editStory story_sender_chat_id:int53 story_id:int32 content:InputStoryContent areas:inputStoryAreas caption:formattedText = Ok; -//@description Changes privacy settings of a previously sent story @story_id Identifier of the story @privacy_settings The new privacy settigs for the story -setStoryPrivacySettings story_id:int32 privacy_settings:StoryPrivacySettings = Ok; +//@description Changes privacy settings of a story. Can be called only if story.can_be_edited == true +//@story_sender_chat_id Identifier of the chat that posted the story +//@story_id Identifier of the story +//@privacy_settings The new privacy settigs for the story +setStoryPrivacySettings story_sender_chat_id:int53 story_id:int32 privacy_settings:StoryPrivacySettings = Ok; -//@description Toggles whether a story is accessible after expiration @story_id Identifier of the story @is_pinned Pass true to make the story accessible after expiration; pass false to make it private -toggleStoryIsPinned story_id:int32 is_pinned:Bool = Ok; +//@description Toggles whether a story is accessible after expiration. Can be called only if story.can_toggle_is_pinned == true +//@story_sender_chat_id Identifier of the chat that posted the story +//@story_id Identifier of the story +//@is_pinned Pass true to make the story accessible after expiration; pass false to make it private +toggleStoryIsPinned story_sender_chat_id:int53 story_id:int32 is_pinned:Bool = Ok; -//@description Deletes a previously sent story @story_id Identifier of the story to delete -deleteStory story_id:int32 = Ok; +//@description Deletes a previously sent story. Can be called only if story.can_be_deleted == true +//@story_sender_chat_id Identifier of the chat that posted the story +//@story_id Identifier of the story to delete +deleteStory story_sender_chat_id:int53 story_id:int32 = Ok; //@description Returns list of chats with non-default notification settings for stories getStoryNotificationSettingsExceptions = Chats; @@ -7567,12 +7936,13 @@ getChatActiveStories chat_id:int53 = ChatActiveStories; //-For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit getChatPinnedStories chat_id:int53 from_story_id:int32 limit:int32 = Stories; -//@description Returns the list of all stories of the current user. The stories are returned in a reverse chronological order (i.e., in order of decreasing story_id). -//-For optimal performance, the number of returned stories is chosen by TDLib +//@description Returns the list of all stories posted by the given chat; requires can_edit_stories rights for channel chats. +//-The stories are returned in a reverse chronological order (i.e., in order of decreasing story_id). For optimal performance, the number of returned stories is chosen by TDLib +//@chat_id Chat identifier //@from_story_id Identifier of the story starting from which stories must be returned; use 0 to get results from the last story //@limit The maximum number of stories to be returned //-For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit -getArchivedStories from_story_id:int32 limit:int32 = Stories; +getChatArchivedStories chat_id:int53 from_story_id:int32 limit:int32 = Stories; //@description Informs TDLib that a story is opened and is being viewed by the user //@story_sender_chat_id The identifier of the sender of the opened story @@ -7594,7 +7964,7 @@ getStoryAvailableReactions row_size:int32 = AvailableReactions; //@update_recent_reactions Pass true if the reaction needs to be added to recent reactions setStoryReaction story_sender_chat_id:int53 story_id:int32 reaction_type:ReactionType update_recent_reactions:Bool = Ok; -//@description Returns viewers of a story. The method can be called if story.can_get_viewers == true +//@description Returns viewers of a story. The method can be called only for stories posted on behalf of the current user //@story_id Story identifier //@query Query to search for in names and usernames of the viewers; may be empty to get all relevant viewers //@only_contacts Pass true to get only contacts; pass false to get all relevant viewers @@ -7615,6 +7985,34 @@ reportStory story_sender_chat_id:int53 story_id:int32 reason:ReportReason text:s activateStoryStealthMode = Ok; +//@description Returns the list of available chat boost slots for the current user +getAvailableChatBoostSlots = ChatBoostSlots; + +//@description Returns the current boost status for a channel chat @chat_id Identifier of the channel chat +getChatBoostStatus chat_id:int53 = ChatBoostStatus; + +//@description Boosts a chat and returns the list of available chat boost slots for the current user after the boost @chat_id Identifier of the chat @slot_ids Identifiers of boost slots of the current user from which to apply boosts to the chat +boostChat chat_id:int53 slot_ids:vector = ChatBoostSlots; + +//@description Returns an HTTPS link to boost the specified channel chat @chat_id Identifier of the chat +getChatBoostLink chat_id:int53 = ChatBoostLink; + +//@description Returns information about a link to boost a chat. Can be called for any internal link of the type internalLinkTypeChatBoost @url The link to boost a chat +getChatBoostLinkInfo url:string = ChatBoostLinkInfo; + +//@description Returns list of boosts applied to a chat; requires administrator rights in the channel chat +//@chat_id Identifier of the chat +//@only_gift_codes Pass true to receive only boosts received from gift codes and giveaways created by the chat +//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results +//@limit The maximum number of boosts to be returned; up to 100. For optimal performance, the number of returned boosts can be smaller than the specified limit +getChatBoosts chat_id:int53 only_gift_codes:Bool offset:string limit:int32 = FoundChatBoosts; + +//@description Returns list of boosts applied to a chat by a given user; requires administrator rights in the channel chat; for bots only +//@chat_id Identifier of the chat +//@user_id Identifier of the user +getUserChatBoosts chat_id:int53 user_id:int53 = FoundChatBoosts; + + //@description Returns information about a bot that can be added to attachment or side menu @bot_user_id Bot's user identifier getAttachmentMenuBot bot_user_id:int53 = AttachmentMenuBot; @@ -7912,7 +8310,7 @@ setGroupCallTitle group_call_id:int32 title:string = Ok; //@mute_new_participants New value of the mute_new_participants setting toggleGroupCallMuteNewParticipants group_call_id:int32 mute_new_participants:Bool = Ok; -//@description Invites users to an active group call. Sends a service message of type messageInviteToGroupCall for video chats +//@description Invites users to an active group call. Sends a service message of type messageInviteVideoChatParticipants for video chats //@group_call_id Group call identifier //@user_ids User identifiers. At most 10 users can be invited simultaneously inviteGroupCallParticipants group_call_id:int32 user_ids:vector = Ok; @@ -8174,6 +8572,9 @@ getDefaultChatPhotoCustomEmojiStickers = Stickers; //@description Returns default list of custom emoji stickers for placing on a profile photo getDefaultProfilePhotoCustomEmojiStickers = Stickers; +//@description Returns default list of custom emoji stickers for reply background +getDefaultBackgroundCustomEmojiStickers = Stickers; + //@description Returns saved animations getSavedAnimations = Animations; @@ -8197,8 +8598,10 @@ searchHashtags prefix:string limit:int32 = Hashtags; removeRecentHashtag hashtag:string = Ok; -//@description Returns a web page preview by the text of the message. Do not call this function too often. Returns a 404 error if the web page has no preview @text Message text with formatting -getWebPagePreview text:formattedText = WebPage; +//@description Returns a link preview by the text of a message. Do not call this function too often. Returns a 404 error if the text has no link preview +//@text Message text with formatting +//@link_preview_options Options to be used for generation of the link preview; pass null to use default link preview options +getWebPagePreview text:formattedText link_preview_options:linkPreviewOptions = WebPage; //@description Returns an instant view version of a web page if available. Returns a 404 error if the web page has no instant view page @url The web page URL @force_full Pass true to get full instant view for the web page getWebPageInstantView url:string force_full:Bool = WebPageInstantView; @@ -8212,6 +8615,11 @@ setProfilePhoto photo:InputChatPhoto is_public:Bool = Ok; //@description Deletes a profile photo @profile_photo_id Identifier of the profile photo to delete deleteProfilePhoto profile_photo_id:int64 = Ok; +//@description Changes accent color and background custom emoji for the current user; for Telegram Premium users only +//@accent_color_id Identifier of the accent color to use +//@background_custom_emoji_id Identifier of a custom emoji to be shown on the reply header background; 0 if none +setAccentColor accent_color_id:int32 background_custom_emoji_id:int64 = Ok; + //@description Changes the first and last name of the current user @first_name The new value of the first name for the current user; 1-64 characters @last_name The new value of the optional last name for the current user; 0-64 characters setName first_name:string last_name:string = Ok; @@ -8456,7 +8864,7 @@ closeSecretChat secret_chat_id:int32 = Ok; getChatEventLog chat_id:int53 query:string from_event_id:int64 limit:int32 filters:chatEventLogFilters user_ids:vector = ChatEvents; -//@description Returns an invoice payment form. This method must be called when the user presses inlineKeyboardButtonBuy +//@description Returns an invoice payment form. This method must be called when the user presses inline button of the type inlineKeyboardButtonTypeBuy //@input_invoice The invoice //@theme Preferred payment form theme; pass null to use the default theme getPaymentForm input_invoice:InputInvoice theme:themeParameters = PaymentForm; @@ -8637,6 +9045,13 @@ getChatStatistics chat_id:int53 is_dark:Bool = ChatStatistics; //@description Returns detailed statistics about a message. Can be used only if message.can_get_statistics == true @chat_id Chat identifier @message_id Message identifier @is_dark Pass true if a dark theme is used by the application getMessageStatistics chat_id:int53 message_id:int53 is_dark:Bool = MessageStatistics; +//@description Returns forwarded copies of a channel message to different public channels. Can be used only if message.can_get_statistics == true. For optimal performance, the number of returned messages is chosen by TDLib +//@chat_id Chat identifier of the message +//@message_id Message identifier +//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results +//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit +getMessagePublicForwards chat_id:int53 message_id:int53 offset:string limit:int32 = FoundMessages; + //@description Loads an asynchronous or a zoomed in statistical graph @chat_id Chat identifier @token The token for graph loading @x X-value for zoomed in graph or 0 otherwise getStatisticalGraph chat_id:int53 token:string x:int53 = StatisticalGraph; @@ -8877,6 +9292,26 @@ clickPremiumSubscriptionButton = Ok; //@description Returns state of Telegram Premium subscription and promotion videos for Premium features getPremiumState = PremiumState; +//@description Returns available options for Telegram Premium gift code or giveaway creation +//@boosted_chat_id Identifier of the channel chat, which will be automatically boosted by receivers of the gift codes and which is administered by the user; 0 if none +getPremiumGiftCodePaymentOptions boosted_chat_id:int53 = PremiumGiftCodePaymentOptions; + +//@description Return information about a Telegram Premium gift code @code The code to check +checkPremiumGiftCode code:string = PremiumGiftCodeInfo; + +//@description Applies a Telegram Premium gift code @code The code to apply +applyPremiumGiftCode code:string = Ok; + +//@description Launches a prepaid Telegram Premium giveaway for subscribers of channel chats; requires can_post_messages rights in the channels +//@giveaway_id Unique identifier of the prepaid giveaway +//@parameters Giveaway parameters +launchPrepaidPremiumGiveaway giveaway_id:int64 parameters:premiumGiveawayParameters = Ok; + +//@description Returns information about a Telegram Premium giveaway +//@chat_id Identifier of the channel chat which started the giveaway +//@message_id Identifier of the giveaway message in the chat +getPremiumGiveawayInfo chat_id:int53 message_id:int53 = PremiumGiveawayInfo; + //@description Checks whether Telegram Premium purchase is possible. Must be called before in-store Premium purchase @purpose Transaction purpose canPurchasePremium purpose:StorePaymentPurpose = Ok; diff --git a/example/bot/Bot.go b/example/bot/Bot.go index d4513ba..8880ff0 100644 --- a/example/bot/Bot.go +++ b/example/bot/Bot.go @@ -87,7 +87,7 @@ func main() { }) m, err := client.SendMessage(&tdlib.SendMessageRequest{ ChatId: chatId, - ReplyTo: &tdlib.MessageReplyToMessage{ + ReplyTo: &tdlib.InputMessageReplyToMessage{ ChatId: chatId, MessageId: msgId, }, diff --git a/example/command/ReplyCommand.go b/example/command/ReplyCommand.go index f88c2f5..5d898d6 100644 --- a/example/command/ReplyCommand.go +++ b/example/command/ReplyCommand.go @@ -98,7 +98,7 @@ func main() { }) m, err := client.SendMessage(&tdlib.SendMessageRequest{ ChatId: chatId, - ReplyTo: &tdlib.MessageReplyToMessage{ + ReplyTo: &tdlib.InputMessageReplyToMessage{ ChatId: chatId, MessageId: msgId, }, @@ -113,7 +113,7 @@ func main() { case "/repeat": m, err := client.SendMessage(&tdlib.SendMessageRequest{ ChatId: chatId, - ReplyTo: &tdlib.MessageReplyToMessage{ + ReplyTo: &tdlib.InputMessageReplyToMessage{ ChatId: chatId, MessageId: msgId, }, diff --git a/example/media/Photo_or_Album.go b/example/media/Photo_or_Album.go index e44c35d..fe153bf 100644 --- a/example/media/Photo_or_Album.go +++ b/example/media/Photo_or_Album.go @@ -98,7 +98,7 @@ func main() { }) m, err := client.SendMessage(&tdlib.SendMessageRequest{ ChatId: chatId, - ReplyTo: &tdlib.MessageReplyToMessage{ + ReplyTo: &tdlib.InputMessageReplyToMessage{ ChatId: chatId, MessageId: msgId, }, @@ -120,7 +120,7 @@ func main() { }) m, err := client.SendMessageAlbum(&tdlib.SendMessageAlbumRequest{ ChatId: chatId, - ReplyTo: &tdlib.MessageReplyToMessage{ + ReplyTo: &tdlib.InputMessageReplyToMessage{ ChatId: chatId, MessageId: msgId, }, diff --git a/example/pending/PendingUpdate.go b/example/pending/PendingUpdate.go index 738f506..3256a6d 100644 --- a/example/pending/PendingUpdate.go +++ b/example/pending/PendingUpdate.go @@ -92,7 +92,7 @@ func main() { }) m, err := client.SendMessage(&tdlib.SendMessageRequest{ ChatId: chatId, - ReplyTo: &tdlib.MessageReplyToMessage{ + ReplyTo: &tdlib.InputMessageReplyToMessage{ ChatId: chatId, MessageId: msgId, }, From 4459ee0f5541dbdef7250338fcb4dea399f16135 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Sat, 25 Nov 2023 04:24:41 +0800 Subject: [PATCH 05/54] Fix messageSendingStatePending replacer --- client/client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/client.go b/client/client.go index 33a96d5..5c1b076 100644 --- a/client/client.go +++ b/client/client.go @@ -211,7 +211,7 @@ func (client *Client) Send(req Request) (*Response, error) { if err2 != nil { return response, nil } - response.Data = bytes.Replace(response.Data, []byte("{\"@type\":\"messageSendingStatePending\"}"), []byte("{\"@type\":\"updateMessageSendSucceeded\"}"), 1) + response.Data = bytes.Replace(response.Data, []byte("\"@type\":\"messageSendingStatePending\""), []byte("\"@type\":\"updateMessageSendSucceeded\""), 1) response.Data = bytes.Replace(response.Data, []byte("\"id\":"+strconv.FormatInt(m.Id, 10)), []byte("\"id\":"+strconv.FormatInt(m2.Message.Id, 10)), 1) return response, nil case <-time.After(1 * time.Second): From 434963f2c9ecbe6ddf25181c3507922c77f4a0f9 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Sat, 25 Nov 2023 19:52:46 +0800 Subject: [PATCH 06/54] Remove unused sync.map --- client/client.go | 6 ------ 1 file changed, 6 deletions(-) diff --git a/client/client.go b/client/client.go index 5c1b076..114818c 100644 --- a/client/client.go +++ b/client/client.go @@ -19,7 +19,6 @@ type Client struct { listenerStore *listenerStore catchersStore *sync.Map successMsgStore *sync.Map - forwardMsgStore *sync.Map updatesTimeout time.Duration catchTimeout time.Duration } @@ -75,7 +74,6 @@ func NewClient(authorizationStateHandler AuthorizationStateHandler, options ...O listenerStore: newListenerStore(), catchersStore: &sync.Map{}, successMsgStore: &sync.Map{}, - forwardMsgStore: &sync.Map{}, } client.extraGenerator = UuidV4Generator() @@ -116,10 +114,6 @@ func (client *Client) processResponse(response *Response) { if sOk { sendVal.(chan *Response) <- response } - forwardVal, fOk := client.forwardMsgStore.Load(typ.(*UpdateMessageSendSucceeded).OldMessageId) - if fOk { - forwardVal.(chan *Response) <- response - } } if len(client.listenerStore.Listeners()) == 0 { From 7563ce479c466d95d8580d0f78ba69df69cf5ed2 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Sat, 25 Nov 2023 21:08:02 +0800 Subject: [PATCH 07/54] Allow disable sendMessage patch --- client/client.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/client/client.go b/client/client.go index 114818c..e3ac867 100644 --- a/client/client.go +++ b/client/client.go @@ -21,6 +21,7 @@ type Client struct { successMsgStore *sync.Map updatesTimeout time.Duration catchTimeout time.Duration + DisablePatch bool } type Option func(*Client) @@ -43,6 +44,12 @@ func WithProxy(req *AddProxyRequest) Option { } } +func WithoutSendMessagePatch() Option { + return func(client *Client) { + client.DisablePatch = true + } +} + func SetLogLevel(level int32) { _, _ = SetLogVerbosityLevel(&SetLogVerbosityLevelRequest{ NewVerbosityLevel: level, @@ -184,7 +191,7 @@ func (client *Client) Send(req Request) (*Response, error) { select { case response := <-catcher: - if response.Type != "error" && req.Type == "sendMessage" { + if !client.DisablePatch && response.Type != "error" && req.Type == "sendMessage" { m, err := UnmarshalMessage(response.Data) if err != nil { return nil, err From ad108a3ee250f788b5758d0086711cffc06721b3 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Mon, 27 Nov 2023 01:28:22 +0800 Subject: [PATCH 08/54] Skip check successMsgStore when DisablePatch is true --- client/client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/client.go b/client/client.go index e3ac867..85f9afc 100644 --- a/client/client.go +++ b/client/client.go @@ -116,7 +116,7 @@ func (client *Client) processResponse(response *Response) { return } - if typ.GetType() == (&UpdateMessageSendSucceeded{}).GetType() { + if !client.DisablePatch && typ.GetType() == (&UpdateMessageSendSucceeded{}).GetType() { sendVal, sOk := client.successMsgStore.Load(typ.(*UpdateMessageSendSucceeded).OldMessageId) if sOk { sendVal.(chan *Response) <- response From 563cd7d67796de73090e83ebdd9e10ec6d5dbb2d Mon Sep 17 00:00:00 2001 From: c0re100 Date: Mon, 27 Nov 2023 03:14:17 +0800 Subject: [PATCH 09/54] Make some delay to the UpdateMessageSendSucceeded listener --- client/client.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/client/client.go b/client/client.go index 85f9afc..89a7f39 100644 --- a/client/client.go +++ b/client/client.go @@ -134,7 +134,18 @@ func (client *Client) processResponse(response *Response) { needGc := false for _, listener := range client.listenerStore.Listeners() { if listener.IsActive() && listener.Updates != nil && typ.GetType() == listener.Filter.GetType() { // All updates go to Updates channel if type == filter - listener.Updates <- typ + // Make some delay to UpdateMessageSendSucceeded listener + // This can make UpdateMessageSendSucceeded response later than sendMessage response. + // This may help a bot developer to map temporary message id to actual message id easily. + // Cause an event listener slower than sendMessage response, so you have enough time to do mapping stuff. + if typ.GetType() == (&UpdateMessageSendSucceeded{}).GetType() { + go func(listener *Listener, typ Type) { + time.Sleep(5 * time.Millisecond) + listener.Updates <- typ + }(listener, typ) + } else { + listener.Updates <- typ + } } else if listener.IsActive() && listener.RawUpdates != nil { // All updates go to RawUpdates channel if filter is empty listener.RawUpdates <- typ } else if !listener.IsActive() { // GC inactive listener From af41176160b6491f2fa49650e60920289b5a94d0 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Sun, 3 Dec 2023 07:26:26 +0800 Subject: [PATCH 10/54] Update to TDLib 1.8.22 --- client/function.go | 249 ++++++++++- client/type.go | 966 ++++++++++++++++++++++++++++++++++++++---- client/unmarshaler.go | 362 +++++++++++++++- data/td_api.tl | 351 +++++++++++---- 4 files changed, 1731 insertions(+), 197 deletions(-) diff --git a/client/function.go b/client/function.go index 52c8bcb..4b0f21c 100755 --- a/client/function.go +++ b/client/function.go @@ -1313,7 +1313,7 @@ type GetRepliedMessageRequest struct { MessageId int64 `json:"message_id"` } -// Returns information about a message that is replied by a given message. Also, returns the pinned message, the game message, the invoice message, and the topic creation message for messages of the types messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground and topic messages without replied message respectively +// Returns information about a non-bundled message that is replied by a given message. Also, returns the pinned message, the game message, the invoice message, the message with a previously set same background, and the topic creation message for messages of the types messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground and topic messages without non-bundled replied message respectively func (client *Client) GetRepliedMessage(req *GetRepliedMessageRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -1729,6 +1729,61 @@ func (client *Client) SearchChatsNearby(req *SearchChatsNearbyRequest) (*ChatsNe return UnmarshalChatsNearby(result.Data) } +type GetChatSimilarChatsRequest struct { + // Identifier of the target chat; must be an identifier of a channel chat + ChatId int64 `json:"chat_id"` +} + +// Returns a list of chats similar to the given chat +func (client *Client) GetChatSimilarChats(req *GetChatSimilarChatsRequest) (*Chats, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatSimilarChats", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChats(result.Data) +} + +type GetChatSimilarChatCountRequest struct { + // Identifier of the target chat; must be an identifier of a channel chat + ChatId int64 `json:"chat_id"` + // Pass true to get the number of chats without sending network requests, or -1 if the number of chats is unknown locally + ReturnLocal bool `json:"return_local"` +} + +// Returns approximate number of chats similar to the given chat +func (client *Client) GetChatSimilarChatCount(req *GetChatSimilarChatCountRequest) (*Count, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatSimilarChatCount", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "return_local": req.ReturnLocal, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalCount(result.Data) +} + type GetTopChatsRequest struct { // Category of chats to be returned Category TopChatCategory `json:"category"` @@ -2949,7 +3004,7 @@ type RecognizeSpeechRequest struct { MessageId int64 `json:"message_id"` } -// Recognizes speech in a video note or a voice note message. The message must be successfully sent and must not be scheduled. May return an error with a message "MSG_VOICE_TOO_LONG" if media duration is too big to be recognized +// Recognizes speech in a video note or a voice note message. The message must be successfully sent, must not be scheduled, and must be from a non-secret chat func (client *Client) RecognizeSpeech(req *RecognizeSpeechRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -3263,7 +3318,7 @@ type ResendMessagesRequest struct { // Identifiers of the messages to resend. Message identifiers must be in a strictly increasing order MessageIds []int64 `json:"message_ids"` // New manually chosen quote from the message to be replied; pass null if none. Ignored if more than one message is re-sent, or if messageSendingStateFailed.need_another_reply_quote == false - Quote *FormattedText `json:"quote"` + Quote *InputTextQuote `json:"quote"` } // Resends messages which failed to send. Can be called only for messages for which messageSendingStateFailed.can_retry is true and after specified in messageSendingStateFailed.retry_after time passed. If a message is re-sent, the corresponding failed to send message is deleted. Returns the sent messages in the same order as the message identifiers passed in message_ids. If a message can't be re-sent, null will be returned instead of the message @@ -7270,15 +7325,17 @@ func (client *Client) SetChatPermissions(req *SetChatPermissionsRequest) (*Ok, e type SetChatBackgroundRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` - // The input background to use; pass null to create a new filled background or to remove the current background + // The input background to use; pass null to create a new filled background Background InputBackground `json:"background"` - // Background type; pass null to remove the current background + // Background type; pass null to use default background type for the chosen background Type BackgroundType `json:"type"` // Dimming of the background in dark themes, as a percentage; 0-100 DarkThemeDimming int32 `json:"dark_theme_dimming"` + // Pass true to set background only for self; pass false to set background for both chat users. Background can be set for both users only by Telegram Premium users and if set background isn't of the type inputBackgroundPrevious + OnlyForSelf bool `json:"only_for_self"` } -// Changes the background in a specific chat. Supported only in private and secret chats with non-deleted users +// Sets the background in a specific chat. Supported only in private and secret chats with non-deleted users func (client *Client) SetChatBackground(req *SetChatBackgroundRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -7289,6 +7346,36 @@ func (client *Client) SetChatBackground(req *SetChatBackgroundRequest) (*Ok, err "background": req.Background, "type": req.Type, "dark_theme_dimming": req.DarkThemeDimming, + "only_for_self": req.OnlyForSelf, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DeleteChatBackgroundRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Pass true to restore previously set background. Can be used only in private and secret chats with non-deleted users if userFullInfo.set_chat_background == true. Supposed to be used from messageChatSetBackground messages with the currently set background that was set for both sides by the other user + RestorePrevious bool `json:"restore_previous"` +} + +// Deletes background in a specific chat +func (client *Client) DeleteChatBackground(req *DeleteChatBackgroundRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteChatBackground", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "restore_previous": req.RestorePrevious, }, }) if err != nil { @@ -7421,6 +7508,35 @@ func (client *Client) ToggleChatHasProtectedContent(req *ToggleChatHasProtectedC return UnmarshalOk(result.Data) } +type ToggleChatViewAsTopicsRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // New value of view_as_topics + ViewAsTopics bool `json:"view_as_topics"` +} + +// Changes the view_as_topics setting of a forum chat +func (client *Client) ToggleChatViewAsTopics(req *ToggleChatViewAsTopicsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleChatViewAsTopics", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "view_as_topics": req.ViewAsTopics, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type ToggleChatIsTranslatableRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -7428,7 +7544,7 @@ type ToggleChatIsTranslatableRequest struct { IsTranslatable bool `json:"is_translatable"` } -// Changes the translatable state of a chat; for Telegram Premium users only +// Changes the translatable state of a chat func (client *Client) ToggleChatIsTranslatable(req *ToggleChatIsTranslatableRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -7511,7 +7627,7 @@ func (client *Client) ToggleChatDefaultDisableNotification(req *ToggleChatDefaul type SetChatAvailableReactionsRequest struct { // Identifier of the chat ChatId int64 `json:"chat_id"` - // Reactions available in the chat. All emoji reactions must be active + // Reactions available in the chat. All explicitly specified emoji reactions must be active. Up to the chat's boost level custom emoji reactions can be explicitly specified AvailableReactions ChatAvailableReactions `json:"available_reactions"` } @@ -8561,6 +8677,8 @@ type SendStoryRequest struct { PrivacySettings StoryPrivacySettings `json:"privacy_settings"` // Period after which the story is moved to archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400 for Telegram Premium users, and 86400 otherwise ActivePeriod int32 `json:"active_period"` + // Full identifier of the original story, which content was used to create the story + FromStoryFullId *StoryFullId `json:"from_story_full_id"` // Pass true to keep the story accessible after expiration IsPinned bool `json:"is_pinned"` // Pass true if the content of the story must be protected from forwarding and screenshotting @@ -8580,6 +8698,7 @@ func (client *Client) SendStory(req *SendStoryRequest) (*Story, error) { "caption": req.Caption, "privacy_settings": req.PrivacySettings, "active_period": req.ActivePeriod, + "from_story_full_id": req.FromStoryFullId, "is_pinned": req.IsPinned, "protect_content": req.ProtectContent, }, @@ -9104,6 +9223,41 @@ func (client *Client) ActivateStoryStealthMode() (*Ok, error) { return UnmarshalOk(result.Data) } +type GetStoryPublicForwardsRequest struct { + // The identifier of the sender of the story + StorySenderChatId int64 `json:"story_sender_chat_id"` + // The identifier of the story + StoryId int32 `json:"story_id"` + // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results + Offset string `json:"offset"` + // The maximum number of messages and stories to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned objects is chosen by TDLib and can be smaller than the specified limit + Limit int32 `json:"limit"` +} + +// Returns forwards of a story as a message to public chats and reposts by public channels. Can be used only if the story is posted on behalf of the current user or story.can_get_statistics == true. For optimal performance, the number of returned messages and stories is chosen by TDLib +func (client *Client) GetStoryPublicForwards(req *GetStoryPublicForwardsRequest) (*StoryPublicForwards, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getStoryPublicForwards", + }, + Data: map[string]interface{}{ + "story_sender_chat_id": req.StorySenderChatId, + "story_id": req.StoryId, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStoryPublicForwards(result.Data) +} + // Returns the list of available chat boost slots for the current user func (client *Client) GetAvailableChatBoostSlots() (*ChatBoostSlots, error) { result, err := client.Send(Request{ @@ -9562,7 +9716,7 @@ type PreliminaryUploadFileRequest struct { Priority int32 `json:"priority"` } -// Preliminary uploads a file to the cloud before sending it in a message, which can be useful for uploading of being recorded voice and video notes. Updates updateFile will be used to notify about upload progress and successful completion of the upload. The file will not have a persistent remote identifier until it will be sent in a message +// Preliminary uploads a file to the cloud before sending it in a message, which can be useful for uploading of being recorded voice and video notes. Updates updateFile will be used to notify about upload progress and successful completion of the upload. The file will not have a persistent remote identifier until it is sent in a message func (client *Client) PreliminaryUploadFile(req *PreliminaryUploadFileRequest) (*File, error) { result, err := client.Send(Request{ meta: meta{ @@ -10946,7 +11100,7 @@ type ToggleGroupCallEnabledStartNotificationRequest struct { EnabledStartNotification bool `json:"enabled_start_notification"` } -// Toggles whether the current user will receive a notification when the group call will start; scheduled group calls only +// Toggles whether the current user will receive a notification when the group call starts; scheduled group calls only func (client *Client) ToggleGroupCallEnabledStartNotification(req *ToggleGroupCallEnabledStartNotificationRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -12438,17 +12592,20 @@ func (client *Client) SearchInstalledStickerSets(req *SearchInstalledStickerSets } type SearchStickerSetsRequest struct { + // Type of the sticker sets to return + StickerType StickerType `json:"sticker_type"` // Query to search for Query string `json:"query"` } -// Searches for ordinary sticker sets by looking for specified query in their title and name. Excludes installed sticker sets from the results +// Searches for sticker sets by looking for specified query in their title and name. Excludes installed sticker sets from the results func (client *Client) SearchStickerSets(req *SearchStickerSetsRequest) (*StickerSets, error) { result, err := client.Send(Request{ meta: meta{ Type: "searchStickerSets", }, Data: map[string]interface{}{ + "sticker_type": req.StickerType, "query": req.Query, }, }) @@ -13237,6 +13394,35 @@ func (client *Client) SetAccentColor(req *SetAccentColorRequest) (*Ok, error) { return UnmarshalOk(result.Data) } +type SetProfileAccentColorRequest struct { + // Identifier of the accent color to use for profile; pass -1 if none + ProfileAccentColorId int32 `json:"profile_accent_color_id"` + // Identifier of a custom emoji to be shown in the on the user's profile photo background; 0 if none + ProfileBackgroundCustomEmojiId JsonInt64 `json:"profile_background_custom_emoji_id"` +} + +// Changes accent color and background custom emoji for profile of the current user; for Telegram Premium users only +func (client *Client) SetProfileAccentColor(req *SetProfileAccentColorRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setProfileAccentColor", + }, + Data: map[string]interface{}{ + "profile_accent_color_id": req.ProfileAccentColorId, + "profile_background_custom_emoji_id": req.ProfileBackgroundCustomEmojiId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type SetNameRequest struct { // The new value of the first name for the current user; 1-64 characters FirstName string `json:"first_name"` @@ -16098,6 +16284,38 @@ func (client *Client) GetMessagePublicForwards(req *GetMessagePublicForwardsRequ return UnmarshalFoundMessages(result.Data) } +type GetStoryStatisticsRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Story identifier + StoryId int32 `json:"story_id"` + // Pass true if a dark theme is used by the application + IsDark bool `json:"is_dark"` +} + +// Returns detailed statistics about a story. Can be used only if story.can_get_statistics == true +func (client *Client) GetStoryStatistics(req *GetStoryStatisticsRequest) (*StoryStatistics, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getStoryStatistics", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "story_id": req.StoryId, + "is_dark": req.IsDark, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStoryStatistics(result.Data) +} + type GetStatisticalGraphRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -19270,6 +19488,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateChatIsMarkedAsUnread: return UnmarshalUpdateChatIsMarkedAsUnread(result.Data) + case TypeUpdateChatViewAsTopics: + return UnmarshalUpdateChatViewAsTopics(result.Data) + case TypeUpdateChatBlockList: return UnmarshalUpdateChatBlockList(result.Data) @@ -19429,6 +19650,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateAccentColors: return UnmarshalUpdateAccentColors(result.Data) + case TypeUpdateProfileAccentColors: + return UnmarshalUpdateProfileAccentColors(result.Data) + case TypeUpdateLanguagePackStrings: return UnmarshalUpdateLanguagePackStrings(result.Data) @@ -19456,6 +19680,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateDefaultReactionType: return UnmarshalUpdateDefaultReactionType(result.Data) + case TypeUpdateSpeechRecognitionTrial: + return UnmarshalUpdateSpeechRecognitionTrial(result.Data) + case TypeUpdateDiceEmojis: return UnmarshalUpdateDiceEmojis(result.Data) diff --git a/client/type.go b/client/type.go index 1c74660..f03324f 100755 --- a/client/type.go +++ b/client/type.go @@ -74,6 +74,8 @@ const ( ClassStoryContent = "StoryContent" ClassInputStoryContent = "InputStoryContent" ClassStoryList = "StoryList" + ClassStoryOrigin = "StoryOrigin" + ClassStoryPublicForward = "StoryPublicForward" ClassChatBoostSource = "ChatBoostSource" ClassCallDiscardReason = "CallDiscardReason" ClassCallServerType = "CallServerType" @@ -130,6 +132,7 @@ const ( ClassTextParseMode = "TextParseMode" ClassProxyType = "ProxyType" ClassStatisticalGraph = "StatisticalGraph" + ClassChatStatisticsObjectType = "ChatStatisticsObjectType" ClassChatStatistics = "ChatStatistics" ClassVectorPathCommand = "VectorPathCommand" ClassBotCommandScope = "BotCommandScope" @@ -191,6 +194,8 @@ const ( ClassPremiumGiftCodePaymentOptions = "PremiumGiftCodePaymentOptions" ClassPremiumGiftCodeInfo = "PremiumGiftCodeInfo" ClassAccentColor = "AccentColor" + ClassProfileAccentColors = "ProfileAccentColors" + ClassProfileAccentColor = "ProfileAccentColor" ClassEmojiStatus = "EmojiStatus" ClassEmojiStatuses = "EmojiStatuses" ClassUsernames = "Usernames" @@ -228,6 +233,8 @@ const ( ClassMessageReaction = "MessageReaction" ClassMessageInteractionInfo = "MessageInteractionInfo" ClassUnreadReaction = "UnreadReaction" + ClassTextQuote = "TextQuote" + ClassInputTextQuote = "InputTextQuote" ClassMessage = "Message" ClassMessages = "Messages" ClassFoundMessages = "FoundMessages" @@ -329,11 +336,14 @@ const ( ClassInputStoryArea = "InputStoryArea" ClassInputStoryAreas = "InputStoryAreas" ClassStoryVideo = "StoryVideo" + ClassStoryRepostInfo = "StoryRepostInfo" ClassStoryInteractionInfo = "StoryInteractionInfo" ClassStory = "Story" ClassStories = "Stories" + ClassStoryFullId = "StoryFullId" ClassStoryInfo = "StoryInfo" ClassChatActiveStories = "ChatActiveStories" + ClassStoryPublicForwards = "StoryPublicForwards" ClassPrepaidPremiumGiveaway = "PrepaidPremiumGiveaway" ClassChatBoostStatus = "ChatBoostStatus" ClassChatBoost = "ChatBoost" @@ -430,11 +440,12 @@ const ( ClassInputSticker = "InputSticker" ClassDateRange = "DateRange" ClassStatisticalValue = "StatisticalValue" - ClassChatStatisticsMessageInteractionInfo = "ChatStatisticsMessageInteractionInfo" + ClassChatStatisticsInteractionInfo = "ChatStatisticsInteractionInfo" ClassChatStatisticsMessageSenderInfo = "ChatStatisticsMessageSenderInfo" ClassChatStatisticsAdministratorActionsInfo = "ChatStatisticsAdministratorActionsInfo" ClassChatStatisticsInviterInfo = "ChatStatisticsInviterInfo" ClassMessageStatistics = "MessageStatistics" + ClassStoryStatistics = "StoryStatistics" ClassPoint = "Point" ClassUpdates = "Updates" ClassLogVerbosityLevel = "LogVerbosityLevel" @@ -574,6 +585,8 @@ const ( TypePremiumGiveawayInfoOngoing = "premiumGiveawayInfoOngoing" TypePremiumGiveawayInfoCompleted = "premiumGiveawayInfoCompleted" TypeAccentColor = "accentColor" + TypeProfileAccentColors = "profileAccentColors" + TypeProfileAccentColor = "profileAccentColor" TypeEmojiStatus = "emojiStatus" TypeEmojiStatuses = "emojiStatuses" TypeUsernames = "usernames" @@ -648,6 +661,8 @@ const ( TypeUnreadReaction = "unreadReaction" TypeMessageSendingStatePending = "messageSendingStatePending" TypeMessageSendingStateFailed = "messageSendingStateFailed" + TypeTextQuote = "textQuote" + TypeInputTextQuote = "inputTextQuote" TypeMessageReplyToMessage = "messageReplyToMessage" TypeMessageReplyToStory = "messageReplyToStory" TypeInputMessageReplyToMessage = "inputMessageReplyToMessage" @@ -671,6 +686,7 @@ const ( TypeMessageSourceScreenshot = "messageSourceScreenshot" TypeMessageSourceOther = "messageSourceOther" TypeMessageSponsorTypeBot = "messageSponsorTypeBot" + TypeMessageSponsorTypeWebApp = "messageSponsorTypeWebApp" TypeMessageSponsorTypePublicChannel = "messageSponsorTypePublicChannel" TypeMessageSponsorTypePrivateChannel = "messageSponsorTypePrivateChannel" TypeMessageSponsorTypeWebsite = "messageSponsorTypeWebsite" @@ -971,6 +987,7 @@ const ( TypeMessagePremiumGiftCode = "messagePremiumGiftCode" TypeMessagePremiumGiveawayCreated = "messagePremiumGiveawayCreated" TypeMessagePremiumGiveaway = "messagePremiumGiveaway" + TypeMessagePremiumGiveawayCompleted = "messagePremiumGiveawayCompleted" TypeMessageContactRegistered = "messageContactRegistered" TypeMessageUserShared = "messageUserShared" TypeMessageChatShared = "messageChatShared" @@ -1097,11 +1114,18 @@ const ( TypeInputStoryContentVideo = "inputStoryContentVideo" TypeStoryListMain = "storyListMain" TypeStoryListArchive = "storyListArchive" + TypeStoryOriginPublicStory = "storyOriginPublicStory" + TypeStoryOriginHiddenUser = "storyOriginHiddenUser" + TypeStoryRepostInfo = "storyRepostInfo" TypeStoryInteractionInfo = "storyInteractionInfo" TypeStory = "story" TypeStories = "stories" + TypeStoryFullId = "storyFullId" TypeStoryInfo = "storyInfo" TypeChatActiveStories = "chatActiveStories" + TypeStoryPublicForwardMessage = "storyPublicForwardMessage" + TypeStoryPublicForwardStory = "storyPublicForwardStory" + TypeStoryPublicForwards = "storyPublicForwards" TypeChatBoostSourceGiftCode = "chatBoostSourceGiftCode" TypeChatBoostSourceGiveaway = "chatBoostSourceGiveaway" TypeChatBoostSourcePremium = "chatBoostSourcePremium" @@ -1281,6 +1305,7 @@ const ( TypePremiumLimitTypeMonthlySentStoryCount = "premiumLimitTypeMonthlySentStoryCount" TypePremiumLimitTypeStoryCaptionLength = "premiumLimitTypeStoryCaptionLength" TypePremiumLimitTypeStorySuggestedReactionAreaCount = "premiumLimitTypeStorySuggestedReactionAreaCount" + TypePremiumLimitTypeSimilarChatCount = "premiumLimitTypeSimilarChatCount" TypePremiumFeatureIncreasedLimits = "premiumFeatureIncreasedLimits" TypePremiumFeatureIncreasedUploadFileSize = "premiumFeatureIncreasedUploadFileSize" TypePremiumFeatureImprovedDownloadSpeed = "premiumFeatureImprovedDownloadSpeed" @@ -1299,6 +1324,7 @@ const ( TypePremiumFeatureUpgradedStories = "premiumFeatureUpgradedStories" TypePremiumFeatureChatBoost = "premiumFeatureChatBoost" TypePremiumFeatureAccentColor = "premiumFeatureAccentColor" + TypePremiumFeatureBackgroundForBoth = "premiumFeatureBackgroundForBoth" TypePremiumStoryFeaturePriorityOrder = "premiumStoryFeaturePriorityOrder" TypePremiumStoryFeatureStealthMode = "premiumStoryFeatureStealthMode" TypePremiumStoryFeaturePermanentViewsHistory = "premiumStoryFeaturePermanentViewsHistory" @@ -1624,13 +1650,16 @@ const ( TypeStatisticalGraphData = "statisticalGraphData" TypeStatisticalGraphAsync = "statisticalGraphAsync" TypeStatisticalGraphError = "statisticalGraphError" - TypeChatStatisticsMessageInteractionInfo = "chatStatisticsMessageInteractionInfo" + TypeChatStatisticsObjectTypeMessage = "chatStatisticsObjectTypeMessage" + TypeChatStatisticsObjectTypeStory = "chatStatisticsObjectTypeStory" + TypeChatStatisticsInteractionInfo = "chatStatisticsInteractionInfo" TypeChatStatisticsMessageSenderInfo = "chatStatisticsMessageSenderInfo" TypeChatStatisticsAdministratorActionsInfo = "chatStatisticsAdministratorActionsInfo" TypeChatStatisticsInviterInfo = "chatStatisticsInviterInfo" TypeChatStatisticsSupergroup = "chatStatisticsSupergroup" TypeChatStatisticsChannel = "chatStatisticsChannel" TypeMessageStatistics = "messageStatistics" + TypeStoryStatistics = "storyStatistics" TypePoint = "point" TypeVectorPathCommandLine = "vectorPathCommandLine" TypeVectorPathCommandCubicBezierCurve = "vectorPathCommandCubicBezierCurve" @@ -1681,6 +1710,7 @@ const ( TypeUpdateChatHasProtectedContent = "updateChatHasProtectedContent" TypeUpdateChatIsTranslatable = "updateChatIsTranslatable" TypeUpdateChatIsMarkedAsUnread = "updateChatIsMarkedAsUnread" + TypeUpdateChatViewAsTopics = "updateChatViewAsTopics" TypeUpdateChatBlockList = "updateChatBlockList" TypeUpdateChatHasScheduledMessages = "updateChatHasScheduledMessages" TypeUpdateChatFolders = "updateChatFolders" @@ -1734,6 +1764,7 @@ const ( TypeUpdateSelectedBackground = "updateSelectedBackground" TypeUpdateChatThemes = "updateChatThemes" TypeUpdateAccentColors = "updateAccentColors" + TypeUpdateProfileAccentColors = "updateProfileAccentColors" TypeUpdateLanguagePackStrings = "updateLanguagePackStrings" TypeUpdateConnectionState = "updateConnectionState" TypeUpdateTermsOfService = "updateTermsOfService" @@ -1743,6 +1774,7 @@ const ( TypeUpdateWebAppMessageSent = "updateWebAppMessageSent" TypeUpdateActiveEmojiReactions = "updateActiveEmojiReactions" TypeUpdateDefaultReactionType = "updateDefaultReactionType" + TypeUpdateSpeechRecognitionTrial = "updateSpeechRecognitionTrial" TypeUpdateDiceEmojis = "updateDiceEmojis" TypeUpdateAnimatedEmojiMessageClicked = "updateAnimatedEmojiMessageClicked" TypeUpdateAnimationSearchParameters = "updateAnimationSearchParameters" @@ -2113,6 +2145,16 @@ type StoryList interface { StoryListType() string } +// Contains information about the origin of a story that was reposted +type StoryOrigin interface { + StoryOriginType() string +} + +// Describes a public forward or repost of a story +type StoryPublicForward interface { + StoryPublicForwardType() string +} + // Describes source of a chat boost type ChatBoostSource interface { ChatBoostSourceType() string @@ -2393,6 +2435,11 @@ type StatisticalGraph interface { StatisticalGraphType() string } +// Describes type of an object, for which statistics are provided +type ChatStatisticsObjectType interface { + ChatStatisticsObjectTypeType() string +} + // Contains a detailed statistics about a chat type ChatStatistics interface { ChatStatisticsType() string @@ -6088,7 +6135,7 @@ type PremiumGiftCodeInfo struct { CreationDate int32 `json:"creation_date"` // True, if the gift code was created for a giveaway IsFromGiveaway bool `json:"is_from_giveaway"` - // Identifier of the corresponding giveaway message; can be 0 or an identifier of a deleted message + // Identifier of the corresponding giveaway message in the creator_id chat; can be 0 or an identifier of a deleted message GiveawayMessageId int64 `json:"giveaway_message_id"` // Number of month the Telegram Premium subscription will be active after code activation MonthCount int32 `json:"month_count"` @@ -6392,6 +6439,60 @@ func (*AccentColor) GetType() string { return TypeAccentColor } +// Contains information about supported accent colors for user profile photo background in RGB format +type ProfileAccentColors struct { + meta + // The list of 1-2 colors in RGB format, describing the colors, as expected to be shown in the color palette settings + PaletteColors []int32 `json:"palette_colors"` + // The list of 1-2 colors in RGB format, describing the colors, as expected to be used for the profile photo background + BackgroundColors []int32 `json:"background_colors"` + // The list of 2 colors in RGB format, describing the colors of the gradient to be used for the unread active story indicator around profile photo + StoryColors []int32 `json:"story_colors"` +} + +func (entity *ProfileAccentColors) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProfileAccentColors + + return json.Marshal((*stub)(entity)) +} + +func (*ProfileAccentColors) GetClass() string { + return ClassProfileAccentColors +} + +func (*ProfileAccentColors) GetType() string { + return TypeProfileAccentColors +} + +// Contains information about supported accent color for user profile photo background +type ProfileAccentColor struct { + meta + // Profile accent color identifier + Id int32 `json:"id"` + // The list of 1-3 colors in RGB format, describing the accent color, as expected to be shown in light themes + LightThemeColors *ProfileAccentColors `json:"light_theme_colors"` + // The list of 1-3 colors in RGB format, describing the accent color, as expected to be shown in dark themes + DarkThemeColors *ProfileAccentColors `json:"dark_theme_colors"` +} + +func (entity *ProfileAccentColor) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProfileAccentColor + + return json.Marshal((*stub)(entity)) +} + +func (*ProfileAccentColor) GetClass() string { + return ClassProfileAccentColor +} + +func (*ProfileAccentColor) GetType() string { + return TypeProfileAccentColor +} + // Describes a custom emoji to be shown instead of the Telegram Premium badge type EmojiStatus struct { meta @@ -6486,10 +6587,14 @@ type User struct { Status UserStatus `json:"status"` // Profile photo of the user; may be null ProfilePhoto *ProfilePhoto `json:"profile_photo"` - // Identifier of the accent color for name, and backgrounds of profile photo, reply header, and link preview + // Identifier of the accent color for name, and backgrounds of profile photo, reply header, and link preview. For Telegram Premium users only AccentColorId int32 `json:"accent_color_id"` // Identifier of a custom emoji to be shown on the reply header background; 0 if none. For Telegram Premium users only BackgroundCustomEmojiId JsonInt64 `json:"background_custom_emoji_id"` + // Identifier of the accent color for the user's profile; -1 if none. For Telegram Premium users only + ProfileAccentColorId int32 `json:"profile_accent_color_id"` + // Identifier of a custom emoji to be shown on the background of the user's profile; 0 if none. For Telegram Premium users only + ProfileBackgroundCustomEmojiId JsonInt64 `json:"profile_background_custom_emoji_id"` // Emoji status to be shown instead of the default Telegram Premium badge; may be null. For Telegram Premium users only EmojiStatus *EmojiStatus `json:"emoji_status"` // The user is a contact of the current user @@ -6552,6 +6657,8 @@ func (user *User) UnmarshalJSON(data []byte) error { ProfilePhoto *ProfilePhoto `json:"profile_photo"` AccentColorId int32 `json:"accent_color_id"` BackgroundCustomEmojiId JsonInt64 `json:"background_custom_emoji_id"` + ProfileAccentColorId int32 `json:"profile_accent_color_id"` + ProfileBackgroundCustomEmojiId JsonInt64 `json:"profile_background_custom_emoji_id"` EmojiStatus *EmojiStatus `json:"emoji_status"` IsContact bool `json:"is_contact"` IsMutualContact bool `json:"is_mutual_contact"` @@ -6584,6 +6691,8 @@ func (user *User) UnmarshalJSON(data []byte) error { user.ProfilePhoto = tmp.ProfilePhoto user.AccentColorId = tmp.AccentColorId user.BackgroundCustomEmojiId = tmp.BackgroundCustomEmojiId + user.ProfileAccentColorId = tmp.ProfileAccentColorId + user.ProfileBackgroundCustomEmojiId = tmp.ProfileBackgroundCustomEmojiId user.EmojiStatus = tmp.EmojiStatus user.IsContact = tmp.IsContact user.IsMutualContact = tmp.IsMutualContact @@ -6724,6 +6833,8 @@ type UserFullInfo struct { HasPinnedStories bool `json:"has_pinned_stories"` // True, if the current user needs to explicitly allow to share their phone number with the user when the method addContact is used NeedPhoneNumberPrivacyException bool `json:"need_phone_number_privacy_exception"` + // True, if the user set chat background for both chat users and it wasn't reverted yet + SetChatBackground bool `json:"set_chat_background"` // A short user bio; may be null for bots Bio *FormattedText `json:"bio"` // The list of available options for gifting Telegram Premium to the user @@ -6763,6 +6874,7 @@ func (userFullInfo *UserFullInfo) UnmarshalJSON(data []byte) error { HasRestrictedVoiceAndVideoNoteMessages bool `json:"has_restricted_voice_and_video_note_messages"` HasPinnedStories bool `json:"has_pinned_stories"` NeedPhoneNumberPrivacyException bool `json:"need_phone_number_privacy_exception"` + SetChatBackground bool `json:"set_chat_background"` Bio *FormattedText `json:"bio"` PremiumGiftOptions []*PremiumPaymentOption `json:"premium_gift_options"` GroupInCommonCount int32 `json:"group_in_common_count"` @@ -6784,6 +6896,7 @@ func (userFullInfo *UserFullInfo) UnmarshalJSON(data []byte) error { userFullInfo.HasRestrictedVoiceAndVideoNoteMessages = tmp.HasRestrictedVoiceAndVideoNoteMessages userFullInfo.HasPinnedStories = tmp.HasPinnedStories userFullInfo.NeedPhoneNumberPrivacyException = tmp.NeedPhoneNumberPrivacyException + userFullInfo.SetChatBackground = tmp.SetChatBackground userFullInfo.Bio = tmp.Bio userFullInfo.PremiumGiftOptions = tmp.PremiumGiftOptions userFullInfo.GroupInCommonCount = tmp.GroupInCommonCount @@ -8036,7 +8149,7 @@ type Supergroup struct { Date int32 `json:"date"` // Status of the current user in the supergroup or channel; custom title will always be empty Status ChatMemberStatus `json:"status"` - // Number of members in the supergroup or channel; 0 if unknown. Currently, it is guaranteed to be known only if the supergroup or channel was received through searchPublicChats, searchChatsNearby, getInactiveSupergroupChats, getSuitableDiscussionChats, getGroupsInCommon, getUserPrivacySettingRules, or in chatFolderInviteLinkInfo.missing_chat_ids + // Number of members in the supergroup or channel; 0 if unknown. Currently, it is guaranteed to be known only if the supergroup or channel was received through getChatSimilarChats, getChatsToSendStories, getCreatedPublicChats, getGroupsInCommon, getInactiveSupergroupChats, getSuitableDiscussionChats, getUserPrivacySettingRules, getVideoChatAvailableParticipants, searchChatsNearby, searchPublicChats, or in chatFolderInviteLinkInfo.missing_chat_ids, or for public chats in which where sent messages and posted stories from storyPublicForwards, or for public chats in which where sent messages from getMessagePublicForwards response MemberCount int32 `json:"member_count"` // True, if the channel has a discussion group, or the supergroup is the designated discussion group for a channel HasLinkedChat bool `json:"has_linked_chat"` @@ -8054,7 +8167,7 @@ type Supergroup struct { IsChannel bool `json:"is_channel"` // True, if the supergroup is a broadcast group, i.e. only administrators can send messages and there is no limit on the number of members IsBroadcastGroup bool `json:"is_broadcast_group"` - // True, if the supergroup must be shown as a forum by default + // True, if the supergroup is a forum with topics IsForum bool `json:"is_forum"` // True, if the supergroup or channel is verified IsVerified bool `json:"is_verified"` @@ -8450,7 +8563,7 @@ func (messageSenders *MessageSenders) UnmarshalJSON(data []byte) error { // Represents a message sender, which can be used to send messages in a chat type ChatMessageSender struct { meta - // Available message senders + // The message sender Sender MessageSender `json:"sender"` // True, if Telegram Premium is needed to use the message sender NeedsPremium bool `json:"needs_premium"` @@ -8876,7 +8989,7 @@ type MessageReaction struct { TotalCount int32 `json:"total_count"` // True, if the reaction is chosen by the current user IsChosen bool `json:"is_chosen"` - // Identifier of the message sender used by the current user to add the reaction; null if unknown or the reaction isn't chosen + // Identifier of the message sender used by the current user to add the reaction; may be null if unknown or the reaction isn't chosen UsedSenderId MessageSender `json:"used_sender_id"` // Identifiers of at most 3 recent message senders, added the reaction; available in private, basic group and supergroup chats RecentSenderIds []MessageSender `json:"recent_sender_ids"` @@ -9070,6 +9183,58 @@ func (*MessageSendingStateFailed) MessageSendingStateType() string { return TypeMessageSendingStateFailed } +// Describes manually or automatically chosen quote from another message +type TextQuote struct { + meta + // Text of the quote. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities can be present in the text + Text *FormattedText `json:"text"` + // Approximate quote position in the original message in UTF-16 code units + Position int32 `json:"position"` + // True, if the quote was manually chosen by the message sender + IsManual bool `json:"is_manual"` +} + +func (entity *TextQuote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TextQuote + + return json.Marshal((*stub)(entity)) +} + +func (*TextQuote) GetClass() string { + return ClassTextQuote +} + +func (*TextQuote) GetType() string { + return TypeTextQuote +} + +// Describes manually chosen quote from another message +type InputTextQuote struct { + meta + // Text of the quote; 0-getOption("message_reply_quote_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed to be kept and must be kept in the quote + Text *FormattedText `json:"text"` + // Quote position in the original message in UTF-16 code units + Position int32 `json:"position"` +} + +func (entity *InputTextQuote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputTextQuote + + return json.Marshal((*stub)(entity)) +} + +func (*InputTextQuote) GetClass() string { + return ClassInputTextQuote +} + +func (*InputTextQuote) GetType() string { + return TypeInputTextQuote +} + // Describes a message replied by a given message type MessageReplyToMessage struct { meta @@ -9077,15 +9242,13 @@ type MessageReplyToMessage struct { ChatId int64 `json:"chat_id"` // The identifier of the message; may be 0 if the replied message is in unknown chat MessageId int64 `json:"message_id"` - // Manually or automatically chosen quote from the replied message; may be null if none. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities can be present in the quote - Quote *FormattedText `json:"quote"` - // True, if the quote was manually chosen by the message sender - IsQuoteManual bool `json:"is_quote_manual"` - // Information about origin of the message if the message was replied from another chat; may be null for messages from the same chat + // Chosen quote from the replied message; may be null if none + Quote *TextQuote `json:"quote"` + // Information about origin of the message if the message was from another chat or topic; may be null for messages from the same chat Origin MessageOrigin `json:"origin"` - // Point in time (Unix timestamp) when the message was sent if the message was replied from another chat; 0 for messages from the same chat + // Point in time (Unix timestamp) when the message was sent if the message was from another chat or topic; 0 for messages from the same chat OriginSendDate int32 `json:"origin_send_date"` - // Media content of the message if the message was replied from another chat; may be null for messages from the same chat and messages without media. Can be only one of the following types: messageAnimation, messageAudio, messageContact, messageDice, messageDocument, messageGame, messageInvoice, messageLocation, messagePhoto, messagePoll, messagePremiumGiveaway, messageSticker, messageStory, messageText (for link preview), messageVenue, messageVideo, messageVideoNote, or messageVoiceNote + // Media content of the message if the message was from another chat or topic; may be null for messages from the same chat and messages without media. Can be only one of the following types: messageAnimation, messageAudio, messageContact, messageDice, messageDocument, messageGame, messageInvoice, messageLocation, messagePhoto, messagePoll, messagePremiumGiveaway, messageSticker, messageStory, messageText (for link preview), messageVenue, messageVideo, messageVideoNote, or messageVoiceNote Content MessageContent `json:"content"` } @@ -9113,8 +9276,7 @@ func (messageReplyToMessage *MessageReplyToMessage) UnmarshalJSON(data []byte) e var tmp struct { ChatId int64 `json:"chat_id"` MessageId int64 `json:"message_id"` - Quote *FormattedText `json:"quote"` - IsQuoteManual bool `json:"is_quote_manual"` + Quote *TextQuote `json:"quote"` Origin json.RawMessage `json:"origin"` OriginSendDate int32 `json:"origin_send_date"` Content json.RawMessage `json:"content"` @@ -9128,7 +9290,6 @@ func (messageReplyToMessage *MessageReplyToMessage) UnmarshalJSON(data []byte) e messageReplyToMessage.ChatId = tmp.ChatId messageReplyToMessage.MessageId = tmp.MessageId messageReplyToMessage.Quote = tmp.Quote - messageReplyToMessage.IsQuoteManual = tmp.IsQuoteManual messageReplyToMessage.OriginSendDate = tmp.OriginSendDate fieldOrigin, _ := UnmarshalMessageOrigin(tmp.Origin) @@ -9172,12 +9333,12 @@ func (*MessageReplyToStory) MessageReplyToType() string { // Describes a message to be replied type InputMessageReplyToMessage struct { meta - // The identifier of the chat to which the message to be replied belongs; pass 0 if the message to be replied is in the same chat. Must always be 0 for replies in secret chats. A message can be replied in another chat only if message.can_be_replied_in_another_chat + // The identifier of the chat to which the message to be replied belongs; pass 0 if the message to be replied is in the same chat. Must always be 0 for replies in secret chats. A message can be replied in another chat or topic only if message.can_be_replied_in_another_chat ChatId int64 `json:"chat_id"` // The identifier of the message to be replied in the same or the specified chat MessageId int64 `json:"message_id"` - // Manually chosen quote from the message to be replied; pass null if none; 0-getOption("message_reply_quote_length_max") characters. Must always be null for replies in secret chats. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed to be kept and must be kept in the quote - Quote *FormattedText `json:"quote"` + // Quote from the message to be replied; pass null if none. Must always be null for replies in secret chats + Quote *InputTextQuote `json:"quote"` } func (entity *InputMessageReplyToMessage) MarshalJSON() ([]byte, error) { @@ -9250,7 +9411,7 @@ type Message struct { CanBeEdited bool `json:"can_be_edited"` // True, if the message can be forwarded CanBeForwarded bool `json:"can_be_forwarded"` - // True, if the message can be replied in another chat + // True, if the message can be replied in another chat or topic CanBeRepliedInAnotherChat bool `json:"can_be_replied_in_another_chat"` // True, if content of the message can be saved locally or copied CanBeSaved bool `json:"can_be_saved"` @@ -9469,7 +9630,7 @@ type FoundMessages struct { TotalCount int32 `json:"total_count"` // List of messages Messages []*Message `json:"messages"` - // The offset for the next request. If empty, there are no more results + // The offset for the next request. If empty, then there are no more results NextOffset string `json:"next_offset"` } @@ -9916,6 +10077,54 @@ func (messageSponsorTypeBot *MessageSponsorTypeBot) UnmarshalJSON(data []byte) e return nil } +// The sponsor is a web app +type MessageSponsorTypeWebApp struct { + meta + // Web App title + WebAppTitle string `json:"web_app_title"` + // An internal link to be opened when the sponsored message is clicked + Link InternalLinkType `json:"link"` +} + +func (entity *MessageSponsorTypeWebApp) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSponsorTypeWebApp + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSponsorTypeWebApp) GetClass() string { + return ClassMessageSponsorType +} + +func (*MessageSponsorTypeWebApp) GetType() string { + return TypeMessageSponsorTypeWebApp +} + +func (*MessageSponsorTypeWebApp) MessageSponsorTypeType() string { + return TypeMessageSponsorTypeWebApp +} + +func (messageSponsorTypeWebApp *MessageSponsorTypeWebApp) UnmarshalJSON(data []byte) error { + var tmp struct { + WebAppTitle string `json:"web_app_title"` + Link json.RawMessage `json:"link"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageSponsorTypeWebApp.WebAppTitle = tmp.WebAppTitle + + fieldLink, _ := UnmarshalInternalLinkType(tmp.Link) + messageSponsorTypeWebApp.Link = fieldLink + + return nil +} + // The sponsor is a public channel chat type MessageSponsorTypePublicChannel struct { meta @@ -10081,6 +10290,8 @@ type SponsoredMessage struct { Content MessageContent `json:"content"` // Information about the sponsor of the message Sponsor *MessageSponsor `json:"sponsor"` + // If non-empty, text for the message action button + ButtonText string `json:"button_text"` // If non-empty, additional information about the sponsored message to be shown along with the message AdditionalInfo string `json:"additional_info"` } @@ -10107,6 +10318,7 @@ func (sponsoredMessage *SponsoredMessage) UnmarshalJSON(data []byte) error { IsRecommended bool `json:"is_recommended"` Content json.RawMessage `json:"content"` Sponsor *MessageSponsor `json:"sponsor"` + ButtonText string `json:"button_text"` AdditionalInfo string `json:"additional_info"` } @@ -10118,6 +10330,7 @@ func (sponsoredMessage *SponsoredMessage) UnmarshalJSON(data []byte) error { sponsoredMessage.MessageId = tmp.MessageId sponsoredMessage.IsRecommended = tmp.IsRecommended sponsoredMessage.Sponsor = tmp.Sponsor + sponsoredMessage.ButtonText = tmp.ButtonText sponsoredMessage.AdditionalInfo = tmp.AdditionalInfo fieldContent, _ := UnmarshalMessageContent(tmp.Content) @@ -10216,7 +10429,7 @@ type FoundFileDownloads struct { TotalCounts *DownloadedFileCounts `json:"total_counts"` // The list of files Files []*FileDownload `json:"files"` - // The offset for the next request. If empty, there are no more results + // The offset for the next request. If empty, then there are no more results NextOffset string `json:"next_offset"` } @@ -10314,7 +10527,7 @@ func (*NotificationSettingsScopeChannelChats) NotificationSettingsScopeType() st // Contains information about notification settings for a chat or a forum topic type ChatNotificationSettings struct { meta - // If true, mute_for is ignored and the value for the relevant type of chat or the forum chat is used instead + // If true, the value for the relevant type of chat or the forum chat is used instead of mute_for UseDefaultMuteFor bool `json:"use_default_mute_for"` // Time left before notifications will be unmuted, in seconds MuteFor int32 `json:"mute_for"` @@ -10322,11 +10535,11 @@ type ChatNotificationSettings struct { UseDefaultSound bool `json:"use_default_sound"` // Identifier of the notification sound to be played for messages; 0 if sound is disabled SoundId JsonInt64 `json:"sound_id"` - // If true, show_preview is ignored and the value for the relevant type of chat or the forum chat is used instead + // If true, the value for the relevant type of chat or the forum chat is used instead of show_preview UseDefaultShowPreview bool `json:"use_default_show_preview"` // True, if message content must be displayed in notifications ShowPreview bool `json:"show_preview"` - // If true, mute_stories is ignored and the value for the relevant type of chat is used instead + // If true, the value for the relevant type of chat is used instead of mute_stories UseDefaultMuteStories bool `json:"use_default_mute_stories"` // True, if story notifications are disabled for the chat MuteStories bool `json:"mute_stories"` @@ -10334,15 +10547,15 @@ type ChatNotificationSettings struct { UseDefaultStorySound bool `json:"use_default_story_sound"` // Identifier of the notification sound to be played for stories; 0 if sound is disabled StorySoundId JsonInt64 `json:"story_sound_id"` - // If true, show_story_sender is ignored and the value for the relevant type of chat is used instead + // If true, the value for the relevant type of chat is used instead of show_story_sender UseDefaultShowStorySender bool `json:"use_default_show_story_sender"` // True, if the sender of stories must be displayed in notifications ShowStorySender bool `json:"show_story_sender"` - // If true, disable_pinned_message_notifications is ignored and the value for the relevant type of chat or the forum chat is used instead + // If true, the value for the relevant type of chat or the forum chat is used instead of disable_pinned_message_notifications UseDefaultDisablePinnedMessageNotifications bool `json:"use_default_disable_pinned_message_notifications"` // If true, notifications for incoming pinned messages will be created as for an ordinary unread message DisablePinnedMessageNotifications bool `json:"disable_pinned_message_notifications"` - // If true, disable_mention_notifications is ignored and the value for the relevant type of chat or the forum chat is used instead + // If true, the value for the relevant type of chat or the forum chat is used instead of disable_mention_notifications UseDefaultDisableMentionNotifications bool `json:"use_default_disable_mention_notifications"` // If true, notifications for messages with mentions will be created as for an ordinary unread message DisableMentionNotifications bool `json:"disable_mention_notifications"` @@ -10373,9 +10586,9 @@ type ScopeNotificationSettings struct { SoundId JsonInt64 `json:"sound_id"` // True, if message content must be displayed in notifications ShowPreview bool `json:"show_preview"` - // If true, mute_stories is ignored and story notifications are received only for the first 5 chats from topChatCategoryUsers + // If true, story notifications are received only for the first 5 chats from topChatCategoryUsers regardless of the value of mute_stories UseDefaultMuteStories bool `json:"use_default_mute_stories"` - // True, if story notifications are disabled for the chat + // True, if story notifications are disabled MuteStories bool `json:"mute_stories"` // Identifier of the notification sound to be played for stories; 0 if sound is disabled StorySoundId JsonInt64 `json:"story_sound_id"` @@ -10541,7 +10754,7 @@ type ChatTypeSecret struct { meta // Secret chat identifier SecretChatId int32 `json:"secret_chat_id"` - // User identifier of the secret chat peer + // User identifier of the other user in the secret chat UserId int64 `json:"user_id"` } @@ -11191,6 +11404,8 @@ type Chat struct { IsTranslatable bool `json:"is_translatable"` // True, if the chat is marked as unread IsMarkedAsUnread bool `json:"is_marked_as_unread"` + // True, if the chat is a forum supergroup that must be shown in the "View as topics" mode + ViewAsTopics bool `json:"view_as_topics"` // True, if the chat has scheduled messages HasScheduledMessages bool `json:"has_scheduled_messages"` // True, if the chat messages can be deleted only for the current user while other users will continue to see the messages @@ -11267,6 +11482,7 @@ func (chat *Chat) UnmarshalJSON(data []byte) error { HasProtectedContent bool `json:"has_protected_content"` IsTranslatable bool `json:"is_translatable"` IsMarkedAsUnread bool `json:"is_marked_as_unread"` + ViewAsTopics bool `json:"view_as_topics"` HasScheduledMessages bool `json:"has_scheduled_messages"` CanBeDeletedOnlyForSelf bool `json:"can_be_deleted_only_for_self"` CanBeDeletedForAllUsers bool `json:"can_be_deleted_for_all_users"` @@ -11306,6 +11522,7 @@ func (chat *Chat) UnmarshalJSON(data []byte) error { chat.HasProtectedContent = tmp.HasProtectedContent chat.IsTranslatable = tmp.IsTranslatable chat.IsMarkedAsUnread = tmp.IsMarkedAsUnread + chat.ViewAsTopics = tmp.ViewAsTopics chat.HasScheduledMessages = tmp.HasScheduledMessages chat.CanBeDeletedOnlyForSelf = tmp.CanBeDeletedOnlyForSelf chat.CanBeDeletedForAllUsers = tmp.CanBeDeletedForAllUsers @@ -11551,7 +11768,7 @@ type ChatActionBarReportAddBlock struct { meta // If true, the chat was automatically archived and can be moved back to the main chat list using addChatToList simultaneously with setting chat notification settings to default using setChatNotificationSettings CanUnarchive bool `json:"can_unarchive"` - // If non-negative, the current user was found by the peer through searchChatsNearby and this is the distance between the users + // If non-negative, the current user was found by the other user through searchChatsNearby and this is the distance between the users Distance int32 `json:"distance"` } @@ -15034,9 +15251,9 @@ type WebPage struct { Duration int32 `json:"duration"` // Author of the content Author string `json:"author"` - // True, if the preview has large media and its appearance can be changed + // True, if size of media in the preview can be changed HasLargeMedia bool `json:"has_large_media"` - // True, if large media preview must be shown + // True, if large media preview must be shown; otherwise, the media preview must be shown small and only the first frame must be shown for videos ShowLargeMedia bool `json:"show_large_media"` // True, if there is no need to show an ordinary open URL confirmation, when opening the URL from the preview, because the URL is shown in the message text in clear SkipConfirmation bool `json:"skip_confirmation"` @@ -18257,7 +18474,7 @@ type MessageText struct { Text *FormattedText `json:"text"` // A link preview attached to the message; may be null WebPage *WebPage `json:"web_page"` - // Options which was used for generation of the link preview; may be null if default options were used + // Options which were used for generation of the link preview; may be null if default options were used LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options"` } @@ -19442,6 +19659,8 @@ type MessageChatSetBackground struct { OldBackgroundMessageId int64 `json:"old_background_message_id"` // The new background Background *ChatBackground `json:"background"` + // True, if the background was set only for self + OnlyForSelf bool `json:"only_for_self"` } func (entity *MessageChatSetBackground) MarshalJSON() ([]byte, error) { @@ -19962,6 +20181,37 @@ func (*MessagePremiumGiveaway) MessageContentType() string { return TypeMessagePremiumGiveaway } +// A Telegram Premium giveaway has been completed for the chat +type MessagePremiumGiveawayCompleted struct { + meta + // Identifier of the message with the giveaway, can be an identifier of a deleted message + GiveawayMessageId int64 `json:"giveaway_message_id"` + // Number of winners in the giveaway + WinnerCount int32 `json:"winner_count"` + // Number of undistributed prizes + UnclaimedPrizeCount int32 `json:"unclaimed_prize_count"` +} + +func (entity *MessagePremiumGiveawayCompleted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessagePremiumGiveawayCompleted + + return json.Marshal((*stub)(entity)) +} + +func (*MessagePremiumGiveawayCompleted) GetClass() string { + return ClassMessageContent +} + +func (*MessagePremiumGiveawayCompleted) GetType() string { + return TypeMessagePremiumGiveawayCompleted +} + +func (*MessagePremiumGiveawayCompleted) MessageContentType() string { + return TypeMessagePremiumGiveawayCompleted +} + // A contact has registered with Telegram type MessageContactRegistered struct{ meta @@ -20905,7 +21155,7 @@ func (*MessageSchedulingStateSendAtDate) MessageSchedulingStateType() string { return TypeMessageSchedulingStateSendAtDate } -// The message will be sent when the peer will be online. Applicable to private chats only and when the exact online status of the peer is known +// The message will be sent when the other user is online. Applicable to private chats only and when the exact online status of the other user is known type MessageSchedulingStateSendWhenOnline struct{ meta } @@ -21247,7 +21497,7 @@ type InputMessageDocument struct { Document InputFile `json:"document"` // Document thumbnail; pass null to skip thumbnail uploading Thumbnail *InputThumbnail `json:"thumbnail"` - // If true, automatic file type detection will be disabled and the document will always be sent as file. Always true for files sent to secret chats + // True, if automatic file type detection is disabled and the document must be sent as a file. Always true for files sent to secret chats DisableContentTypeDetection bool `json:"disable_content_type_detection"` // Document caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters Caption *FormattedText `json:"caption"` @@ -23427,7 +23677,7 @@ type StoryViewers struct { TotalReactionCount int32 `json:"total_reaction_count"` // List of story viewers Viewers []*StoryViewer `json:"viewers"` - // The offset for the next request. If empty, there are no more results + // The offset for the next request. If empty, then there are no more results NextOffset string `json:"next_offset"` } @@ -24110,6 +24360,106 @@ func (*StoryListArchive) StoryListType() string { return TypeStoryListArchive } +// The original story was a public story with known sender +type StoryOriginPublicStory struct { + meta + // Identifier of the chat that posted original story + ChatId int64 `json:"chat_id"` + // Story identifier of the original story + StoryId int32 `json:"story_id"` +} + +func (entity *StoryOriginPublicStory) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryOriginPublicStory + + return json.Marshal((*stub)(entity)) +} + +func (*StoryOriginPublicStory) GetClass() string { + return ClassStoryOrigin +} + +func (*StoryOriginPublicStory) GetType() string { + return TypeStoryOriginPublicStory +} + +func (*StoryOriginPublicStory) StoryOriginType() string { + return TypeStoryOriginPublicStory +} + +// The original story was sent by an unknown user +type StoryOriginHiddenUser struct { + meta + // Name of the story sender + SenderName string `json:"sender_name"` +} + +func (entity *StoryOriginHiddenUser) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryOriginHiddenUser + + return json.Marshal((*stub)(entity)) +} + +func (*StoryOriginHiddenUser) GetClass() string { + return ClassStoryOrigin +} + +func (*StoryOriginHiddenUser) GetType() string { + return TypeStoryOriginHiddenUser +} + +func (*StoryOriginHiddenUser) StoryOriginType() string { + return TypeStoryOriginHiddenUser +} + +// Contains information about original story that was reposted +type StoryRepostInfo struct { + meta + // Origin of the story that was reposted + Origin StoryOrigin `json:"origin"` + // True, if story content was modified during reposting; otherwise, story wasn't modified + IsContentModified bool `json:"is_content_modified"` +} + +func (entity *StoryRepostInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryRepostInfo + + return json.Marshal((*stub)(entity)) +} + +func (*StoryRepostInfo) GetClass() string { + return ClassStoryRepostInfo +} + +func (*StoryRepostInfo) GetType() string { + return TypeStoryRepostInfo +} + +func (storyRepostInfo *StoryRepostInfo) UnmarshalJSON(data []byte) error { + var tmp struct { + Origin json.RawMessage `json:"origin"` + IsContentModified bool `json:"is_content_modified"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + storyRepostInfo.IsContentModified = tmp.IsContentModified + + fieldOrigin, _ := UnmarshalStoryOrigin(tmp.Origin) + storyRepostInfo.Origin = fieldOrigin + + return nil +} + // Contains information about interactions with a story type StoryInteractionInfo struct { meta @@ -24168,10 +24518,14 @@ type Story struct { CanBeReplied bool `json:"can_be_replied"` // True, if the story's is_pinned value can be changed CanToggleIsPinned bool `json:"can_toggle_is_pinned"` + // True, if the story statistics are available through getStoryStatistics + CanGetStatistics bool `json:"can_get_statistics"` // True, if users viewed the story can be received through getStoryViewers CanGetViewers bool `json:"can_get_viewers"` // True, if users viewed the story can't be received, because the story has expired more than getOption("story_viewers_expiration_delay") seconds ago HasExpiredViewers bool `json:"has_expired_viewers"` + // Information about the original story; may be null if the story wasn't reposted + RepostInfo *StoryRepostInfo `json:"repost_info"` // Information about interactions with the story; may be null if the story isn't owned or there were no interactions InteractionInfo *StoryInteractionInfo `json:"interaction_info"` // Type of the chosen reaction; may be null if none @@ -24217,8 +24571,10 @@ func (story *Story) UnmarshalJSON(data []byte) error { CanBeForwarded bool `json:"can_be_forwarded"` CanBeReplied bool `json:"can_be_replied"` CanToggleIsPinned bool `json:"can_toggle_is_pinned"` + CanGetStatistics bool `json:"can_get_statistics"` CanGetViewers bool `json:"can_get_viewers"` HasExpiredViewers bool `json:"has_expired_viewers"` + RepostInfo *StoryRepostInfo `json:"repost_info"` InteractionInfo *StoryInteractionInfo `json:"interaction_info"` ChosenReactionType json.RawMessage `json:"chosen_reaction_type"` PrivacySettings json.RawMessage `json:"privacy_settings"` @@ -24245,8 +24601,10 @@ func (story *Story) UnmarshalJSON(data []byte) error { story.CanBeForwarded = tmp.CanBeForwarded story.CanBeReplied = tmp.CanBeReplied story.CanToggleIsPinned = tmp.CanToggleIsPinned + story.CanGetStatistics = tmp.CanGetStatistics story.CanGetViewers = tmp.CanGetViewers story.HasExpiredViewers = tmp.HasExpiredViewers + story.RepostInfo = tmp.RepostInfo story.InteractionInfo = tmp.InteractionInfo story.Areas = tmp.Areas story.Caption = tmp.Caption @@ -24288,6 +24646,31 @@ func (*Stories) GetType() string { return TypeStories } +// Contains identifier of a story along with identifier of its sender +type StoryFullId struct { + meta + // Identifier of the chat that posted the story + SenderChatId int64 `json:"sender_chat_id"` + // Unique story identifier among stories of the given sender + StoryId int32 `json:"story_id"` +} + +func (entity *StoryFullId) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryFullId + + return json.Marshal((*stub)(entity)) +} + +func (*StoryFullId) GetClass() string { + return ClassStoryFullId +} + +func (*StoryFullId) GetType() string { + return TypeStoryFullId +} + // Contains basic information about a story type StoryInfo struct { meta @@ -24371,6 +24754,108 @@ func (chatActiveStories *ChatActiveStories) UnmarshalJSON(data []byte) error { return nil } +// Contains a public forward of a story as a message +type StoryPublicForwardMessage struct { + meta + // Information about the message with the story + Message *Message `json:"message"` +} + +func (entity *StoryPublicForwardMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryPublicForwardMessage + + return json.Marshal((*stub)(entity)) +} + +func (*StoryPublicForwardMessage) GetClass() string { + return ClassStoryPublicForward +} + +func (*StoryPublicForwardMessage) GetType() string { + return TypeStoryPublicForwardMessage +} + +func (*StoryPublicForwardMessage) StoryPublicForwardType() string { + return TypeStoryPublicForwardMessage +} + +// Contains a public repost of a story as a story +type StoryPublicForwardStory struct { + meta + // Information about the reposted story + Story *Story `json:"story"` +} + +func (entity *StoryPublicForwardStory) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryPublicForwardStory + + return json.Marshal((*stub)(entity)) +} + +func (*StoryPublicForwardStory) GetClass() string { + return ClassStoryPublicForward +} + +func (*StoryPublicForwardStory) GetType() string { + return TypeStoryPublicForwardStory +} + +func (*StoryPublicForwardStory) StoryPublicForwardType() string { + return TypeStoryPublicForwardStory +} + +// Represents a list of public forwards and reposts of a story +type StoryPublicForwards struct { + meta + // Approximate total number of messages and stories found + TotalCount int32 `json:"total_count"` + // List of found public forwards and reposts + Forwards []StoryPublicForward `json:"forwards"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` +} + +func (entity *StoryPublicForwards) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryPublicForwards + + return json.Marshal((*stub)(entity)) +} + +func (*StoryPublicForwards) GetClass() string { + return ClassStoryPublicForwards +} + +func (*StoryPublicForwards) GetType() string { + return TypeStoryPublicForwards +} + +func (storyPublicForwards *StoryPublicForwards) UnmarshalJSON(data []byte) error { + var tmp struct { + TotalCount int32 `json:"total_count"` + Forwards []json.RawMessage `json:"forwards"` + NextOffset string `json:"next_offset"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + storyPublicForwards.TotalCount = tmp.TotalCount + storyPublicForwards.NextOffset = tmp.NextOffset + + fieldForwards, _ := UnmarshalListOfStoryPublicForward(tmp.Forwards) + storyPublicForwards.Forwards = fieldForwards + + return nil +} + // The chat created a Telegram Premium gift code for a user type ChatBoostSourceGiftCode struct { meta @@ -24593,7 +25078,7 @@ type FoundChatBoosts struct { TotalCount int32 `json:"total_count"` // List of boosts Boosts []*ChatBoost `json:"boosts"` - // The offset for the next request. If empty, there are no more results + // The offset for the next request. If empty, then there are no more results NextOffset string `json:"next_offset"` } @@ -25044,7 +25529,7 @@ func (*CallStateExchangingKeys) CallStateType() string { // The call is ready to use type CallStateReady struct { meta - // Call protocols supported by the peer + // Call protocols supported by the other call participant Protocol *CallProtocol `json:"protocol"` // List of available call servers Servers []*CallServer `json:"servers"` @@ -25389,7 +25874,7 @@ type GroupCall struct { Title string `json:"title"` // Point in time (Unix timestamp) when the group call is supposed to be started by an administrator; 0 if it is already active or was ended ScheduledStartDate int32 `json:"scheduled_start_date"` - // True, if the group call is scheduled and the current user will receive a notification when the group call will start + // True, if the group call is scheduled and the current user will receive a notification when the group call starts EnabledStartNotification bool `json:"enabled_start_notification"` // True, if the call is active IsActive bool `json:"is_active"` @@ -25833,7 +26318,7 @@ type Call struct { meta // Call identifier, not persistent Id int32 `json:"id"` - // Peer user identifier + // User identifier of the other call participant UserId int64 `json:"user_id"` // True, if the call is outgoing IsOutgoing bool `json:"is_outgoing"` @@ -26059,7 +26544,7 @@ type AddedReactions struct { TotalCount int32 `json:"total_count"` // The list of added reactions Reactions []*AddedReaction `json:"reactions"` - // The offset for the next request. If empty, there are no more results + // The offset for the next request. If empty, then there are no more results NextOffset string `json:"next_offset"` } @@ -26132,7 +26617,7 @@ type AvailableReactions struct { RecentReactions []*AvailableReaction `json:"recent_reactions"` // List of popular reactions PopularReactions []*AvailableReaction `json:"popular_reactions"` - // True, if custom emoji reactions could be added by Telegram Premium subscribers + // True, if any custom emoji reaction can be added by Telegram Premium subscribers AllowCustomEmoji bool `json:"allow_custom_emoji"` } @@ -26360,7 +26845,7 @@ func (*SpeechRecognitionResultText) SpeechRecognitionResultType() string { // The speech recognition failed type SpeechRecognitionResultError struct { meta - // Recognition error + // Recognition error. An error with a message "MSG_VOICE_TOO_LONG" is returned when media duration is too big to be recognized Error *Error `json:"error"` } @@ -28028,7 +28513,7 @@ type InlineQueryResults struct { Button *InlineQueryResultsButton `json:"button"` // Results of the query Results []InlineQueryResult `json:"results"` - // The offset for the next request. If empty, there are no more results + // The offset for the next request. If empty, then there are no more results NextOffset string `json:"next_offset"` } @@ -28823,7 +29308,7 @@ func (*ChatEventMessageAutoDeleteTimeChanged) ChatEventActionType() string { return TypeChatEventMessageAutoDeleteTimeChanged } -// The chat permissions was changed +// The chat permissions were changed type ChatEventPermissionsChanged struct { meta // Previous chat permissions @@ -30447,6 +30932,31 @@ func (*PremiumLimitTypeStorySuggestedReactionAreaCount) PremiumLimitTypeType() s return TypePremiumLimitTypeStorySuggestedReactionAreaCount } +// The maximum number of received similar chats +type PremiumLimitTypeSimilarChatCount struct{ + meta +} + +func (entity *PremiumLimitTypeSimilarChatCount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumLimitTypeSimilarChatCount + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumLimitTypeSimilarChatCount) GetClass() string { + return ClassPremiumLimitType +} + +func (*PremiumLimitTypeSimilarChatCount) GetType() string { + return TypePremiumLimitTypeSimilarChatCount +} + +func (*PremiumLimitTypeSimilarChatCount) PremiumLimitTypeType() string { + return TypePremiumLimitTypeSimilarChatCount +} + // Increased limits type PremiumFeatureIncreasedLimits struct{ meta @@ -30872,7 +31382,7 @@ func (*PremiumFeatureChatBoost) PremiumFeatureType() string { return TypePremiumFeatureChatBoost } -// The ability to choose accent color +// The ability to choose accent color for replies and user profile type PremiumFeatureAccentColor struct{ meta } @@ -30897,6 +31407,31 @@ func (*PremiumFeatureAccentColor) PremiumFeatureType() string { return TypePremiumFeatureAccentColor } +// The ability to set private chat background for both users +type PremiumFeatureBackgroundForBoth struct{ + meta +} + +func (entity *PremiumFeatureBackgroundForBoth) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumFeatureBackgroundForBoth + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumFeatureBackgroundForBoth) GetClass() string { + return ClassPremiumFeature +} + +func (*PremiumFeatureBackgroundForBoth) GetType() string { + return TypePremiumFeatureBackgroundForBoth +} + +func (*PremiumFeatureBackgroundForBoth) PremiumFeatureType() string { + return TypePremiumFeatureBackgroundForBoth +} + // User stories are displayed before stories of non-premium contacts and channels type PremiumStoryFeaturePriorityOrder struct{ meta @@ -32930,7 +33465,7 @@ func (*ResetPasswordResultDeclined) ResetPasswordResultType() string { return TypeResetPasswordResultDeclined } -// The messages was exported from a private chat +// The messages were exported from a private chat type MessageFileTypePrivate struct { meta // Name of the other party; may be empty if unrecognized @@ -32957,7 +33492,7 @@ func (*MessageFileTypePrivate) MessageFileTypeType() string { return TypeMessageFileTypePrivate } -// The messages was exported from a group chat +// The messages were exported from a group chat type MessageFileTypeGroup struct { meta // Title of the group chat; may be empty if unrecognized @@ -32984,7 +33519,7 @@ func (*MessageFileTypeGroup) MessageFileTypeType() string { return TypeMessageFileTypeGroup } -// The messages was exported from a chat of unknown type +// The messages were exported from a chat of unknown type type MessageFileTypeUnknown struct{ meta } @@ -38907,7 +39442,7 @@ func (*AutosaveSettings) GetType() string { return TypeAutosaveSettings } -// Currently waiting for the network to become available. Use setNetworkType to change the available network type +// Waiting for the network to become available. Use setNetworkType to change the available network type type ConnectionStateWaitingForNetwork struct{ meta } @@ -38932,7 +39467,7 @@ func (*ConnectionStateWaitingForNetwork) ConnectionStateType() string { return TypeConnectionStateWaitingForNetwork } -// Currently establishing a connection with a proxy server +// Establishing a connection with a proxy server type ConnectionStateConnectingToProxy struct{ meta } @@ -38957,7 +39492,7 @@ func (*ConnectionStateConnectingToProxy) ConnectionStateType() string { return TypeConnectionStateConnectingToProxy } -// Currently establishing a connection to the Telegram servers +// Establishing a connection to the Telegram servers type ConnectionStateConnecting struct{ meta } @@ -38982,7 +39517,7 @@ func (*ConnectionStateConnecting) ConnectionStateType() string { return TypeConnectionStateConnecting } -// Downloading data received while the application was offline +// Downloading data supposed to be received while the application was offline type ConnectionStateUpdating struct{ meta } @@ -40185,31 +40720,110 @@ func (*StatisticalGraphError) StatisticalGraphType() string { return TypeStatisticalGraphError } -// Contains statistics about interactions with a message -type ChatStatisticsMessageInteractionInfo struct { +// Describes a message sent in the chat +type ChatStatisticsObjectTypeMessage struct { meta // Message identifier MessageId int64 `json:"message_id"` - // Number of times the message was viewed - ViewCount int32 `json:"view_count"` - // Number of times the message was forwarded - ForwardCount int32 `json:"forward_count"` } -func (entity *ChatStatisticsMessageInteractionInfo) MarshalJSON() ([]byte, error) { +func (entity *ChatStatisticsObjectTypeMessage) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ChatStatisticsMessageInteractionInfo + type stub ChatStatisticsObjectTypeMessage return json.Marshal((*stub)(entity)) } -func (*ChatStatisticsMessageInteractionInfo) GetClass() string { - return ClassChatStatisticsMessageInteractionInfo +func (*ChatStatisticsObjectTypeMessage) GetClass() string { + return ClassChatStatisticsObjectType } -func (*ChatStatisticsMessageInteractionInfo) GetType() string { - return TypeChatStatisticsMessageInteractionInfo +func (*ChatStatisticsObjectTypeMessage) GetType() string { + return TypeChatStatisticsObjectTypeMessage +} + +func (*ChatStatisticsObjectTypeMessage) ChatStatisticsObjectTypeType() string { + return TypeChatStatisticsObjectTypeMessage +} + +// Describes a story sent by the chat +type ChatStatisticsObjectTypeStory struct { + meta + // Story identifier + StoryId int32 `json:"story_id"` +} + +func (entity *ChatStatisticsObjectTypeStory) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatStatisticsObjectTypeStory + + return json.Marshal((*stub)(entity)) +} + +func (*ChatStatisticsObjectTypeStory) GetClass() string { + return ClassChatStatisticsObjectType +} + +func (*ChatStatisticsObjectTypeStory) GetType() string { + return TypeChatStatisticsObjectTypeStory +} + +func (*ChatStatisticsObjectTypeStory) ChatStatisticsObjectTypeType() string { + return TypeChatStatisticsObjectTypeStory +} + +// Contains statistics about interactions with a message sent in the chat or a story sent by the chat +type ChatStatisticsInteractionInfo struct { + meta + // Type of the object + ObjectType ChatStatisticsObjectType `json:"object_type"` + // Number of times the object was viewed + ViewCount int32 `json:"view_count"` + // Number of times the object was forwarded + ForwardCount int32 `json:"forward_count"` + // Number of times reactions were added to the object + ReactionCount int32 `json:"reaction_count"` +} + +func (entity *ChatStatisticsInteractionInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatStatisticsInteractionInfo + + return json.Marshal((*stub)(entity)) +} + +func (*ChatStatisticsInteractionInfo) GetClass() string { + return ClassChatStatisticsInteractionInfo +} + +func (*ChatStatisticsInteractionInfo) GetType() string { + return TypeChatStatisticsInteractionInfo +} + +func (chatStatisticsInteractionInfo *ChatStatisticsInteractionInfo) UnmarshalJSON(data []byte) error { + var tmp struct { + ObjectType json.RawMessage `json:"object_type"` + ViewCount int32 `json:"view_count"` + ForwardCount int32 `json:"forward_count"` + ReactionCount int32 `json:"reaction_count"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + chatStatisticsInteractionInfo.ViewCount = tmp.ViewCount + chatStatisticsInteractionInfo.ForwardCount = tmp.ForwardCount + chatStatisticsInteractionInfo.ReactionCount = tmp.ReactionCount + + fieldObjectType, _ := UnmarshalChatStatisticsObjectType(tmp.ObjectType) + chatStatisticsInteractionInfo.ObjectType = fieldObjectType + + return nil } // Contains statistics about messages sent by a user @@ -40418,10 +41032,18 @@ type ChatStatisticsChannel struct { Period *DateRange `json:"period"` // Number of members in the chat MemberCount *StatisticalValue `json:"member_count"` - // Mean number of times the recently sent messages was viewed - MeanViewCount *StatisticalValue `json:"mean_view_count"` - // Mean number of times the recently sent messages was shared - MeanShareCount *StatisticalValue `json:"mean_share_count"` + // Mean number of times the recently sent messages were viewed + MeanMessageViewCount *StatisticalValue `json:"mean_message_view_count"` + // Mean number of times the recently sent messages were shared + MeanMessageShareCount *StatisticalValue `json:"mean_message_share_count"` + // Mean number of times reactions were added to the recently sent messages + MeanMessageReactionCount *StatisticalValue `json:"mean_message_reaction_count"` + // Mean number of times the recently sent stories were viewed + MeanStoryViewCount *StatisticalValue `json:"mean_story_view_count"` + // Mean number of times the recently sent stories were shared + MeanStoryShareCount *StatisticalValue `json:"mean_story_share_count"` + // Mean number of times reactions were added to the recently sent stories + MeanStoryReactionCount *StatisticalValue `json:"mean_story_reaction_count"` // A percentage of users with enabled notifications for the chat; 0-100 EnabledNotificationsPercentage float64 `json:"enabled_notifications_percentage"` // A graph containing number of members in the chat @@ -40440,10 +41062,16 @@ type ChatStatisticsChannel struct { LanguageGraph StatisticalGraph `json:"language_graph"` // A graph containing number of chat message views and shares MessageInteractionGraph StatisticalGraph `json:"message_interaction_graph"` + // A graph containing number of reactions on messages + MessageReactionGraph StatisticalGraph `json:"message_reaction_graph"` + // A graph containing number of story views and shares + StoryInteractionGraph StatisticalGraph `json:"story_interaction_graph"` + // A graph containing number of reactions on stories + StoryReactionGraph StatisticalGraph `json:"story_reaction_graph"` // A graph containing number of views of associated with the chat instant views InstantViewInteractionGraph StatisticalGraph `json:"instant_view_interaction_graph"` - // Detailed statistics about number of views and shares of recently sent messages - RecentMessageInteractions []*ChatStatisticsMessageInteractionInfo `json:"recent_message_interactions"` + // Detailed statistics about number of views and shares of recently sent messages and stories + RecentInteractions []*ChatStatisticsInteractionInfo `json:"recent_interactions"` } func (entity *ChatStatisticsChannel) MarshalJSON() ([]byte, error) { @@ -40470,8 +41098,12 @@ func (chatStatisticsChannel *ChatStatisticsChannel) UnmarshalJSON(data []byte) e var tmp struct { Period *DateRange `json:"period"` MemberCount *StatisticalValue `json:"member_count"` - MeanViewCount *StatisticalValue `json:"mean_view_count"` - MeanShareCount *StatisticalValue `json:"mean_share_count"` + MeanMessageViewCount *StatisticalValue `json:"mean_message_view_count"` + MeanMessageShareCount *StatisticalValue `json:"mean_message_share_count"` + MeanMessageReactionCount *StatisticalValue `json:"mean_message_reaction_count"` + MeanStoryViewCount *StatisticalValue `json:"mean_story_view_count"` + MeanStoryShareCount *StatisticalValue `json:"mean_story_share_count"` + MeanStoryReactionCount *StatisticalValue `json:"mean_story_reaction_count"` EnabledNotificationsPercentage float64 `json:"enabled_notifications_percentage"` MemberCountGraph json.RawMessage `json:"member_count_graph"` JoinGraph json.RawMessage `json:"join_graph"` @@ -40481,8 +41113,11 @@ func (chatStatisticsChannel *ChatStatisticsChannel) UnmarshalJSON(data []byte) e JoinBySourceGraph json.RawMessage `json:"join_by_source_graph"` LanguageGraph json.RawMessage `json:"language_graph"` MessageInteractionGraph json.RawMessage `json:"message_interaction_graph"` + MessageReactionGraph json.RawMessage `json:"message_reaction_graph"` + StoryInteractionGraph json.RawMessage `json:"story_interaction_graph"` + StoryReactionGraph json.RawMessage `json:"story_reaction_graph"` InstantViewInteractionGraph json.RawMessage `json:"instant_view_interaction_graph"` - RecentMessageInteractions []*ChatStatisticsMessageInteractionInfo `json:"recent_message_interactions"` + RecentInteractions []*ChatStatisticsInteractionInfo `json:"recent_interactions"` } err := json.Unmarshal(data, &tmp) @@ -40492,10 +41127,14 @@ func (chatStatisticsChannel *ChatStatisticsChannel) UnmarshalJSON(data []byte) e chatStatisticsChannel.Period = tmp.Period chatStatisticsChannel.MemberCount = tmp.MemberCount - chatStatisticsChannel.MeanViewCount = tmp.MeanViewCount - chatStatisticsChannel.MeanShareCount = tmp.MeanShareCount + chatStatisticsChannel.MeanMessageViewCount = tmp.MeanMessageViewCount + chatStatisticsChannel.MeanMessageShareCount = tmp.MeanMessageShareCount + chatStatisticsChannel.MeanMessageReactionCount = tmp.MeanMessageReactionCount + chatStatisticsChannel.MeanStoryViewCount = tmp.MeanStoryViewCount + chatStatisticsChannel.MeanStoryShareCount = tmp.MeanStoryShareCount + chatStatisticsChannel.MeanStoryReactionCount = tmp.MeanStoryReactionCount chatStatisticsChannel.EnabledNotificationsPercentage = tmp.EnabledNotificationsPercentage - chatStatisticsChannel.RecentMessageInteractions = tmp.RecentMessageInteractions + chatStatisticsChannel.RecentInteractions = tmp.RecentInteractions fieldMemberCountGraph, _ := UnmarshalStatisticalGraph(tmp.MemberCountGraph) chatStatisticsChannel.MemberCountGraph = fieldMemberCountGraph @@ -40521,6 +41160,15 @@ func (chatStatisticsChannel *ChatStatisticsChannel) UnmarshalJSON(data []byte) e fieldMessageInteractionGraph, _ := UnmarshalStatisticalGraph(tmp.MessageInteractionGraph) chatStatisticsChannel.MessageInteractionGraph = fieldMessageInteractionGraph + fieldMessageReactionGraph, _ := UnmarshalStatisticalGraph(tmp.MessageReactionGraph) + chatStatisticsChannel.MessageReactionGraph = fieldMessageReactionGraph + + fieldStoryInteractionGraph, _ := UnmarshalStatisticalGraph(tmp.StoryInteractionGraph) + chatStatisticsChannel.StoryInteractionGraph = fieldStoryInteractionGraph + + fieldStoryReactionGraph, _ := UnmarshalStatisticalGraph(tmp.StoryReactionGraph) + chatStatisticsChannel.StoryReactionGraph = fieldStoryReactionGraph + fieldInstantViewInteractionGraph, _ := UnmarshalStatisticalGraph(tmp.InstantViewInteractionGraph) chatStatisticsChannel.InstantViewInteractionGraph = fieldInstantViewInteractionGraph @@ -40532,6 +41180,8 @@ type MessageStatistics struct { meta // A graph containing number of message views and shares MessageInteractionGraph StatisticalGraph `json:"message_interaction_graph"` + // A graph containing number of message reactions + MessageReactionGraph StatisticalGraph `json:"message_reaction_graph"` } func (entity *MessageStatistics) MarshalJSON() ([]byte, error) { @@ -40553,6 +41203,7 @@ func (*MessageStatistics) GetType() string { func (messageStatistics *MessageStatistics) UnmarshalJSON(data []byte) error { var tmp struct { MessageInteractionGraph json.RawMessage `json:"message_interaction_graph"` + MessageReactionGraph json.RawMessage `json:"message_reaction_graph"` } err := json.Unmarshal(data, &tmp) @@ -40563,6 +41214,54 @@ func (messageStatistics *MessageStatistics) UnmarshalJSON(data []byte) error { fieldMessageInteractionGraph, _ := UnmarshalStatisticalGraph(tmp.MessageInteractionGraph) messageStatistics.MessageInteractionGraph = fieldMessageInteractionGraph + fieldMessageReactionGraph, _ := UnmarshalStatisticalGraph(tmp.MessageReactionGraph) + messageStatistics.MessageReactionGraph = fieldMessageReactionGraph + + return nil +} + +// A detailed statistics about a story +type StoryStatistics struct { + meta + // A graph containing number of story views and shares + StoryInteractionGraph StatisticalGraph `json:"story_interaction_graph"` + // A graph containing number of story reactions + StoryReactionGraph StatisticalGraph `json:"story_reaction_graph"` +} + +func (entity *StoryStatistics) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryStatistics + + return json.Marshal((*stub)(entity)) +} + +func (*StoryStatistics) GetClass() string { + return ClassStoryStatistics +} + +func (*StoryStatistics) GetType() string { + return TypeStoryStatistics +} + +func (storyStatistics *StoryStatistics) UnmarshalJSON(data []byte) error { + var tmp struct { + StoryInteractionGraph json.RawMessage `json:"story_interaction_graph"` + StoryReactionGraph json.RawMessage `json:"story_reaction_graph"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldStoryInteractionGraph, _ := UnmarshalStatisticalGraph(tmp.StoryInteractionGraph) + storyStatistics.StoryInteractionGraph = fieldStoryInteractionGraph + + fieldStoryReactionGraph, _ := UnmarshalStatisticalGraph(tmp.StoryReactionGraph) + storyStatistics.StoryReactionGraph = fieldStoryReactionGraph + return nil } @@ -40902,7 +41601,7 @@ func (*UpdateNewMessage) UpdateType() string { return TypeUpdateNewMessage } -// A request to send a message has reached the Telegram server. This doesn't mean that the message will be sent successfully or even that the send message request will be processed. This update will be sent only if the option "use_quick_ack" is set to true. This update may be sent multiple times for the same message +// A request to send a message has reached the Telegram server. This doesn't mean that the message will be sent successfully. This update is sent only if the option "use_quick_ack" is set to true. This update may be sent multiple times for the same message type UpdateMessageSendAcknowledged struct { meta // The chat identifier of the sent message @@ -41402,7 +42101,7 @@ type UpdateChatBackgroundCustomEmoji struct { meta // Chat identifier ChatId int64 `json:"chat_id"` - // The new tdentifier of a custom emoji to be shown on the reply header background + // The new identifier of a custom emoji to be shown on the reply header background; 0 if none BackgroundCustomEmojiId JsonInt64 `json:"background_custom_emoji_id"` } @@ -41426,7 +42125,7 @@ func (*UpdateChatBackgroundCustomEmoji) UpdateType() string { return TypeUpdateChatBackgroundCustomEmoji } -// Chat permissions was changed +// Chat permissions were changed type UpdateChatPermissions struct { meta // Chat identifier @@ -42127,6 +42826,35 @@ func (*UpdateChatIsMarkedAsUnread) UpdateType() string { return TypeUpdateChatIsMarkedAsUnread } +// A chat default appearance has changed +type UpdateChatViewAsTopics struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // New value of view_as_topics + ViewAsTopics bool `json:"view_as_topics"` +} + +func (entity *UpdateChatViewAsTopics) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateChatViewAsTopics + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateChatViewAsTopics) GetClass() string { + return ClassUpdate +} + +func (*UpdateChatViewAsTopics) GetType() string { + return TypeUpdateChatViewAsTopics +} + +func (*UpdateChatViewAsTopics) UpdateType() string { + return TypeUpdateChatViewAsTopics +} + // A chat was blocked or unblocked type UpdateChatBlockList struct { meta @@ -42233,7 +42961,7 @@ func (*UpdateChatFolders) UpdateType() string { return TypeUpdateChatFolders } -// The number of online group members has changed. This update with non-zero number of online group members is sent only for currently opened chats. There is no guarantee that it will be sent just after the number of online users has changed +// The number of online group members has changed. This update with non-zero number of online group members is sent only for currently opened chats. There is no guarantee that it is sent just after the number of online users has changed type UpdateChatOnlineMemberCount struct { meta // Identifier of the chat @@ -42440,7 +43168,7 @@ func (updateNotificationGroup *UpdateNotificationGroup) UnmarshalJSON(data []byt return nil } -// Contains active notifications that was shown on previous application launches. This update is sent only if the message database is used. In that case it comes once before any updateNotification and updateNotificationGroup update +// Contains active notifications that were shown on previous application launches. This update is sent only if the message database is used. In that case it comes once before any updateNotification and updateNotificationGroup update type UpdateActiveNotifications struct { meta // Lists of active notification groups @@ -43858,7 +44586,7 @@ func (*UpdateSavedAnimations) UpdateType() string { return TypeUpdateSavedAnimations } -// The list of saved notifications sounds was updated. This update may not be sent until information about a notification sound was requested for the first time +// The list of saved notification sounds was updated. This update may not be sent until information about a notification sound was requested for the first time type UpdateSavedNotificationSounds struct { meta // The new list of identifiers of saved notification sounds @@ -43970,6 +44698,35 @@ func (*UpdateAccentColors) UpdateType() string { return TypeUpdateAccentColors } +// The list of supported accent colors for user profiles has changed +type UpdateProfileAccentColors struct { + meta + // Information about supported colors + Colors []*ProfileAccentColor `json:"colors"` + // The list of accent color identifiers, which can be set through setProfileAccentColor. The colors must be shown in the specififed order + AvailableAccentColorIds []int32 `json:"available_accent_color_ids"` +} + +func (entity *UpdateProfileAccentColors) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateProfileAccentColors + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateProfileAccentColors) GetClass() string { + return ClassUpdate +} + +func (*UpdateProfileAccentColors) GetType() string { + return TypeUpdateProfileAccentColors +} + +func (*UpdateProfileAccentColors) UpdateType() string { + return TypeUpdateProfileAccentColors +} + // Some language pack strings have been updated type UpdateLanguagePackStrings struct { meta @@ -44251,6 +45008,39 @@ func (updateDefaultReactionType *UpdateDefaultReactionType) UnmarshalJSON(data [ return nil } +// The parameters of speech recognition without Telegram Premium subscription has changed +type UpdateSpeechRecognitionTrial struct { + meta + // The maximum allowed duration of media for speech recognition without Telegram Premium subscription + MaxMediaDuration int32 `json:"max_media_duration"` + // The total number of allowed speech recognitions per week; 0 if none + WeeklyCount int32 `json:"weekly_count"` + // Number of left speech recognition attempts this week + LeftCount int32 `json:"left_count"` + // Point in time (Unix timestamp) when the weekly number of tries will reset; 0 if unknown + NextResetDate int32 `json:"next_reset_date"` +} + +func (entity *UpdateSpeechRecognitionTrial) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateSpeechRecognitionTrial + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateSpeechRecognitionTrial) GetClass() string { + return ClassUpdate +} + +func (*UpdateSpeechRecognitionTrial) GetType() string { + return TypeUpdateSpeechRecognitionTrial +} + +func (*UpdateSpeechRecognitionTrial) UpdateType() string { + return TypeUpdateSpeechRecognitionTrial +} + // The list of supported dice emojis has changed type UpdateDiceEmojis struct { meta @@ -44903,7 +45693,7 @@ type UpdateChatMember struct { ChatId int64 `json:"chat_id"` // Identifier of the user, changing the rights ActorUserId int64 `json:"actor_user_id"` - // Point in time (Unix timestamp) when the user rights was changed + // Point in time (Unix timestamp) when the user rights were changed Date int32 `json:"date"` // If user has joined the chat using an invite link, the invite link; may be null InviteLink *ChatInviteLink `json:"invite_link"` diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 3af611e..08fb7f7 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -1160,6 +1160,9 @@ func UnmarshalMessageSponsorType(data json.RawMessage) (MessageSponsorType, erro case TypeMessageSponsorTypeBot: return UnmarshalMessageSponsorTypeBot(data) + case TypeMessageSponsorTypeWebApp: + return UnmarshalMessageSponsorTypeWebApp(data) + case TypeMessageSponsorTypePublicChannel: return UnmarshalMessageSponsorTypePublicChannel(data) @@ -2535,6 +2538,9 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessagePremiumGiveaway: return UnmarshalMessagePremiumGiveaway(data) + case TypeMessagePremiumGiveawayCompleted: + return UnmarshalMessagePremiumGiveawayCompleted(data) + case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) @@ -3242,6 +3248,74 @@ func UnmarshalListOfStoryList(dataList []json.RawMessage) ([]StoryList, error) { return list, nil } +func UnmarshalStoryOrigin(data json.RawMessage) (StoryOrigin, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeStoryOriginPublicStory: + return UnmarshalStoryOriginPublicStory(data) + + case TypeStoryOriginHiddenUser: + return UnmarshalStoryOriginHiddenUser(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfStoryOrigin(dataList []json.RawMessage) ([]StoryOrigin, error) { + list := []StoryOrigin{} + + for _, data := range dataList { + entity, err := UnmarshalStoryOrigin(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalStoryPublicForward(data json.RawMessage) (StoryPublicForward, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeStoryPublicForwardMessage: + return UnmarshalStoryPublicForwardMessage(data) + + case TypeStoryPublicForwardStory: + return UnmarshalStoryPublicForwardStory(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfStoryPublicForward(dataList []json.RawMessage) ([]StoryPublicForward, error) { + list := []StoryPublicForward{} + + for _, data := range dataList { + entity, err := UnmarshalStoryPublicForward(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalChatBoostSource(data json.RawMessage) (ChatBoostSource, error) { var meta meta @@ -4101,6 +4175,9 @@ func UnmarshalPremiumLimitType(data json.RawMessage) (PremiumLimitType, error) { case TypePremiumLimitTypeStorySuggestedReactionAreaCount: return UnmarshalPremiumLimitTypeStorySuggestedReactionAreaCount(data) + case TypePremiumLimitTypeSimilarChatCount: + return UnmarshalPremiumLimitTypeSimilarChatCount(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -4183,6 +4260,9 @@ func UnmarshalPremiumFeature(data json.RawMessage) (PremiumFeature, error) { case TypePremiumFeatureAccentColor: return UnmarshalPremiumFeatureAccentColor(data) + case TypePremiumFeatureBackgroundForBoth: + return UnmarshalPremiumFeatureBackgroundForBoth(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -6088,6 +6168,40 @@ func UnmarshalListOfStatisticalGraph(dataList []json.RawMessage) ([]StatisticalG return list, nil } +func UnmarshalChatStatisticsObjectType(data json.RawMessage) (ChatStatisticsObjectType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeChatStatisticsObjectTypeMessage: + return UnmarshalChatStatisticsObjectTypeMessage(data) + + case TypeChatStatisticsObjectTypeStory: + return UnmarshalChatStatisticsObjectTypeStory(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfChatStatisticsObjectType(dataList []json.RawMessage) ([]ChatStatisticsObjectType, error) { + list := []ChatStatisticsObjectType{} + + for _, data := range dataList { + entity, err := UnmarshalChatStatisticsObjectType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalChatStatistics(data json.RawMessage) (ChatStatistics, error) { var meta meta @@ -6334,6 +6448,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateChatIsMarkedAsUnread: return UnmarshalUpdateChatIsMarkedAsUnread(data) + case TypeUpdateChatViewAsTopics: + return UnmarshalUpdateChatViewAsTopics(data) + case TypeUpdateChatBlockList: return UnmarshalUpdateChatBlockList(data) @@ -6493,6 +6610,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateAccentColors: return UnmarshalUpdateAccentColors(data) + case TypeUpdateProfileAccentColors: + return UnmarshalUpdateProfileAccentColors(data) + case TypeUpdateLanguagePackStrings: return UnmarshalUpdateLanguagePackStrings(data) @@ -6520,6 +6640,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateDefaultReactionType: return UnmarshalUpdateDefaultReactionType(data) + case TypeUpdateSpeechRecognitionTrial: + return UnmarshalUpdateSpeechRecognitionTrial(data) + case TypeUpdateDiceEmojis: return UnmarshalUpdateDiceEmojis(data) @@ -7625,6 +7748,22 @@ func UnmarshalAccentColor(data json.RawMessage) (*AccentColor, error) { return &resp, err } +func UnmarshalProfileAccentColors(data json.RawMessage) (*ProfileAccentColors, error) { + var resp ProfileAccentColors + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalProfileAccentColor(data json.RawMessage) (*ProfileAccentColor, error) { + var resp ProfileAccentColor + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalEmojiStatus(data json.RawMessage) (*EmojiStatus, error) { var resp EmojiStatus @@ -8217,6 +8356,22 @@ func UnmarshalMessageSendingStateFailed(data json.RawMessage) (*MessageSendingSt return &resp, err } +func UnmarshalTextQuote(data json.RawMessage) (*TextQuote, error) { + var resp TextQuote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputTextQuote(data json.RawMessage) (*InputTextQuote, error) { + var resp InputTextQuote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageReplyToMessage(data json.RawMessage) (*MessageReplyToMessage, error) { var resp MessageReplyToMessage @@ -8401,6 +8556,14 @@ func UnmarshalMessageSponsorTypeBot(data json.RawMessage) (*MessageSponsorTypeBo return &resp, err } +func UnmarshalMessageSponsorTypeWebApp(data json.RawMessage) (*MessageSponsorTypeWebApp, error) { + var resp MessageSponsorTypeWebApp + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageSponsorTypePublicChannel(data json.RawMessage) (*MessageSponsorTypePublicChannel, error) { var resp MessageSponsorTypePublicChannel @@ -10801,6 +10964,14 @@ func UnmarshalMessagePremiumGiveaway(data json.RawMessage) (*MessagePremiumGivea return &resp, err } +func UnmarshalMessagePremiumGiveawayCompleted(data json.RawMessage) (*MessagePremiumGiveawayCompleted, error) { + var resp MessagePremiumGiveawayCompleted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageContactRegistered(data json.RawMessage) (*MessageContactRegistered, error) { var resp MessageContactRegistered @@ -11809,6 +11980,30 @@ func UnmarshalStoryListArchive(data json.RawMessage) (*StoryListArchive, error) return &resp, err } +func UnmarshalStoryOriginPublicStory(data json.RawMessage) (*StoryOriginPublicStory, error) { + var resp StoryOriginPublicStory + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryOriginHiddenUser(data json.RawMessage) (*StoryOriginHiddenUser, error) { + var resp StoryOriginHiddenUser + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryRepostInfo(data json.RawMessage) (*StoryRepostInfo, error) { + var resp StoryRepostInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStoryInteractionInfo(data json.RawMessage) (*StoryInteractionInfo, error) { var resp StoryInteractionInfo @@ -11833,6 +12028,14 @@ func UnmarshalStories(data json.RawMessage) (*Stories, error) { return &resp, err } +func UnmarshalStoryFullId(data json.RawMessage) (*StoryFullId, error) { + var resp StoryFullId + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStoryInfo(data json.RawMessage) (*StoryInfo, error) { var resp StoryInfo @@ -11849,6 +12052,30 @@ func UnmarshalChatActiveStories(data json.RawMessage) (*ChatActiveStories, error return &resp, err } +func UnmarshalStoryPublicForwardMessage(data json.RawMessage) (*StoryPublicForwardMessage, error) { + var resp StoryPublicForwardMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryPublicForwardStory(data json.RawMessage) (*StoryPublicForwardStory, error) { + var resp StoryPublicForwardStory + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryPublicForwards(data json.RawMessage) (*StoryPublicForwards, error) { + var resp StoryPublicForwards + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatBoostSourceGiftCode(data json.RawMessage) (*ChatBoostSourceGiftCode, error) { var resp ChatBoostSourceGiftCode @@ -13281,6 +13508,14 @@ func UnmarshalPremiumLimitTypeStorySuggestedReactionAreaCount(data json.RawMessa return &resp, err } +func UnmarshalPremiumLimitTypeSimilarChatCount(data json.RawMessage) (*PremiumLimitTypeSimilarChatCount, error) { + var resp PremiumLimitTypeSimilarChatCount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPremiumFeatureIncreasedLimits(data json.RawMessage) (*PremiumFeatureIncreasedLimits, error) { var resp PremiumFeatureIncreasedLimits @@ -13425,6 +13660,14 @@ func UnmarshalPremiumFeatureAccentColor(data json.RawMessage) (*PremiumFeatureAc return &resp, err } +func UnmarshalPremiumFeatureBackgroundForBoth(data json.RawMessage) (*PremiumFeatureBackgroundForBoth, error) { + var resp PremiumFeatureBackgroundForBoth + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPremiumStoryFeaturePriorityOrder(data json.RawMessage) (*PremiumStoryFeaturePriorityOrder, error) { var resp PremiumStoryFeaturePriorityOrder @@ -16025,8 +16268,24 @@ func UnmarshalStatisticalGraphError(data json.RawMessage) (*StatisticalGraphErro return &resp, err } -func UnmarshalChatStatisticsMessageInteractionInfo(data json.RawMessage) (*ChatStatisticsMessageInteractionInfo, error) { - var resp ChatStatisticsMessageInteractionInfo +func UnmarshalChatStatisticsObjectTypeMessage(data json.RawMessage) (*ChatStatisticsObjectTypeMessage, error) { + var resp ChatStatisticsObjectTypeMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatStatisticsObjectTypeStory(data json.RawMessage) (*ChatStatisticsObjectTypeStory, error) { + var resp ChatStatisticsObjectTypeStory + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatStatisticsInteractionInfo(data json.RawMessage) (*ChatStatisticsInteractionInfo, error) { + var resp ChatStatisticsInteractionInfo err := json.Unmarshal(data, &resp) @@ -16081,6 +16340,14 @@ func UnmarshalMessageStatistics(data json.RawMessage) (*MessageStatistics, error return &resp, err } +func UnmarshalStoryStatistics(data json.RawMessage) (*StoryStatistics, error) { + var resp StoryStatistics + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPoint(data json.RawMessage) (*Point, error) { var resp Point @@ -16481,6 +16748,14 @@ func UnmarshalUpdateChatIsMarkedAsUnread(data json.RawMessage) (*UpdateChatIsMar return &resp, err } +func UnmarshalUpdateChatViewAsTopics(data json.RawMessage) (*UpdateChatViewAsTopics, error) { + var resp UpdateChatViewAsTopics + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateChatBlockList(data json.RawMessage) (*UpdateChatBlockList, error) { var resp UpdateChatBlockList @@ -16905,6 +17180,14 @@ func UnmarshalUpdateAccentColors(data json.RawMessage) (*UpdateAccentColors, err return &resp, err } +func UnmarshalUpdateProfileAccentColors(data json.RawMessage) (*UpdateProfileAccentColors, error) { + var resp UpdateProfileAccentColors + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateLanguagePackStrings(data json.RawMessage) (*UpdateLanguagePackStrings, error) { var resp UpdateLanguagePackStrings @@ -16977,6 +17260,14 @@ func UnmarshalUpdateDefaultReactionType(data json.RawMessage) (*UpdateDefaultRea return &resp, err } +func UnmarshalUpdateSpeechRecognitionTrial(data json.RawMessage) (*UpdateSpeechRecognitionTrial, error) { + var resp UpdateSpeechRecognitionTrial + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateDiceEmojis(data json.RawMessage) (*UpdateDiceEmojis, error) { var resp UpdateDiceEmojis @@ -17622,6 +17913,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeAccentColor: return UnmarshalAccentColor(data) + case TypeProfileAccentColors: + return UnmarshalProfileAccentColors(data) + + case TypeProfileAccentColor: + return UnmarshalProfileAccentColor(data) + case TypeEmojiStatus: return UnmarshalEmojiStatus(data) @@ -17844,6 +18141,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageSendingStateFailed: return UnmarshalMessageSendingStateFailed(data) + case TypeTextQuote: + return UnmarshalTextQuote(data) + + case TypeInputTextQuote: + return UnmarshalInputTextQuote(data) + case TypeMessageReplyToMessage: return UnmarshalMessageReplyToMessage(data) @@ -17913,6 +18216,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageSponsorTypeBot: return UnmarshalMessageSponsorTypeBot(data) + case TypeMessageSponsorTypeWebApp: + return UnmarshalMessageSponsorTypeWebApp(data) + case TypeMessageSponsorTypePublicChannel: return UnmarshalMessageSponsorTypePublicChannel(data) @@ -18813,6 +19119,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessagePremiumGiveaway: return UnmarshalMessagePremiumGiveaway(data) + case TypeMessagePremiumGiveawayCompleted: + return UnmarshalMessagePremiumGiveawayCompleted(data) + case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) @@ -19191,6 +19500,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStoryListArchive: return UnmarshalStoryListArchive(data) + case TypeStoryOriginPublicStory: + return UnmarshalStoryOriginPublicStory(data) + + case TypeStoryOriginHiddenUser: + return UnmarshalStoryOriginHiddenUser(data) + + case TypeStoryRepostInfo: + return UnmarshalStoryRepostInfo(data) + case TypeStoryInteractionInfo: return UnmarshalStoryInteractionInfo(data) @@ -19200,12 +19518,24 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStories: return UnmarshalStories(data) + case TypeStoryFullId: + return UnmarshalStoryFullId(data) + case TypeStoryInfo: return UnmarshalStoryInfo(data) case TypeChatActiveStories: return UnmarshalChatActiveStories(data) + case TypeStoryPublicForwardMessage: + return UnmarshalStoryPublicForwardMessage(data) + + case TypeStoryPublicForwardStory: + return UnmarshalStoryPublicForwardStory(data) + + case TypeStoryPublicForwards: + return UnmarshalStoryPublicForwards(data) + case TypeChatBoostSourceGiftCode: return UnmarshalChatBoostSourceGiftCode(data) @@ -19743,6 +20073,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePremiumLimitTypeStorySuggestedReactionAreaCount: return UnmarshalPremiumLimitTypeStorySuggestedReactionAreaCount(data) + case TypePremiumLimitTypeSimilarChatCount: + return UnmarshalPremiumLimitTypeSimilarChatCount(data) + case TypePremiumFeatureIncreasedLimits: return UnmarshalPremiumFeatureIncreasedLimits(data) @@ -19797,6 +20130,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePremiumFeatureAccentColor: return UnmarshalPremiumFeatureAccentColor(data) + case TypePremiumFeatureBackgroundForBoth: + return UnmarshalPremiumFeatureBackgroundForBoth(data) + case TypePremiumStoryFeaturePriorityOrder: return UnmarshalPremiumStoryFeaturePriorityOrder(data) @@ -20772,8 +21108,14 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStatisticalGraphError: return UnmarshalStatisticalGraphError(data) - case TypeChatStatisticsMessageInteractionInfo: - return UnmarshalChatStatisticsMessageInteractionInfo(data) + case TypeChatStatisticsObjectTypeMessage: + return UnmarshalChatStatisticsObjectTypeMessage(data) + + case TypeChatStatisticsObjectTypeStory: + return UnmarshalChatStatisticsObjectTypeStory(data) + + case TypeChatStatisticsInteractionInfo: + return UnmarshalChatStatisticsInteractionInfo(data) case TypeChatStatisticsMessageSenderInfo: return UnmarshalChatStatisticsMessageSenderInfo(data) @@ -20793,6 +21135,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageStatistics: return UnmarshalMessageStatistics(data) + case TypeStoryStatistics: + return UnmarshalStoryStatistics(data) + case TypePoint: return UnmarshalPoint(data) @@ -20943,6 +21288,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateChatIsMarkedAsUnread: return UnmarshalUpdateChatIsMarkedAsUnread(data) + case TypeUpdateChatViewAsTopics: + return UnmarshalUpdateChatViewAsTopics(data) + case TypeUpdateChatBlockList: return UnmarshalUpdateChatBlockList(data) @@ -21102,6 +21450,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateAccentColors: return UnmarshalUpdateAccentColors(data) + case TypeUpdateProfileAccentColors: + return UnmarshalUpdateProfileAccentColors(data) + case TypeUpdateLanguagePackStrings: return UnmarshalUpdateLanguagePackStrings(data) @@ -21129,6 +21480,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateDefaultReactionType: return UnmarshalUpdateDefaultReactionType(data) + case TypeUpdateSpeechRecognitionTrial: + return UnmarshalUpdateSpeechRecognitionTrial(data) + case TypeUpdateDiceEmojis: return UnmarshalUpdateDiceEmojis(data) diff --git a/data/td_api.tl b/data/td_api.tl index b14df9a..f55b5ba 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -703,7 +703,7 @@ premiumGiftCodePaymentOptions options:vector = Pre //@creator_id Identifier of a chat or a user that created the gift code //@creation_date Point in time (Unix timestamp) when the code was created //@is_from_giveaway True, if the gift code was created for a giveaway -//@giveaway_message_id Identifier of the corresponding giveaway message; can be 0 or an identifier of a deleted message +//@giveaway_message_id Identifier of the corresponding giveaway message in the creator_id chat; can be 0 or an identifier of a deleted message //@month_count Number of month the Telegram Premium subscription will be active after code activation //@user_id Identifier of a user for which the code was created; 0 if none //@use_date Point in time (Unix timestamp) when the code was activated; 0 if none @@ -754,6 +754,18 @@ premiumGiveawayInfoCompleted creation_date:int32 actual_winners_selection_date:i //@dark_theme_colors The list of 1-3 colors in RGB format, describing the accent color, as expected to be shown in dark themes accentColor id:int32 built_in_accent_color_id:int32 light_theme_colors:vector dark_theme_colors:vector = AccentColor; +//@description Contains information about supported accent colors for user profile photo background in RGB format +//@palette_colors The list of 1-2 colors in RGB format, describing the colors, as expected to be shown in the color palette settings +//@background_colors The list of 1-2 colors in RGB format, describing the colors, as expected to be used for the profile photo background +//@story_colors The list of 2 colors in RGB format, describing the colors of the gradient to be used for the unread active story indicator around profile photo +profileAccentColors palette_colors:vector background_colors:vector story_colors:vector = ProfileAccentColors; + +//@description Contains information about supported accent color for user profile photo background +//@id Profile accent color identifier +//@light_theme_colors The list of 1-3 colors in RGB format, describing the accent color, as expected to be shown in light themes +//@dark_theme_colors The list of 1-3 colors in RGB format, describing the accent color, as expected to be shown in dark themes +profileAccentColor id:int32 light_theme_colors:profileAccentColors dark_theme_colors:profileAccentColors = ProfileAccentColor; + //@description Describes a custom emoji to be shown instead of the Telegram Premium badge //@custom_emoji_id Identifier of the custom emoji in stickerFormatTgs format //@expiration_date Point in time (Unix timestamp) when the status will expire; 0 if never @@ -779,8 +791,10 @@ usernames active_usernames:vector disabled_usernames:vector edit //@phone_number Phone number of the user //@status Current online status of the user //@profile_photo Profile photo of the user; may be null -//@accent_color_id Identifier of the accent color for name, and backgrounds of profile photo, reply header, and link preview +//@accent_color_id Identifier of the accent color for name, and backgrounds of profile photo, reply header, and link preview. For Telegram Premium users only //@background_custom_emoji_id Identifier of a custom emoji to be shown on the reply header background; 0 if none. For Telegram Premium users only +//@profile_accent_color_id Identifier of the accent color for the user's profile; -1 if none. For Telegram Premium users only +//@profile_background_custom_emoji_id Identifier of a custom emoji to be shown on the background of the user's profile; 0 if none. For Telegram Premium users only //@emoji_status Emoji status to be shown instead of the default Telegram Premium badge; may be null. For Telegram Premium users only //@is_contact The user is a contact of the current user //@is_mutual_contact The user is a contact of the current user and the current user is a contact of the user @@ -797,7 +811,7 @@ usernames active_usernames:vector disabled_usernames:vector edit //@type Type of the user //@language_code IETF language tag of the user's language; only available to bots //@added_to_attachment_menu True, if the user added the current bot to attachment menu; only available to bots -user id:int53 access_hash:int64 first_name:string last_name:string usernames:usernames phone_number:string status:UserStatus profile_photo:profilePhoto accent_color_id:int32 background_custom_emoji_id:int64 emoji_status:emojiStatus is_contact:Bool is_mutual_contact:Bool is_close_friend:Bool is_verified:Bool is_premium:Bool is_support:Bool restriction_reason:string is_scam:Bool is_fake:Bool has_active_stories:Bool has_unread_active_stories:Bool have_access:Bool type:UserType language_code:string added_to_attachment_menu:Bool = User; +user id:int53 access_hash:int64 first_name:string last_name:string usernames:usernames phone_number:string status:UserStatus profile_photo:profilePhoto accent_color_id:int32 background_custom_emoji_id:int64 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 emoji_status:emojiStatus is_contact:Bool is_mutual_contact:Bool is_close_friend:Bool is_verified:Bool is_premium:Bool is_support:Bool restriction_reason:string is_scam:Bool is_fake:Bool has_active_stories:Bool has_unread_active_stories:Bool have_access:Bool type:UserType language_code:string added_to_attachment_menu:Bool = User; //@description Contains information about a bot @@ -830,11 +844,12 @@ botInfo short_description:string description:string photo:photo animation:animat //@has_restricted_voice_and_video_note_messages True, if voice and video notes can't be sent or forwarded to the user //@has_pinned_stories True, if the user has pinned stories //@need_phone_number_privacy_exception True, if the current user needs to explicitly allow to share their phone number with the user when the method addContact is used +//@set_chat_background True, if the user set chat background for both chat users and it wasn't reverted yet //@bio A short user bio; may be null for bots //@premium_gift_options The list of available options for gifting Telegram Premium to the user //@group_in_common_count Number of group chats where both the other user and the current user are a member; 0 for the current user //@bot_info For bots, information about the bot; may be null if the user isn't a bot -userFullInfo personal_photo:chatPhoto photo:chatPhoto public_photo:chatPhoto block_list:BlockList can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool has_private_forwards:Bool has_restricted_voice_and_video_note_messages:Bool has_pinned_stories:Bool need_phone_number_privacy_exception:Bool bio:formattedText premium_gift_options:vector group_in_common_count:int32 bot_info:botInfo = UserFullInfo; +userFullInfo personal_photo:chatPhoto photo:chatPhoto public_photo:chatPhoto block_list:BlockList can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool has_private_forwards:Bool has_restricted_voice_and_video_note_messages:Bool has_pinned_stories:Bool need_phone_number_privacy_exception:Bool set_chat_background:Bool bio:formattedText premium_gift_options:vector group_in_common_count:int32 bot_info:botInfo = UserFullInfo; //@description Represents a list of users @total_count Approximate total number of users found @user_ids A list of user identifiers users total_count:int32 user_ids:vector = Users; @@ -1048,8 +1063,10 @@ basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int53 memb //@usernames Usernames of the supergroup or channel; may be null //@date Point in time (Unix timestamp) when the current user joined, or the point in time when the supergroup or channel was created, in case the user is not a member //@status Status of the current user in the supergroup or channel; custom title will always be empty -//@member_count Number of members in the supergroup or channel; 0 if unknown. Currently, it is guaranteed to be known only if the supergroup or channel was received -//-through searchPublicChats, searchChatsNearby, getInactiveSupergroupChats, getSuitableDiscussionChats, getGroupsInCommon, getUserPrivacySettingRules, or in chatFolderInviteLinkInfo.missing_chat_ids +//@member_count Number of members in the supergroup or channel; 0 if unknown. Currently, it is guaranteed to be known only if the supergroup or channel was received through +//-getChatSimilarChats, getChatsToSendStories, getCreatedPublicChats, getGroupsInCommon, getInactiveSupergroupChats, getSuitableDiscussionChats, getUserPrivacySettingRules, getVideoChatAvailableParticipants, +//-searchChatsNearby, searchPublicChats, or in chatFolderInviteLinkInfo.missing_chat_ids, or for public chats in which where sent messages and posted stories from storyPublicForwards, +//-or for public chats in which where sent messages from getMessagePublicForwards response //@has_linked_chat True, if the channel has a discussion group, or the supergroup is the designated discussion group for a channel //@has_location True, if the supergroup is connected to a location, i.e. the supergroup is a location-based supergroup //@sign_messages True, if messages sent to the channel need to contain information about the sender. This field is only applicable to channels @@ -1058,7 +1075,7 @@ basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int53 memb //@is_slow_mode_enabled True, if the slow mode is enabled in the supergroup //@is_channel True, if the supergroup is a channel //@is_broadcast_group True, if the supergroup is a broadcast group, i.e. only administrators can send messages and there is no limit on the number of members -//@is_forum True, if the supergroup must be shown as a forum by default +//@is_forum True, if the supergroup is a forum with topics //@is_verified True, if the supergroup or channel is verified //@restriction_reason If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted //@is_scam True, if many users reported this supergroup or channel as a scam @@ -1134,7 +1151,7 @@ messageSenderChat chat_id:int53 = MessageSender; messageSenders total_count:int32 senders:vector = MessageSenders; -//@description Represents a message sender, which can be used to send messages in a chat @sender Available message senders @needs_premium True, if Telegram Premium is needed to use the message sender +//@description Represents a message sender, which can be used to send messages in a chat @sender The message sender @needs_premium True, if Telegram Premium is needed to use the message sender chatMessageSender sender:MessageSender needs_premium:Bool = ChatMessageSender; //@description Represents a list of message senders, which can be used to send messages in a chat @senders List of available message senders @@ -1202,7 +1219,7 @@ messageReplyInfo reply_count:int32 recent_replier_ids:vector last //@type Type of the reaction //@total_count Number of times the reaction was added //@is_chosen True, if the reaction is chosen by the current user -//@used_sender_id Identifier of the message sender used by the current user to add the reaction; null if unknown or the reaction isn't chosen +//@used_sender_id Identifier of the message sender used by the current user to add the reaction; may be null if unknown or the reaction isn't chosen //@recent_sender_ids Identifiers of at most 3 recent message senders, added the reaction; available in private, basic group and supergroup chats messageReaction type:ReactionType total_count:int32 is_chosen:Bool used_sender_id:MessageSender recent_sender_ids:vector = MessageReaction; @@ -1236,19 +1253,30 @@ messageSendingStatePending sending_id:int32 = MessageSendingState; messageSendingStateFailed error:error can_retry:Bool need_another_sender:Bool need_another_reply_quote:Bool need_drop_reply:Bool retry_after:double = MessageSendingState; +//@description Describes manually or automatically chosen quote from another message +//@text Text of the quote. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities can be present in the text +//@position Approximate quote position in the original message in UTF-16 code units +//@is_manual True, if the quote was manually chosen by the message sender +textQuote text:formattedText position:int32 is_manual:Bool = TextQuote; + +//@description Describes manually chosen quote from another message +//@text Text of the quote; 0-getOption("message_reply_quote_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed to be kept and must be kept in the quote +//@position Quote position in the original message in UTF-16 code units +inputTextQuote text:formattedText position:int32 = InputTextQuote; + + //@class MessageReplyTo @description Contains information about the message or the story a message is replying to //@description Describes a message replied by a given message //@chat_id The identifier of the chat to which the message belongs; may be 0 if the replied message is in unknown chat //@message_id The identifier of the message; may be 0 if the replied message is in unknown chat -//@quote Manually or automatically chosen quote from the replied message; may be null if none. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities can be present in the quote -//@is_quote_manual True, if the quote was manually chosen by the message sender -//@origin Information about origin of the message if the message was replied from another chat; may be null for messages from the same chat -//@origin_send_date Point in time (Unix timestamp) when the message was sent if the message was replied from another chat; 0 for messages from the same chat -//@content Media content of the message if the message was replied from another chat; may be null for messages from the same chat and messages without media. +//@quote Chosen quote from the replied message; may be null if none +//@origin Information about origin of the message if the message was from another chat or topic; may be null for messages from the same chat +//@origin_send_date Point in time (Unix timestamp) when the message was sent if the message was from another chat or topic; 0 for messages from the same chat +//@content Media content of the message if the message was from another chat or topic; may be null for messages from the same chat and messages without media. //-Can be only one of the following types: messageAnimation, messageAudio, messageContact, messageDice, messageDocument, messageGame, messageInvoice, messageLocation, //-messagePhoto, messagePoll, messagePremiumGiveaway, messageSticker, messageStory, messageText (for link preview), messageVenue, messageVideo, messageVideoNote, or messageVoiceNote -messageReplyToMessage chat_id:int53 message_id:int53 quote:formattedText is_quote_manual:Bool origin:MessageOrigin origin_send_date:int32 content:MessageContent = MessageReplyTo; +messageReplyToMessage chat_id:int53 message_id:int53 quote:textQuote origin:MessageOrigin origin_send_date:int32 content:MessageContent = MessageReplyTo; //@description Describes a story replied by a given message @story_sender_chat_id The identifier of the sender of the story @story_id The identifier of the story messageReplyToStory story_sender_chat_id:int53 story_id:int32 = MessageReplyTo; @@ -1257,11 +1285,10 @@ messageReplyToStory story_sender_chat_id:int53 story_id:int32 = MessageReplyTo; //@class InputMessageReplyTo @description Contains information about the message or the story to be replied //@description Describes a message to be replied -//@chat_id The identifier of the chat to which the message to be replied belongs; pass 0 if the message to be replied is in the same chat. Must always be 0 for replies in secret chats. A message can be replied in another chat only if message.can_be_replied_in_another_chat +//@chat_id The identifier of the chat to which the message to be replied belongs; pass 0 if the message to be replied is in the same chat. Must always be 0 for replies in secret chats. A message can be replied in another chat or topic only if message.can_be_replied_in_another_chat //@message_id The identifier of the message to be replied in the same or the specified chat -//@quote Manually chosen quote from the message to be replied; pass null if none; 0-getOption("message_reply_quote_length_max") characters. Must always be null for replies in secret chats. -//-Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed to be kept and must be kept in the quote -inputMessageReplyToMessage chat_id:int53 message_id:int53 quote:formattedText = InputMessageReplyTo; +//@quote Quote from the message to be replied; pass null if none. Must always be null for replies in secret chats +inputMessageReplyToMessage chat_id:int53 message_id:int53 quote:inputTextQuote = InputMessageReplyTo; //@description Describes a story to be replied @story_sender_chat_id The identifier of the sender of the story. Currently, stories can be replied only in the sender's chat @story_id The identifier of the story inputMessageReplyToStory story_sender_chat_id:int53 story_id:int32 = InputMessageReplyTo; @@ -1277,7 +1304,7 @@ inputMessageReplyToStory story_sender_chat_id:int53 story_id:int32 = InputMessag //@is_pinned True, if the message is pinned //@can_be_edited True, if the message can be edited. For live location and poll messages this fields shows whether editMessageLiveLocation or stopPoll can be used with this message by the application //@can_be_forwarded True, if the message can be forwarded -//@can_be_replied_in_another_chat True, if the message can be replied in another chat +//@can_be_replied_in_another_chat True, if the message can be replied in another chat or topic //@can_be_saved True, if content of the message can be saved locally or copied //@can_be_deleted_only_for_self True, if the message can be deleted only for the current user while other users will continue to see it //@can_be_deleted_for_all_users True, if the message can be deleted for all users @@ -1313,7 +1340,7 @@ message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSend //@description Contains a list of messages @total_count Approximate total number of messages found @messages List of messages; messages may be null messages total_count:int32 messages:vector = Messages; -//@description Contains a list of messages found by a search @total_count Approximate total number of messages found; -1 if unknown @messages List of messages @next_offset The offset for the next request. If empty, there are no more results +//@description Contains a list of messages found by a search @total_count Approximate total number of messages found; -1 if unknown @messages List of messages @next_offset The offset for the next request. If empty, then there are no more results foundMessages total_count:int32 messages:vector next_offset:string = FoundMessages; //@description Contains a list of messages found by a search in a given chat @total_count Approximate total number of messages found; -1 if unknown @messages List of messages @next_from_message_id The offset for the next request. If 0, there are no more results @@ -1370,6 +1397,9 @@ messageSourceOther = MessageSource; //@description The sponsor is a bot @bot_user_id User identifier of the bot @link An internal link to be opened when the sponsored message is clicked messageSponsorTypeBot bot_user_id:int53 link:InternalLinkType = MessageSponsorType; +//@description The sponsor is a web app @web_app_title Web App title @link An internal link to be opened when the sponsored message is clicked +messageSponsorTypeWebApp web_app_title:string link:InternalLinkType = MessageSponsorType; + //@description The sponsor is a public channel chat @chat_id Sponsor chat identifier @link An internal link to be opened when the sponsored message is clicked; may be null if the sponsor chat needs to be opened instead messageSponsorTypePublicChannel chat_id:int53 link:InternalLinkType = MessageSponsorType; @@ -1391,8 +1421,9 @@ messageSponsor type:MessageSponsorType photo:chatPhotoInfo info:string = Message //@is_recommended True, if the message needs to be labeled as "recommended" instead of "sponsored" //@content Content of the message. Currently, can be only of the type messageText //@sponsor Information about the sponsor of the message +//@button_text If non-empty, text for the message action button //@additional_info If non-empty, additional information about the sponsored message to be shown along with the message -sponsoredMessage message_id:int53 is_recommended:Bool content:MessageContent sponsor:messageSponsor additional_info:string = SponsoredMessage; +sponsoredMessage message_id:int53 is_recommended:Bool content:MessageContent sponsor:messageSponsor button_text:string additional_info:string = SponsoredMessage; //@description Contains a list of sponsored messages @messages List of sponsored messages @messages_between The minimum number of messages between shown sponsored messages, or 0 if only one sponsored message must be shown after all ordinary messages sponsoredMessages messages:vector messages_between:int32 = SponsoredMessages; @@ -1415,7 +1446,7 @@ downloadedFileCounts active_count:int32 paused_count:int32 completed_count:int32 //@description Contains a list of downloaded files, found by a search //@total_counts Total number of suitable files, ignoring offset //@files The list of files -//@next_offset The offset for the next request. If empty, there are no more results +//@next_offset The offset for the next request. If empty, then there are no more results foundFileDownloads total_counts:downloadedFileCounts files:vector next_offset:string = FoundFileDownloads; @@ -1432,21 +1463,21 @@ notificationSettingsScopeChannelChats = NotificationSettingsScope; //@description Contains information about notification settings for a chat or a forum topic -//@use_default_mute_for If true, mute_for is ignored and the value for the relevant type of chat or the forum chat is used instead +//@use_default_mute_for If true, the value for the relevant type of chat or the forum chat is used instead of mute_for //@mute_for Time left before notifications will be unmuted, in seconds //@use_default_sound If true, the value for the relevant type of chat or the forum chat is used instead of sound_id //@sound_id Identifier of the notification sound to be played for messages; 0 if sound is disabled -//@use_default_show_preview If true, show_preview is ignored and the value for the relevant type of chat or the forum chat is used instead +//@use_default_show_preview If true, the value for the relevant type of chat or the forum chat is used instead of show_preview //@show_preview True, if message content must be displayed in notifications -//@use_default_mute_stories If true, mute_stories is ignored and the value for the relevant type of chat is used instead +//@use_default_mute_stories If true, the value for the relevant type of chat is used instead of mute_stories //@mute_stories True, if story notifications are disabled for the chat //@use_default_story_sound If true, the value for the relevant type of chat is used instead of story_sound_id //@story_sound_id Identifier of the notification sound to be played for stories; 0 if sound is disabled -//@use_default_show_story_sender If true, show_story_sender is ignored and the value for the relevant type of chat is used instead +//@use_default_show_story_sender If true, the value for the relevant type of chat is used instead of show_story_sender //@show_story_sender True, if the sender of stories must be displayed in notifications -//@use_default_disable_pinned_message_notifications If true, disable_pinned_message_notifications is ignored and the value for the relevant type of chat or the forum chat is used instead +//@use_default_disable_pinned_message_notifications If true, the value for the relevant type of chat or the forum chat is used instead of disable_pinned_message_notifications //@disable_pinned_message_notifications If true, notifications for incoming pinned messages will be created as for an ordinary unread message -//@use_default_disable_mention_notifications If true, disable_mention_notifications is ignored and the value for the relevant type of chat or the forum chat is used instead +//@use_default_disable_mention_notifications If true, the value for the relevant type of chat or the forum chat is used instead of disable_mention_notifications //@disable_mention_notifications If true, notifications for messages with mentions will be created as for an ordinary unread message chatNotificationSettings use_default_mute_for:Bool mute_for:int32 use_default_sound:Bool sound_id:int64 use_default_show_preview:Bool show_preview:Bool use_default_mute_stories:Bool mute_stories:Bool use_default_story_sound:Bool story_sound_id:int64 use_default_show_story_sender:Bool show_story_sender:Bool use_default_disable_pinned_message_notifications:Bool disable_pinned_message_notifications:Bool use_default_disable_mention_notifications:Bool disable_mention_notifications:Bool = ChatNotificationSettings; @@ -1454,8 +1485,8 @@ chatNotificationSettings use_default_mute_for:Bool mute_for:int32 use_default_so //@mute_for Time left before notifications will be unmuted, in seconds //@sound_id Identifier of the notification sound to be played; 0 if sound is disabled //@show_preview True, if message content must be displayed in notifications -//@use_default_mute_stories If true, mute_stories is ignored and story notifications are received only for the first 5 chats from topChatCategoryUsers -//@mute_stories True, if story notifications are disabled for the chat +//@use_default_mute_stories If true, story notifications are received only for the first 5 chats from topChatCategoryUsers regardless of the value of mute_stories +//@mute_stories True, if story notifications are disabled //@story_sound_id Identifier of the notification sound to be played for stories; 0 if sound is disabled //@show_story_sender True, if the sender of stories must be displayed in notifications //@disable_pinned_message_notifications True, if notifications for incoming pinned messages will be created as for an ordinary unread message @@ -1481,7 +1512,7 @@ chatTypeBasicGroup basic_group_id:int53 = ChatType; //@description A supergroup or channel (with unlimited members) @supergroup_id Supergroup or channel identifier @is_channel True, if the supergroup is a channel chatTypeSupergroup supergroup_id:int53 is_channel:Bool = ChatType; -//@description A secret chat with a user @secret_chat_id Secret chat identifier @user_id User identifier of the secret chat peer +//@description A secret chat with a user @secret_chat_id Secret chat identifier @user_id User identifier of the other user in the secret chat chatTypeSecret secret_chat_id:int32 user_id:int53 = ChatType; @@ -1605,6 +1636,7 @@ videoChat group_call_id:int32 has_participants:Bool default_participant_id:Messa //@has_protected_content True, if chat content can't be saved locally, forwarded, or copied //@is_translatable True, if translation of all messages in the chat must be suggested to the user //@is_marked_as_unread True, if the chat is marked as unread +//@view_as_topics True, if the chat is a forum supergroup that must be shown in the "View as topics" mode //@has_scheduled_messages True, if the chat has scheduled messages //@can_be_deleted_only_for_self True, if the chat messages can be deleted only for the current user while other users will continue to see the messages //@can_be_deleted_for_all_users True, if the chat messages can be deleted for all users @@ -1626,7 +1658,7 @@ videoChat group_call_id:int32 has_participants:Bool default_participant_id:Messa //@reply_markup_message_id Identifier of the message from which reply markup needs to be used; 0 if there is no default custom reply markup in the chat //@draft_message A draft of a message in the chat; may be null if none //@client_data 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 -chat id:int53 type:ChatType title:string photo:chatPhotoInfo accent_color_id:int32 background_custom_emoji_id:int64 permissions:chatPermissions last_message:message positions:vector message_sender_id:MessageSender block_list:BlockList has_protected_content:Bool is_translatable:Bool is_marked_as_unread:Bool has_scheduled_messages:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_reported:Bool default_disable_notification:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 unread_reaction_count:int32 notification_settings:chatNotificationSettings available_reactions:ChatAvailableReactions message_auto_delete_time:int32 background:chatBackground theme_name:string action_bar:ChatActionBar video_chat:videoChat pending_join_requests:chatJoinRequestsInfo reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat; +chat id:int53 type:ChatType title:string photo:chatPhotoInfo accent_color_id:int32 background_custom_emoji_id:int64 permissions:chatPermissions last_message:message positions:vector message_sender_id:MessageSender block_list:BlockList has_protected_content:Bool is_translatable:Bool is_marked_as_unread:Bool view_as_topics:Bool has_scheduled_messages:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_reported:Bool default_disable_notification:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 unread_reaction_count:int32 notification_settings:chatNotificationSettings available_reactions:ChatAvailableReactions message_auto_delete_time:int32 background:chatBackground theme_name:string action_bar:ChatActionBar video_chat:videoChat pending_join_requests:chatJoinRequestsInfo reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat; //@description Represents a list of chats @total_count Approximate total number of chats found @chat_ids List of chat identifiers chats total_count:int32 chat_ids:vector = Chats; @@ -1663,7 +1695,7 @@ chatActionBarInviteMembers = ChatActionBar; //@description The chat is a private or secret chat, which can be reported using the method reportChat, or the other user can be blocked using the method setMessageSenderBlockList, //-or the other user can be added to the contact list using the method addContact. If the chat is a private chat with a user with an emoji status, then a notice about emoji status usage must be shown //@can_unarchive If true, the chat was automatically archived and can be moved back to the main chat list using addChatToList simultaneously with setting chat notification settings to default using setChatNotificationSettings -//@distance If non-negative, the current user was found by the peer through searchChatsNearby and this is the distance between the users +//@distance If non-negative, the current user was found by the other user through searchChatsNearby and this is the distance between the users chatActionBarReportAddBlock can_unarchive:Bool distance:int32 = ChatActionBar; //@description The chat is a private or secret chat and the other user can be added to the contact list using the method addContact @@ -2133,8 +2165,8 @@ webPageInstantView page_blocks:vector view_count:int32 version:int32 //@embed_height Height of the embedded preview //@duration Duration of the content, in seconds //@author Author of the content -//@has_large_media True, if the preview has large media and its appearance can be changed -//@show_large_media True, if large media preview must be shown +//@has_large_media True, if size of media in the preview can be changed +//@show_large_media True, if large media preview must be shown; otherwise, the media preview must be shown small and only the first frame must be shown for videos //@skip_confirmation True, if there is no need to show an ordinary open URL confirmation, when opening the URL from the preview, because the URL is shown in the message text in clear //@show_above_text True, if the link preview must be shown above message text; otherwise, the link preview must be shown below the message text //@animation Preview of the content as an animation, if available; may be null @@ -2639,7 +2671,7 @@ inputPassportElementError type:PassportElementType message:string source:InputPa //@description A text message //@text Text of the message //@web_page A link preview attached to the message; may be null -//@link_preview_options Options which was used for generation of the link preview; may be null if default options were used +//@link_preview_options Options which were used for generation of the link preview; may be null if default options were used messageText text:formattedText web_page:webPage link_preview_options:linkPreviewOptions = MessageContent; //@description An animation message (GIF-style). @@ -2788,8 +2820,11 @@ messagePinMessage message_id:int53 = MessageContent; //@description A screenshot of a message in the chat has been taken messageScreenshotTaken = MessageContent; -//@description A new background was set in the chat @old_background_message_id Identifier of the message with a previously set same background; 0 if none. Can be an identifier of a deleted message @background The new background -messageChatSetBackground old_background_message_id:int53 background:chatBackground = MessageContent; +//@description A new background was set in the chat +//@old_background_message_id Identifier of the message with a previously set same background; 0 if none. Can be an identifier of a deleted message +//@background The new background +//@only_for_self True, if the background was set only for self +messageChatSetBackground old_background_message_id:int53 background:chatBackground only_for_self:Bool = MessageContent; //@description A theme in the chat has been changed @theme_name If non-empty, name of a new theme, set for the chat. Otherwise, chat theme was reset to the default one messageChatSetTheme theme_name:string = MessageContent; @@ -2872,6 +2907,12 @@ messagePremiumGiveawayCreated = MessageContent; //@sticker A sticker to be shown in the message; may be null if unknown messagePremiumGiveaway parameters:premiumGiveawayParameters winner_count:int32 month_count:int32 sticker:sticker = MessageContent; +//@description A Telegram Premium giveaway has been completed for the chat +//@giveaway_message_id Identifier of the message with the giveaway, can be an identifier of a deleted message +//@winner_count Number of winners in the giveaway +//@unclaimed_prize_count Number of undistributed prizes +messagePremiumGiveawayCompleted giveaway_message_id:int53 winner_count:int32 unclaimed_prize_count:int32 = MessageContent; + //@description A contact has registered with Telegram messageContactRegistered = MessageContent; @@ -2981,7 +3022,7 @@ inputThumbnail thumbnail:InputFile width:int32 height:int32 = InputThumbnail; //@description The message will be sent at the specified date @send_date Point in time (Unix timestamp) when the message will be sent. The date must be within 367 days in the future messageSchedulingStateSendAtDate send_date:int32 = MessageSchedulingState; -//@description The message will be sent when the peer will be online. Applicable to private chats only and when the exact online status of the peer is known +//@description The message will be sent when the other user is online. Applicable to private chats only and when the exact online status of the other user is known messageSchedulingStateSendWhenOnline = MessageSchedulingState; @@ -3042,7 +3083,7 @@ inputMessageAudio audio:InputFile album_cover_thumbnail:inputThumbnail duration: //@description A document message (general file) //@document Document to be sent //@thumbnail Document thumbnail; pass null to skip thumbnail uploading -//@disable_content_type_detection If true, automatic file type detection will be disabled and the document will always be sent as file. Always true for files sent to secret chats +//@disable_content_type_detection True, if automatic file type detection is disabled and the document must be sent as a file. Always true for files sent to secret chats //@caption Document caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters inputMessageDocument document:InputFile thumbnail:inputThumbnail disable_content_type_detection:Bool caption:formattedText = InputMessageContent; @@ -3353,7 +3394,7 @@ storyViewer user_id:int53 view_date:int32 block_list:BlockList chosen_reaction_t //@total_count Approximate total number of story viewers found //@total_reaction_count Approximate total number of reactions set by found story viewers //@viewers List of story viewers -//@next_offset The offset for the next request. If empty, there are no more results +//@next_offset The offset for the next request. If empty, then there are no more results storyViewers total_count:int32 total_reaction_count:int32 viewers:vector next_offset:string = StoryViewers; @@ -3464,6 +3505,20 @@ storyListMain = StoryList; storyListArchive = StoryList; +//@class StoryOrigin @description Contains information about the origin of a story that was reposted + +//@description The original story was a public story with known sender @chat_id Identifier of the chat that posted original story @story_id Story identifier of the original story +storyOriginPublicStory chat_id:int53 story_id:int32 = StoryOrigin; + +//@description The original story was sent by an unknown user @sender_name Name of the story sender +storyOriginHiddenUser sender_name:string = StoryOrigin; + + +//@description Contains information about original story that was reposted +//@origin Origin of the story that was reposted +//@is_content_modified True, if story content was modified during reposting; otherwise, story wasn't modified +storyRepostInfo origin:StoryOrigin is_content_modified:Bool = StoryRepostInfo; + //@description Contains information about interactions with a story //@view_count Number of times the story was viewed //@forward_count Number of times the story was forwarded; 0 if none or unknown @@ -3485,19 +3540,26 @@ storyInteractionInfo view_count:int32 forward_count:int32 reaction_count:int32 r //@can_be_forwarded True, if the story can be forwarded as a message. Otherwise, screenshots and saving of the story content must be also forbidden //@can_be_replied True, if the story can be replied in the chat with the story sender //@can_toggle_is_pinned True, if the story's is_pinned value can be changed +//@can_get_statistics True, if the story statistics are available through getStoryStatistics //@can_get_viewers True, if users viewed the story can be received through getStoryViewers //@has_expired_viewers True, if users viewed the story can't be received, because the story has expired more than getOption("story_viewers_expiration_delay") seconds ago +//@repost_info Information about the original story; may be null if the story wasn't reposted //@interaction_info Information about interactions with the story; may be null if the story isn't owned or there were no interactions //@chosen_reaction_type Type of the chosen reaction; may be null if none //@privacy_settings Privacy rules affecting story visibility; may be approximate for non-owned stories //@content Content of the story //@areas Clickable areas to be shown on the story content //@caption Caption of the story -story id:int32 sender_chat_id:int53 date:int32 is_being_sent:Bool is_being_edited:Bool is_edited:Bool is_pinned:Bool is_visible_only_for_self:Bool can_be_deleted:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied:Bool can_toggle_is_pinned:Bool can_get_viewers:Bool has_expired_viewers:Bool interaction_info:storyInteractionInfo chosen_reaction_type:ReactionType privacy_settings:StoryPrivacySettings content:StoryContent areas:vector caption:formattedText = Story; +story id:int32 sender_chat_id:int53 date:int32 is_being_sent:Bool is_being_edited:Bool is_edited:Bool is_pinned:Bool is_visible_only_for_self:Bool can_be_deleted:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied:Bool can_toggle_is_pinned:Bool can_get_statistics:Bool can_get_viewers:Bool has_expired_viewers:Bool repost_info:storyRepostInfo interaction_info:storyInteractionInfo chosen_reaction_type:ReactionType privacy_settings:StoryPrivacySettings content:StoryContent areas:vector caption:formattedText = Story; //@description Represents a list of stories @total_count Approximate total number of stories found @stories The list of stories stories total_count:int32 stories:vector = Stories; +//@description Contains identifier of a story along with identifier of its sender +//@sender_chat_id Identifier of the chat that posted the story +//@story_id Unique story identifier among stories of the given sender +storyFullId sender_chat_id:int53 story_id:int32 = StoryFullId; + //@description Contains basic information about a story //@story_id Unique story identifier among stories of the given sender //@date Point in time (Unix timestamp) when the story was published @@ -3513,6 +3575,22 @@ storyInfo story_id:int32 date:int32 is_for_close_friends:Bool = StoryInfo; chatActiveStories chat_id:int53 list:StoryList order:int53 max_read_story_id:int32 stories:vector = ChatActiveStories; +//@class StoryPublicForward @description Describes a public forward or repost of a story + +//@description Contains a public forward of a story as a message @message Information about the message with the story +storyPublicForwardMessage message:message = StoryPublicForward; + +//@description Contains a public repost of a story as a story @story Information about the reposted story +storyPublicForwardStory story:story = StoryPublicForward; + + +//@description Represents a list of public forwards and reposts of a story +//@total_count Approximate total number of messages and stories found +//@forwards List of found public forwards and reposts +//@next_offset The offset for the next request. If empty, then there are no more results +storyPublicForwards total_count:int32 forwards:vector next_offset:string = StoryPublicForwards; + + //@class ChatBoostSource @description Describes source of a chat boost //@description The chat created a Telegram Premium gift code for a user @@ -3560,7 +3638,7 @@ chatBoostStatus boost_url:string applied_slot_ids:vector level:int32 gift //@expiration_date Point in time (Unix timestamp) when the boost will expire chatBoost id:string count:int32 source:ChatBoostSource start_date:int32 expiration_date:int32 = ChatBoost; -//@description Contains a list of boosts applied to a chat @total_count Total number of boosts applied to the chat @boosts List of boosts @next_offset The offset for the next request. If empty, there are no more results +//@description Contains a list of boosts applied to a chat @total_count Total number of boosts applied to the chat @boosts List of boosts @next_offset The offset for the next request. If empty, then there are no more results foundChatBoosts total_count:int32 boosts:vector next_offset:string = FoundChatBoosts; //@description Describes a slot for chat boost @@ -3640,7 +3718,7 @@ callStatePending is_created:Bool is_received:Bool = CallState; callStateExchangingKeys = CallState; //@description The call is ready to use -//@protocol Call protocols supported by the peer +//@protocol Call protocols supported by the other call participant //@servers List of available call servers //@config A JSON-encoded call config //@encryption_key Call encryption key @@ -3694,7 +3772,7 @@ groupCallRecentSpeaker participant_id:MessageSender is_speaking:Bool = GroupCall //@id Group call identifier //@title Group call title //@scheduled_start_date Point in time (Unix timestamp) when the group call is supposed to be started by an administrator; 0 if it is already active or was ended -//@enabled_start_notification True, if the group call is scheduled and the current user will receive a notification when the group call will start +//@enabled_start_notification True, if the group call is scheduled and the current user will receive a notification when the group call starts //@is_active True, if the call is active //@is_rtmp_stream True, if the chat is an RTMP stream instead of an ordinary video chat //@is_joined True, if the call is joined @@ -3777,7 +3855,7 @@ callProblemPixelatedVideo = CallProblem; //@description Describes a call //@id Call identifier, not persistent -//@user_id Peer user identifier +//@user_id User identifier of the other call participant //@is_outgoing True, if the call is outgoing //@is_video True, if the call is a video call //@state Call state @@ -3810,7 +3888,7 @@ phoneNumberAuthenticationSettings allow_flash_call:Bool allow_missed_call:Bool i //@date Point in time (Unix timestamp) when the reaction was added addedReaction type:ReactionType sender_id:MessageSender is_outgoing:Bool date:int32 = AddedReaction; -//@description Represents a list of reactions added to a message @total_count The total number of found reactions @reactions The list of added reactions @next_offset The offset for the next request. If empty, there are no more results +//@description Represents a list of reactions added to a message @total_count The total number of found reactions @reactions The list of added reactions @next_offset The offset for the next request. If empty, then there are no more results addedReactions total_count:int32 reactions:vector next_offset:string = AddedReactions; //@description Represents an available reaction @type Type of the reaction @needs_premium True, if Telegram Premium is needed to send the reaction @@ -3820,7 +3898,7 @@ availableReaction type:ReactionType needs_premium:Bool = AvailableReaction; //@top_reactions List of reactions to be shown at the top //@recent_reactions List of recently used reactions //@popular_reactions List of popular reactions -//@allow_custom_emoji True, if custom emoji reactions could be added by Telegram Premium subscribers +//@allow_custom_emoji True, if any custom emoji reaction can be added by Telegram Premium subscribers availableReactions top_reactions:vector recent_reactions:vector popular_reactions:vector allow_custom_emoji:Bool = AvailableReactions; //@description Contains information about a emoji reaction @@ -3869,7 +3947,7 @@ speechRecognitionResultPending partial_text:string = SpeechRecognitionResult; //@description The speech recognition successfully finished @text Recognized text speechRecognitionResultText text:string = SpeechRecognitionResult; -//@description The speech recognition failed @error Recognition error +//@description The speech recognition failed @error Recognition error. An error with a message "MSG_VOICE_TOO_LONG" is returned when media duration is too big to be recognized speechRecognitionResultError error:error = SpeechRecognitionResult; @@ -4161,7 +4239,7 @@ inlineQueryResultsButton text:string type:InlineQueryResultsButtonType = InlineQ //@inline_query_id Unique identifier of the inline query //@button Button to be shown above inline query results; may be null //@results Results of the query -//@next_offset The offset for the next request. If empty, there are no more results +//@next_offset The offset for the next request. If empty, then there are no more results inlineQueryResults inline_query_id:int64 button:inlineQueryResultsButton results:vector next_offset:string = InlineQueryResults; @@ -4245,7 +4323,7 @@ chatEventLocationChanged old_location:chatLocation new_location:chatLocation = C //@description The message auto-delete timer was changed @old_message_auto_delete_time Previous value of message_auto_delete_time @new_message_auto_delete_time New value of message_auto_delete_time chatEventMessageAutoDeleteTimeChanged old_message_auto_delete_time:int32 new_message_auto_delete_time:int32 = ChatEventAction; -//@description The chat permissions was changed @old_permissions Previous chat permissions @new_permissions New chat permissions +//@description The chat permissions were changed @old_permissions Previous chat permissions @new_permissions New chat permissions chatEventPermissionsChanged old_permissions:chatPermissions new_permissions:chatPermissions = ChatEventAction; //@description The chat photo was changed @old_photo Previous chat photo value; may be null @new_photo New chat photo value; may be null @@ -4456,6 +4534,9 @@ premiumLimitTypeStoryCaptionLength = PremiumLimitType; //@description The maximum number of suggested reaction areas on a story premiumLimitTypeStorySuggestedReactionAreaCount = PremiumLimitType; +//@description The maximum number of received similar chats +premiumLimitTypeSimilarChatCount = PremiumLimitType; + //@class PremiumFeature @description Describes a feature available to Premium users @@ -4510,9 +4591,12 @@ premiumFeatureUpgradedStories = PremiumFeature; //@description The ability to boost chats premiumFeatureChatBoost = PremiumFeature; -//@description The ability to choose accent color +//@description The ability to choose accent color for replies and user profile premiumFeatureAccentColor = PremiumFeature; +//@description The ability to set private chat background for both users +premiumFeatureBackgroundForBoth = PremiumFeature; + //@class PremiumStoryFeature @description Describes a story feature available to Premium users @@ -4809,13 +4893,13 @@ resetPasswordResultDeclined retry_date:int32 = ResetPasswordResult; //@class MessageFileType @description Contains information about a file with messages exported from another app -//@description The messages was exported from a private chat @name Name of the other party; may be empty if unrecognized +//@description The messages were exported from a private chat @name Name of the other party; may be empty if unrecognized messageFileTypePrivate name:string = MessageFileType; -//@description The messages was exported from a group chat @title Title of the group chat; may be empty if unrecognized +//@description The messages were exported from a group chat @title Title of the group chat; may be empty if unrecognized messageFileTypeGroup title:string = MessageFileType; -//@description The messages was exported from a chat of unknown type +//@description The messages were exported from a chat of unknown type messageFileTypeUnknown = MessageFileType; @@ -5702,16 +5786,16 @@ autosaveSettings private_chat_settings:scopeAutosaveSettings group_settings:scop //@class ConnectionState @description Describes the current state of the connection to Telegram servers -//@description Currently waiting for the network to become available. Use setNetworkType to change the available network type +//@description Waiting for the network to become available. Use setNetworkType to change the available network type connectionStateWaitingForNetwork = ConnectionState; -//@description Currently establishing a connection with a proxy server +//@description Establishing a connection with a proxy server connectionStateConnectingToProxy = ConnectionState; -//@description Currently establishing a connection to the Telegram servers +//@description Establishing a connection to the Telegram servers connectionStateConnecting = ConnectionState; -//@description Downloading data received while the application was offline +//@description Downloading data supposed to be received while the application was offline connectionStateUpdating = ConnectionState; //@description There is a working connection to the Telegram servers @@ -5882,11 +5966,21 @@ statisticalGraphAsync token:string = StatisticalGraph; statisticalGraphError error_message:string = StatisticalGraph; -//@description Contains statistics about interactions with a message -//@message_id Message identifier -//@view_count Number of times the message was viewed -//@forward_count Number of times the message was forwarded -chatStatisticsMessageInteractionInfo message_id:int53 view_count:int32 forward_count:int32 = ChatStatisticsMessageInteractionInfo; +//@class ChatStatisticsObjectType @description Describes type of an object, for which statistics are provided + +//@description Describes a message sent in the chat @message_id Message identifier +chatStatisticsObjectTypeMessage message_id:int53 = ChatStatisticsObjectType; + +//@description Describes a story sent by the chat @story_id Story identifier +chatStatisticsObjectTypeStory story_id:int32 = ChatStatisticsObjectType; + + +//@description Contains statistics about interactions with a message sent in the chat or a story sent by the chat +//@object_type Type of the object +//@view_count Number of times the object was viewed +//@forward_count Number of times the object was forwarded +//@reaction_count Number of times reactions were added to the object +chatStatisticsInteractionInfo object_type:ChatStatisticsObjectType view_count:int32 forward_count:int32 reaction_count:int32 = ChatStatisticsInteractionInfo; //@description Contains statistics about messages sent by a user //@user_id User identifier @@ -5931,8 +6025,12 @@ chatStatisticsSupergroup period:dateRange member_count:statisticalValue message_ //@description A detailed statistics about a channel chat //@period A period to which the statistics applies //@member_count Number of members in the chat -//@mean_view_count Mean number of times the recently sent messages was viewed -//@mean_share_count Mean number of times the recently sent messages was shared +//@mean_message_view_count Mean number of times the recently sent messages were viewed +//@mean_message_share_count Mean number of times the recently sent messages were shared +//@mean_message_reaction_count Mean number of times reactions were added to the recently sent messages +//@mean_story_view_count Mean number of times the recently sent stories were viewed +//@mean_story_share_count Mean number of times the recently sent stories were shared +//@mean_story_reaction_count Mean number of times reactions were added to the recently sent stories //@enabled_notifications_percentage A percentage of users with enabled notifications for the chat; 0-100 //@member_count_graph A graph containing number of members in the chat //@join_graph A graph containing number of members joined and left the chat @@ -5942,13 +6040,23 @@ chatStatisticsSupergroup period:dateRange member_count:statisticalValue message_ //@join_by_source_graph A graph containing number of new member joins per source //@language_graph A graph containing number of users viewed chat messages per language //@message_interaction_graph A graph containing number of chat message views and shares +//@message_reaction_graph A graph containing number of reactions on messages +//@story_interaction_graph A graph containing number of story views and shares +//@story_reaction_graph A graph containing number of reactions on stories //@instant_view_interaction_graph A graph containing number of views of associated with the chat instant views -//@recent_message_interactions Detailed statistics about number of views and shares of recently sent messages -chatStatisticsChannel period:dateRange member_count:statisticalValue mean_view_count:statisticalValue mean_share_count:statisticalValue enabled_notifications_percentage:double member_count_graph:StatisticalGraph join_graph:StatisticalGraph mute_graph:StatisticalGraph view_count_by_hour_graph:StatisticalGraph view_count_by_source_graph:StatisticalGraph join_by_source_graph:StatisticalGraph language_graph:StatisticalGraph message_interaction_graph:StatisticalGraph instant_view_interaction_graph:StatisticalGraph recent_message_interactions:vector = ChatStatistics; +//@recent_interactions Detailed statistics about number of views and shares of recently sent messages and stories +chatStatisticsChannel period:dateRange member_count:statisticalValue mean_message_view_count:statisticalValue mean_message_share_count:statisticalValue mean_message_reaction_count:statisticalValue mean_story_view_count:statisticalValue mean_story_share_count:statisticalValue mean_story_reaction_count:statisticalValue enabled_notifications_percentage:double member_count_graph:StatisticalGraph join_graph:StatisticalGraph mute_graph:StatisticalGraph view_count_by_hour_graph:StatisticalGraph view_count_by_source_graph:StatisticalGraph join_by_source_graph:StatisticalGraph language_graph:StatisticalGraph message_interaction_graph:StatisticalGraph message_reaction_graph:StatisticalGraph story_interaction_graph:StatisticalGraph story_reaction_graph:StatisticalGraph instant_view_interaction_graph:StatisticalGraph recent_interactions:vector = ChatStatistics; -//@description A detailed statistics about a message @message_interaction_graph A graph containing number of message views and shares -messageStatistics message_interaction_graph:StatisticalGraph = MessageStatistics; +//@description A detailed statistics about a message +//@message_interaction_graph A graph containing number of message views and shares +//@message_reaction_graph A graph containing number of message reactions +messageStatistics message_interaction_graph:StatisticalGraph message_reaction_graph:StatisticalGraph = MessageStatistics; + +//@description A detailed statistics about a story +//@story_interaction_graph A graph containing number of story views and shares +//@story_reaction_graph A graph containing number of story reactions +storyStatistics story_interaction_graph:StatisticalGraph story_reaction_graph:StatisticalGraph = StoryStatistics; //@description A point on a Cartesian plane @x The point's first coordinate @y The point's second coordinate @@ -5996,8 +6104,8 @@ updateAuthorizationState authorization_state:AuthorizationState = Update; //@description A new message was received; can also be an outgoing message @message The new message updateNewMessage message:message = Update; -//@description A request to send a message has reached the Telegram server. This doesn't mean that the message will be sent successfully or even that the send message request will be processed. -//-This update will be sent only if the option "use_quick_ack" is set to true. This update may be sent multiple times for the same message +//@description A request to send a message has reached the Telegram server. This doesn't mean that the message will be sent successfully. +//-This update is sent only if the option "use_quick_ack" is set to true. This update may be sent multiple times for the same message //@chat_id The chat identifier of the sent message //@message_id A temporary message identifier updateMessageSendAcknowledged chat_id:int53 message_id:int53 = Update; @@ -6057,10 +6165,10 @@ updateChatPhoto chat_id:int53 photo:chatPhotoInfo = Update; //@description A chat accent color has changed @chat_id Chat identifier @accent_color_id The new chat accent color identifier updateChatAccentColor chat_id:int53 accent_color_id:int32 = Update; -//@description A chat's custom emoji for reply background has changed @chat_id Chat identifier @background_custom_emoji_id The new tdentifier of a custom emoji to be shown on the reply header background +//@description A chat's custom emoji for reply background has changed @chat_id Chat identifier @background_custom_emoji_id The new identifier of a custom emoji to be shown on the reply header background; 0 if none updateChatBackgroundCustomEmoji chat_id:int53 background_custom_emoji_id:int64 = Update; -//@description Chat permissions was changed @chat_id Chat identifier @permissions The new chat permissions +//@description Chat permissions were changed @chat_id Chat identifier @permissions The new chat permissions updateChatPermissions chat_id:int53 permissions:chatPermissions = Update; //@description The last message of a chat was changed @@ -6136,6 +6244,9 @@ updateChatIsTranslatable chat_id:int53 is_translatable:Bool = Update; //@description A chat was marked as unread or was read @chat_id Chat identifier @is_marked_as_unread New value of is_marked_as_unread updateChatIsMarkedAsUnread chat_id:int53 is_marked_as_unread:Bool = Update; +//@description A chat default appearance has changed @chat_id Chat identifier @view_as_topics New value of view_as_topics +updateChatViewAsTopics chat_id:int53 view_as_topics:Bool = Update; + //@description A chat was blocked or unblocked @chat_id Chat identifier @block_list Block list to which the chat is added; may be null if none updateChatBlockList chat_id:int53 block_list:BlockList = Update; @@ -6146,7 +6257,7 @@ updateChatHasScheduledMessages chat_id:int53 has_scheduled_messages:Bool = Updat updateChatFolders chat_folders:vector main_chat_list_position:int32 = Update; //@description The number of online group members has changed. This update with non-zero number of online group members is sent only for currently opened chats. -//-There is no guarantee that it will be sent just after the number of online users has changed +//-There is no guarantee that it is sent just after the number of online users has changed //@chat_id Identifier of the chat //@online_member_count New number of online members in the chat, or 0 if unknown updateChatOnlineMemberCount chat_id:int53 online_member_count:int32 = Update; @@ -6171,7 +6282,7 @@ updateNotification notification_group_id:int32 notification:notification = Updat //@removed_notification_ids Identifiers of removed group notifications, sorted by notification identifier updateNotificationGroup notification_group_id:int32 type:NotificationGroupType chat_id:int53 notification_settings_chat_id:int53 notification_sound_id:int64 total_count:int32 added_notifications:vector removed_notification_ids:vector = Update; -//@description Contains active notifications that was shown on previous application launches. This update is sent only if the message database is used. In that case it comes once before any updateNotification and updateNotificationGroup update @groups Lists of active notification groups +//@description Contains active notifications that were shown on previous application launches. This update is sent only if the message database is used. In that case it comes once before any updateNotification and updateNotificationGroup update @groups Lists of active notification groups updateActiveNotifications groups:vector = Update; //@description Describes whether there are some pending notification updates. Can be used to prevent application from killing, while there are some pending notifications @@ -6334,7 +6445,7 @@ updateFavoriteStickers sticker_ids:vector = Update; //@description The list of saved animations was updated @animation_ids The new list of file identifiers of saved animations updateSavedAnimations animation_ids:vector = Update; -//@description The list of saved notifications sounds was updated. This update may not be sent until information about a notification sound was requested for the first time @notification_sound_ids The new list of identifiers of saved notification sounds +//@description The list of saved notification sounds was updated. This update may not be sent until information about a notification sound was requested for the first time @notification_sound_ids The new list of identifiers of saved notification sounds updateSavedNotificationSounds notification_sound_ids:vector = Update; //@description The selected background has changed @for_dark_theme True, if background for dark theme has changed @background The new selected background; may be null @@ -6349,6 +6460,11 @@ updateChatThemes chat_themes:vector = Update; //@available_accent_color_ids The list of accent color identifiers, which can be set through setAccentColor and setChatAccentColor. The colors must be shown in the specififed order updateAccentColors colors:vector available_accent_color_ids:vector = Update; +//@description The list of supported accent colors for user profiles has changed +//@colors Information about supported colors +//@available_accent_color_ids The list of accent color identifiers, which can be set through setProfileAccentColor. The colors must be shown in the specififed order +updateProfileAccentColors colors:vector available_accent_color_ids:vector = Update; + //@description Some language pack strings have been updated @localization_target Localization target to which the language pack belongs @language_pack_id Identifier of the updated language pack @strings List of changed language pack strings; empty if all strings have changed updateLanguagePackStrings localization_target:string language_pack_id:string strings:vector = Update; @@ -6376,6 +6492,13 @@ updateActiveEmojiReactions emojis:vector = Update; //@description The type of default reaction has changed @reaction_type The new type of the default reaction updateDefaultReactionType reaction_type:ReactionType = Update; +//@description The parameters of speech recognition without Telegram Premium subscription has changed +//@max_media_duration The maximum allowed duration of media for speech recognition without Telegram Premium subscription +//@weekly_count The total number of allowed speech recognitions per week; 0 if none +//@left_count Number of left speech recognition attempts this week +//@next_reset_date Point in time (Unix timestamp) when the weekly number of tries will reset; 0 if unknown +updateSpeechRecognitionTrial max_media_duration:int32 weekly_count:int32 left_count:int32 next_reset_date:int32 = Update; + //@description The list of supported dice emojis has changed @emojis The new list of supported dice emojis updateDiceEmojis emojis:vector = Update; @@ -6466,7 +6589,7 @@ updatePollAnswer poll_id:int64 voter_id:MessageSender option_ids:vector = //@description User rights changed in a chat; for bots only //@chat_id Chat identifier //@actor_user_id Identifier of the user, changing the rights -//@date Point in time (Unix timestamp) when the user rights was changed +//@date Point in time (Unix timestamp) when the user rights were changed //@invite_link If user has joined the chat using an invite link, the invite link; may be null //@via_chat_folder_invite_link True, if the user has joined the chat using an invite link for a chat folder //@old_chat_member Previous chat member @@ -6729,8 +6852,9 @@ getMessage chat_id:int53 message_id:int53 = Message; //@description Returns information about a message, if it is available without sending network request. This is an offline request @chat_id Identifier of the chat the message belongs to @message_id Identifier of the message to get getMessageLocally chat_id:int53 message_id:int53 = Message; -//@description Returns information about a message that is replied by a given message. Also, returns the pinned message, the game message, the invoice message, and the topic creation message for messages -//-of the types messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground and topic messages without replied message respectively +//@description Returns information about a non-bundled message that is replied by a given message. Also, returns the pinned message, the game message, the invoice message, +//-the message with a previously set same background, and the topic creation message for messages of the types +//-messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground and topic messages without non-bundled replied message respectively //@chat_id Identifier of the chat the message belongs to //@message_id Identifier of the reply message getRepliedMessage chat_id:int53 message_id:int53 = Message; @@ -6792,6 +6916,14 @@ searchChatsOnServer query:string limit:int32 = Chats; //@location Current user location searchChatsNearby location:location = ChatsNearby; +//@description Returns a list of chats similar to the given chat @chat_id Identifier of the target chat; must be an identifier of a channel chat +getChatSimilarChats chat_id:int53 = Chats; + +//@description Returns approximate number of chats similar to the given chat +//@chat_id Identifier of the target chat; must be an identifier of a channel chat +//@return_local Pass true to get the number of chats without sending network requests, or -1 if the number of chats is unknown locally +getChatSimilarChatCount chat_id:int53 return_local:Bool = Count; + //@description Returns a list of frequently used chats @category Category of chats to be returned @limit The maximum number of chats to be returned; up to 30 getTopChats category:TopChatCategory limit:int32 = Chats; @@ -7009,7 +7141,7 @@ translateText text:formattedText to_language_code:string = FormattedText; //-"st", "sn", "sd", "si", "sk", "sl", "so", "es", "su", "sw", "sv", "tl", "tg", "ta", "tt", "te", "th", "tr", "tk", "uk", "ur", "ug", "uz", "vi", "cy", "xh", "yi", "ji", "yo", "zu" translateMessageText chat_id:int53 message_id:int53 to_language_code:string = FormattedText; -//@description Recognizes speech in a video note or a voice note message. The message must be successfully sent and must not be scheduled. May return an error with a message "MSG_VOICE_TOO_LONG" if media duration is too big to be recognized +//@description Recognizes speech in a video note or a voice note message. The message must be successfully sent, must not be scheduled, and must be from a non-secret chat //@chat_id Identifier of the chat to which the message belongs //@message_id Identifier of the message recognizeSpeech chat_id:int53 message_id:int53 = Ok; @@ -7072,7 +7204,7 @@ forwardMessages chat_id:int53 message_thread_id:int53 from_chat_id:int53 message //@chat_id Identifier of the chat to send messages //@message_ids Identifiers of the messages to resend. Message identifiers must be in a strictly increasing order //@quote New manually chosen quote from the message to be replied; pass null if none. Ignored if more than one message is re-sent, or if messageSendingStateFailed.need_another_reply_quote == false -resendMessages chat_id:int53 message_ids:vector quote:formattedText = Messages; +resendMessages chat_id:int53 message_ids:vector quote:inputTextQuote = Messages; //@description Sends a notification about a screenshot taken in a chat. Supported only in private and secret chats @chat_id Chat identifier sendChatScreenshotTakenNotification chat_id:int53 = Ok; @@ -7696,12 +7828,19 @@ setChatMessageAutoDeleteTime chat_id:int53 message_auto_delete_time:int32 = Ok; //@permissions New non-administrator members permissions in the chat setChatPermissions chat_id:int53 permissions:chatPermissions = Ok; -//@description Changes the background in a specific chat. Supported only in private and secret chats with non-deleted users +//@description Sets the background in a specific chat. Supported only in private and secret chats with non-deleted users //@chat_id Chat identifier -//@background The input background to use; pass null to create a new filled background or to remove the current background -//@type Background type; pass null to remove the current background +//@background The input background to use; pass null to create a new filled background +//@type Background type; pass null to use default background type for the chosen background //@dark_theme_dimming Dimming of the background in dark themes, as a percentage; 0-100 -setChatBackground chat_id:int53 background:InputBackground type:BackgroundType dark_theme_dimming:int32 = Ok; +//@only_for_self Pass true to set background only for self; pass false to set background for both chat users. Background can be set for both users only by Telegram Premium users and if set background isn't of the type inputBackgroundPrevious +setChatBackground chat_id:int53 background:InputBackground type:BackgroundType dark_theme_dimming:int32 only_for_self:Bool = Ok; + +//@description Deletes background in a specific chat +//@chat_id Chat identifier +//@restore_previous Pass true to restore previously set background. Can be used only in private and secret chats with non-deleted users if userFullInfo.set_chat_background == true. +//-Supposed to be used from messageChatSetBackground messages with the currently set background that was set for both sides by the other user +deleteChatBackground chat_id:int53 restore_previous:Bool = Ok; //@description Changes the chat theme. Supported only in private and secret chats @chat_id Chat identifier @theme_name Name of the new chat theme; pass an empty string to return the default theme setChatTheme chat_id:int53 theme_name:string = Ok; @@ -7719,7 +7858,10 @@ setChatNotificationSettings chat_id:int53 notification_settings:chatNotification //@has_protected_content New value of has_protected_content toggleChatHasProtectedContent chat_id:int53 has_protected_content:Bool = Ok; -//@description Changes the translatable state of a chat; for Telegram Premium users only @chat_id Chat identifier @is_translatable New value of is_translatable +//@description Changes the view_as_topics setting of a forum chat @chat_id Chat identifier @view_as_topics New value of view_as_topics +toggleChatViewAsTopics chat_id:int53 view_as_topics:Bool = Ok; + +//@description Changes the translatable state of a chat @chat_id Chat identifier @is_translatable New value of is_translatable toggleChatIsTranslatable chat_id:int53 is_translatable:Bool = Ok; //@description Changes the marked as unread state of a chat @chat_id Chat identifier @is_marked_as_unread New value of is_marked_as_unread @@ -7728,7 +7870,9 @@ toggleChatIsMarkedAsUnread chat_id:int53 is_marked_as_unread:Bool = Ok; //@description Changes the value of the default disable_notification parameter, used when a message is sent to a chat @chat_id Chat identifier @default_disable_notification New value of default_disable_notification toggleChatDefaultDisableNotification chat_id:int53 default_disable_notification:Bool = Ok; -//@description Changes reactions, available in a chat. Available for basic groups, supergroups, and channels. Requires can_change_info administrator right @chat_id Identifier of the chat @available_reactions Reactions available in the chat. All emoji reactions must be active +//@description Changes reactions, available in a chat. Available for basic groups, supergroups, and channels. Requires can_change_info administrator right +//@chat_id Identifier of the chat +//@available_reactions Reactions available in the chat. All explicitly specified emoji reactions must be active. Up to the chat's boost level custom emoji reactions can be explicitly specified setChatAvailableReactions chat_id:int53 available_reactions:ChatAvailableReactions = Ok; //@description Changes application-specific data associated with a chat @chat_id Chat identifier @client_data New value of client_data @@ -7885,9 +8029,10 @@ canSendStory chat_id:int53 = CanSendStoryResult; //@caption Story caption; pass null to use an empty caption; 0-getOption("story_caption_length_max") characters //@privacy_settings The privacy settings for the story //@active_period Period after which the story is moved to archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400 for Telegram Premium users, and 86400 otherwise +//@from_story_full_id Full identifier of the original story, which content was used to create the story //@is_pinned Pass true to keep the story accessible after expiration //@protect_content Pass true if the content of the story must be protected from forwarding and screenshotting -sendStory chat_id:int53 content:InputStoryContent areas:inputStoryAreas caption:formattedText privacy_settings:StoryPrivacySettings active_period:int32 is_pinned:Bool protect_content:Bool = Story; +sendStory chat_id:int53 content:InputStoryContent areas:inputStoryAreas caption:formattedText privacy_settings:StoryPrivacySettings active_period:int32 from_story_full_id:storyFullId is_pinned:Bool protect_content:Bool = Story; //@description Changes content and caption of a story. Can be called only if story.can_be_edited == true //@story_sender_chat_id Identifier of the chat that posted the story @@ -7984,6 +8129,14 @@ reportStory story_sender_chat_id:int53 story_id:int32 reason:ReportReason text:s //-and for the next "story_stealth_mode_future_period" seconds; for Telegram Premium users only activateStoryStealthMode = Ok; +//@description Returns forwards of a story as a message to public chats and reposts by public channels. Can be used only if the story is posted on behalf of the current user or story.can_get_statistics == true. +//-For optimal performance, the number of returned messages and stories is chosen by TDLib +//@story_sender_chat_id The identifier of the sender of the story +//@story_id The identifier of the story +//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results +//@limit The maximum number of messages and stories to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned objects is chosen by TDLib and can be smaller than the specified limit +getStoryPublicForwards story_sender_chat_id:int53 story_id:int32 offset:string limit:int32 = StoryPublicForwards; + //@description Returns the list of available chat boost slots for the current user getAvailableChatBoostSlots = ChatBoostSlots; @@ -8054,7 +8207,7 @@ cancelDownloadFile file_id:int32 only_if_pending:Bool = Ok; getSuggestedFileName file_id:int32 directory:string = Text; //@description Preliminary uploads a file to the cloud before sending it in a message, which can be useful for uploading of being recorded voice and video notes. Updates updateFile will be used -//-to notify about upload progress and successful completion of the upload. The file will not have a persistent remote identifier until it will be sent in a message +//-to notify about upload progress and successful completion of the upload. The file will not have a persistent remote identifier until it is sent in a message //@file File to upload //@file_type File type; pass null if unknown //@priority Priority of the upload (1-32). The higher the priority, the earlier the file will be uploaded. If the priorities of two files are equal, then the first one for which preliminaryUploadFile was called will be uploaded first @@ -8275,7 +8428,7 @@ getGroupCall group_call_id:int32 = GroupCall; //@description Starts a scheduled group call @group_call_id Group call identifier startScheduledGroupCall group_call_id:int32 = Ok; -//@description Toggles whether the current user will receive a notification when the group call will start; scheduled group calls only +//@description Toggles whether the current user will receive a notification when the group call starts; scheduled group calls only //@group_call_id Group call identifier //@enabled_start_notification New value of the enabled_start_notification setting toggleGroupCallEnabledStartNotification group_call_id:int32 enabled_start_notification:Bool = Ok; @@ -8507,8 +8660,10 @@ searchStickerSet name:string = StickerSet; //@description Searches for installed sticker sets by looking for specified query in their title and name @sticker_type Type of the sticker sets to search for @query Query to search for @limit The maximum number of sticker sets to return searchInstalledStickerSets sticker_type:StickerType query:string limit:int32 = StickerSets; -//@description Searches for ordinary sticker sets by looking for specified query in their title and name. Excludes installed sticker sets from the results @query Query to search for -searchStickerSets query:string = StickerSets; +//@description Searches for sticker sets by looking for specified query in their title and name. Excludes installed sticker sets from the results +//@sticker_type Type of the sticker sets to return +//@query Query to search for +searchStickerSets sticker_type:StickerType query:string = StickerSets; //@description Installs/uninstalls or activates/archives a sticker set @set_id Identifier of the sticker set @is_installed The new value of is_installed @is_archived The new value of is_archived. A sticker set can't be installed and archived simultaneously changeStickerSet set_id:int64 is_installed:Bool is_archived:Bool = Ok; @@ -8620,6 +8775,11 @@ deleteProfilePhoto profile_photo_id:int64 = Ok; //@background_custom_emoji_id Identifier of a custom emoji to be shown on the reply header background; 0 if none setAccentColor accent_color_id:int32 background_custom_emoji_id:int64 = Ok; +//@description Changes accent color and background custom emoji for profile of the current user; for Telegram Premium users only +//@profile_accent_color_id Identifier of the accent color to use for profile; pass -1 if none +//@profile_background_custom_emoji_id Identifier of a custom emoji to be shown in the on the user's profile photo background; 0 if none +setProfileAccentColor profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 = Ok; + //@description Changes the first and last name of the current user @first_name The new value of the first name for the current user; 1-64 characters @last_name The new value of the optional last name for the current user; 0-64 characters setName first_name:string last_name:string = Ok; @@ -9052,6 +9212,9 @@ getMessageStatistics chat_id:int53 message_id:int53 is_dark:Bool = MessageStatis //@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit getMessagePublicForwards chat_id:int53 message_id:int53 offset:string limit:int32 = FoundMessages; +//@description Returns detailed statistics about a story. Can be used only if story.can_get_statistics == true @chat_id Chat identifier @story_id Story identifier @is_dark Pass true if a dark theme is used by the application +getStoryStatistics chat_id:int53 story_id:int32 is_dark:Bool = StoryStatistics; + //@description Loads an asynchronous or a zoomed in statistical graph @chat_id Chat identifier @token The token for graph loading @x X-value for zoomed in graph or 0 otherwise getStatisticalGraph chat_id:int53 token:string x:int53 = StatisticalGraph; From e30af65ec7f5eed23c79f4694cb11ff2964304ae Mon Sep 17 00:00:00 2001 From: c0re100 Date: Sat, 30 Dec 2023 05:43:03 +0800 Subject: [PATCH 11/54] Update to TDLib 1.8.23 --- client/function.go | 502 ++++++++++++++---- client/type.go | 1117 +++++++++++++++++++++++++++++++---------- client/unmarshaler.go | 404 +++++++++++---- data/td_api.tl | 429 +++++++++++----- 4 files changed, 1865 insertions(+), 587 deletions(-) diff --git a/client/function.go b/client/function.go index 4b0f21c..f43e753 100755 --- a/client/function.go +++ b/client/function.go @@ -1313,7 +1313,7 @@ type GetRepliedMessageRequest struct { MessageId int64 `json:"message_id"` } -// Returns information about a non-bundled message that is replied by a given message. Also, returns the pinned message, the game message, the invoice message, the message with a previously set same background, and the topic creation message for messages of the types messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground and topic messages without non-bundled replied message respectively +// Returns information about a non-bundled message that is replied by a given message. Also, returns the pinned message, the game message, the invoice message, the message with a previously set same background, the giveaway message, and the topic creation message for messages of the types messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground, messagePremiumGiveawayCompleted and topic messages without non-bundled replied message respectively func (client *Client) GetRepliedMessage(req *GetRepliedMessageRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -1784,6 +1784,35 @@ func (client *Client) GetChatSimilarChatCount(req *GetChatSimilarChatCountReques return UnmarshalCount(result.Data) } +type OpenChatSimilarChatRequest struct { + // Identifier of the original chat, which similar chats were requested + ChatId int64 `json:"chat_id"` + // Identifier of the opened chat + OpenedChatId int64 `json:"opened_chat_id"` +} + +// Informs TDLib that a chat was opened from the list of similar chats. The method is independent from openChat and closeChat methods +func (client *Client) OpenChatSimilarChat(req *OpenChatSimilarChatRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "openChatSimilarChat", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "opened_chat_id": req.OpenedChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type GetTopChatsRequest struct { // Category of chats to be returned Category TopChatCategory `json:"category"` @@ -4414,6 +4443,41 @@ func (client *Client) RemoveMessageReaction(req *RemoveMessageReactionRequest) ( return UnmarshalOk(result.Data) } +type SetMessageReactionsRequest struct { + // Identifier of the chat to which the message belongs + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` + // Types of the reaction to set + ReactionTypes []ReactionType `json:"reaction_types"` + // Pass true if the reactions are added with a big animation + IsBig bool `json:"is_big"` +} + +// Sets reactions on a message; for bots only +func (client *Client) SetMessageReactions(req *SetMessageReactionsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setMessageReactions", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "reaction_types": req.ReactionTypes, + "is_big": req.IsBig, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type GetMessageAddedReactionsRequest struct { // Identifier of the chat to which the message belongs ChatId int64 `json:"chat_id"` @@ -5105,30 +5169,30 @@ func (client *Client) GetLoginUrl(req *GetLoginUrlRequest) (*HttpUrl, error) { return UnmarshalHttpUrl(result.Data) } -type ShareUserWithBotRequest struct { +type ShareUsersWithBotRequest struct { // Identifier of the chat with the bot ChatId int64 `json:"chat_id"` // Identifier of the message with the button MessageId int64 `json:"message_id"` // Identifier of the button ButtonId int32 `json:"button_id"` - // Identifier of the shared user - SharedUserId int64 `json:"shared_user_id"` - // Pass true to check that the user can be shared by the button instead of actually sharing them + // Identifiers of the shared users + SharedUserIds []int64 `json:"shared_user_ids"` + // Pass true to check that the users can be shared by the button instead of actually sharing them OnlyCheck bool `json:"only_check"` } -// Shares a user after pressing a keyboardButtonTypeRequestUser button with the bot -func (client *Client) ShareUserWithBot(req *ShareUserWithBotRequest) (*Ok, error) { +// Shares users after pressing a keyboardButtonTypeRequestUsers button with the bot +func (client *Client) ShareUsersWithBot(req *ShareUsersWithBotRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "shareUserWithBot", + Type: "shareUsersWithBot", }, Data: map[string]interface{}{ "chat_id": req.ChatId, "message_id": req.MessageId, "button_id": req.ButtonId, - "shared_user_id": req.SharedUserId, + "shared_user_ids": req.SharedUserIds, "only_check": req.OnlyCheck, }, }) @@ -6101,6 +6165,9 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypePremiumFeatures: return UnmarshalInternalLinkTypePremiumFeatures(result.Data) + case TypeInternalLinkTypePremiumGift: + return UnmarshalInternalLinkTypePremiumGift(result.Data) + case TypeInternalLinkTypePremiumGiftCode: return UnmarshalInternalLinkTypePremiumGiftCode(result.Data) @@ -7235,13 +7302,13 @@ func (client *Client) SetChatPhoto(req *SetChatPhotoRequest) (*Ok, error) { type SetChatAccentColorRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` - // Identifier of the accent color to use + // Identifier of the accent color to use. The chat must have at least accentColor.min_chat_boost_level boost level to pass the corresponding color AccentColorId int32 `json:"accent_color_id"` - // Identifier of a custom emoji to be shown on the reply header background; 0 if none + // Identifier of a custom emoji to be shown on the reply header and link preview background; 0 if none. Use chatBoostLevelFeatures.can_set_background_custom_emoji to check whether a custom emoji can be set BackgroundCustomEmojiId JsonInt64 `json:"background_custom_emoji_id"` } -// Changes accent color and background custom emoji of a chat. Supported only for channels with getOption("channel_custom_accent_color_boost_level_min") boost level. Requires can_change_info administrator right +// Changes accent color and background custom emoji of a chat. Requires can_change_info administrator right func (client *Client) SetChatAccentColor(req *SetChatAccentColorRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -7264,6 +7331,38 @@ func (client *Client) SetChatAccentColor(req *SetChatAccentColorRequest) (*Ok, e return UnmarshalOk(result.Data) } +type SetChatProfileAccentColorRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Identifier of the accent color to use for profile; pass -1 if none. The chat must have at least profileAccentColor.min_chat_boost_level boost level to pass the corresponding color + ProfileAccentColorId int32 `json:"profile_accent_color_id"` + // Identifier of a custom emoji to be shown on the chat's profile photo background; 0 if none. Use chatBoostLevelFeatures.can_set_profile_background_custom_emoji to check whether a custom emoji can be set + ProfileBackgroundCustomEmojiId JsonInt64 `json:"profile_background_custom_emoji_id"` +} + +// Changes accent color and background custom emoji for profile of a chat. Requires can_change_info administrator right +func (client *Client) SetChatProfileAccentColor(req *SetChatProfileAccentColorRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setChatProfileAccentColor", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "profile_accent_color_id": req.ProfileAccentColorId, + "profile_background_custom_emoji_id": req.ProfileBackgroundCustomEmojiId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type SetChatMessageAutoDeleteTimeRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -7293,6 +7392,35 @@ func (client *Client) SetChatMessageAutoDeleteTime(req *SetChatMessageAutoDelete return UnmarshalOk(result.Data) } +type SetChatEmojiStatusRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // New emoji status; pass null to remove emoji status + EmojiStatus *EmojiStatus `json:"emoji_status"` +} + +// Changes the emoji status of a chat. Use chatBoostLevelFeatures.can_set_emoji_status to check whether an emoji status can be set. Requires can_change_info administrator right +func (client *Client) SetChatEmojiStatus(req *SetChatEmojiStatusRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setChatEmojiStatus", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "emoji_status": req.EmojiStatus, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type SetChatPermissionsRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -7325,17 +7453,17 @@ func (client *Client) SetChatPermissions(req *SetChatPermissionsRequest) (*Ok, e type SetChatBackgroundRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` - // The input background to use; pass null to create a new filled background + // The input background to use; pass null to create a new filled or chat theme background Background InputBackground `json:"background"` - // Background type; pass null to use default background type for the chosen background + // Background type; pass null to use default background type for the chosen background; backgroundTypeChatTheme isn't supported for private and secret chats. Use chatBoostLevelFeatures.chat_theme_background_count and chatBoostLevelFeatures.can_set_custom_background to check whether the background type can be set in the boosted chat Type BackgroundType `json:"type"` - // Dimming of the background in dark themes, as a percentage; 0-100 + // Dimming of the background in dark themes, as a percentage; 0-100. Applied only to Wallpaper and Fill types of background DarkThemeDimming int32 `json:"dark_theme_dimming"` - // Pass true to set background only for self; pass false to set background for both chat users. Background can be set for both users only by Telegram Premium users and if set background isn't of the type inputBackgroundPrevious + // Pass true to set background only for self; pass false to set background for all chat users. Always false for backgrounds set in boosted chats. Background can be set for both users only by Telegram Premium users and if set background isn't of the type inputBackgroundPrevious OnlyForSelf bool `json:"only_for_self"` } -// Sets the background in a specific chat. Supported only in private and secret chats with non-deleted users +// Sets the background in a specific chat. Supported only in private and secret chats with non-deleted users, and in chats with sufficient boost level and can_change_info administrator right func (client *Client) SetChatBackground(req *SetChatBackgroundRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -9128,31 +9256,34 @@ func (client *Client) SetStoryReaction(req *SetStoryReactionRequest) (*Ok, error return UnmarshalOk(result.Data) } -type GetStoryViewersRequest struct { +type GetStoryInteractionsRequest struct { // Story identifier StoryId int32 `json:"story_id"` - // Query to search for in names and usernames of the viewers; may be empty to get all relevant viewers + // Query to search for in names, usernames and titles; may be empty to get all relevant interactions Query string `json:"query"` - // Pass true to get only contacts; pass false to get all relevant viewers + // Pass true to get only interactions by contacts; pass false to get all relevant interactions OnlyContacts bool `json:"only_contacts"` - // Pass true to get viewers with reaction first; pass false to get viewers sorted just by view_date + // Pass true to get forwards and reposts first, then reactions, then other views; pass false to get interactions sorted just by interaction date + PreferForwards bool `json:"prefer_forwards"` + // Pass true to get interactions with reaction first; pass false to get interactions sorted just by interaction date. Ignored if prefer_forwards == true PreferWithReaction bool `json:"prefer_with_reaction"` // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results Offset string `json:"offset"` - // The maximum number of story viewers to return + // The maximum number of story interactions to return Limit int32 `json:"limit"` } -// Returns viewers of a story. The method can be called only for stories posted on behalf of the current user -func (client *Client) GetStoryViewers(req *GetStoryViewersRequest) (*StoryViewers, error) { +// Returns interactions with a story. The method can be called only for stories posted on behalf of the current user +func (client *Client) GetStoryInteractions(req *GetStoryInteractionsRequest) (*StoryInteractions, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getStoryViewers", + Type: "getStoryInteractions", }, Data: map[string]interface{}{ "story_id": req.StoryId, "query": req.Query, "only_contacts": req.OnlyContacts, + "prefer_forwards": req.PreferForwards, "prefer_with_reaction": req.PreferWithReaction, "offset": req.Offset, "limit": req.Limit, @@ -9166,7 +9297,48 @@ func (client *Client) GetStoryViewers(req *GetStoryViewersRequest) (*StoryViewer return nil, buildResponseError(result.Data) } - return UnmarshalStoryViewers(result.Data) + return UnmarshalStoryInteractions(result.Data) +} + +type GetChatStoryInteractionsRequest struct { + // The identifier of the sender of the story + StorySenderChatId int64 `json:"story_sender_chat_id"` + // Story identifier + StoryId int32 `json:"story_id"` + // Pass the default heart reaction or a suggested reaction type to receive only interactions with the specified reaction type; pass null to receive all interactions + ReactionType ReactionType `json:"reaction_type"` + // Pass true to get forwards and reposts first, then reactions, then other views; pass false to get interactions sorted just by interaction date + PreferForwards bool `json:"prefer_forwards"` + // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results + Offset string `json:"offset"` + // The maximum number of story interactions to return + Limit int32 `json:"limit"` +} + +// Returns interactions with a story posted in a chat. Can be used only if story is posted on behalf of a chat and the user is an administrator in the chat +func (client *Client) GetChatStoryInteractions(req *GetChatStoryInteractionsRequest) (*StoryInteractions, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatStoryInteractions", + }, + Data: map[string]interface{}{ + "story_sender_chat_id": req.StorySenderChatId, + "story_id": req.StoryId, + "reaction_type": req.ReactionType, + "prefer_forwards": req.PreferForwards, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStoryInteractions(result.Data) } type ReportStoryRequest struct { @@ -9235,7 +9407,7 @@ type GetStoryPublicForwardsRequest struct { } // Returns forwards of a story as a message to public chats and reposts by public channels. Can be used only if the story is posted on behalf of the current user or story.can_get_statistics == true. For optimal performance, the number of returned messages and stories is chosen by TDLib -func (client *Client) GetStoryPublicForwards(req *GetStoryPublicForwardsRequest) (*StoryPublicForwards, error) { +func (client *Client) GetStoryPublicForwards(req *GetStoryPublicForwardsRequest) (*PublicForwards, error) { result, err := client.Send(Request{ meta: meta{ Type: "getStoryPublicForwards", @@ -9255,7 +9427,52 @@ func (client *Client) GetStoryPublicForwards(req *GetStoryPublicForwardsRequest) return nil, buildResponseError(result.Data) } - return UnmarshalStoryPublicForwards(result.Data) + return UnmarshalPublicForwards(result.Data) +} + +type GetChatBoostLevelFeaturesRequest struct { + // Chat boost level + Level int32 `json:"level"` +} + +// Returns list of features available on the specific chat boost level; this is an offline request +func (client *Client) GetChatBoostLevelFeatures(req *GetChatBoostLevelFeaturesRequest) (*ChatBoostLevelFeatures, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatBoostLevelFeatures", + }, + Data: map[string]interface{}{ + "level": req.Level, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatBoostLevelFeatures(result.Data) +} + +// Returns list of features available on the first 10 chat boost levels; this is an offline request +func (client *Client) GetChatBoostFeatures() (*ChatBoostFeatures, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatBoostFeatures", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatBoostFeatures(result.Data) } // Returns the list of available chat boost slots for the current user @@ -9506,7 +9723,7 @@ func (client *Client) ToggleBotIsAddedToAttachmentMenu(req *ToggleBotIsAddedToAt return UnmarshalOk(result.Data) } -// Returns up to 8 emoji statuses, which must be shown right after the default Premium Badge in the emoji status list +// Returns up to 8 emoji statuses, which must be shown right after the default Premium Badge in the emoji status list for self status func (client *Client) GetThemedEmojiStatuses() (*EmojiStatuses, error) { result, err := client.Send(Request{ meta: meta{ @@ -9525,7 +9742,7 @@ func (client *Client) GetThemedEmojiStatuses() (*EmojiStatuses, error) { return UnmarshalEmojiStatuses(result.Data) } -// Returns recent emoji statuses +// Returns recent emoji statuses for self status func (client *Client) GetRecentEmojiStatuses() (*EmojiStatuses, error) { result, err := client.Send(Request{ meta: meta{ @@ -9544,7 +9761,7 @@ func (client *Client) GetRecentEmojiStatuses() (*EmojiStatuses, error) { return UnmarshalEmojiStatuses(result.Data) } -// Returns default emoji statuses +// Returns default emoji statuses for self status func (client *Client) GetDefaultEmojiStatuses() (*EmojiStatuses, error) { result, err := client.Send(Request{ meta: meta{ @@ -9563,7 +9780,7 @@ func (client *Client) GetDefaultEmojiStatuses() (*EmojiStatuses, error) { return UnmarshalEmojiStatuses(result.Data) } -// Clears the list of recently used emoji statuses +// Clears the list of recently used emoji statuses for self status func (client *Client) ClearRecentEmojiStatuses() (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -9582,6 +9799,63 @@ func (client *Client) ClearRecentEmojiStatuses() (*Ok, error) { return UnmarshalOk(result.Data) } +// Returns up to 8 emoji statuses, which must be shown in the emoji status list for chats +func (client *Client) GetThemedChatEmojiStatuses() (*EmojiStatuses, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getThemedChatEmojiStatuses", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalEmojiStatuses(result.Data) +} + +// Returns default emoji statuses for chats +func (client *Client) GetDefaultChatEmojiStatuses() (*EmojiStatuses, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getDefaultChatEmojiStatuses", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalEmojiStatuses(result.Data) +} + +// Returns the list of emoji statuses, which can't be used as chat emoji status, even they are from a sticker set with is_allowed_as_chat_emoji_status == true +func (client *Client) GetDisallowedChatEmojiStatuses() (*EmojiStatuses, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getDisallowedChatEmojiStatuses", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalEmojiStatuses(result.Data) +} + type DownloadFileRequest struct { // Identifier of the file to download FileId int32 `json:"file_id"` @@ -13368,7 +13642,7 @@ func (client *Client) DeleteProfilePhoto(req *DeleteProfilePhotoRequest) (*Ok, e type SetAccentColorRequest struct { // Identifier of the accent color to use AccentColorId int32 `json:"accent_color_id"` - // Identifier of a custom emoji to be shown on the reply header background; 0 if none + // Identifier of a custom emoji to be shown on the reply header and link preview background; 0 if none BackgroundCustomEmojiId JsonInt64 `json:"background_custom_emoji_id"` } @@ -13397,7 +13671,7 @@ func (client *Client) SetAccentColor(req *SetAccentColorRequest) (*Ok, error) { type SetProfileAccentColorRequest struct { // Identifier of the accent color to use for profile; pass -1 if none ProfileAccentColorId int32 `json:"profile_accent_color_id"` - // Identifier of a custom emoji to be shown in the on the user's profile photo background; 0 if none + // Identifier of a custom emoji to be shown on the user's profile photo background; 0 if none ProfileBackgroundCustomEmojiId JsonInt64 `json:"profile_background_custom_emoji_id"` } @@ -15289,36 +15563,10 @@ func (client *Client) GetSupportUser() (*User, error) { return UnmarshalUser(result.Data) } -type GetBackgroundsRequest struct { - // Pass true to order returned backgrounds for a dark theme - ForDarkTheme bool `json:"for_dark_theme"` -} - -// Returns backgrounds installed by the user -func (client *Client) GetBackgrounds(req *GetBackgroundsRequest) (*Backgrounds, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "getBackgrounds", - }, - Data: map[string]interface{}{ - "for_dark_theme": req.ForDarkTheme, - }, - }) - if err != nil { - return nil, err - } - - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } - - return UnmarshalBackgrounds(result.Data) -} - type GetBackgroundUrlRequest struct { // Background name Name string `json:"name"` - // Background type + // Background type; backgroundTypeChatTheme isn't supported Type BackgroundType `json:"type"` } @@ -15370,20 +15618,20 @@ func (client *Client) SearchBackground(req *SearchBackgroundRequest) (*Backgroun return UnmarshalBackground(result.Data) } -type SetBackgroundRequest struct { - // The input background to use; pass null to create a new filled background or to remove the current background +type SetDefaultBackgroundRequest struct { + // The input background to use; pass null to create a new filled background Background InputBackground `json:"background"` - // Background type; pass null to use the default type of the remote background or to remove the current background + // Background type; pass null to use the default type of the remote background; backgroundTypeChatTheme isn't supported Type BackgroundType `json:"type"` - // Pass true if the background is changed for a dark theme + // Pass true if the background is set for a dark theme ForDarkTheme bool `json:"for_dark_theme"` } -// Changes the background selected by the user; adds background to the list of installed backgrounds -func (client *Client) SetBackground(req *SetBackgroundRequest) (*Background, error) { +// Sets default background for chats; adds the background to the list of installed backgrounds +func (client *Client) SetDefaultBackground(req *SetDefaultBackgroundRequest) (*Background, error) { result, err := client.Send(Request{ meta: meta{ - Type: "setBackground", + Type: "setDefaultBackground", }, Data: map[string]interface{}{ "background": req.Background, @@ -15402,16 +15650,68 @@ func (client *Client) SetBackground(req *SetBackgroundRequest) (*Background, err return UnmarshalBackground(result.Data) } -type RemoveBackgroundRequest struct { +type DeleteDefaultBackgroundRequest struct { + // Pass true if the background is deleted for a dark theme + ForDarkTheme bool `json:"for_dark_theme"` +} + +// Deletes default background for chats +func (client *Client) DeleteDefaultBackground(req *DeleteDefaultBackgroundRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteDefaultBackground", + }, + Data: map[string]interface{}{ + "for_dark_theme": req.ForDarkTheme, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetInstalledBackgroundsRequest struct { + // Pass true to order returned backgrounds for a dark theme + ForDarkTheme bool `json:"for_dark_theme"` +} + +// Returns backgrounds installed by the user +func (client *Client) GetInstalledBackgrounds(req *GetInstalledBackgroundsRequest) (*Backgrounds, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getInstalledBackgrounds", + }, + Data: map[string]interface{}{ + "for_dark_theme": req.ForDarkTheme, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBackgrounds(result.Data) +} + +type RemoveInstalledBackgroundRequest struct { // The background identifier BackgroundId JsonInt64 `json:"background_id"` } // Removes background from the list of installed backgrounds -func (client *Client) RemoveBackground(req *RemoveBackgroundRequest) (*Ok, error) { +func (client *Client) RemoveInstalledBackground(req *RemoveInstalledBackgroundRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "removeBackground", + Type: "removeInstalledBackground", }, Data: map[string]interface{}{ "background_id": req.BackgroundId, @@ -15429,10 +15729,10 @@ func (client *Client) RemoveBackground(req *RemoveBackgroundRequest) (*Ok, error } // Resets list of installed backgrounds to its default value -func (client *Client) ResetBackgrounds() (*Ok, error) { +func (client *Client) ResetInstalledBackgrounds() (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "resetBackgrounds", + Type: "resetInstalledBackgrounds", }, Data: map[string]interface{}{}, }) @@ -16256,12 +16556,12 @@ type GetMessagePublicForwardsRequest struct { MessageId int64 `json:"message_id"` // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results Offset string `json:"offset"` - // The maximum number of messages to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit + // The maximum number of messages and stories to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned objects is chosen by TDLib and can be smaller than the specified limit Limit int32 `json:"limit"` } -// Returns forwarded copies of a channel message to different public channels. Can be used only if message.can_get_statistics == true. For optimal performance, the number of returned messages is chosen by TDLib -func (client *Client) GetMessagePublicForwards(req *GetMessagePublicForwardsRequest) (*FoundMessages, error) { +// Returns forwarded copies of a channel message to different public channels and public reposts as a story. Can be used only if message.can_get_statistics == true. For optimal performance, the number of returned messages and stories is chosen by TDLib +func (client *Client) GetMessagePublicForwards(req *GetMessagePublicForwardsRequest) (*PublicForwards, error) { result, err := client.Send(Request{ meta: meta{ Type: "getMessagePublicForwards", @@ -16281,7 +16581,7 @@ func (client *Client) GetMessagePublicForwards(req *GetMessagePublicForwardsRequ return nil, buildResponseError(result.Data) } - return UnmarshalFoundMessages(result.Data) + return UnmarshalPublicForwards(result.Data) } type GetStoryStatisticsRequest struct { @@ -18024,7 +18324,7 @@ func (client *Client) LaunchPrepaidPremiumGiveaway(req *LaunchPrepaidPremiumGive type GetPremiumGiveawayInfoRequest struct { // Identifier of the channel chat which started the giveaway ChatId int64 `json:"chat_id"` - // Identifier of the giveaway message in the chat + // Identifier of the giveaway or a giveaway winners message in the chat MessageId int64 `json:"message_id"` } @@ -18463,32 +18763,6 @@ func (client *Client) GetApplicationConfig() (JsonValue, error) { } } -type AddApplicationChangelogRequest struct { - // The previous application version - PreviousApplicationVersion string `json:"previous_application_version"` -} - -// Adds server-provided application changelog as messages to the chat 777000 (Telegram) or as a stories; for official applications only. Returns a 404 error if nothing changed -func (client *Client) AddApplicationChangelog(req *AddApplicationChangelogRequest) (*Ok, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "addApplicationChangelog", - }, - Data: map[string]interface{}{ - "previous_application_version": req.PreviousApplicationVersion, - }, - }) - if err != nil { - return nil, err - } - - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } - - return UnmarshalOk(result.Data) -} - type SaveApplicationLogEventRequest struct { // Event type Type string `json:"type"` @@ -19416,11 +19690,8 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateChatPhoto: return UnmarshalUpdateChatPhoto(result.Data) - case TypeUpdateChatAccentColor: - return UnmarshalUpdateChatAccentColor(result.Data) - - case TypeUpdateChatBackgroundCustomEmoji: - return UnmarshalUpdateChatBackgroundCustomEmoji(result.Data) + case TypeUpdateChatAccentColors: + return UnmarshalUpdateChatAccentColors(result.Data) case TypeUpdateChatPermissions: return UnmarshalUpdateChatPermissions(result.Data) @@ -19446,6 +19717,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateChatDraftMessage: return UnmarshalUpdateChatDraftMessage(result.Data) + case TypeUpdateChatEmojiStatus: + return UnmarshalUpdateChatEmojiStatus(result.Data) + case TypeUpdateChatMessageSender: return UnmarshalUpdateChatMessageSender(result.Data) @@ -19641,8 +19915,8 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateSavedNotificationSounds: return UnmarshalUpdateSavedNotificationSounds(result.Data) - case TypeUpdateSelectedBackground: - return UnmarshalUpdateSelectedBackground(result.Data) + case TypeUpdateDefaultBackground: + return UnmarshalUpdateDefaultBackground(result.Data) case TypeUpdateChatThemes: return UnmarshalUpdateChatThemes(result.Data) @@ -19740,6 +20014,12 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateChatBoost: return UnmarshalUpdateChatBoost(result.Data) + case TypeUpdateMessageReaction: + return UnmarshalUpdateMessageReaction(result.Data) + + case TypeUpdateMessageReactions: + return UnmarshalUpdateMessageReactions(result.Data) + default: return nil, errors.New("invalid type") } diff --git a/client/type.go b/client/type.go index f03324f..13286d6 100755 --- a/client/type.go +++ b/client/type.go @@ -75,7 +75,8 @@ const ( ClassInputStoryContent = "InputStoryContent" ClassStoryList = "StoryList" ClassStoryOrigin = "StoryOrigin" - ClassStoryPublicForward = "StoryPublicForward" + ClassStoryInteractionType = "StoryInteractionType" + ClassPublicForward = "PublicForward" ClassChatBoostSource = "ChatBoostSource" ClassCallDiscardReason = "CallDiscardReason" ClassCallServerType = "CallServerType" @@ -329,8 +330,6 @@ const ( ClassTrendingStickerSets = "TrendingStickerSets" ClassEmojiCategory = "EmojiCategory" ClassEmojiCategories = "EmojiCategories" - ClassStoryViewer = "StoryViewer" - ClassStoryViewers = "StoryViewers" ClassStoryAreaPosition = "StoryAreaPosition" ClassStoryArea = "StoryArea" ClassInputStoryArea = "InputStoryArea" @@ -343,7 +342,11 @@ const ( ClassStoryFullId = "StoryFullId" ClassStoryInfo = "StoryInfo" ClassChatActiveStories = "ChatActiveStories" - ClassStoryPublicForwards = "StoryPublicForwards" + ClassStoryInteraction = "StoryInteraction" + ClassStoryInteractions = "StoryInteractions" + ClassPublicForwards = "PublicForwards" + ClassChatBoostLevelFeatures = "ChatBoostLevelFeatures" + ClassChatBoostFeatures = "ChatBoostFeatures" ClassPrepaidPremiumGiveaway = "PrepaidPremiumGiveaway" ClassChatBoostStatus = "ChatBoostStatus" ClassChatBoost = "ChatBoost" @@ -742,7 +745,7 @@ const ( TypeKeyboardButtonTypeRequestPhoneNumber = "keyboardButtonTypeRequestPhoneNumber" TypeKeyboardButtonTypeRequestLocation = "keyboardButtonTypeRequestLocation" TypeKeyboardButtonTypeRequestPoll = "keyboardButtonTypeRequestPoll" - TypeKeyboardButtonTypeRequestUser = "keyboardButtonTypeRequestUser" + TypeKeyboardButtonTypeRequestUsers = "keyboardButtonTypeRequestUsers" TypeKeyboardButtonTypeRequestChat = "keyboardButtonTypeRequestChat" TypeKeyboardButtonTypeWebApp = "keyboardButtonTypeWebApp" TypeKeyboardButton = "keyboardButton" @@ -988,8 +991,9 @@ const ( TypeMessagePremiumGiveawayCreated = "messagePremiumGiveawayCreated" TypeMessagePremiumGiveaway = "messagePremiumGiveaway" TypeMessagePremiumGiveawayCompleted = "messagePremiumGiveawayCompleted" + TypeMessagePremiumGiveawayWinners = "messagePremiumGiveawayWinners" TypeMessageContactRegistered = "messageContactRegistered" - TypeMessageUserShared = "messageUserShared" + TypeMessageUsersShared = "messageUsersShared" TypeMessageChatShared = "messageChatShared" TypeMessageBotWriteAccessAllowed = "messageBotWriteAccessAllowed" TypeMessageWebAppDataSent = "messageWebAppDataSent" @@ -1093,17 +1097,17 @@ const ( TypeEmojiCategoryTypeDefault = "emojiCategoryTypeDefault" TypeEmojiCategoryTypeEmojiStatus = "emojiCategoryTypeEmojiStatus" TypeEmojiCategoryTypeChatPhoto = "emojiCategoryTypeChatPhoto" - TypeStoryViewer = "storyViewer" - TypeStoryViewers = "storyViewers" TypeStoryAreaPosition = "storyAreaPosition" TypeStoryAreaTypeLocation = "storyAreaTypeLocation" TypeStoryAreaTypeVenue = "storyAreaTypeVenue" TypeStoryAreaTypeSuggestedReaction = "storyAreaTypeSuggestedReaction" + TypeStoryAreaTypeMessage = "storyAreaTypeMessage" TypeStoryArea = "storyArea" TypeInputStoryAreaTypeLocation = "inputStoryAreaTypeLocation" TypeInputStoryAreaTypeFoundVenue = "inputStoryAreaTypeFoundVenue" TypeInputStoryAreaTypePreviousVenue = "inputStoryAreaTypePreviousVenue" TypeInputStoryAreaTypeSuggestedReaction = "inputStoryAreaTypeSuggestedReaction" + TypeInputStoryAreaTypeMessage = "inputStoryAreaTypeMessage" TypeInputStoryArea = "inputStoryArea" TypeInputStoryAreas = "inputStoryAreas" TypeStoryVideo = "storyVideo" @@ -1123,9 +1127,16 @@ const ( TypeStoryFullId = "storyFullId" TypeStoryInfo = "storyInfo" TypeChatActiveStories = "chatActiveStories" - TypeStoryPublicForwardMessage = "storyPublicForwardMessage" - TypeStoryPublicForwardStory = "storyPublicForwardStory" - TypeStoryPublicForwards = "storyPublicForwards" + TypeStoryInteractionTypeView = "storyInteractionTypeView" + TypeStoryInteractionTypeForward = "storyInteractionTypeForward" + TypeStoryInteractionTypeRepost = "storyInteractionTypeRepost" + TypeStoryInteraction = "storyInteraction" + TypeStoryInteractions = "storyInteractions" + TypePublicForwardMessage = "publicForwardMessage" + TypePublicForwardStory = "publicForwardStory" + TypePublicForwards = "publicForwards" + TypeChatBoostLevelFeatures = "chatBoostLevelFeatures" + TypeChatBoostFeatures = "chatBoostFeatures" TypeChatBoostSourceGiftCode = "chatBoostSourceGiftCode" TypeChatBoostSourceGiveaway = "chatBoostSourceGiveaway" TypeChatBoostSourcePremium = "chatBoostSourcePremium" @@ -1245,7 +1256,9 @@ const ( TypeChatEventMemberPromoted = "chatEventMemberPromoted" TypeChatEventMemberRestricted = "chatEventMemberRestricted" TypeChatEventAvailableReactionsChanged = "chatEventAvailableReactionsChanged" + TypeChatEventBackgroundChanged = "chatEventBackgroundChanged" TypeChatEventDescriptionChanged = "chatEventDescriptionChanged" + TypeChatEventEmojiStatusChanged = "chatEventEmojiStatusChanged" TypeChatEventLinkedChatChanged = "chatEventLinkedChatChanged" TypeChatEventLocationChanged = "chatEventLocationChanged" TypeChatEventMessageAutoDeleteTimeChanged = "chatEventMessageAutoDeleteTimeChanged" @@ -1257,7 +1270,7 @@ const ( TypeChatEventUsernameChanged = "chatEventUsernameChanged" TypeChatEventActiveUsernamesChanged = "chatEventActiveUsernamesChanged" TypeChatEventAccentColorChanged = "chatEventAccentColorChanged" - TypeChatEventBackgroundCustomEmojiChanged = "chatEventBackgroundCustomEmojiChanged" + TypeChatEventProfileAccentColorChanged = "chatEventProfileAccentColorChanged" TypeChatEventHasProtectedContentToggled = "chatEventHasProtectedContentToggled" TypeChatEventInvitesToggled = "chatEventInvitesToggled" TypeChatEventIsAllHistoryAvailableToggled = "chatEventIsAllHistoryAvailableToggled" @@ -1365,6 +1378,7 @@ const ( TypeBackgroundTypeWallpaper = "backgroundTypeWallpaper" TypeBackgroundTypePattern = "backgroundTypePattern" TypeBackgroundTypeFill = "backgroundTypeFill" + TypeBackgroundTypeChatTheme = "backgroundTypeChatTheme" TypeInputBackgroundLocal = "inputBackgroundLocal" TypeInputBackgroundRemote = "inputBackgroundRemote" TypeInputBackgroundPrevious = "inputBackgroundPrevious" @@ -1537,6 +1551,7 @@ const ( TypeInternalLinkTypePassportDataRequest = "internalLinkTypePassportDataRequest" TypeInternalLinkTypePhoneNumberConfirmation = "internalLinkTypePhoneNumberConfirmation" TypeInternalLinkTypePremiumFeatures = "internalLinkTypePremiumFeatures" + TypeInternalLinkTypePremiumGift = "internalLinkTypePremiumGift" TypeInternalLinkTypePremiumGiftCode = "internalLinkTypePremiumGiftCode" TypeInternalLinkTypePrivacyAndSecuritySettings = "internalLinkTypePrivacyAndSecuritySettings" TypeInternalLinkTypeProxy = "internalLinkTypeProxy" @@ -1632,6 +1647,7 @@ const ( TypeSuggestedActionUpgradePremium = "suggestedActionUpgradePremium" TypeSuggestedActionRestorePremium = "suggestedActionRestorePremium" TypeSuggestedActionSubscribeToAnnualPremium = "suggestedActionSubscribeToAnnualPremium" + TypeSuggestedActionGiftPremiumForChristmas = "suggestedActionGiftPremiumForChristmas" TypeCount = "count" TypeText = "text" TypeSeconds = "seconds" @@ -1686,8 +1702,7 @@ const ( TypeUpdateNewChat = "updateNewChat" TypeUpdateChatTitle = "updateChatTitle" TypeUpdateChatPhoto = "updateChatPhoto" - TypeUpdateChatAccentColor = "updateChatAccentColor" - TypeUpdateChatBackgroundCustomEmoji = "updateChatBackgroundCustomEmoji" + TypeUpdateChatAccentColors = "updateChatAccentColors" TypeUpdateChatPermissions = "updateChatPermissions" TypeUpdateChatLastMessage = "updateChatLastMessage" TypeUpdateChatPosition = "updateChatPosition" @@ -1696,6 +1711,7 @@ const ( TypeUpdateChatActionBar = "updateChatActionBar" TypeUpdateChatAvailableReactions = "updateChatAvailableReactions" TypeUpdateChatDraftMessage = "updateChatDraftMessage" + TypeUpdateChatEmojiStatus = "updateChatEmojiStatus" TypeUpdateChatMessageSender = "updateChatMessageSender" TypeUpdateChatMessageAutoDeleteTime = "updateChatMessageAutoDeleteTime" TypeUpdateChatNotificationSettings = "updateChatNotificationSettings" @@ -1761,7 +1777,7 @@ const ( TypeUpdateFavoriteStickers = "updateFavoriteStickers" TypeUpdateSavedAnimations = "updateSavedAnimations" TypeUpdateSavedNotificationSounds = "updateSavedNotificationSounds" - TypeUpdateSelectedBackground = "updateSelectedBackground" + TypeUpdateDefaultBackground = "updateDefaultBackground" TypeUpdateChatThemes = "updateChatThemes" TypeUpdateAccentColors = "updateAccentColors" TypeUpdateProfileAccentColors = "updateProfileAccentColors" @@ -1794,6 +1810,8 @@ const ( TypeUpdateChatMember = "updateChatMember" TypeUpdateNewChatJoinRequest = "updateNewChatJoinRequest" TypeUpdateChatBoost = "updateChatBoost" + TypeUpdateMessageReaction = "updateMessageReaction" + TypeUpdateMessageReactions = "updateMessageReactions" TypeUpdates = "updates" TypeLogStreamDefault = "logStreamDefault" TypeLogStreamFile = "logStreamFile" @@ -2150,9 +2168,14 @@ type StoryOrigin interface { StoryOriginType() string } +// Describes type of interaction with a story +type StoryInteractionType interface { + StoryInteractionTypeType() string +} + // Describes a public forward or repost of a story -type StoryPublicForward interface { - StoryPublicForwardType() string +type PublicForward interface { + PublicForwardType() string } // Describes source of a chat boost @@ -5167,7 +5190,7 @@ type Background struct { IsDark bool `json:"is_dark"` // Unique background name Name string `json:"name"` - // Document with the background; may be null. Null only for filled backgrounds + // Document with the background; may be null. Null only for filled and chat theme backgrounds Document *Document `json:"document"` // Type of the background Type BackgroundType `json:"type"` @@ -5244,7 +5267,7 @@ type ChatBackground struct { meta // The background Background *Background `json:"background"` - // Dimming of the background in dark themes, as a percentage; 0-100 + // Dimming of the background in dark themes, as a percentage; 0-100. Applied only to Wallpaper and Fill types of background DarkThemeDimming int32 `json:"dark_theme_dimming"` } @@ -5878,7 +5901,7 @@ func (*InputChatPhotoSticker) InputChatPhotoType() string { // Describes actions that a user is allowed to take in a chat type ChatPermissions struct { meta - // True, if the user can send text messages, contacts, giveaways, invoices, locations, and venues + // True, if the user can send text messages, contacts, giveaways, giveaway winners, invoices, locations, and venues CanSendBasicMessages bool `json:"can_send_basic_messages"` // True, if the user can send music files CanSendAudios bool `json:"can_send_audios"` @@ -5990,7 +6013,7 @@ type PremiumPaymentOption struct { Amount int64 `json:"amount"` // The discount associated with this option, as a percentage DiscountPercentage int32 `json:"discount_percentage"` - // Number of month the Telegram Premium subscription will be active + // Number of months the Telegram Premium subscription will be active MonthCount int32 `json:"month_count"` // Identifier of the store product associated with the option StoreProductId string `json:"store_product_id"` @@ -6079,7 +6102,7 @@ type PremiumGiftCodePaymentOption struct { Amount int64 `json:"amount"` // Number of users which will be able to activate the gift codes UserCount int32 `json:"user_count"` - // Number of month the Telegram Premium subscription will be active + // Number of months the Telegram Premium subscription will be active MonthCount int32 `json:"month_count"` // Identifier of the store product associated with the option; may be empty if none StoreProductId string `json:"store_product_id"` @@ -6129,7 +6152,7 @@ func (*PremiumGiftCodePaymentOptions) GetType() string { // Contains information about a Telegram Premium gift code type PremiumGiftCodeInfo struct { meta - // Identifier of a chat or a user that created the gift code + // Identifier of a chat or a user that created the gift code; may be null if unknown. If null and the code is from messagePremiumGiftCode message, then creator_id from the message can be used CreatorId MessageSender `json:"creator_id"` // Point in time (Unix timestamp) when the code was created CreationDate int32 `json:"creation_date"` @@ -6137,7 +6160,7 @@ type PremiumGiftCodeInfo struct { IsFromGiveaway bool `json:"is_from_giveaway"` // Identifier of the corresponding giveaway message in the creator_id chat; can be 0 or an identifier of a deleted message GiveawayMessageId int64 `json:"giveaway_message_id"` - // Number of month the Telegram Premium subscription will be active after code activation + // Number of months the Telegram Premium subscription will be active after code activation MonthCount int32 `json:"month_count"` // Identifier of a user for which the code was created; 0 if none UserId int64 `json:"user_id"` @@ -6421,6 +6444,8 @@ type AccentColor struct { LightThemeColors []int32 `json:"light_theme_colors"` // The list of 1-3 colors in RGB format, describing the accent color, as expected to be shown in dark themes DarkThemeColors []int32 `json:"dark_theme_colors"` + // The minimum chat boost level required to use the color + MinChatBoostLevel int32 `json:"min_chat_boost_level"` } func (entity *AccentColor) MarshalJSON() ([]byte, error) { @@ -6471,10 +6496,12 @@ type ProfileAccentColor struct { meta // Profile accent color identifier Id int32 `json:"id"` - // The list of 1-3 colors in RGB format, describing the accent color, as expected to be shown in light themes + // Accent colors expected to be used in light themes LightThemeColors *ProfileAccentColors `json:"light_theme_colors"` - // The list of 1-3 colors in RGB format, describing the accent color, as expected to be shown in dark themes + // Accent colors expected to be used in dark themes DarkThemeColors *ProfileAccentColors `json:"dark_theme_colors"` + // The minimum chat boost level required to use the color + MinChatBoostLevel int32 `json:"min_chat_boost_level"` } func (entity *ProfileAccentColor) MarshalJSON() ([]byte, error) { @@ -6518,7 +6545,7 @@ func (*EmojiStatus) GetType() string { return TypeEmojiStatus } -// Contains a list of custom emoji identifiers, which can be set as emoji statuses +// Contains a list of custom emoji identifiers for emoji statuses type EmojiStatuses struct { meta // The list of custom emoji identifiers @@ -6589,7 +6616,7 @@ type User struct { ProfilePhoto *ProfilePhoto `json:"profile_photo"` // Identifier of the accent color for name, and backgrounds of profile photo, reply header, and link preview. For Telegram Premium users only AccentColorId int32 `json:"accent_color_id"` - // Identifier of a custom emoji to be shown on the reply header background; 0 if none. For Telegram Premium users only + // Identifier of a custom emoji to be shown on the reply header and link preview background; 0 if none. For Telegram Premium users only BackgroundCustomEmojiId JsonInt64 `json:"background_custom_emoji_id"` // Identifier of the accent color for the user's profile; -1 if none. For Telegram Premium users only ProfileAccentColorId int32 `json:"profile_accent_color_id"` @@ -8149,8 +8176,10 @@ type Supergroup struct { Date int32 `json:"date"` // Status of the current user in the supergroup or channel; custom title will always be empty Status ChatMemberStatus `json:"status"` - // Number of members in the supergroup or channel; 0 if unknown. Currently, it is guaranteed to be known only if the supergroup or channel was received through getChatSimilarChats, getChatsToSendStories, getCreatedPublicChats, getGroupsInCommon, getInactiveSupergroupChats, getSuitableDiscussionChats, getUserPrivacySettingRules, getVideoChatAvailableParticipants, searchChatsNearby, searchPublicChats, or in chatFolderInviteLinkInfo.missing_chat_ids, or for public chats in which where sent messages and posted stories from storyPublicForwards, or for public chats in which where sent messages from getMessagePublicForwards response + // Number of members in the supergroup or channel; 0 if unknown. Currently, it is guaranteed to be known only if the supergroup or channel was received through getChatSimilarChats, getChatsToSendStories, getCreatedPublicChats, getGroupsInCommon, getInactiveSupergroupChats, getSuitableDiscussionChats, getUserPrivacySettingRules, getVideoChatAvailableParticipants, searchChatsNearby, searchPublicChats, or in chatFolderInviteLinkInfo.missing_chat_ids, or for public chats in which where sent messages and posted stories from publicForwards, or for public chats in which where sent messages from getMessagePublicForwards response MemberCount int32 `json:"member_count"` + // Approximate boost level for the chat + BoostLevel int32 `json:"boost_level"` // True, if the channel has a discussion group, or the supergroup is the designated discussion group for a channel HasLinkedChat bool `json:"has_linked_chat"` // True, if the supergroup is connected to a location, i.e. the supergroup is a location-based supergroup @@ -8207,6 +8236,7 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { Date int32 `json:"date"` Status json.RawMessage `json:"status"` MemberCount int32 `json:"member_count"` + BoostLevel int32 `json:"boost_level"` HasLinkedChat bool `json:"has_linked_chat"` HasLocation bool `json:"has_location"` SignMessages bool `json:"sign_messages"` @@ -8234,6 +8264,7 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { supergroup.Usernames = tmp.Usernames supergroup.Date = tmp.Date supergroup.MemberCount = tmp.MemberCount + supergroup.BoostLevel = tmp.BoostLevel supergroup.HasLinkedChat = tmp.HasLinkedChat supergroup.HasLocation = tmp.HasLocation supergroup.SignMessages = tmp.SignMessages @@ -9188,7 +9219,7 @@ type TextQuote struct { meta // Text of the quote. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities can be present in the text Text *FormattedText `json:"text"` - // Approximate quote position in the original message in UTF-16 code units + // Approximate quote position in the original message in UTF-16 code units as specified by the message sender Position int32 `json:"position"` // True, if the quote was manually chosen by the message sender IsManual bool `json:"is_manual"` @@ -9248,7 +9279,7 @@ type MessageReplyToMessage struct { Origin MessageOrigin `json:"origin"` // Point in time (Unix timestamp) when the message was sent if the message was from another chat or topic; 0 for messages from the same chat OriginSendDate int32 `json:"origin_send_date"` - // Media content of the message if the message was from another chat or topic; may be null for messages from the same chat and messages without media. Can be only one of the following types: messageAnimation, messageAudio, messageContact, messageDice, messageDocument, messageGame, messageInvoice, messageLocation, messagePhoto, messagePoll, messagePremiumGiveaway, messageSticker, messageStory, messageText (for link preview), messageVenue, messageVideo, messageVideoNote, or messageVoiceNote + // Media content of the message if the message was from another chat or topic; may be null for messages from the same chat and messages without media. Can be only one of the following types: messageAnimation, messageAudio, messageContact, messageDice, messageDocument, messageGame, messageInvoice, messageLocation, messagePhoto, messagePoll, messagePremiumGiveaway, messagePremiumGiveawayWinners, messageSticker, messageStory, messageText (for link preview), messageVenue, messageVideo, messageVideoNote, or messageVoiceNote Content MessageContent `json:"content"` } @@ -11386,8 +11417,12 @@ type Chat struct { Photo *ChatPhotoInfo `json:"photo"` // Identifier of the accent color for message sender name, and backgrounds of chat photo, reply header, and link preview AccentColorId int32 `json:"accent_color_id"` - // Identifier of a custom emoji to be shown on the reply header background in replies to messages sent by the chat; 0 if none + // 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 JsonInt64 `json:"background_custom_emoji_id"` + // Identifier of the profile accent color for the chat's profile; -1 if none + ProfileAccentColorId int32 `json:"profile_accent_color_id"` + // Identifier of a custom emoji to be shown on the background of the chat's profile; 0 if none + ProfileBackgroundCustomEmojiId JsonInt64 `json:"profile_background_custom_emoji_id"` // Actions that non-administrator chat members are allowed to take in the chat Permissions *ChatPermissions `json:"permissions"` // Last message in the chat; may be null if none or unknown @@ -11432,6 +11467,8 @@ type Chat struct { AvailableReactions ChatAvailableReactions `json:"available_reactions"` // 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 `json:"message_auto_delete_time"` + // Emoji status to be shown along with chat title; may be null + EmojiStatus *EmojiStatus `json:"emoji_status"` // Background set for the chat; may be null if none Background *ChatBackground `json:"background"` // If non-empty, name of a theme, set for the chat @@ -11474,6 +11511,8 @@ func (chat *Chat) UnmarshalJSON(data []byte) error { Photo *ChatPhotoInfo `json:"photo"` AccentColorId int32 `json:"accent_color_id"` BackgroundCustomEmojiId JsonInt64 `json:"background_custom_emoji_id"` + ProfileAccentColorId int32 `json:"profile_accent_color_id"` + ProfileBackgroundCustomEmojiId JsonInt64 `json:"profile_background_custom_emoji_id"` Permissions *ChatPermissions `json:"permissions"` LastMessage *Message `json:"last_message"` Positions []*ChatPosition `json:"positions"` @@ -11496,6 +11535,7 @@ func (chat *Chat) UnmarshalJSON(data []byte) error { NotificationSettings *ChatNotificationSettings `json:"notification_settings"` AvailableReactions json.RawMessage `json:"available_reactions"` MessageAutoDeleteTime int32 `json:"message_auto_delete_time"` + EmojiStatus *EmojiStatus `json:"emoji_status"` Background *ChatBackground `json:"background"` ThemeName string `json:"theme_name"` ActionBar json.RawMessage `json:"action_bar"` @@ -11516,6 +11556,8 @@ func (chat *Chat) UnmarshalJSON(data []byte) error { chat.Photo = tmp.Photo chat.AccentColorId = tmp.AccentColorId chat.BackgroundCustomEmojiId = tmp.BackgroundCustomEmojiId + chat.ProfileAccentColorId = tmp.ProfileAccentColorId + chat.ProfileBackgroundCustomEmojiId = tmp.ProfileBackgroundCustomEmojiId chat.Permissions = tmp.Permissions chat.LastMessage = tmp.LastMessage chat.Positions = tmp.Positions @@ -11535,6 +11577,7 @@ func (chat *Chat) UnmarshalJSON(data []byte) error { chat.UnreadReactionCount = tmp.UnreadReactionCount chat.NotificationSettings = tmp.NotificationSettings chat.MessageAutoDeleteTime = tmp.MessageAutoDeleteTime + chat.EmojiStatus = tmp.EmojiStatus chat.Background = tmp.Background chat.ThemeName = tmp.ThemeName chat.VideoChat = tmp.VideoChat @@ -11977,39 +12020,41 @@ func (*KeyboardButtonTypeRequestPoll) KeyboardButtonTypeType() string { return TypeKeyboardButtonTypeRequestPoll } -// A button that requests a user to be shared by the current user; available only in private chats. Use the method shareUserWithBot to complete the request -type KeyboardButtonTypeRequestUser struct { +// A button that requests users to be shared by the current user; available only in private chats. Use the method shareUsersWithBot to complete the request +type KeyboardButtonTypeRequestUsers struct { meta // Unique button identifier Id int32 `json:"id"` - // True, if the shared user must or must not be a bot + // True, if the shared users must or must not be bots RestrictUserIsBot bool `json:"restrict_user_is_bot"` - // True, if the shared user must be a bot; otherwise, the shared user must no be a bot. Ignored if restrict_user_is_bot is false + // True, if the shared users must be bots; otherwise, the shared users must not be bots. Ignored if restrict_user_is_bot is false UserIsBot bool `json:"user_is_bot"` - // True, if the shared user must or must not be a Telegram Premium user + // True, if the shared users must or must not be Telegram Premium users RestrictUserIsPremium bool `json:"restrict_user_is_premium"` - // True, if the shared user must be a Telegram Premium user; otherwise, the shared user must no be a Telegram Premium user. Ignored if restrict_user_is_premium is false + // True, if the shared users must be Telegram Premium users; otherwise, the shared users must not be Telegram Premium users. Ignored if restrict_user_is_premium is false UserIsPremium bool `json:"user_is_premium"` + // The maximum number of users to share + MaxQuantity int32 `json:"max_quantity"` } -func (entity *KeyboardButtonTypeRequestUser) MarshalJSON() ([]byte, error) { +func (entity *KeyboardButtonTypeRequestUsers) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub KeyboardButtonTypeRequestUser + type stub KeyboardButtonTypeRequestUsers return json.Marshal((*stub)(entity)) } -func (*KeyboardButtonTypeRequestUser) GetClass() string { +func (*KeyboardButtonTypeRequestUsers) GetClass() string { return ClassKeyboardButtonType } -func (*KeyboardButtonTypeRequestUser) GetType() string { - return TypeKeyboardButtonTypeRequestUser +func (*KeyboardButtonTypeRequestUsers) GetType() string { + return TypeKeyboardButtonTypeRequestUsers } -func (*KeyboardButtonTypeRequestUser) KeyboardButtonTypeType() string { - return TypeKeyboardButtonTypeRequestUser +func (*KeyboardButtonTypeRequestUsers) KeyboardButtonTypeType() string { + return TypeKeyboardButtonTypeRequestUsers } // A button that requests a chat to be shared by the current user; available only in private chats. Use the method shareChatWithBot to complete the request @@ -15780,6 +15825,8 @@ type PaymentProviderSmartGlocal struct { meta // Public payment token PublicToken string `json:"public_token"` + // URL for sending card tokenization requests + TokenizeUrl string `json:"tokenize_url"` } func (entity *PaymentProviderSmartGlocal) MarshalJSON() ([]byte, error) { @@ -16296,10 +16343,14 @@ type PremiumGiveawayParameters struct { AdditionalChatIds []int64 `json:"additional_chat_ids"` // Point in time (Unix timestamp) when the giveaway is expected to be performed; must be 60-getOption("giveaway_duration_max") seconds in the future in scheduled giveaways WinnersSelectionDate int32 `json:"winners_selection_date"` - // True, if only new subscribers of the chats will be eligible for the giveaway + // True, if only new members of the chats will be eligible for the giveaway OnlyNewMembers bool `json:"only_new_members"` + // True, if the list of winners of the giveaway will be available to everyone + HasPublicWinners bool `json:"has_public_winners"` // The list of two-letter ISO 3166-1 alpha-2 codes of countries, users from which will be eligible for the giveaway. If empty, then all users can participate in the giveaway. There can be up to getOption("giveaway_country_count_max") chosen countries. Users with phone number that was bought on Fragment can participate in any giveaway and the country code "FT" must not be specified in the list CountryCodes []string `json:"country_codes"` + // Additional description of the giveaway prize; 0-128 characters + PrizeDescription string `json:"prize_description"` } func (entity *PremiumGiveawayParameters) MarshalJSON() ([]byte, error) { @@ -20031,9 +20082,9 @@ type MessageGiftedPremium struct { Amount int64 `json:"amount"` // Cryptocurrency used to pay for the gift; may be empty if none Cryptocurrency string `json:"cryptocurrency"` - // The paid amount, in the smallest units of the cryptocurrency + // The paid amount, in the smallest units of the cryptocurrency; 0 if none CryptocurrencyAmount JsonInt64 `json:"cryptocurrency_amount"` - // Number of month the Telegram Premium subscription will be active + // Number of months the Telegram Premium subscription will be active MonthCount int32 `json:"month_count"` // A sticker to be shown in the message; may be null if unknown Sticker *Sticker `json:"sticker"` @@ -20062,13 +20113,21 @@ func (*MessageGiftedPremium) MessageContentType() string { // A Telegram Premium gift code was created for the user type MessagePremiumGiftCode struct { meta - // Identifier of a chat or a user that created the gift code + // Identifier of a chat or a user that created the gift code; may be null if unknown CreatorId MessageSender `json:"creator_id"` // True, if the gift code was created for a giveaway IsFromGiveaway bool `json:"is_from_giveaway"` // True, if the winner for the corresponding Telegram Premium subscription wasn't chosen IsUnclaimed bool `json:"is_unclaimed"` - // Number of month the Telegram Premium subscription will be active after code activation + // Currency for the paid amount; empty if unknown + Currency string `json:"currency"` + // The paid amount, in the smallest units of the currency; 0 if unknown + Amount int64 `json:"amount"` + // Cryptocurrency used to pay for the gift; may be empty if none or unknown + Cryptocurrency string `json:"cryptocurrency"` + // The paid amount, in the smallest units of the cryptocurrency; 0 if unknown + CryptocurrencyAmount JsonInt64 `json:"cryptocurrency_amount"` + // Number of months the Telegram Premium subscription will be active after code activation MonthCount int32 `json:"month_count"` // A sticker to be shown in the message; may be null if unknown Sticker *Sticker `json:"sticker"` @@ -20101,6 +20160,10 @@ func (messagePremiumGiftCode *MessagePremiumGiftCode) UnmarshalJSON(data []byte) CreatorId json.RawMessage `json:"creator_id"` IsFromGiveaway bool `json:"is_from_giveaway"` IsUnclaimed bool `json:"is_unclaimed"` + Currency string `json:"currency"` + Amount int64 `json:"amount"` + Cryptocurrency string `json:"cryptocurrency"` + CryptocurrencyAmount JsonInt64 `json:"cryptocurrency_amount"` MonthCount int32 `json:"month_count"` Sticker *Sticker `json:"sticker"` Code string `json:"code"` @@ -20113,6 +20176,10 @@ func (messagePremiumGiftCode *MessagePremiumGiftCode) UnmarshalJSON(data []byte) messagePremiumGiftCode.IsFromGiveaway = tmp.IsFromGiveaway messagePremiumGiftCode.IsUnclaimed = tmp.IsUnclaimed + messagePremiumGiftCode.Currency = tmp.Currency + messagePremiumGiftCode.Amount = tmp.Amount + messagePremiumGiftCode.Cryptocurrency = tmp.Cryptocurrency + messagePremiumGiftCode.CryptocurrencyAmount = tmp.CryptocurrencyAmount messagePremiumGiftCode.MonthCount = tmp.MonthCount messagePremiumGiftCode.Sticker = tmp.Sticker messagePremiumGiftCode.Code = tmp.Code @@ -20155,7 +20222,7 @@ type MessagePremiumGiveaway struct { Parameters *PremiumGiveawayParameters `json:"parameters"` // Number of users which will receive Telegram Premium subscription gift codes WinnerCount int32 `json:"winner_count"` - // Number of month the Telegram Premium subscription will be active after code activation + // Number of months the Telegram Premium subscription will be active after code activation MonthCount int32 `json:"month_count"` // A sticker to be shown in the message; may be null if unknown Sticker *Sticker `json:"sticker"` @@ -20181,10 +20248,10 @@ func (*MessagePremiumGiveaway) MessageContentType() string { return TypeMessagePremiumGiveaway } -// A Telegram Premium giveaway has been completed for the chat +// A Telegram Premium giveaway without public winners has been completed for the chat type MessagePremiumGiveawayCompleted struct { meta - // Identifier of the message with the giveaway, can be an identifier of a deleted message + // Identifier of the message with the giveaway; can be 0 if the message was deleted GiveawayMessageId int64 `json:"giveaway_message_id"` // Number of winners in the giveaway WinnerCount int32 `json:"winner_count"` @@ -20212,6 +20279,53 @@ func (*MessagePremiumGiveawayCompleted) MessageContentType() string { return TypeMessagePremiumGiveawayCompleted } +// A Telegram Premium giveaway with public winners has been completed for the chat +type MessagePremiumGiveawayWinners struct { + meta + // Identifier of the channel chat, which was automatically boosted by the winners of the giveaway for duration of the Premium subscription + BoostedChatId int64 `json:"boosted_chat_id"` + // Identifier of the message with the giveaway in the boosted chat + GiveawayMessageId int64 `json:"giveaway_message_id"` + // Number of other chats that participated in the giveaway + AdditionalChatCount int32 `json:"additional_chat_count"` + // Point in time (Unix timestamp) when the winners were selected. May be bigger than winners selection date specified in parameters of the giveaway + ActualWinnersSelectionDate int32 `json:"actual_winners_selection_date"` + // True, if only new members of the chats were eligible for the giveaway + OnlyNewMembers bool `json:"only_new_members"` + // True, if the giveaway was canceled and was fully refunded + WasRefunded bool `json:"was_refunded"` + // Number of months the Telegram Premium subscription will be active after code activation + MonthCount int32 `json:"month_count"` + // Additional description of the giveaway prize + PrizeDescription string `json:"prize_description"` + // Total number of winners in the giveaway + WinnerCount int32 `json:"winner_count"` + // Up to 100 user identifiers of the winners of the giveaway + WinnerUserIds []int64 `json:"winner_user_ids"` + // Number of undistributed prizes + UnclaimedPrizeCount int32 `json:"unclaimed_prize_count"` +} + +func (entity *MessagePremiumGiveawayWinners) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessagePremiumGiveawayWinners + + return json.Marshal((*stub)(entity)) +} + +func (*MessagePremiumGiveawayWinners) GetClass() string { + return ClassMessageContent +} + +func (*MessagePremiumGiveawayWinners) GetType() string { + return TypeMessagePremiumGiveawayWinners +} + +func (*MessagePremiumGiveawayWinners) MessageContentType() string { + return TypeMessagePremiumGiveawayWinners +} + // A contact has registered with Telegram type MessageContactRegistered struct{ meta @@ -20237,33 +20351,33 @@ func (*MessageContactRegistered) MessageContentType() string { return TypeMessageContactRegistered } -// The current user shared a user, which was requested by the bot -type MessageUserShared struct { +// The current user shared users, which were requested by the bot +type MessageUsersShared struct { meta - // Identifier of the shared user - UserId int64 `json:"user_id"` + // Identifier of the shared users + UserIds []int64 `json:"user_ids"` // Identifier of the keyboard button with the request ButtonId int32 `json:"button_id"` } -func (entity *MessageUserShared) MarshalJSON() ([]byte, error) { +func (entity *MessageUsersShared) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub MessageUserShared + type stub MessageUsersShared return json.Marshal((*stub)(entity)) } -func (*MessageUserShared) GetClass() string { +func (*MessageUsersShared) GetClass() string { return ClassMessageContent } -func (*MessageUserShared) GetType() string { - return TypeMessageUserShared +func (*MessageUsersShared) GetType() string { + return TypeMessageUsersShared } -func (*MessageUserShared) MessageContentType() string { - return TypeMessageUserShared +func (*MessageUsersShared) MessageContentType() string { + return TypeMessageUsersShared } // The current user shared a chat, which was requested by the bot @@ -21296,7 +21410,7 @@ func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { return nil } -// Options to be used when a message content is copied without reference to the original sender. Service messages, and messages with messageInvoice or messagePremiumGiveaway content can't be copied +// Options to be used when a message content is copied without reference to the original sender. Service messages, messages with messageInvoice, messagePremiumGiveaway, or messagePremiumGiveawayWinners content can't be copied type MessageCopyOptions struct { meta // True, if content of the message needs to be copied without reference to the original sender. Always true if the message is forwarded to a secret chat or is local @@ -21497,7 +21611,7 @@ type InputMessageDocument struct { Document InputFile `json:"document"` // Document thumbnail; pass null to skip thumbnail uploading Thumbnail *InputThumbnail `json:"thumbnail"` - // True, if automatic file type detection is disabled and the document must be sent as a file. Always true for files sent to secret chats + // Pass true to disable automatic file type detection and send the document as a file. Always true for files sent to secret chats DisableContentTypeDetection bool `json:"disable_content_type_detection"` // Document caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters Caption *FormattedText `json:"caption"` @@ -23274,6 +23388,8 @@ type StickerSet struct { StickerType StickerType `json:"sticker_type"` // True, if stickers in the sticker set are custom emoji that must be repainted; for custom emoji sticker sets only NeedsRepainting bool `json:"needs_repainting"` + // True, if stickers in the sticker set are custom emoji that can be used as chat emoji status; for custom emoji sticker sets only + IsAllowedAsChatEmojiStatus bool `json:"is_allowed_as_chat_emoji_status"` // True for already viewed trending sticker sets IsViewed bool `json:"is_viewed"` // List of stickers in this set @@ -23311,6 +23427,7 @@ func (stickerSet *StickerSet) UnmarshalJSON(data []byte) error { StickerFormat json.RawMessage `json:"sticker_format"` StickerType json.RawMessage `json:"sticker_type"` NeedsRepainting bool `json:"needs_repainting"` + IsAllowedAsChatEmojiStatus bool `json:"is_allowed_as_chat_emoji_status"` IsViewed bool `json:"is_viewed"` Stickers []*Sticker `json:"stickers"` Emojis []*Emojis `json:"emojis"` @@ -23330,6 +23447,7 @@ func (stickerSet *StickerSet) UnmarshalJSON(data []byte) error { stickerSet.IsArchived = tmp.IsArchived stickerSet.IsOfficial = tmp.IsOfficial stickerSet.NeedsRepainting = tmp.NeedsRepainting + stickerSet.IsAllowedAsChatEmojiStatus = tmp.IsAllowedAsChatEmojiStatus stickerSet.IsViewed = tmp.IsViewed stickerSet.Stickers = tmp.Stickers stickerSet.Emojis = tmp.Emojis @@ -23352,7 +23470,7 @@ type StickerSetInfo struct { Title string `json:"title"` // Name of the sticker set Name string `json:"name"` - // Sticker set thumbnail in WEBP, TGS, or WEBM format with width and height 100; may be null + // Sticker set thumbnail in WEBP, TGS, or WEBM format with width and height 100; may be null. The file can be downloaded only before the thumbnail is changed Thumbnail *Thumbnail `json:"thumbnail"` // Sticker set thumbnail's outline represented as a list of closed vector paths; may be empty. The coordinate system origin is in the upper-left corner ThumbnailOutline []*ClosedVectorPath `json:"thumbnail_outline"` @@ -23368,6 +23486,8 @@ type StickerSetInfo struct { StickerType StickerType `json:"sticker_type"` // True, if stickers in the sticker set are custom emoji that must be repainted; for custom emoji sticker sets only NeedsRepainting bool `json:"needs_repainting"` + // True, if stickers in the sticker set are custom emoji that can be used as chat emoji status; for custom emoji sticker sets only + IsAllowedAsChatEmojiStatus bool `json:"is_allowed_as_chat_emoji_status"` // True for already viewed trending sticker sets IsViewed bool `json:"is_viewed"` // Total number of stickers in the set @@ -23405,6 +23525,7 @@ func (stickerSetInfo *StickerSetInfo) UnmarshalJSON(data []byte) error { StickerFormat json.RawMessage `json:"sticker_format"` StickerType json.RawMessage `json:"sticker_type"` NeedsRepainting bool `json:"needs_repainting"` + IsAllowedAsChatEmojiStatus bool `json:"is_allowed_as_chat_emoji_status"` IsViewed bool `json:"is_viewed"` Size int32 `json:"size"` Covers []*Sticker `json:"covers"` @@ -23424,6 +23545,7 @@ func (stickerSetInfo *StickerSetInfo) UnmarshalJSON(data []byte) error { stickerSetInfo.IsArchived = tmp.IsArchived stickerSetInfo.IsOfficial = tmp.IsOfficial stickerSetInfo.NeedsRepainting = tmp.NeedsRepainting + stickerSetInfo.IsAllowedAsChatEmojiStatus = tmp.IsAllowedAsChatEmojiStatus stickerSetInfo.IsViewed = tmp.IsViewed stickerSetInfo.Size = tmp.Size stickerSetInfo.Covers = tmp.Covers @@ -23614,89 +23736,6 @@ func (*EmojiCategoryTypeChatPhoto) EmojiCategoryTypeType() string { return TypeEmojiCategoryTypeChatPhoto } -// Represents a viewer of a story -type StoryViewer struct { - meta - // User identifier of the viewer - UserId int64 `json:"user_id"` - // Approximate point in time (Unix timestamp) when the story was viewed - ViewDate int32 `json:"view_date"` - // Block list to which the user is added; may be null if none - BlockList BlockList `json:"block_list"` - // Type of the reaction that was chosen by the user; may be null if none - ChosenReactionType ReactionType `json:"chosen_reaction_type"` -} - -func (entity *StoryViewer) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StoryViewer - - return json.Marshal((*stub)(entity)) -} - -func (*StoryViewer) GetClass() string { - return ClassStoryViewer -} - -func (*StoryViewer) GetType() string { - return TypeStoryViewer -} - -func (storyViewer *StoryViewer) UnmarshalJSON(data []byte) error { - var tmp struct { - UserId int64 `json:"user_id"` - ViewDate int32 `json:"view_date"` - BlockList json.RawMessage `json:"block_list"` - ChosenReactionType json.RawMessage `json:"chosen_reaction_type"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - storyViewer.UserId = tmp.UserId - storyViewer.ViewDate = tmp.ViewDate - - fieldBlockList, _ := UnmarshalBlockList(tmp.BlockList) - storyViewer.BlockList = fieldBlockList - - fieldChosenReactionType, _ := UnmarshalReactionType(tmp.ChosenReactionType) - storyViewer.ChosenReactionType = fieldChosenReactionType - - return nil -} - -// Represents a list of story viewers -type StoryViewers struct { - meta - // Approximate total number of story viewers found - TotalCount int32 `json:"total_count"` - // Approximate total number of reactions set by found story viewers - TotalReactionCount int32 `json:"total_reaction_count"` - // List of story viewers - Viewers []*StoryViewer `json:"viewers"` - // The offset for the next request. If empty, then there are no more results - NextOffset string `json:"next_offset"` -} - -func (entity *StoryViewers) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StoryViewers - - return json.Marshal((*stub)(entity)) -} - -func (*StoryViewers) GetClass() string { - return ClassStoryViewers -} - -func (*StoryViewers) GetType() string { - return TypeStoryViewers -} - // Describes position of a clickable rectangle area on a story media type StoryAreaPosition struct { meta @@ -23838,6 +23877,35 @@ func (storyAreaTypeSuggestedReaction *StoryAreaTypeSuggestedReaction) UnmarshalJ return nil } +// An area pointing to a message +type StoryAreaTypeMessage struct { + meta + // Identifier of the chat with the message + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` +} + +func (entity *StoryAreaTypeMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryAreaTypeMessage + + return json.Marshal((*stub)(entity)) +} + +func (*StoryAreaTypeMessage) GetClass() string { + return ClassStoryAreaType +} + +func (*StoryAreaTypeMessage) GetType() string { + return TypeStoryAreaTypeMessage +} + +func (*StoryAreaTypeMessage) StoryAreaTypeType() string { + return TypeStoryAreaTypeMessage +} + // Describes a clickable rectangle area on a story media type StoryArea struct { meta @@ -24019,6 +24087,35 @@ func (inputStoryAreaTypeSuggestedReaction *InputStoryAreaTypeSuggestedReaction) return nil } +// An area pointing to a message +type InputStoryAreaTypeMessage struct { + meta + // Identifier of the chat with the message. Currently, the chat must be a supergroup or a channel chat + ChatId int64 `json:"chat_id"` + // Identifier of the message. Only successfully sent non-scheduled messages can be specified + MessageId int64 `json:"message_id"` +} + +func (entity *InputStoryAreaTypeMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputStoryAreaTypeMessage + + return json.Marshal((*stub)(entity)) +} + +func (*InputStoryAreaTypeMessage) GetClass() string { + return ClassInputStoryAreaType +} + +func (*InputStoryAreaTypeMessage) GetType() string { + return TypeInputStoryAreaTypeMessage +} + +func (*InputStoryAreaTypeMessage) InputStoryAreaTypeType() string { + return TypeInputStoryAreaTypeMessage +} + // Describes a clickable rectangle area on a story media to be added type InputStoryArea struct { meta @@ -24066,7 +24163,7 @@ func (inputStoryArea *InputStoryArea) UnmarshalJSON(data []byte) error { // Contains a list of story areas to be added type InputStoryAreas struct { meta - // List of 0-10 input story areas + // List of input story areas. Currently, a story can have up to 10 inputStoryAreaTypeLocation, inputStoryAreaTypeFoundVenue, and inputStoryAreaTypePreviousVenue areas, up to getOption("story_suggested_reaction_area_count_max") inputStoryAreaTypeSuggestedReaction areas, and up to 1 inputStoryAreaTypeMessage area Areas []*InputStoryArea `json:"areas"` } @@ -24520,8 +24617,8 @@ type Story struct { CanToggleIsPinned bool `json:"can_toggle_is_pinned"` // True, if the story statistics are available through getStoryStatistics CanGetStatistics bool `json:"can_get_statistics"` - // True, if users viewed the story can be received through getStoryViewers - CanGetViewers bool `json:"can_get_viewers"` + // True, if interactions with the story can be received through getStoryInteractions + CanGetInteractions bool `json:"can_get_interactions"` // True, if users viewed the story can't be received, because the story has expired more than getOption("story_viewers_expiration_delay") seconds ago HasExpiredViewers bool `json:"has_expired_viewers"` // Information about the original story; may be null if the story wasn't reposted @@ -24572,7 +24669,7 @@ func (story *Story) UnmarshalJSON(data []byte) error { CanBeReplied bool `json:"can_be_replied"` CanToggleIsPinned bool `json:"can_toggle_is_pinned"` CanGetStatistics bool `json:"can_get_statistics"` - CanGetViewers bool `json:"can_get_viewers"` + CanGetInteractions bool `json:"can_get_interactions"` HasExpiredViewers bool `json:"has_expired_viewers"` RepostInfo *StoryRepostInfo `json:"repost_info"` InteractionInfo *StoryInteractionInfo `json:"interaction_info"` @@ -24602,7 +24699,7 @@ func (story *Story) UnmarshalJSON(data []byte) error { story.CanBeReplied = tmp.CanBeReplied story.CanToggleIsPinned = tmp.CanToggleIsPinned story.CanGetStatistics = tmp.CanGetStatistics - story.CanGetViewers = tmp.CanGetViewers + story.CanGetInteractions = tmp.CanGetInteractions story.HasExpiredViewers = tmp.HasExpiredViewers story.RepostInfo = tmp.RepostInfo story.InteractionInfo = tmp.InteractionInfo @@ -24754,88 +24851,272 @@ func (chatActiveStories *ChatActiveStories) UnmarshalJSON(data []byte) error { return nil } -// Contains a public forward of a story as a message -type StoryPublicForwardMessage struct { +// A view of the story +type StoryInteractionTypeView struct { meta - // Information about the message with the story + // Type of the reaction that was chosen by the viewer; may be null if none + ChosenReactionType ReactionType `json:"chosen_reaction_type"` +} + +func (entity *StoryInteractionTypeView) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryInteractionTypeView + + return json.Marshal((*stub)(entity)) +} + +func (*StoryInteractionTypeView) GetClass() string { + return ClassStoryInteractionType +} + +func (*StoryInteractionTypeView) GetType() string { + return TypeStoryInteractionTypeView +} + +func (*StoryInteractionTypeView) StoryInteractionTypeType() string { + return TypeStoryInteractionTypeView +} + +func (storyInteractionTypeView *StoryInteractionTypeView) UnmarshalJSON(data []byte) error { + var tmp struct { + ChosenReactionType json.RawMessage `json:"chosen_reaction_type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldChosenReactionType, _ := UnmarshalReactionType(tmp.ChosenReactionType) + storyInteractionTypeView.ChosenReactionType = fieldChosenReactionType + + return nil +} + +// A forward of the story as a message +type StoryInteractionTypeForward struct { + meta + // The message with story forward Message *Message `json:"message"` } -func (entity *StoryPublicForwardMessage) MarshalJSON() ([]byte, error) { +func (entity *StoryInteractionTypeForward) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub StoryPublicForwardMessage + type stub StoryInteractionTypeForward return json.Marshal((*stub)(entity)) } -func (*StoryPublicForwardMessage) GetClass() string { - return ClassStoryPublicForward +func (*StoryInteractionTypeForward) GetClass() string { + return ClassStoryInteractionType } -func (*StoryPublicForwardMessage) GetType() string { - return TypeStoryPublicForwardMessage +func (*StoryInteractionTypeForward) GetType() string { + return TypeStoryInteractionTypeForward } -func (*StoryPublicForwardMessage) StoryPublicForwardType() string { - return TypeStoryPublicForwardMessage +func (*StoryInteractionTypeForward) StoryInteractionTypeType() string { + return TypeStoryInteractionTypeForward } -// Contains a public repost of a story as a story -type StoryPublicForwardStory struct { +// A repost of the story as a story +type StoryInteractionTypeRepost struct { meta - // Information about the reposted story + // The reposted story Story *Story `json:"story"` } -func (entity *StoryPublicForwardStory) MarshalJSON() ([]byte, error) { +func (entity *StoryInteractionTypeRepost) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub StoryPublicForwardStory + type stub StoryInteractionTypeRepost return json.Marshal((*stub)(entity)) } -func (*StoryPublicForwardStory) GetClass() string { - return ClassStoryPublicForward +func (*StoryInteractionTypeRepost) GetClass() string { + return ClassStoryInteractionType } -func (*StoryPublicForwardStory) GetType() string { - return TypeStoryPublicForwardStory +func (*StoryInteractionTypeRepost) GetType() string { + return TypeStoryInteractionTypeRepost } -func (*StoryPublicForwardStory) StoryPublicForwardType() string { - return TypeStoryPublicForwardStory +func (*StoryInteractionTypeRepost) StoryInteractionTypeType() string { + return TypeStoryInteractionTypeRepost } -// Represents a list of public forwards and reposts of a story -type StoryPublicForwards struct { +// Represents interaction with a story +type StoryInteraction struct { meta - // Approximate total number of messages and stories found + // Identifier of the user or chat that made the interaction + ActorId MessageSender `json:"actor_id"` + // Approximate point in time (Unix timestamp) when the interaction happened + InteractionDate int32 `json:"interaction_date"` + // Block list to which the actor is added; may be null if none or for chat stories + BlockList BlockList `json:"block_list"` + // Type of the interaction + Type StoryInteractionType `json:"type"` +} + +func (entity *StoryInteraction) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryInteraction + + return json.Marshal((*stub)(entity)) +} + +func (*StoryInteraction) GetClass() string { + return ClassStoryInteraction +} + +func (*StoryInteraction) GetType() string { + return TypeStoryInteraction +} + +func (storyInteraction *StoryInteraction) UnmarshalJSON(data []byte) error { + var tmp struct { + ActorId json.RawMessage `json:"actor_id"` + InteractionDate int32 `json:"interaction_date"` + BlockList json.RawMessage `json:"block_list"` + Type json.RawMessage `json:"type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + storyInteraction.InteractionDate = tmp.InteractionDate + + fieldActorId, _ := UnmarshalMessageSender(tmp.ActorId) + storyInteraction.ActorId = fieldActorId + + fieldBlockList, _ := UnmarshalBlockList(tmp.BlockList) + storyInteraction.BlockList = fieldBlockList + + fieldType, _ := UnmarshalStoryInteractionType(tmp.Type) + storyInteraction.Type = fieldType + + return nil +} + +// Represents a list of interactions with a story +type StoryInteractions struct { + meta + // Approximate total number of interactions found TotalCount int32 `json:"total_count"` - // List of found public forwards and reposts - Forwards []StoryPublicForward `json:"forwards"` + // Approximate total number of found forwards and reposts; always 0 for chat stories + TotalForwardCount int32 `json:"total_forward_count"` + // Approximate total number of found reactions; always 0 for chat stories + TotalReactionCount int32 `json:"total_reaction_count"` + // List of story interactions + Interactions []*StoryInteraction `json:"interactions"` // The offset for the next request. If empty, then there are no more results NextOffset string `json:"next_offset"` } -func (entity *StoryPublicForwards) MarshalJSON() ([]byte, error) { +func (entity *StoryInteractions) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub StoryPublicForwards + type stub StoryInteractions return json.Marshal((*stub)(entity)) } -func (*StoryPublicForwards) GetClass() string { - return ClassStoryPublicForwards +func (*StoryInteractions) GetClass() string { + return ClassStoryInteractions } -func (*StoryPublicForwards) GetType() string { - return TypeStoryPublicForwards +func (*StoryInteractions) GetType() string { + return TypeStoryInteractions } -func (storyPublicForwards *StoryPublicForwards) UnmarshalJSON(data []byte) error { +// Contains a public forward as a message +type PublicForwardMessage struct { + meta + // Information about the message + Message *Message `json:"message"` +} + +func (entity *PublicForwardMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PublicForwardMessage + + return json.Marshal((*stub)(entity)) +} + +func (*PublicForwardMessage) GetClass() string { + return ClassPublicForward +} + +func (*PublicForwardMessage) GetType() string { + return TypePublicForwardMessage +} + +func (*PublicForwardMessage) PublicForwardType() string { + return TypePublicForwardMessage +} + +// Contains a public repost to a story +type PublicForwardStory struct { + meta + // Information about the story + Story *Story `json:"story"` +} + +func (entity *PublicForwardStory) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PublicForwardStory + + return json.Marshal((*stub)(entity)) +} + +func (*PublicForwardStory) GetClass() string { + return ClassPublicForward +} + +func (*PublicForwardStory) GetType() string { + return TypePublicForwardStory +} + +func (*PublicForwardStory) PublicForwardType() string { + return TypePublicForwardStory +} + +// Represents a list of public forwards and reposts as a story of a message or a story +type PublicForwards struct { + meta + // Approximate total number of messages and stories found + TotalCount int32 `json:"total_count"` + // List of found public forwards and reposts + Forwards []PublicForward `json:"forwards"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` +} + +func (entity *PublicForwards) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PublicForwards + + return json.Marshal((*stub)(entity)) +} + +func (*PublicForwards) GetClass() string { + return ClassPublicForwards +} + +func (*PublicForwards) GetType() string { + return TypePublicForwards +} + +func (publicForwards *PublicForwards) UnmarshalJSON(data []byte) error { var tmp struct { TotalCount int32 `json:"total_count"` Forwards []json.RawMessage `json:"forwards"` @@ -24847,15 +25128,81 @@ func (storyPublicForwards *StoryPublicForwards) UnmarshalJSON(data []byte) error return err } - storyPublicForwards.TotalCount = tmp.TotalCount - storyPublicForwards.NextOffset = tmp.NextOffset + publicForwards.TotalCount = tmp.TotalCount + publicForwards.NextOffset = tmp.NextOffset - fieldForwards, _ := UnmarshalListOfStoryPublicForward(tmp.Forwards) - storyPublicForwards.Forwards = fieldForwards + fieldForwards, _ := UnmarshalListOfPublicForward(tmp.Forwards) + publicForwards.Forwards = fieldForwards return nil } +// Contains a list of features available on a specific chat boost level +type ChatBoostLevelFeatures struct { + meta + // Target chat boost level + Level int32 `json:"level"` + // Number of stories that the chat can publish daily + StoryPerDayCount int32 `json:"story_per_day_count"` + // Number of custom emoji reactions that can be added to the list of available reactions + CustomEmojiReactionCount int32 `json:"custom_emoji_reaction_count"` + // Number of custom colors for chat title + TitleColorCount int32 `json:"title_color_count"` + // Number of custom colors for profile photo background + ProfileAccentColorCount int32 `json:"profile_accent_color_count"` + // True, if custom emoji for profile background can be set + CanSetProfileBackgroundCustomEmoji bool `json:"can_set_profile_background_custom_emoji"` + // Number of custom colors for background of empty chat photo, replies to messages and link previews + AccentColorCount int32 `json:"accent_color_count"` + // True, if custom emoji for reply header and link preview background can be set + CanSetBackgroundCustomEmoji bool `json:"can_set_background_custom_emoji"` + // True, if emoji status can be set + CanSetEmojiStatus bool `json:"can_set_emoji_status"` + // Number of chat theme backgrounds that can be set as chat background + ChatThemeBackgroundCount int32 `json:"chat_theme_background_count"` + // True, if custom background can be set in the chat for all users + CanSetCustomBackground bool `json:"can_set_custom_background"` +} + +func (entity *ChatBoostLevelFeatures) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatBoostLevelFeatures + + return json.Marshal((*stub)(entity)) +} + +func (*ChatBoostLevelFeatures) GetClass() string { + return ClassChatBoostLevelFeatures +} + +func (*ChatBoostLevelFeatures) GetType() string { + return TypeChatBoostLevelFeatures +} + +// Contains a list of features available on the first chat boost levels +type ChatBoostFeatures struct { + meta + // The list of features + Features []*ChatBoostLevelFeatures `json:"features"` +} + +func (entity *ChatBoostFeatures) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatBoostFeatures + + return json.Marshal((*stub)(entity)) +} + +func (*ChatBoostFeatures) GetClass() string { + return ClassChatBoostFeatures +} + +func (*ChatBoostFeatures) GetType() string { + return TypeChatBoostFeatures +} + // The chat created a Telegram Premium gift code for a user type ChatBoostSourceGiftCode struct { meta @@ -24952,7 +25299,7 @@ type PrepaidPremiumGiveaway struct { Id JsonInt64 `json:"id"` // Number of users which will receive Telegram Premium subscription gift codes WinnerCount int32 `json:"winner_count"` - // Number of month the Telegram Premium subscription will be active after code activation + // Number of months the Telegram Premium subscription will be active after code activation MonthCount int32 `json:"month_count"` // Point in time (Unix timestamp) when the giveaway was paid PaymentDate int32 `json:"payment_date"` @@ -29192,6 +29539,35 @@ func (chatEventAvailableReactionsChanged *ChatEventAvailableReactionsChanged) Un return nil } +// The chat background was changed +type ChatEventBackgroundChanged struct { + meta + // Previous background; may be null if none + OldBackground *ChatBackground `json:"old_background"` + // New background; may be null if none + NewBackground *ChatBackground `json:"new_background"` +} + +func (entity *ChatEventBackgroundChanged) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventBackgroundChanged + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventBackgroundChanged) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventBackgroundChanged) GetType() string { + return TypeChatEventBackgroundChanged +} + +func (*ChatEventBackgroundChanged) ChatEventActionType() string { + return TypeChatEventBackgroundChanged +} + // The chat description was changed type ChatEventDescriptionChanged struct { meta @@ -29221,6 +29597,35 @@ func (*ChatEventDescriptionChanged) ChatEventActionType() string { return TypeChatEventDescriptionChanged } +// The chat emoji status was changed +type ChatEventEmojiStatusChanged struct { + meta + // Previous emoji status; may be null if none + OldEmojiStatus *EmojiStatus `json:"old_emoji_status"` + // New emoji status; may be null if none + NewEmojiStatus *EmojiStatus `json:"new_emoji_status"` +} + +func (entity *ChatEventEmojiStatusChanged) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventEmojiStatusChanged + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventEmojiStatusChanged) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventEmojiStatusChanged) GetType() string { + return TypeChatEventEmojiStatusChanged +} + +func (*ChatEventEmojiStatusChanged) ChatEventActionType() string { + return TypeChatEventEmojiStatusChanged +} + // The linked chat of a supergroup was changed type ChatEventLinkedChatChanged struct { meta @@ -29511,13 +29916,17 @@ func (*ChatEventActiveUsernamesChanged) ChatEventActionType() string { return TypeChatEventActiveUsernamesChanged } -// The chat accent color was changed +// The chat accent color or background custom emoji were changed type ChatEventAccentColorChanged struct { meta // Previous identifier of chat accent color OldAccentColorId int32 `json:"old_accent_color_id"` + // Previous identifier of the custom emoji; 0 if none + OldBackgroundCustomEmojiId JsonInt64 `json:"old_background_custom_emoji_id"` // New identifier of chat accent color NewAccentColorId int32 `json:"new_accent_color_id"` + // New identifier of the custom emoji; 0 if none + NewBackgroundCustomEmojiId JsonInt64 `json:"new_background_custom_emoji_id"` } func (entity *ChatEventAccentColorChanged) MarshalJSON() ([]byte, error) { @@ -29540,33 +29949,37 @@ func (*ChatEventAccentColorChanged) ChatEventActionType() string { return TypeChatEventAccentColorChanged } -// The chat's custom emoji for reply background was changed -type ChatEventBackgroundCustomEmojiChanged struct { +// The chat's profile accent color or profile background custom emoji were changed +type ChatEventProfileAccentColorChanged struct { meta + // Previous identifier of chat's profile accent color; -1 if none + OldProfileAccentColorId int32 `json:"old_profile_accent_color_id"` // Previous identifier of the custom emoji; 0 if none - OldBackgroundCustomEmojiId JsonInt64 `json:"old_background_custom_emoji_id"` + OldProfileBackgroundCustomEmojiId JsonInt64 `json:"old_profile_background_custom_emoji_id"` + // New identifier of chat's profile accent color; -1 if none + NewProfileAccentColorId int32 `json:"new_profile_accent_color_id"` // New identifier of the custom emoji; 0 if none - NewBackgroundCustomEmojiId JsonInt64 `json:"new_background_custom_emoji_id"` + NewProfileBackgroundCustomEmojiId JsonInt64 `json:"new_profile_background_custom_emoji_id"` } -func (entity *ChatEventBackgroundCustomEmojiChanged) MarshalJSON() ([]byte, error) { +func (entity *ChatEventProfileAccentColorChanged) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ChatEventBackgroundCustomEmojiChanged + type stub ChatEventProfileAccentColorChanged return json.Marshal((*stub)(entity)) } -func (*ChatEventBackgroundCustomEmojiChanged) GetClass() string { +func (*ChatEventProfileAccentColorChanged) GetClass() string { return ClassChatEventAction } -func (*ChatEventBackgroundCustomEmojiChanged) GetType() string { - return TypeChatEventBackgroundCustomEmojiChanged +func (*ChatEventProfileAccentColorChanged) GetType() string { + return TypeChatEventProfileAccentColorChanged } -func (*ChatEventBackgroundCustomEmojiChanged) ChatEventActionType() string { - return TypeChatEventBackgroundCustomEmojiChanged +func (*ChatEventProfileAccentColorChanged) ChatEventActionType() string { + return TypeChatEventProfileAccentColorChanged } // The has_protected_content setting of a channel was toggled @@ -32067,7 +32480,7 @@ type TelegramPaymentPurposePremiumGiftCodes struct { Amount int64 `json:"amount"` // Identifiers of the users which can activate the gift codes UserIds []int64 `json:"user_ids"` - // Number of month the Telegram Premium subscription will be active for the users + // Number of months the Telegram Premium subscription will be active for the users MonthCount int32 `json:"month_count"` } @@ -32102,7 +32515,7 @@ type TelegramPaymentPurposePremiumGiveaway struct { Amount int64 `json:"amount"` // Number of users which will be able to activate the gift codes WinnerCount int32 `json:"winner_count"` - // Number of month the Telegram Premium subscription will be active for the users + // Number of months the Telegram Premium subscription will be active for the users MonthCount int32 `json:"month_count"` } @@ -32700,6 +33113,33 @@ func (backgroundTypeFill *BackgroundTypeFill) UnmarshalJSON(data []byte) error { return nil } +// A background from a chat theme; can be used only as a chat background in channels +type BackgroundTypeChatTheme struct { + meta + // Name of the chat theme + ThemeName string `json:"theme_name"` +} + +func (entity *BackgroundTypeChatTheme) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BackgroundTypeChatTheme + + return json.Marshal((*stub)(entity)) +} + +func (*BackgroundTypeChatTheme) GetClass() string { + return ClassBackgroundType +} + +func (*BackgroundTypeChatTheme) GetType() string { + return TypeBackgroundTypeChatTheme +} + +func (*BackgroundTypeChatTheme) BackgroundTypeType() string { + return TypeBackgroundTypeChatTheme +} + // A background from a local file type InputBackgroundLocal struct { meta @@ -33899,7 +34339,7 @@ func (*PushMessageContentPoll) PushMessageContentType() string { // A message with a Telegram Premium gift code created for the user type PushMessageContentPremiumGiftCode struct { meta - // Number of month the Telegram Premium subscription will be active after code activation + // Number of months the Telegram Premium subscription will be active after code activation MonthCount int32 `json:"month_count"` } @@ -33928,7 +34368,7 @@ type PushMessageContentPremiumGiveaway struct { meta // Number of users which will receive Telegram Premium subscription gift codes; 0 for pinned message WinnerCount int32 `json:"winner_count"` - // Number of month the Telegram Premium subscription will be active after code activation; 0 for pinned message + // Number of months the Telegram Premium subscription will be active after code activation; 0 for pinned message MonthCount int32 `json:"month_count"` // True, if the message is a pinned message with the specified content IsPinned bool `json:"is_pinned"` @@ -37583,6 +38023,33 @@ func (*InternalLinkTypePremiumFeatures) InternalLinkTypeType() string { return TypeInternalLinkTypePremiumFeatures } +// The link is a link to the screen for gifting Telegram Premium subscriptions to friends +type InternalLinkTypePremiumGift struct { + meta + // Referrer specified in the link + Referrer string `json:"referrer"` +} + +func (entity *InternalLinkTypePremiumGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypePremiumGift + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypePremiumGift) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypePremiumGift) GetType() string { + return TypeInternalLinkTypePremiumGift +} + +func (*InternalLinkTypePremiumGift) InternalLinkTypeType() string { + return TypeInternalLinkTypePremiumGift +} + // The link is a link with a Telegram Premium gift code. Call checkPremiumGiftCode with the given code to process the link. If the code is valid and the user wants to apply it, then call applyPremiumGiftCode type InternalLinkTypePremiumGiftCode struct { meta @@ -40194,6 +40661,31 @@ func (*SuggestedActionSubscribeToAnnualPremium) SuggestedActionType() string { return TypeSuggestedActionSubscribeToAnnualPremium } +// Suggests the user to gift Telegram Premium to friends for Christmas +type SuggestedActionGiftPremiumForChristmas struct{ + meta +} + +func (entity *SuggestedActionGiftPremiumForChristmas) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedActionGiftPremiumForChristmas + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedActionGiftPremiumForChristmas) GetClass() string { + return ClassSuggestedAction +} + +func (*SuggestedActionGiftPremiumForChristmas) GetType() string { + return TypeSuggestedActionGiftPremiumForChristmas +} + +func (*SuggestedActionGiftPremiumForChristmas) SuggestedActionType() string { + return TypeSuggestedActionGiftPremiumForChristmas +} + // Contains a counter type Count struct { meta @@ -42067,62 +42559,39 @@ func (*UpdateChatPhoto) UpdateType() string { return TypeUpdateChatPhoto } -// A chat accent color has changed -type UpdateChatAccentColor struct { +// Chat accent colors have changed +type UpdateChatAccentColors struct { meta // Chat identifier ChatId int64 `json:"chat_id"` // The new chat accent color identifier AccentColorId int32 `json:"accent_color_id"` -} - -func (entity *UpdateChatAccentColor) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub UpdateChatAccentColor - - return json.Marshal((*stub)(entity)) -} - -func (*UpdateChatAccentColor) GetClass() string { - return ClassUpdate -} - -func (*UpdateChatAccentColor) GetType() string { - return TypeUpdateChatAccentColor -} - -func (*UpdateChatAccentColor) UpdateType() string { - return TypeUpdateChatAccentColor -} - -// A chat's custom emoji for reply background has changed -type UpdateChatBackgroundCustomEmoji struct { - meta - // Chat identifier - ChatId int64 `json:"chat_id"` - // The new identifier of a custom emoji to be shown on the reply header background; 0 if none + // The new identifier of a custom emoji to be shown on the reply header and link preview background; 0 if none BackgroundCustomEmojiId JsonInt64 `json:"background_custom_emoji_id"` + // The new chat profile accent color identifier; -1 if none + ProfileAccentColorId int32 `json:"profile_accent_color_id"` + // The new identifier of a custom emoji to be shown on the profile background; 0 if none + ProfileBackgroundCustomEmojiId JsonInt64 `json:"profile_background_custom_emoji_id"` } -func (entity *UpdateChatBackgroundCustomEmoji) MarshalJSON() ([]byte, error) { +func (entity *UpdateChatAccentColors) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub UpdateChatBackgroundCustomEmoji + type stub UpdateChatAccentColors return json.Marshal((*stub)(entity)) } -func (*UpdateChatBackgroundCustomEmoji) GetClass() string { +func (*UpdateChatAccentColors) GetClass() string { return ClassUpdate } -func (*UpdateChatBackgroundCustomEmoji) GetType() string { - return TypeUpdateChatBackgroundCustomEmoji +func (*UpdateChatAccentColors) GetType() string { + return TypeUpdateChatAccentColors } -func (*UpdateChatBackgroundCustomEmoji) UpdateType() string { - return TypeUpdateChatBackgroundCustomEmoji +func (*UpdateChatAccentColors) UpdateType() string { + return TypeUpdateChatAccentColors } // Chat permissions were changed @@ -42401,6 +42870,35 @@ func (*UpdateChatDraftMessage) UpdateType() string { return TypeUpdateChatDraftMessage } +// Chat emoji status has changed +type UpdateChatEmojiStatus struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // The new chat emoji status; may be null + EmojiStatus *EmojiStatus `json:"emoji_status"` +} + +func (entity *UpdateChatEmojiStatus) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateChatEmojiStatus + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateChatEmojiStatus) GetClass() string { + return ClassUpdate +} + +func (*UpdateChatEmojiStatus) GetType() string { + return TypeUpdateChatEmojiStatus +} + +func (*UpdateChatEmojiStatus) UpdateType() string { + return TypeUpdateChatEmojiStatus +} + // The message sender that is selected to send messages in a chat has changed type UpdateChatMessageSender struct { meta @@ -44613,33 +45111,33 @@ func (*UpdateSavedNotificationSounds) UpdateType() string { return TypeUpdateSavedNotificationSounds } -// The selected background has changed -type UpdateSelectedBackground struct { +// The default background has changed +type UpdateDefaultBackground struct { meta - // True, if background for dark theme has changed + // True, if default background for dark theme has changed ForDarkTheme bool `json:"for_dark_theme"` - // The new selected background; may be null + // The new default background; may be null Background *Background `json:"background"` } -func (entity *UpdateSelectedBackground) MarshalJSON() ([]byte, error) { +func (entity *UpdateDefaultBackground) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub UpdateSelectedBackground + type stub UpdateDefaultBackground return json.Marshal((*stub)(entity)) } -func (*UpdateSelectedBackground) GetClass() string { +func (*UpdateDefaultBackground) GetClass() string { return ClassUpdate } -func (*UpdateSelectedBackground) GetType() string { - return TypeUpdateSelectedBackground +func (*UpdateDefaultBackground) GetType() string { + return TypeUpdateDefaultBackground } -func (*UpdateSelectedBackground) UpdateType() string { - return TypeUpdateSelectedBackground +func (*UpdateDefaultBackground) UpdateType() string { + return TypeUpdateDefaultBackground } // The list of available chat themes has changed @@ -44703,7 +45201,7 @@ type UpdateProfileAccentColors struct { meta // Information about supported colors Colors []*ProfileAccentColor `json:"colors"` - // The list of accent color identifiers, which can be set through setProfileAccentColor. The colors must be shown in the specififed order + // The list of accent color identifiers, which can be set through setProfileAccentColor and setChatProfileAccentColor. The colors must be shown in the specififed order AvailableAccentColorIds []int32 `json:"available_accent_color_ids"` } @@ -45787,6 +46285,107 @@ func (*UpdateChatBoost) UpdateType() string { return TypeUpdateChatBoost } +// User changed its reactions on a message with public reactions; for bots only +type UpdateMessageReaction struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // Message identifier + MessageId int64 `json:"message_id"` + // Identifier of the user or chat that changed reactions + ActorId MessageSender `json:"actor_id"` + // Point in time (Unix timestamp) when the reactions were changed + Date int32 `json:"date"` + // Old list of chosen reactions + OldReactionTypes []ReactionType `json:"old_reaction_types"` + // New list of chosen reactions + NewReactionTypes []ReactionType `json:"new_reaction_types"` +} + +func (entity *UpdateMessageReaction) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateMessageReaction + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateMessageReaction) GetClass() string { + return ClassUpdate +} + +func (*UpdateMessageReaction) GetType() string { + return TypeUpdateMessageReaction +} + +func (*UpdateMessageReaction) UpdateType() string { + return TypeUpdateMessageReaction +} + +func (updateMessageReaction *UpdateMessageReaction) UnmarshalJSON(data []byte) error { + var tmp struct { + ChatId int64 `json:"chat_id"` + MessageId int64 `json:"message_id"` + ActorId json.RawMessage `json:"actor_id"` + Date int32 `json:"date"` + OldReactionTypes []json.RawMessage `json:"old_reaction_types"` + NewReactionTypes []json.RawMessage `json:"new_reaction_types"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + updateMessageReaction.ChatId = tmp.ChatId + updateMessageReaction.MessageId = tmp.MessageId + updateMessageReaction.Date = tmp.Date + + fieldActorId, _ := UnmarshalMessageSender(tmp.ActorId) + updateMessageReaction.ActorId = fieldActorId + + fieldOldReactionTypes, _ := UnmarshalListOfReactionType(tmp.OldReactionTypes) + updateMessageReaction.OldReactionTypes = fieldOldReactionTypes + + fieldNewReactionTypes, _ := UnmarshalListOfReactionType(tmp.NewReactionTypes) + updateMessageReaction.NewReactionTypes = fieldNewReactionTypes + + return nil +} + +// Reactions added to a message with anonymous reactions have changed; for bots only +type UpdateMessageReactions struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // Message identifier + MessageId int64 `json:"message_id"` + // Point in time (Unix timestamp) when the reactions were changed + Date int32 `json:"date"` + // The list of reactions added to the message + Reactions []*MessageReaction `json:"reactions"` +} + +func (entity *UpdateMessageReactions) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateMessageReactions + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateMessageReactions) GetClass() string { + return ClassUpdate +} + +func (*UpdateMessageReactions) GetType() string { + return TypeUpdateMessageReactions +} + +func (*UpdateMessageReactions) UpdateType() string { + return TypeUpdateMessageReactions +} + // Contains a list of updates type Updates struct { meta diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 08fb7f7..c66335e 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -1477,8 +1477,8 @@ func UnmarshalKeyboardButtonType(data json.RawMessage) (KeyboardButtonType, erro case TypeKeyboardButtonTypeRequestPoll: return UnmarshalKeyboardButtonTypeRequestPoll(data) - case TypeKeyboardButtonTypeRequestUser: - return UnmarshalKeyboardButtonTypeRequestUser(data) + case TypeKeyboardButtonTypeRequestUsers: + return UnmarshalKeyboardButtonTypeRequestUsers(data) case TypeKeyboardButtonTypeRequestChat: return UnmarshalKeyboardButtonTypeRequestChat(data) @@ -2541,11 +2541,14 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessagePremiumGiveawayCompleted: return UnmarshalMessagePremiumGiveawayCompleted(data) + case TypeMessagePremiumGiveawayWinners: + return UnmarshalMessagePremiumGiveawayWinners(data) + case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) - case TypeMessageUserShared: - return UnmarshalMessageUserShared(data) + case TypeMessageUsersShared: + return UnmarshalMessageUsersShared(data) case TypeMessageChatShared: return UnmarshalMessageChatShared(data) @@ -3084,6 +3087,9 @@ func UnmarshalStoryAreaType(data json.RawMessage) (StoryAreaType, error) { case TypeStoryAreaTypeSuggestedReaction: return UnmarshalStoryAreaTypeSuggestedReaction(data) + case TypeStoryAreaTypeMessage: + return UnmarshalStoryAreaTypeMessage(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -3124,6 +3130,9 @@ func UnmarshalInputStoryAreaType(data json.RawMessage) (InputStoryAreaType, erro case TypeInputStoryAreaTypeSuggestedReaction: return UnmarshalInputStoryAreaTypeSuggestedReaction(data) + case TypeInputStoryAreaTypeMessage: + return UnmarshalInputStoryAreaTypeMessage(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -3282,7 +3291,7 @@ func UnmarshalListOfStoryOrigin(dataList []json.RawMessage) ([]StoryOrigin, erro return list, nil } -func UnmarshalStoryPublicForward(data json.RawMessage) (StoryPublicForward, error) { +func UnmarshalStoryInteractionType(data json.RawMessage) (StoryInteractionType, error) { var meta meta err := json.Unmarshal(data, &meta) @@ -3291,22 +3300,59 @@ func UnmarshalStoryPublicForward(data json.RawMessage) (StoryPublicForward, erro } switch meta.Type { - case TypeStoryPublicForwardMessage: - return UnmarshalStoryPublicForwardMessage(data) + case TypeStoryInteractionTypeView: + return UnmarshalStoryInteractionTypeView(data) - case TypeStoryPublicForwardStory: - return UnmarshalStoryPublicForwardStory(data) + case TypeStoryInteractionTypeForward: + return UnmarshalStoryInteractionTypeForward(data) + + case TypeStoryInteractionTypeRepost: + return UnmarshalStoryInteractionTypeRepost(data) default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } } -func UnmarshalListOfStoryPublicForward(dataList []json.RawMessage) ([]StoryPublicForward, error) { - list := []StoryPublicForward{} +func UnmarshalListOfStoryInteractionType(dataList []json.RawMessage) ([]StoryInteractionType, error) { + list := []StoryInteractionType{} for _, data := range dataList { - entity, err := UnmarshalStoryPublicForward(data) + entity, err := UnmarshalStoryInteractionType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalPublicForward(data json.RawMessage) (PublicForward, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypePublicForwardMessage: + return UnmarshalPublicForwardMessage(data) + + case TypePublicForwardStory: + return UnmarshalPublicForwardStory(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfPublicForward(dataList []json.RawMessage) ([]PublicForward, error) { + list := []PublicForward{} + + for _, data := range dataList { + entity, err := UnmarshalPublicForward(data) if err != nil { return nil, err } @@ -3960,9 +4006,15 @@ func UnmarshalChatEventAction(data json.RawMessage) (ChatEventAction, error) { case TypeChatEventAvailableReactionsChanged: return UnmarshalChatEventAvailableReactionsChanged(data) + case TypeChatEventBackgroundChanged: + return UnmarshalChatEventBackgroundChanged(data) + case TypeChatEventDescriptionChanged: return UnmarshalChatEventDescriptionChanged(data) + case TypeChatEventEmojiStatusChanged: + return UnmarshalChatEventEmojiStatusChanged(data) + case TypeChatEventLinkedChatChanged: return UnmarshalChatEventLinkedChatChanged(data) @@ -3996,8 +4048,8 @@ func UnmarshalChatEventAction(data json.RawMessage) (ChatEventAction, error) { case TypeChatEventAccentColorChanged: return UnmarshalChatEventAccentColorChanged(data) - case TypeChatEventBackgroundCustomEmojiChanged: - return UnmarshalChatEventBackgroundCustomEmojiChanged(data) + case TypeChatEventProfileAccentColorChanged: + return UnmarshalChatEventProfileAccentColorChanged(data) case TypeChatEventHasProtectedContentToggled: return UnmarshalChatEventHasProtectedContentToggled(data) @@ -4564,6 +4616,9 @@ func UnmarshalBackgroundType(data json.RawMessage) (BackgroundType, error) { case TypeBackgroundTypeFill: return UnmarshalBackgroundTypeFill(data) + case TypeBackgroundTypeChatTheme: + return UnmarshalBackgroundTypeChatTheme(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -5564,6 +5619,9 @@ func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { case TypeInternalLinkTypePremiumFeatures: return UnmarshalInternalLinkTypePremiumFeatures(data) + case TypeInternalLinkTypePremiumGift: + return UnmarshalInternalLinkTypePremiumGift(data) + case TypeInternalLinkTypePremiumGiftCode: return UnmarshalInternalLinkTypePremiumGiftCode(data) @@ -6041,6 +6099,9 @@ func UnmarshalSuggestedAction(data json.RawMessage) (SuggestedAction, error) { case TypeSuggestedActionSubscribeToAnnualPremium: return UnmarshalSuggestedActionSubscribeToAnnualPremium(data) + case TypeSuggestedActionGiftPremiumForChristmas: + return UnmarshalSuggestedActionGiftPremiumForChristmas(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -6376,11 +6437,8 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateChatPhoto: return UnmarshalUpdateChatPhoto(data) - case TypeUpdateChatAccentColor: - return UnmarshalUpdateChatAccentColor(data) - - case TypeUpdateChatBackgroundCustomEmoji: - return UnmarshalUpdateChatBackgroundCustomEmoji(data) + case TypeUpdateChatAccentColors: + return UnmarshalUpdateChatAccentColors(data) case TypeUpdateChatPermissions: return UnmarshalUpdateChatPermissions(data) @@ -6406,6 +6464,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateChatDraftMessage: return UnmarshalUpdateChatDraftMessage(data) + case TypeUpdateChatEmojiStatus: + return UnmarshalUpdateChatEmojiStatus(data) + case TypeUpdateChatMessageSender: return UnmarshalUpdateChatMessageSender(data) @@ -6601,8 +6662,8 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateSavedNotificationSounds: return UnmarshalUpdateSavedNotificationSounds(data) - case TypeUpdateSelectedBackground: - return UnmarshalUpdateSelectedBackground(data) + case TypeUpdateDefaultBackground: + return UnmarshalUpdateDefaultBackground(data) case TypeUpdateChatThemes: return UnmarshalUpdateChatThemes(data) @@ -6700,6 +6761,12 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateChatBoost: return UnmarshalUpdateChatBoost(data) + case TypeUpdateMessageReaction: + return UnmarshalUpdateMessageReaction(data) + + case TypeUpdateMessageReactions: + return UnmarshalUpdateMessageReactions(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -9004,8 +9071,8 @@ func UnmarshalKeyboardButtonTypeRequestPoll(data json.RawMessage) (*KeyboardButt return &resp, err } -func UnmarshalKeyboardButtonTypeRequestUser(data json.RawMessage) (*KeyboardButtonTypeRequestUser, error) { - var resp KeyboardButtonTypeRequestUser +func UnmarshalKeyboardButtonTypeRequestUsers(data json.RawMessage) (*KeyboardButtonTypeRequestUsers, error) { + var resp KeyboardButtonTypeRequestUsers err := json.Unmarshal(data, &resp) @@ -10972,6 +11039,14 @@ func UnmarshalMessagePremiumGiveawayCompleted(data json.RawMessage) (*MessagePre return &resp, err } +func UnmarshalMessagePremiumGiveawayWinners(data json.RawMessage) (*MessagePremiumGiveawayWinners, error) { + var resp MessagePremiumGiveawayWinners + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageContactRegistered(data json.RawMessage) (*MessageContactRegistered, error) { var resp MessageContactRegistered @@ -10980,8 +11055,8 @@ func UnmarshalMessageContactRegistered(data json.RawMessage) (*MessageContactReg return &resp, err } -func UnmarshalMessageUserShared(data json.RawMessage) (*MessageUserShared, error) { - var resp MessageUserShared +func UnmarshalMessageUsersShared(data json.RawMessage) (*MessageUsersShared, error) { + var resp MessageUsersShared err := json.Unmarshal(data, &resp) @@ -11812,22 +11887,6 @@ func UnmarshalEmojiCategoryTypeChatPhoto(data json.RawMessage) (*EmojiCategoryTy return &resp, err } -func UnmarshalStoryViewer(data json.RawMessage) (*StoryViewer, error) { - var resp StoryViewer - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalStoryViewers(data json.RawMessage) (*StoryViewers, error) { - var resp StoryViewers - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - func UnmarshalStoryAreaPosition(data json.RawMessage) (*StoryAreaPosition, error) { var resp StoryAreaPosition @@ -11860,6 +11919,14 @@ func UnmarshalStoryAreaTypeSuggestedReaction(data json.RawMessage) (*StoryAreaTy return &resp, err } +func UnmarshalStoryAreaTypeMessage(data json.RawMessage) (*StoryAreaTypeMessage, error) { + var resp StoryAreaTypeMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStoryArea(data json.RawMessage) (*StoryArea, error) { var resp StoryArea @@ -11900,6 +11967,14 @@ func UnmarshalInputStoryAreaTypeSuggestedReaction(data json.RawMessage) (*InputS return &resp, err } +func UnmarshalInputStoryAreaTypeMessage(data json.RawMessage) (*InputStoryAreaTypeMessage, error) { + var resp InputStoryAreaTypeMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInputStoryArea(data json.RawMessage) (*InputStoryArea, error) { var resp InputStoryArea @@ -12052,24 +12127,80 @@ func UnmarshalChatActiveStories(data json.RawMessage) (*ChatActiveStories, error return &resp, err } -func UnmarshalStoryPublicForwardMessage(data json.RawMessage) (*StoryPublicForwardMessage, error) { - var resp StoryPublicForwardMessage +func UnmarshalStoryInteractionTypeView(data json.RawMessage) (*StoryInteractionTypeView, error) { + var resp StoryInteractionTypeView err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStoryPublicForwardStory(data json.RawMessage) (*StoryPublicForwardStory, error) { - var resp StoryPublicForwardStory +func UnmarshalStoryInteractionTypeForward(data json.RawMessage) (*StoryInteractionTypeForward, error) { + var resp StoryInteractionTypeForward err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStoryPublicForwards(data json.RawMessage) (*StoryPublicForwards, error) { - var resp StoryPublicForwards +func UnmarshalStoryInteractionTypeRepost(data json.RawMessage) (*StoryInteractionTypeRepost, error) { + var resp StoryInteractionTypeRepost + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryInteraction(data json.RawMessage) (*StoryInteraction, error) { + var resp StoryInteraction + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryInteractions(data json.RawMessage) (*StoryInteractions, error) { + var resp StoryInteractions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPublicForwardMessage(data json.RawMessage) (*PublicForwardMessage, error) { + var resp PublicForwardMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPublicForwardStory(data json.RawMessage) (*PublicForwardStory, error) { + var resp PublicForwardStory + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPublicForwards(data json.RawMessage) (*PublicForwards, error) { + var resp PublicForwards + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatBoostLevelFeatures(data json.RawMessage) (*ChatBoostLevelFeatures, error) { + var resp ChatBoostLevelFeatures + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatBoostFeatures(data json.RawMessage) (*ChatBoostFeatures, error) { + var resp ChatBoostFeatures err := json.Unmarshal(data, &resp) @@ -13028,6 +13159,14 @@ func UnmarshalChatEventAvailableReactionsChanged(data json.RawMessage) (*ChatEve return &resp, err } +func UnmarshalChatEventBackgroundChanged(data json.RawMessage) (*ChatEventBackgroundChanged, error) { + var resp ChatEventBackgroundChanged + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatEventDescriptionChanged(data json.RawMessage) (*ChatEventDescriptionChanged, error) { var resp ChatEventDescriptionChanged @@ -13036,6 +13175,14 @@ func UnmarshalChatEventDescriptionChanged(data json.RawMessage) (*ChatEventDescr return &resp, err } +func UnmarshalChatEventEmojiStatusChanged(data json.RawMessage) (*ChatEventEmojiStatusChanged, error) { + var resp ChatEventEmojiStatusChanged + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatEventLinkedChatChanged(data json.RawMessage) (*ChatEventLinkedChatChanged, error) { var resp ChatEventLinkedChatChanged @@ -13124,8 +13271,8 @@ func UnmarshalChatEventAccentColorChanged(data json.RawMessage) (*ChatEventAccen return &resp, err } -func UnmarshalChatEventBackgroundCustomEmojiChanged(data json.RawMessage) (*ChatEventBackgroundCustomEmojiChanged, error) { - var resp ChatEventBackgroundCustomEmojiChanged +func UnmarshalChatEventProfileAccentColorChanged(data json.RawMessage) (*ChatEventProfileAccentColorChanged, error) { + var resp ChatEventProfileAccentColorChanged err := json.Unmarshal(data, &resp) @@ -13988,6 +14135,14 @@ func UnmarshalBackgroundTypeFill(data json.RawMessage) (*BackgroundTypeFill, err return &resp, err } +func UnmarshalBackgroundTypeChatTheme(data json.RawMessage) (*BackgroundTypeChatTheme, error) { + var resp BackgroundTypeChatTheme + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInputBackgroundLocal(data json.RawMessage) (*InputBackgroundLocal, error) { var resp InputBackgroundLocal @@ -15364,6 +15519,14 @@ func UnmarshalInternalLinkTypePremiumFeatures(data json.RawMessage) (*InternalLi return &resp, err } +func UnmarshalInternalLinkTypePremiumGift(data json.RawMessage) (*InternalLinkTypePremiumGift, error) { + var resp InternalLinkTypePremiumGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInternalLinkTypePremiumGiftCode(data json.RawMessage) (*InternalLinkTypePremiumGiftCode, error) { var resp InternalLinkTypePremiumGiftCode @@ -16124,6 +16287,14 @@ func UnmarshalSuggestedActionSubscribeToAnnualPremium(data json.RawMessage) (*Su return &resp, err } +func UnmarshalSuggestedActionGiftPremiumForChristmas(data json.RawMessage) (*SuggestedActionGiftPremiumForChristmas, error) { + var resp SuggestedActionGiftPremiumForChristmas + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalCount(data json.RawMessage) (*Count, error) { var resp Count @@ -16556,16 +16727,8 @@ func UnmarshalUpdateChatPhoto(data json.RawMessage) (*UpdateChatPhoto, error) { return &resp, err } -func UnmarshalUpdateChatAccentColor(data json.RawMessage) (*UpdateChatAccentColor, error) { - var resp UpdateChatAccentColor - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalUpdateChatBackgroundCustomEmoji(data json.RawMessage) (*UpdateChatBackgroundCustomEmoji, error) { - var resp UpdateChatBackgroundCustomEmoji +func UnmarshalUpdateChatAccentColors(data json.RawMessage) (*UpdateChatAccentColors, error) { + var resp UpdateChatAccentColors err := json.Unmarshal(data, &resp) @@ -16636,6 +16799,14 @@ func UnmarshalUpdateChatDraftMessage(data json.RawMessage) (*UpdateChatDraftMess return &resp, err } +func UnmarshalUpdateChatEmojiStatus(data json.RawMessage) (*UpdateChatEmojiStatus, error) { + var resp UpdateChatEmojiStatus + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateChatMessageSender(data json.RawMessage) (*UpdateChatMessageSender, error) { var resp UpdateChatMessageSender @@ -17156,8 +17327,8 @@ func UnmarshalUpdateSavedNotificationSounds(data json.RawMessage) (*UpdateSavedN return &resp, err } -func UnmarshalUpdateSelectedBackground(data json.RawMessage) (*UpdateSelectedBackground, error) { - var resp UpdateSelectedBackground +func UnmarshalUpdateDefaultBackground(data json.RawMessage) (*UpdateDefaultBackground, error) { + var resp UpdateDefaultBackground err := json.Unmarshal(data, &resp) @@ -17420,6 +17591,22 @@ func UnmarshalUpdateChatBoost(data json.RawMessage) (*UpdateChatBoost, error) { return &resp, err } +func UnmarshalUpdateMessageReaction(data json.RawMessage) (*UpdateMessageReaction, error) { + var resp UpdateMessageReaction + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateMessageReactions(data json.RawMessage) (*UpdateMessageReactions, error) { + var resp UpdateMessageReactions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdates(data json.RawMessage) (*Updates, error) { var resp Updates @@ -18384,8 +18571,8 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeKeyboardButtonTypeRequestPoll: return UnmarshalKeyboardButtonTypeRequestPoll(data) - case TypeKeyboardButtonTypeRequestUser: - return UnmarshalKeyboardButtonTypeRequestUser(data) + case TypeKeyboardButtonTypeRequestUsers: + return UnmarshalKeyboardButtonTypeRequestUsers(data) case TypeKeyboardButtonTypeRequestChat: return UnmarshalKeyboardButtonTypeRequestChat(data) @@ -19122,11 +19309,14 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessagePremiumGiveawayCompleted: return UnmarshalMessagePremiumGiveawayCompleted(data) + case TypeMessagePremiumGiveawayWinners: + return UnmarshalMessagePremiumGiveawayWinners(data) + case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) - case TypeMessageUserShared: - return UnmarshalMessageUserShared(data) + case TypeMessageUsersShared: + return UnmarshalMessageUsersShared(data) case TypeMessageChatShared: return UnmarshalMessageChatShared(data) @@ -19437,12 +19627,6 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeEmojiCategoryTypeChatPhoto: return UnmarshalEmojiCategoryTypeChatPhoto(data) - case TypeStoryViewer: - return UnmarshalStoryViewer(data) - - case TypeStoryViewers: - return UnmarshalStoryViewers(data) - case TypeStoryAreaPosition: return UnmarshalStoryAreaPosition(data) @@ -19455,6 +19639,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStoryAreaTypeSuggestedReaction: return UnmarshalStoryAreaTypeSuggestedReaction(data) + case TypeStoryAreaTypeMessage: + return UnmarshalStoryAreaTypeMessage(data) + case TypeStoryArea: return UnmarshalStoryArea(data) @@ -19470,6 +19657,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInputStoryAreaTypeSuggestedReaction: return UnmarshalInputStoryAreaTypeSuggestedReaction(data) + case TypeInputStoryAreaTypeMessage: + return UnmarshalInputStoryAreaTypeMessage(data) + case TypeInputStoryArea: return UnmarshalInputStoryArea(data) @@ -19527,14 +19717,35 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatActiveStories: return UnmarshalChatActiveStories(data) - case TypeStoryPublicForwardMessage: - return UnmarshalStoryPublicForwardMessage(data) + case TypeStoryInteractionTypeView: + return UnmarshalStoryInteractionTypeView(data) - case TypeStoryPublicForwardStory: - return UnmarshalStoryPublicForwardStory(data) + case TypeStoryInteractionTypeForward: + return UnmarshalStoryInteractionTypeForward(data) - case TypeStoryPublicForwards: - return UnmarshalStoryPublicForwards(data) + case TypeStoryInteractionTypeRepost: + return UnmarshalStoryInteractionTypeRepost(data) + + case TypeStoryInteraction: + return UnmarshalStoryInteraction(data) + + case TypeStoryInteractions: + return UnmarshalStoryInteractions(data) + + case TypePublicForwardMessage: + return UnmarshalPublicForwardMessage(data) + + case TypePublicForwardStory: + return UnmarshalPublicForwardStory(data) + + case TypePublicForwards: + return UnmarshalPublicForwards(data) + + case TypeChatBoostLevelFeatures: + return UnmarshalChatBoostLevelFeatures(data) + + case TypeChatBoostFeatures: + return UnmarshalChatBoostFeatures(data) case TypeChatBoostSourceGiftCode: return UnmarshalChatBoostSourceGiftCode(data) @@ -19893,9 +20104,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatEventAvailableReactionsChanged: return UnmarshalChatEventAvailableReactionsChanged(data) + case TypeChatEventBackgroundChanged: + return UnmarshalChatEventBackgroundChanged(data) + case TypeChatEventDescriptionChanged: return UnmarshalChatEventDescriptionChanged(data) + case TypeChatEventEmojiStatusChanged: + return UnmarshalChatEventEmojiStatusChanged(data) + case TypeChatEventLinkedChatChanged: return UnmarshalChatEventLinkedChatChanged(data) @@ -19929,8 +20146,8 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatEventAccentColorChanged: return UnmarshalChatEventAccentColorChanged(data) - case TypeChatEventBackgroundCustomEmojiChanged: - return UnmarshalChatEventBackgroundCustomEmojiChanged(data) + case TypeChatEventProfileAccentColorChanged: + return UnmarshalChatEventProfileAccentColorChanged(data) case TypeChatEventHasProtectedContentToggled: return UnmarshalChatEventHasProtectedContentToggled(data) @@ -20253,6 +20470,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeBackgroundTypeFill: return UnmarshalBackgroundTypeFill(data) + case TypeBackgroundTypeChatTheme: + return UnmarshalBackgroundTypeChatTheme(data) + case TypeInputBackgroundLocal: return UnmarshalInputBackgroundLocal(data) @@ -20769,6 +20989,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInternalLinkTypePremiumFeatures: return UnmarshalInternalLinkTypePremiumFeatures(data) + case TypeInternalLinkTypePremiumGift: + return UnmarshalInternalLinkTypePremiumGift(data) + case TypeInternalLinkTypePremiumGiftCode: return UnmarshalInternalLinkTypePremiumGiftCode(data) @@ -21054,6 +21277,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSuggestedActionSubscribeToAnnualPremium: return UnmarshalSuggestedActionSubscribeToAnnualPremium(data) + case TypeSuggestedActionGiftPremiumForChristmas: + return UnmarshalSuggestedActionGiftPremiumForChristmas(data) + case TypeCount: return UnmarshalCount(data) @@ -21216,11 +21442,8 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateChatPhoto: return UnmarshalUpdateChatPhoto(data) - case TypeUpdateChatAccentColor: - return UnmarshalUpdateChatAccentColor(data) - - case TypeUpdateChatBackgroundCustomEmoji: - return UnmarshalUpdateChatBackgroundCustomEmoji(data) + case TypeUpdateChatAccentColors: + return UnmarshalUpdateChatAccentColors(data) case TypeUpdateChatPermissions: return UnmarshalUpdateChatPermissions(data) @@ -21246,6 +21469,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateChatDraftMessage: return UnmarshalUpdateChatDraftMessage(data) + case TypeUpdateChatEmojiStatus: + return UnmarshalUpdateChatEmojiStatus(data) + case TypeUpdateChatMessageSender: return UnmarshalUpdateChatMessageSender(data) @@ -21441,8 +21667,8 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateSavedNotificationSounds: return UnmarshalUpdateSavedNotificationSounds(data) - case TypeUpdateSelectedBackground: - return UnmarshalUpdateSelectedBackground(data) + case TypeUpdateDefaultBackground: + return UnmarshalUpdateDefaultBackground(data) case TypeUpdateChatThemes: return UnmarshalUpdateChatThemes(data) @@ -21540,6 +21766,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateChatBoost: return UnmarshalUpdateChatBoost(data) + case TypeUpdateMessageReaction: + return UnmarshalUpdateMessageReaction(data) + + case TypeUpdateMessageReactions: + return UnmarshalUpdateMessageReactions(data) + case TypeUpdates: return UnmarshalUpdates(data) diff --git a/data/td_api.tl b/data/td_api.tl index f55b5ba..82d9295 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -512,14 +512,14 @@ poll id:int64 question:string options:vector total_voter_count:int32 //@is_default True, if this is one of default backgrounds //@is_dark True, if the background is dark and is recommended to be used with dark theme //@name Unique background name -//@document Document with the background; may be null. Null only for filled backgrounds +//@document Document with the background; may be null. Null only for filled and chat theme backgrounds //@type Type of the background background id:int64 is_default:Bool is_dark:Bool name:string document:document type:BackgroundType = Background; //@description Contains a list of backgrounds @backgrounds A list of backgrounds backgrounds backgrounds:vector = Backgrounds; -//@description Describes a background set for a specific chat @background The background @dark_theme_dimming Dimming of the background in dark themes, as a percentage; 0-100 +//@description Describes a background set for a specific chat @background The background @dark_theme_dimming Dimming of the background in dark themes, as a percentage; 0-100. Applied only to Wallpaper and Fill types of background chatBackground background:background dark_theme_dimming:int32 = ChatBackground; @@ -633,7 +633,7 @@ inputChatPhotoSticker sticker:chatPhotoSticker = InputChatPhoto; //@description Describes actions that a user is allowed to take in a chat -//@can_send_basic_messages True, if the user can send text messages, contacts, giveaways, invoices, locations, and venues +//@can_send_basic_messages True, if the user can send text messages, contacts, giveaways, giveaway winners, invoices, locations, and venues //@can_send_audios True, if the user can send music files //@can_send_documents True, if the user can send documents //@can_send_photos True, if the user can send photos @@ -675,7 +675,7 @@ chatAdministratorRights can_manage_chat:Bool can_change_info:Bool can_post_messa //@currency ISO 4217 currency code for Telegram Premium subscription payment //@amount The amount to pay, in the smallest units of the currency //@discount_percentage The discount associated with this option, as a percentage -//@month_count Number of month the Telegram Premium subscription will be active +//@month_count Number of months the Telegram Premium subscription will be active //@store_product_id Identifier of the store product associated with the option //@payment_link An internal link to be opened for buying Telegram Premium to the user if store payment isn't possible; may be null if direct payment isn't available premiumPaymentOption currency:string amount:int53 discount_percentage:int32 month_count:int32 store_product_id:string payment_link:InternalLinkType = PremiumPaymentOption; @@ -691,7 +691,7 @@ premiumStatePaymentOption payment_option:premiumPaymentOption is_current:Bool is //@currency ISO 4217 currency code for Telegram Premium gift code payment //@amount The amount to pay, in the smallest units of the currency //@user_count Number of users which will be able to activate the gift codes -//@month_count Number of month the Telegram Premium subscription will be active +//@month_count Number of months the Telegram Premium subscription will be active //@store_product_id Identifier of the store product associated with the option; may be empty if none //@store_product_quantity Number of times the store product must be paid premiumGiftCodePaymentOption currency:string amount:int53 user_count:int32 month_count:int32 store_product_id:string store_product_quantity:int32 = PremiumGiftCodePaymentOption; @@ -700,11 +700,11 @@ premiumGiftCodePaymentOption currency:string amount:int53 user_count:int32 month premiumGiftCodePaymentOptions options:vector = PremiumGiftCodePaymentOptions; //@description Contains information about a Telegram Premium gift code -//@creator_id Identifier of a chat or a user that created the gift code +//@creator_id Identifier of a chat or a user that created the gift code; may be null if unknown. If null and the code is from messagePremiumGiftCode message, then creator_id from the message can be used //@creation_date Point in time (Unix timestamp) when the code was created //@is_from_giveaway True, if the gift code was created for a giveaway //@giveaway_message_id Identifier of the corresponding giveaway message in the creator_id chat; can be 0 or an identifier of a deleted message -//@month_count Number of month the Telegram Premium subscription will be active after code activation +//@month_count Number of months the Telegram Premium subscription will be active after code activation //@user_id Identifier of a user for which the code was created; 0 if none //@use_date Point in time (Unix timestamp) when the code was activated; 0 if none premiumGiftCodeInfo creator_id:MessageSender creation_date:int32 is_from_giveaway:Bool giveaway_message_id:int53 month_count:int32 user_id:int53 use_date:int32 = PremiumGiftCodeInfo; @@ -752,7 +752,8 @@ premiumGiveawayInfoCompleted creation_date:int32 actual_winners_selection_date:i //@built_in_accent_color_id Identifier of a built-in color to use in places, where only one color is needed; 0-6 //@light_theme_colors The list of 1-3 colors in RGB format, describing the accent color, as expected to be shown in light themes //@dark_theme_colors The list of 1-3 colors in RGB format, describing the accent color, as expected to be shown in dark themes -accentColor id:int32 built_in_accent_color_id:int32 light_theme_colors:vector dark_theme_colors:vector = AccentColor; +//@min_chat_boost_level The minimum chat boost level required to use the color +accentColor id:int32 built_in_accent_color_id:int32 light_theme_colors:vector dark_theme_colors:vector min_chat_boost_level:int32 = AccentColor; //@description Contains information about supported accent colors for user profile photo background in RGB format //@palette_colors The list of 1-2 colors in RGB format, describing the colors, as expected to be shown in the color palette settings @@ -762,16 +763,17 @@ profileAccentColors palette_colors:vector background_colors:vector //@description Contains information about supported accent color for user profile photo background //@id Profile accent color identifier -//@light_theme_colors The list of 1-3 colors in RGB format, describing the accent color, as expected to be shown in light themes -//@dark_theme_colors The list of 1-3 colors in RGB format, describing the accent color, as expected to be shown in dark themes -profileAccentColor id:int32 light_theme_colors:profileAccentColors dark_theme_colors:profileAccentColors = ProfileAccentColor; +//@light_theme_colors Accent colors expected to be used in light themes +//@dark_theme_colors Accent colors expected to be used in dark themes +//@min_chat_boost_level The minimum chat boost level required to use the color +profileAccentColor id:int32 light_theme_colors:profileAccentColors dark_theme_colors:profileAccentColors min_chat_boost_level:int32 = ProfileAccentColor; //@description Describes a custom emoji to be shown instead of the Telegram Premium badge //@custom_emoji_id Identifier of the custom emoji in stickerFormatTgs format //@expiration_date Point in time (Unix timestamp) when the status will expire; 0 if never emojiStatus custom_emoji_id:int64 expiration_date:int32 = EmojiStatus; -//@description Contains a list of custom emoji identifiers, which can be set as emoji statuses @custom_emoji_ids The list of custom emoji identifiers +//@description Contains a list of custom emoji identifiers for emoji statuses @custom_emoji_ids The list of custom emoji identifiers emojiStatuses custom_emoji_ids:vector = EmojiStatuses; @@ -792,7 +794,7 @@ usernames active_usernames:vector disabled_usernames:vector edit //@status Current online status of the user //@profile_photo Profile photo of the user; may be null //@accent_color_id Identifier of the accent color for name, and backgrounds of profile photo, reply header, and link preview. For Telegram Premium users only -//@background_custom_emoji_id Identifier of a custom emoji to be shown on the reply header background; 0 if none. For Telegram Premium users only +//@background_custom_emoji_id Identifier of a custom emoji to be shown on the reply header and link preview background; 0 if none. For Telegram Premium users only //@profile_accent_color_id Identifier of the accent color for the user's profile; -1 if none. For Telegram Premium users only //@profile_background_custom_emoji_id Identifier of a custom emoji to be shown on the background of the user's profile; 0 if none. For Telegram Premium users only //@emoji_status Emoji status to be shown instead of the default Telegram Premium badge; may be null. For Telegram Premium users only @@ -1065,8 +1067,9 @@ basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int53 memb //@status Status of the current user in the supergroup or channel; custom title will always be empty //@member_count Number of members in the supergroup or channel; 0 if unknown. Currently, it is guaranteed to be known only if the supergroup or channel was received through //-getChatSimilarChats, getChatsToSendStories, getCreatedPublicChats, getGroupsInCommon, getInactiveSupergroupChats, getSuitableDiscussionChats, getUserPrivacySettingRules, getVideoChatAvailableParticipants, -//-searchChatsNearby, searchPublicChats, or in chatFolderInviteLinkInfo.missing_chat_ids, or for public chats in which where sent messages and posted stories from storyPublicForwards, +//-searchChatsNearby, searchPublicChats, or in chatFolderInviteLinkInfo.missing_chat_ids, or for public chats in which where sent messages and posted stories from publicForwards, //-or for public chats in which where sent messages from getMessagePublicForwards response +//@boost_level Approximate boost level for the chat //@has_linked_chat True, if the channel has a discussion group, or the supergroup is the designated discussion group for a channel //@has_location True, if the supergroup is connected to a location, i.e. the supergroup is a location-based supergroup //@sign_messages True, if messages sent to the channel need to contain information about the sender. This field is only applicable to channels @@ -1082,7 +1085,7 @@ basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int53 memb //@is_fake True, if many users reported this supergroup or channel as a fake account //@has_active_stories True, if the channel has non-expired stories available to the current user //@has_unread_active_stories True, if the channel has unread non-expired stories available to the current user -supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 has_linked_chat:Bool has_location:Bool sign_messages:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool is_verified:Bool restriction_reason:string is_scam:Bool is_fake:Bool has_active_stories:Bool has_unread_active_stories:Bool = Supergroup; +supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 boost_level:int32 has_linked_chat:Bool has_location:Bool sign_messages:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool is_verified:Bool restriction_reason:string is_scam:Bool is_fake:Bool has_active_stories:Bool has_unread_active_stories:Bool = Supergroup; //@description Contains full information about a supergroup or channel //@photo Chat photo; may be null if empty or unknown. If non-null, then it is the same photo as in chat.photo @@ -1255,7 +1258,7 @@ messageSendingStateFailed error:error can_retry:Bool need_another_sender:Bool ne //@description Describes manually or automatically chosen quote from another message //@text Text of the quote. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities can be present in the text -//@position Approximate quote position in the original message in UTF-16 code units +//@position Approximate quote position in the original message in UTF-16 code units as specified by the message sender //@is_manual True, if the quote was manually chosen by the message sender textQuote text:formattedText position:int32 is_manual:Bool = TextQuote; @@ -1275,7 +1278,8 @@ inputTextQuote text:formattedText position:int32 = InputTextQuote; //@origin_send_date Point in time (Unix timestamp) when the message was sent if the message was from another chat or topic; 0 for messages from the same chat //@content Media content of the message if the message was from another chat or topic; may be null for messages from the same chat and messages without media. //-Can be only one of the following types: messageAnimation, messageAudio, messageContact, messageDice, messageDocument, messageGame, messageInvoice, messageLocation, -//-messagePhoto, messagePoll, messagePremiumGiveaway, messageSticker, messageStory, messageText (for link preview), messageVenue, messageVideo, messageVideoNote, or messageVoiceNote +//-messagePhoto, messagePoll, messagePremiumGiveaway, messagePremiumGiveawayWinners, messageSticker, messageStory, messageText (for link preview), messageVenue, +//-messageVideo, messageVideoNote, or messageVoiceNote messageReplyToMessage chat_id:int53 message_id:int53 quote:textQuote origin:MessageOrigin origin_send_date:int32 content:MessageContent = MessageReplyTo; //@description Describes a story replied by a given message @story_sender_chat_id The identifier of the sender of the story @story_id The identifier of the story @@ -1627,7 +1631,9 @@ videoChat group_call_id:int32 has_participants:Bool default_participant_id:Messa //@title Chat title //@photo Chat photo; may be null //@accent_color_id Identifier of the accent color for message sender name, and backgrounds of chat photo, reply header, and link preview -//@background_custom_emoji_id Identifier of a custom emoji to be shown on the reply header background in replies to messages sent by the chat; 0 if none +//@background_custom_emoji_id 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 +//@profile_accent_color_id Identifier of the profile accent color for the chat's profile; -1 if none +//@profile_background_custom_emoji_id Identifier of a custom emoji to be shown on the background of the chat's profile; 0 if none //@permissions Actions that non-administrator chat members are allowed to take in the chat //@last_message Last message in the chat; may be null if none or unknown //@positions Positions of the chat in chat lists @@ -1650,6 +1656,7 @@ videoChat group_call_id:int32 has_participants:Bool default_participant_id:Messa //@notification_settings Notification settings for the chat //@available_reactions Types of reaction, available in the chat //@message_auto_delete_time 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 +//@emoji_status Emoji status to be shown along with chat title; may be null //@background Background set for the chat; may be null if none //@theme_name If non-empty, name of a theme, set for the chat //@action_bar Information about actions which must be possible to do through the chat action bar; may be null if none @@ -1658,7 +1665,7 @@ videoChat group_call_id:int32 has_participants:Bool default_participant_id:Messa //@reply_markup_message_id Identifier of the message from which reply markup needs to be used; 0 if there is no default custom reply markup in the chat //@draft_message A draft of a message in the chat; may be null if none //@client_data 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 -chat id:int53 type:ChatType title:string photo:chatPhotoInfo accent_color_id:int32 background_custom_emoji_id:int64 permissions:chatPermissions last_message:message positions:vector message_sender_id:MessageSender block_list:BlockList has_protected_content:Bool is_translatable:Bool is_marked_as_unread:Bool view_as_topics:Bool has_scheduled_messages:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_reported:Bool default_disable_notification:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 unread_reaction_count:int32 notification_settings:chatNotificationSettings available_reactions:ChatAvailableReactions message_auto_delete_time:int32 background:chatBackground theme_name:string action_bar:ChatActionBar video_chat:videoChat pending_join_requests:chatJoinRequestsInfo reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat; +chat id:int53 type:ChatType title:string photo:chatPhotoInfo accent_color_id:int32 background_custom_emoji_id:int64 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 permissions:chatPermissions last_message:message positions:vector message_sender_id:MessageSender block_list:BlockList has_protected_content:Bool is_translatable:Bool is_marked_as_unread:Bool view_as_topics:Bool has_scheduled_messages:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_reported:Bool default_disable_notification:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 unread_reaction_count:int32 notification_settings:chatNotificationSettings available_reactions:ChatAvailableReactions message_auto_delete_time:int32 emoji_status:emojiStatus background:chatBackground theme_name:string action_bar:ChatActionBar video_chat:videoChat pending_join_requests:chatJoinRequestsInfo reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat; //@description Represents a list of chats @total_count Approximate total number of chats found @chat_ids List of chat identifiers chats total_count:int32 chat_ids:vector = Chats; @@ -1725,13 +1732,14 @@ keyboardButtonTypeRequestLocation = KeyboardButtonType; //@description A button that allows the user to create and send a poll when pressed; available only in private chats @force_regular If true, only regular polls must be allowed to create @force_quiz If true, only polls in quiz mode must be allowed to create keyboardButtonTypeRequestPoll force_regular:Bool force_quiz:Bool = KeyboardButtonType; -//@description A button that requests a user to be shared by the current user; available only in private chats. Use the method shareUserWithBot to complete the request +//@description A button that requests users to be shared by the current user; available only in private chats. Use the method shareUsersWithBot to complete the request //@id Unique button identifier -//@restrict_user_is_bot True, if the shared user must or must not be a bot -//@user_is_bot True, if the shared user must be a bot; otherwise, the shared user must no be a bot. Ignored if restrict_user_is_bot is false -//@restrict_user_is_premium True, if the shared user must or must not be a Telegram Premium user -//@user_is_premium True, if the shared user must be a Telegram Premium user; otherwise, the shared user must no be a Telegram Premium user. Ignored if restrict_user_is_premium is false -keyboardButtonTypeRequestUser id:int32 restrict_user_is_bot:Bool user_is_bot:Bool restrict_user_is_premium:Bool user_is_premium:Bool = KeyboardButtonType; +//@restrict_user_is_bot True, if the shared users must or must not be bots +//@user_is_bot True, if the shared users must be bots; otherwise, the shared users must not be bots. Ignored if restrict_user_is_bot is false +//@restrict_user_is_premium True, if the shared users must or must not be Telegram Premium users +//@user_is_premium True, if the shared users must be Telegram Premium users; otherwise, the shared users must not be Telegram Premium users. Ignored if restrict_user_is_premium is false +//@max_quantity The maximum number of users to share +keyboardButtonTypeRequestUsers id:int32 restrict_user_is_bot:Bool user_is_bot:Bool restrict_user_is_premium:Bool user_is_premium:Bool max_quantity:int32 = KeyboardButtonType; //@description A button that requests a chat to be shared by the current user; available only in private chats. Use the method shareChatWithBot to complete the request //@id Unique button identifier @@ -2289,8 +2297,8 @@ inputCredentialsGooglePay data:string = InputCredentials; //@class PaymentProvider @description Contains information about a payment provider -//@description Smart Glocal payment provider @public_token Public payment token -paymentProviderSmartGlocal public_token:string = PaymentProvider; +//@description Smart Glocal payment provider @public_token Public payment token @tokenize_url URL for sending card tokenization requests +paymentProviderSmartGlocal public_token:string tokenize_url:string = PaymentProvider; //@description Stripe payment provider //@publishable_key Stripe API publishable key @@ -2380,10 +2388,12 @@ messageExtendedMediaUnsupported caption:formattedText = MessageExtendedMedia; //@boosted_chat_id Identifier of the channel chat, which will be automatically boosted by the winners of the giveaway for duration of the Premium subscription //@additional_chat_ids Identifiers of other channel chats that must be subscribed by the users to be eligible for the giveaway. There can be up to getOption("giveaway_additional_chat_count_max") additional chats //@winners_selection_date Point in time (Unix timestamp) when the giveaway is expected to be performed; must be 60-getOption("giveaway_duration_max") seconds in the future in scheduled giveaways -//@only_new_members True, if only new subscribers of the chats will be eligible for the giveaway +//@only_new_members True, if only new members of the chats will be eligible for the giveaway +//@has_public_winners True, if the list of winners of the giveaway will be available to everyone //@country_codes The list of two-letter ISO 3166-1 alpha-2 codes of countries, users from which will be eligible for the giveaway. If empty, then all users can participate in the giveaway. //-There can be up to getOption("giveaway_country_count_max") chosen countries. Users with phone number that was bought on Fragment can participate in any giveaway and the country code "FT" must not be specified in the list -premiumGiveawayParameters boosted_chat_id:int53 additional_chat_ids:vector winners_selection_date:int32 only_new_members:Bool country_codes:vector = PremiumGiveawayParameters; +//@prize_description Additional description of the giveaway prize; 0-128 characters +premiumGiveawayParameters boosted_chat_id:int53 additional_chat_ids:vector winners_selection_date:int32 only_new_members:Bool has_public_winners:Bool country_codes:vector prize_description:string = PremiumGiveawayParameters; //@description File with the date it was uploaded @file The file @date Point in time (Unix timestamp) when the file was uploaded @@ -2883,19 +2893,23 @@ messagePaymentSuccessfulBot currency:string total_amount:int53 is_recurring:Bool //@currency Currency for the paid amount //@amount The paid amount, in the smallest units of the currency //@cryptocurrency Cryptocurrency used to pay for the gift; may be empty if none -//@cryptocurrency_amount The paid amount, in the smallest units of the cryptocurrency -//@month_count Number of month the Telegram Premium subscription will be active +//@cryptocurrency_amount The paid amount, in the smallest units of the cryptocurrency; 0 if none +//@month_count Number of months the Telegram Premium subscription will be active //@sticker A sticker to be shown in the message; may be null if unknown messageGiftedPremium gifter_user_id:int53 currency:string amount:int53 cryptocurrency:string cryptocurrency_amount:int64 month_count:int32 sticker:sticker = MessageContent; //@description A Telegram Premium gift code was created for the user -//@creator_id Identifier of a chat or a user that created the gift code +//@creator_id Identifier of a chat or a user that created the gift code; may be null if unknown //@is_from_giveaway True, if the gift code was created for a giveaway //@is_unclaimed True, if the winner for the corresponding Telegram Premium subscription wasn't chosen -//@month_count Number of month the Telegram Premium subscription will be active after code activation +//@currency Currency for the paid amount; empty if unknown +//@amount The paid amount, in the smallest units of the currency; 0 if unknown +//@cryptocurrency Cryptocurrency used to pay for the gift; may be empty if none or unknown +//@cryptocurrency_amount The paid amount, in the smallest units of the cryptocurrency; 0 if unknown +//@month_count Number of months the Telegram Premium subscription will be active after code activation //@sticker A sticker to be shown in the message; may be null if unknown //@code The gift code -messagePremiumGiftCode creator_id:MessageSender is_from_giveaway:Bool is_unclaimed:Bool month_count:int32 sticker:sticker code:string = MessageContent; +messagePremiumGiftCode creator_id:MessageSender is_from_giveaway:Bool is_unclaimed:Bool currency:string amount:int53 cryptocurrency:string cryptocurrency_amount:int64 month_count:int32 sticker:sticker code:string = MessageContent; //@description A Telegram Premium giveaway was created for the chat messagePremiumGiveawayCreated = MessageContent; @@ -2903,21 +2917,35 @@ messagePremiumGiveawayCreated = MessageContent; //@description A Telegram Premium giveaway //@parameters Giveaway parameters //@winner_count Number of users which will receive Telegram Premium subscription gift codes -//@month_count Number of month the Telegram Premium subscription will be active after code activation +//@month_count Number of months the Telegram Premium subscription will be active after code activation //@sticker A sticker to be shown in the message; may be null if unknown messagePremiumGiveaway parameters:premiumGiveawayParameters winner_count:int32 month_count:int32 sticker:sticker = MessageContent; -//@description A Telegram Premium giveaway has been completed for the chat -//@giveaway_message_id Identifier of the message with the giveaway, can be an identifier of a deleted message +//@description A Telegram Premium giveaway without public winners has been completed for the chat +//@giveaway_message_id Identifier of the message with the giveaway; can be 0 if the message was deleted //@winner_count Number of winners in the giveaway //@unclaimed_prize_count Number of undistributed prizes messagePremiumGiveawayCompleted giveaway_message_id:int53 winner_count:int32 unclaimed_prize_count:int32 = MessageContent; +//@description A Telegram Premium giveaway with public winners has been completed for the chat +//@boosted_chat_id Identifier of the channel chat, which was automatically boosted by the winners of the giveaway for duration of the Premium subscription +//@giveaway_message_id Identifier of the message with the giveaway in the boosted chat +//@additional_chat_count Number of other chats that participated in the giveaway +//@actual_winners_selection_date Point in time (Unix timestamp) when the winners were selected. May be bigger than winners selection date specified in parameters of the giveaway +//@only_new_members True, if only new members of the chats were eligible for the giveaway +//@was_refunded True, if the giveaway was canceled and was fully refunded +//@month_count Number of months the Telegram Premium subscription will be active after code activation +//@prize_description Additional description of the giveaway prize +//@winner_count Total number of winners in the giveaway +//@winner_user_ids Up to 100 user identifiers of the winners of the giveaway +//@unclaimed_prize_count Number of undistributed prizes +messagePremiumGiveawayWinners boosted_chat_id:int53 giveaway_message_id:int53 additional_chat_count:int32 actual_winners_selection_date:int32 only_new_members:Bool was_refunded:Bool month_count:int32 prize_description:string winner_count:int32 winner_user_ids:vector unclaimed_prize_count:int32 = MessageContent; + //@description A contact has registered with Telegram messageContactRegistered = MessageContent; -//@description The current user shared a user, which was requested by the bot @user_id Identifier of the shared user @button_id Identifier of the keyboard button with the request -messageUserShared user_id:int53 button_id:int32 = MessageContent; +//@description The current user shared users, which were requested by the bot @user_ids Identifier of the shared users @button_id Identifier of the keyboard button with the request +messageUsersShared user_ids:vector button_id:int32 = MessageContent; //@description The current user shared a chat, which was requested by the bot @chat_id Identifier of the shared chat @button_id Identifier of the keyboard button with the request messageChatShared chat_id:int53 button_id:int32 = MessageContent; @@ -3045,7 +3073,7 @@ messageSelfDestructTypeImmediately = MessageSelfDestructType; //@only_preview Pass true to get a fake message instead of actually sending them messageSendOptions disable_notification:Bool from_background:Bool protect_content:Bool update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState sending_id:int32 only_preview:Bool = MessageSendOptions; -//@description Options to be used when a message content is copied without reference to the original sender. Service messages, and messages with messageInvoice or messagePremiumGiveaway content can't be copied +//@description Options to be used when a message content is copied without reference to the original sender. Service messages, messages with messageInvoice, messagePremiumGiveaway, or messagePremiumGiveawayWinners content can't be copied //@send_copy True, if content of the message needs to be copied without reference to the original sender. Always true if the message is forwarded to a secret chat or is local //@replace_caption True, if media caption of the message copy needs to be replaced. Ignored if send_copy is false //@new_caption New message caption; pass null to copy message without caption. Ignored if replace_caption is false @@ -3083,7 +3111,7 @@ inputMessageAudio audio:InputFile album_cover_thumbnail:inputThumbnail duration: //@description A document message (general file) //@document Document to be sent //@thumbnail Document thumbnail; pass null to skip thumbnail uploading -//@disable_content_type_detection True, if automatic file type detection is disabled and the document must be sent as a file. Always true for files sent to secret chats +//@disable_content_type_detection Pass true to disable automatic file type detection and send the document as a file. Always true for files sent to secret chats //@caption Document caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters inputMessageDocument document:InputFile thumbnail:inputThumbnail disable_content_type_detection:Bool caption:formattedText = InputMessageContent; @@ -3332,16 +3360,17 @@ emojis emojis:vector = Emojis; //@sticker_format Format of the stickers in the set //@sticker_type Type of the stickers in the set //@needs_repainting True, if stickers in the sticker set are custom emoji that must be repainted; for custom emoji sticker sets only +//@is_allowed_as_chat_emoji_status True, if stickers in the sticker set are custom emoji that can be used as chat emoji status; for custom emoji sticker sets only //@is_viewed True for already viewed trending sticker sets //@stickers List of stickers in this set //@emojis A list of emoji corresponding to the stickers in the same order. The list is only for informational purposes, because a sticker is always sent with a fixed emoji from the corresponding Sticker object -stickerSet id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:vector is_installed:Bool is_archived:Bool is_official:Bool sticker_format:StickerFormat sticker_type:StickerType needs_repainting:Bool is_viewed:Bool stickers:vector emojis:vector = StickerSet; +stickerSet id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:vector is_installed:Bool is_archived:Bool is_official:Bool sticker_format:StickerFormat sticker_type:StickerType needs_repainting:Bool is_allowed_as_chat_emoji_status:Bool is_viewed:Bool stickers:vector emojis:vector = StickerSet; //@description Represents short information about a sticker set //@id Identifier of the sticker set //@title Title of the sticker set //@name Name of the sticker set -//@thumbnail Sticker set thumbnail in WEBP, TGS, or WEBM format with width and height 100; may be null +//@thumbnail Sticker set thumbnail in WEBP, TGS, or WEBM format with width and height 100; may be null. The file can be downloaded only before the thumbnail is changed //@thumbnail_outline Sticker set thumbnail's outline represented as a list of closed vector paths; may be empty. The coordinate system origin is in the upper-left corner //@is_installed True, if the sticker set has been installed by the current user //@is_archived True, if the sticker set has been archived. A sticker set can't be installed and archived simultaneously @@ -3349,10 +3378,11 @@ stickerSet id:int64 title:string name:string thumbnail:thumbnail thumbnail_outli //@sticker_format Format of the stickers in the set //@sticker_type Type of the stickers in the set //@needs_repainting True, if stickers in the sticker set are custom emoji that must be repainted; for custom emoji sticker sets only +//@is_allowed_as_chat_emoji_status True, if stickers in the sticker set are custom emoji that can be used as chat emoji status; for custom emoji sticker sets only //@is_viewed True for already viewed trending sticker sets //@size Total number of stickers in the set //@covers Up to the first 5 stickers from the set, depending on the context. If the application needs more stickers the full sticker set needs to be requested -stickerSetInfo id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:vector is_installed:Bool is_archived:Bool is_official:Bool sticker_format:StickerFormat sticker_type:StickerType needs_repainting:Bool is_viewed:Bool size:int32 covers:vector = StickerSetInfo; +stickerSetInfo id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:vector is_installed:Bool is_archived:Bool is_official:Bool sticker_format:StickerFormat sticker_type:StickerType needs_repainting:Bool is_allowed_as_chat_emoji_status:Bool is_viewed:Bool size:int32 covers:vector = StickerSetInfo; //@description Represents a list of sticker sets @total_count Approximate total number of sticker sets found @sets List of sticker sets stickerSets total_count:int32 sets:vector = StickerSets; @@ -3383,21 +3413,6 @@ emojiCategoryTypeEmojiStatus = EmojiCategoryType; emojiCategoryTypeChatPhoto = EmojiCategoryType; -//@description Represents a viewer of a story -//@user_id User identifier of the viewer -//@view_date Approximate point in time (Unix timestamp) when the story was viewed -//@block_list Block list to which the user is added; may be null if none -//@chosen_reaction_type Type of the reaction that was chosen by the user; may be null if none -storyViewer user_id:int53 view_date:int32 block_list:BlockList chosen_reaction_type:ReactionType = StoryViewer; - -//@description Represents a list of story viewers -//@total_count Approximate total number of story viewers found -//@total_reaction_count Approximate total number of reactions set by found story viewers -//@viewers List of story viewers -//@next_offset The offset for the next request. If empty, then there are no more results -storyViewers total_count:int32 total_reaction_count:int32 viewers:vector next_offset:string = StoryViewers; - - //@description Describes position of a clickable rectangle area on a story media //@x_percentage The abscissa of the rectangle's center, as a percentage of the media width //@y_percentage The ordinate of the rectangle's center, as a percentage of the media height @@ -3422,6 +3437,9 @@ storyAreaTypeVenue venue:venue = StoryAreaType; //@is_flipped True, if reaction corner is flipped storyAreaTypeSuggestedReaction reaction_type:ReactionType total_count:int32 is_dark:Bool is_flipped:Bool = StoryAreaType; +//@description An area pointing to a message @chat_id Identifier of the chat with the message @message_id Identifier of the message +storyAreaTypeMessage chat_id:int53 message_id:int53 = StoryAreaType; + //@description Describes a clickable rectangle area on a story media @position Position of the area @type Type of the area storyArea position:storyAreaPosition type:StoryAreaType = StoryArea; @@ -3448,11 +3466,18 @@ inputStoryAreaTypePreviousVenue venue_provider:string venue_id:string = InputSto //@is_flipped True, if reaction corner is flipped inputStoryAreaTypeSuggestedReaction reaction_type:ReactionType is_dark:Bool is_flipped:Bool = InputStoryAreaType; +//@description An area pointing to a message +//@chat_id Identifier of the chat with the message. Currently, the chat must be a supergroup or a channel chat +//@message_id Identifier of the message. Only successfully sent non-scheduled messages can be specified +inputStoryAreaTypeMessage chat_id:int53 message_id:int53 = InputStoryAreaType; + //@description Describes a clickable rectangle area on a story media to be added @position Position of the area @type Type of the area inputStoryArea position:storyAreaPosition type:InputStoryAreaType = InputStoryArea; -//@description Contains a list of story areas to be added @areas List of 0-10 input story areas +//@description Contains a list of story areas to be added @areas List of input story areas. Currently, a story can have +//-up to 10 inputStoryAreaTypeLocation, inputStoryAreaTypeFoundVenue, and inputStoryAreaTypePreviousVenue areas, +//-up to getOption("story_suggested_reaction_area_count_max") inputStoryAreaTypeSuggestedReaction areas, and up to 1 inputStoryAreaTypeMessage area inputStoryAreas areas:vector = InputStoryAreas; @@ -3541,7 +3566,7 @@ storyInteractionInfo view_count:int32 forward_count:int32 reaction_count:int32 r //@can_be_replied True, if the story can be replied in the chat with the story sender //@can_toggle_is_pinned True, if the story's is_pinned value can be changed //@can_get_statistics True, if the story statistics are available through getStoryStatistics -//@can_get_viewers True, if users viewed the story can be received through getStoryViewers +//@can_get_interactions True, if interactions with the story can be received through getStoryInteractions //@has_expired_viewers True, if users viewed the story can't be received, because the story has expired more than getOption("story_viewers_expiration_delay") seconds ago //@repost_info Information about the original story; may be null if the story wasn't reposted //@interaction_info Information about interactions with the story; may be null if the story isn't owned or there were no interactions @@ -3550,7 +3575,7 @@ storyInteractionInfo view_count:int32 forward_count:int32 reaction_count:int32 r //@content Content of the story //@areas Clickable areas to be shown on the story content //@caption Caption of the story -story id:int32 sender_chat_id:int53 date:int32 is_being_sent:Bool is_being_edited:Bool is_edited:Bool is_pinned:Bool is_visible_only_for_self:Bool can_be_deleted:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied:Bool can_toggle_is_pinned:Bool can_get_statistics:Bool can_get_viewers:Bool has_expired_viewers:Bool repost_info:storyRepostInfo interaction_info:storyInteractionInfo chosen_reaction_type:ReactionType privacy_settings:StoryPrivacySettings content:StoryContent areas:vector caption:formattedText = Story; +story id:int32 sender_chat_id:int53 date:int32 is_being_sent:Bool is_being_edited:Bool is_edited:Bool is_pinned:Bool is_visible_only_for_self:Bool can_be_deleted:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied:Bool can_toggle_is_pinned:Bool can_get_statistics:Bool can_get_interactions:Bool has_expired_viewers:Bool repost_info:storyRepostInfo interaction_info:storyInteractionInfo chosen_reaction_type:ReactionType privacy_settings:StoryPrivacySettings content:StoryContent areas:vector caption:formattedText = Story; //@description Represents a list of stories @total_count Approximate total number of stories found @stories The list of stories stories total_count:int32 stories:vector = Stories; @@ -3575,20 +3600,66 @@ storyInfo story_id:int32 date:int32 is_for_close_friends:Bool = StoryInfo; chatActiveStories chat_id:int53 list:StoryList order:int53 max_read_story_id:int32 stories:vector = ChatActiveStories; -//@class StoryPublicForward @description Describes a public forward or repost of a story +//@class StoryInteractionType @description Describes type of interaction with a story -//@description Contains a public forward of a story as a message @message Information about the message with the story -storyPublicForwardMessage message:message = StoryPublicForward; +//@description A view of the story @chosen_reaction_type Type of the reaction that was chosen by the viewer; may be null if none +storyInteractionTypeView chosen_reaction_type:ReactionType = StoryInteractionType; -//@description Contains a public repost of a story as a story @story Information about the reposted story -storyPublicForwardStory story:story = StoryPublicForward; +//@description A forward of the story as a message @message The message with story forward +storyInteractionTypeForward message:message = StoryInteractionType; + +//@description A repost of the story as a story @story The reposted story +storyInteractionTypeRepost story:story = StoryInteractionType; -//@description Represents a list of public forwards and reposts of a story +//@description Represents interaction with a story +//@actor_id Identifier of the user or chat that made the interaction +//@interaction_date Approximate point in time (Unix timestamp) when the interaction happened +//@block_list Block list to which the actor is added; may be null if none or for chat stories +//@type Type of the interaction +storyInteraction actor_id:MessageSender interaction_date:int32 block_list:BlockList type:StoryInteractionType = StoryInteraction; + +//@description Represents a list of interactions with a story +//@total_count Approximate total number of interactions found +//@total_forward_count Approximate total number of found forwards and reposts; always 0 for chat stories +//@total_reaction_count Approximate total number of found reactions; always 0 for chat stories +//@interactions List of story interactions +//@next_offset The offset for the next request. If empty, then there are no more results +storyInteractions total_count:int32 total_forward_count:int32 total_reaction_count:int32 interactions:vector next_offset:string = StoryInteractions; + + +//@class PublicForward @description Describes a public forward or repost of a story + +//@description Contains a public forward as a message @message Information about the message +publicForwardMessage message:message = PublicForward; + +//@description Contains a public repost to a story @story Information about the story +publicForwardStory story:story = PublicForward; + + +//@description Represents a list of public forwards and reposts as a story of a message or a story //@total_count Approximate total number of messages and stories found //@forwards List of found public forwards and reposts //@next_offset The offset for the next request. If empty, then there are no more results -storyPublicForwards total_count:int32 forwards:vector next_offset:string = StoryPublicForwards; +publicForwards total_count:int32 forwards:vector next_offset:string = PublicForwards; + + +//@description Contains a list of features available on a specific chat boost level +//@level Target chat boost level +//@story_per_day_count Number of stories that the chat can publish daily +//@custom_emoji_reaction_count Number of custom emoji reactions that can be added to the list of available reactions +//@title_color_count Number of custom colors for chat title +//@profile_accent_color_count Number of custom colors for profile photo background +//@can_set_profile_background_custom_emoji True, if custom emoji for profile background can be set +//@accent_color_count Number of custom colors for background of empty chat photo, replies to messages and link previews +//@can_set_background_custom_emoji True, if custom emoji for reply header and link preview background can be set +//@can_set_emoji_status True, if emoji status can be set +//@chat_theme_background_count Number of chat theme backgrounds that can be set as chat background +//@can_set_custom_background True, if custom background can be set in the chat for all users +chatBoostLevelFeatures level:int32 story_per_day_count:int32 custom_emoji_reaction_count:int32 title_color_count:int32 profile_accent_color_count:int32 can_set_profile_background_custom_emoji:Bool accent_color_count:int32 can_set_background_custom_emoji:Bool can_set_emoji_status:Bool chat_theme_background_count:int32 can_set_custom_background:Bool = ChatBoostLevelFeatures; + +//@description Contains a list of features available on the first chat boost levels @features The list of features +chatBoostFeatures features:vector = ChatBoostFeatures; //@class ChatBoostSource @description Describes source of a chat boost @@ -3613,7 +3684,7 @@ chatBoostSourcePremium user_id:int53 = ChatBoostSource; //@description Describes a prepaid Telegram Premium giveaway //@id Unique identifier of the prepaid giveaway //@winner_count Number of users which will receive Telegram Premium subscription gift codes -//@month_count Number of month the Telegram Premium subscription will be active after code activation +//@month_count Number of months the Telegram Premium subscription will be active after code activation //@payment_date Point in time (Unix timestamp) when the giveaway was paid prepaidPremiumGiveaway id:int64 winner_count:int32 month_count:int32 payment_date:int32 = PrepaidPremiumGiveaway; @@ -4311,9 +4382,15 @@ chatEventMemberRestricted member_id:MessageSender old_status:ChatMemberStatus ne //@description The chat available reactions were changed @old_available_reactions Previous chat available reactions @new_available_reactions New chat available reactions chatEventAvailableReactionsChanged old_available_reactions:ChatAvailableReactions new_available_reactions:ChatAvailableReactions = ChatEventAction; +//@description The chat background was changed @old_background Previous background; may be null if none @new_background New background; may be null if none +chatEventBackgroundChanged old_background:chatBackground new_background:chatBackground = ChatEventAction; + //@description The chat description was changed @old_description Previous chat description @new_description New chat description chatEventDescriptionChanged old_description:string new_description:string = ChatEventAction; +//@description The chat emoji status was changed @old_emoji_status Previous emoji status; may be null if none @new_emoji_status New emoji status; may be null if none +chatEventEmojiStatusChanged old_emoji_status:emojiStatus new_emoji_status:emojiStatus = ChatEventAction; + //@description The linked chat of a supergroup was changed @old_linked_chat_id Previous supergroup linked chat identifier @new_linked_chat_id New supergroup linked chat identifier chatEventLinkedChatChanged old_linked_chat_id:int53 new_linked_chat_id:int53 = ChatEventAction; @@ -4344,11 +4421,19 @@ chatEventUsernameChanged old_username:string new_username:string = ChatEventActi //@description The chat active usernames were changed @old_usernames Previous list of active usernames @new_usernames New list of active usernames chatEventActiveUsernamesChanged old_usernames:vector new_usernames:vector = ChatEventAction; -//@description The chat accent color was changed @old_accent_color_id Previous identifier of chat accent color @new_accent_color_id New identifier of chat accent color -chatEventAccentColorChanged old_accent_color_id:int32 new_accent_color_id:int32 = ChatEventAction; +//@description The chat accent color or background custom emoji were changed +//@old_accent_color_id Previous identifier of chat accent color +//@old_background_custom_emoji_id Previous identifier of the custom emoji; 0 if none +//@new_accent_color_id New identifier of chat accent color +//@new_background_custom_emoji_id New identifier of the custom emoji; 0 if none +chatEventAccentColorChanged old_accent_color_id:int32 old_background_custom_emoji_id:int64 new_accent_color_id:int32 new_background_custom_emoji_id:int64 = ChatEventAction; -//@description The chat's custom emoji for reply background was changed @old_background_custom_emoji_id Previous identifier of the custom emoji; 0 if none @new_background_custom_emoji_id New identifier of the custom emoji; 0 if none -chatEventBackgroundCustomEmojiChanged old_background_custom_emoji_id:int64 new_background_custom_emoji_id:int64 = ChatEventAction; +//@description The chat's profile accent color or profile background custom emoji were changed +//@old_profile_accent_color_id Previous identifier of chat's profile accent color; -1 if none +//@old_profile_background_custom_emoji_id Previous identifier of the custom emoji; 0 if none +//@new_profile_accent_color_id New identifier of chat's profile accent color; -1 if none +//@new_profile_background_custom_emoji_id New identifier of the custom emoji; 0 if none +chatEventProfileAccentColorChanged old_profile_accent_color_id:int32 old_profile_background_custom_emoji_id:int64 new_profile_accent_color_id:int32 new_profile_background_custom_emoji_id:int64 = ChatEventAction; //@description The has_protected_content setting of a channel was toggled @has_protected_content New value of has_protected_content chatEventHasProtectedContentToggled has_protected_content:Bool = ChatEventAction; @@ -4686,7 +4771,7 @@ storePaymentPurposePremiumGiveaway parameters:premiumGiveawayParameters currency //@currency ISO 4217 currency code of the payment currency //@amount Paid amount, in the smallest units of the currency //@user_ids Identifiers of the users which can activate the gift codes -//@month_count Number of month the Telegram Premium subscription will be active for the users +//@month_count Number of months the Telegram Premium subscription will be active for the users telegramPaymentPurposePremiumGiftCodes boosted_chat_id:int53 currency:string amount:int53 user_ids:vector month_count:int32 = TelegramPaymentPurpose; //@description The user creating a Telegram Premium giveaway for subscribers of channel chats; requires can_post_messages rights in the channels @@ -4694,7 +4779,7 @@ telegramPaymentPurposePremiumGiftCodes boosted_chat_id:int53 currency:string amo //@currency ISO 4217 currency code of the payment currency //@amount Paid amount, in the smallest units of the currency //@winner_count Number of users which will be able to activate the gift codes -//@month_count Number of month the Telegram Premium subscription will be active for the users +//@month_count Number of months the Telegram Premium subscription will be active for the users telegramPaymentPurposePremiumGiveaway parameters:premiumGiveawayParameters currency:string amount:int53 winner_count:int32 month_count:int32 = TelegramPaymentPurpose; @@ -4776,6 +4861,9 @@ backgroundTypePattern fill:BackgroundFill intensity:int32 is_inverted:Bool is_mo //@description A filled background @fill The background fill backgroundTypeFill fill:BackgroundFill = BackgroundType; +//@description A background from a chat theme; can be used only as a chat background in channels @theme_name Name of the chat theme +backgroundTypeChatTheme theme_name:string = BackgroundType; + //@class InputBackground @description Contains information about background to set @@ -4948,12 +5036,12 @@ pushMessageContentPhoto photo:photo caption:string is_secret:Bool is_pinned:Bool //@is_pinned True, if the message is a pinned message with the specified content pushMessageContentPoll question:string is_regular:Bool is_pinned:Bool = PushMessageContent; -//@description A message with a Telegram Premium gift code created for the user @month_count Number of month the Telegram Premium subscription will be active after code activation +//@description A message with a Telegram Premium gift code created for the user @month_count Number of months the Telegram Premium subscription will be active after code activation pushMessageContentPremiumGiftCode month_count:int32 = PushMessageContent; //@description A message with a Telegram Premium giveaway //@winner_count Number of users which will receive Telegram Premium subscription gift codes; 0 for pinned message -//@month_count Number of month the Telegram Premium subscription will be active after code activation; 0 for pinned message +//@month_count Number of months the Telegram Premium subscription will be active after code activation; 0 for pinned message //@is_pinned True, if the message is a pinned message with the specified content pushMessageContentPremiumGiveaway winner_count:int32 month_count:int32 is_pinned:Bool = PushMessageContent; @@ -5488,6 +5576,9 @@ internalLinkTypePhoneNumberConfirmation hash:string phone_number:string = Intern //@description The link is a link to the Premium features screen of the application from which the user can subscribe to Telegram Premium. Call getPremiumFeatures with the given referrer to process the link @referrer Referrer specified in the link internalLinkTypePremiumFeatures referrer:string = InternalLinkType; +//@description The link is a link to the screen for gifting Telegram Premium subscriptions to friends @referrer Referrer specified in the link +internalLinkTypePremiumGift referrer:string = InternalLinkType; + //@description The link is a link with a Telegram Premium gift code. Call checkPremiumGiftCode with the given code to process the link. If the code is valid and the user wants to apply it, then call applyPremiumGiftCode //@code The Telegram Premium gift code internalLinkTypePremiumGiftCode code:string = InternalLinkType; @@ -5884,6 +5975,9 @@ suggestedActionRestorePremium = SuggestedAction; //@description Suggests the user to subscribe to the Premium subscription with annual payments suggestedActionSubscribeToAnnualPremium = SuggestedAction; +//@description Suggests the user to gift Telegram Premium to friends for Christmas +suggestedActionGiftPremiumForChristmas = SuggestedAction; + //@description Contains a counter @count Count count count:int32 = Count; @@ -6162,11 +6256,13 @@ updateChatTitle chat_id:int53 title:string = Update; //@description A chat photo was changed @chat_id Chat identifier @photo The new chat photo; may be null updateChatPhoto chat_id:int53 photo:chatPhotoInfo = Update; -//@description A chat accent color has changed @chat_id Chat identifier @accent_color_id The new chat accent color identifier -updateChatAccentColor chat_id:int53 accent_color_id:int32 = Update; - -//@description A chat's custom emoji for reply background has changed @chat_id Chat identifier @background_custom_emoji_id The new identifier of a custom emoji to be shown on the reply header background; 0 if none -updateChatBackgroundCustomEmoji chat_id:int53 background_custom_emoji_id:int64 = Update; +//@description Chat accent colors have changed +//@chat_id Chat identifier +//@accent_color_id The new chat accent color identifier +//@background_custom_emoji_id The new identifier of a custom emoji to be shown on the reply header and link preview background; 0 if none +//@profile_accent_color_id The new chat profile accent color identifier; -1 if none +//@profile_background_custom_emoji_id The new identifier of a custom emoji to be shown on the profile background; 0 if none +updateChatAccentColors chat_id:int53 accent_color_id:int32 background_custom_emoji_id:int64 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 = Update; //@description Chat permissions were changed @chat_id Chat identifier @permissions The new chat permissions updateChatPermissions chat_id:int53 permissions:chatPermissions = Update; @@ -6200,6 +6296,11 @@ updateChatAvailableReactions chat_id:int53 available_reactions:ChatAvailableReac //@positions The new chat positions in the chat lists updateChatDraftMessage chat_id:int53 draft_message:draftMessage positions:vector = Update; +//@description Chat emoji status has changed +//@chat_id Chat identifier +//@emoji_status The new chat emoji status; may be null +updateChatEmojiStatus chat_id:int53 emoji_status:emojiStatus = Update; + //@description The message sender that is selected to send messages in a chat has changed @chat_id Chat identifier @message_sender_id New value of message_sender_id; may be null if the user can't change message sender updateChatMessageSender chat_id:int53 message_sender_id:MessageSender = Update; @@ -6448,8 +6549,8 @@ updateSavedAnimations animation_ids:vector = Update; //@description The list of saved notification sounds was updated. This update may not be sent until information about a notification sound was requested for the first time @notification_sound_ids The new list of identifiers of saved notification sounds updateSavedNotificationSounds notification_sound_ids:vector = Update; -//@description The selected background has changed @for_dark_theme True, if background for dark theme has changed @background The new selected background; may be null -updateSelectedBackground for_dark_theme:Bool background:background = Update; +//@description The default background has changed @for_dark_theme True, if default background for dark theme has changed @background The new default background; may be null +updateDefaultBackground for_dark_theme:Bool background:background = Update; //@description The list of available chat themes has changed @chat_themes The new list of chat themes updateChatThemes chat_themes:vector = Update; @@ -6462,7 +6563,7 @@ updateAccentColors colors:vector available_accent_color_ids:vector< //@description The list of supported accent colors for user profiles has changed //@colors Information about supported colors -//@available_accent_color_ids The list of accent color identifiers, which can be set through setProfileAccentColor. The colors must be shown in the specififed order +//@available_accent_color_ids The list of accent color identifiers, which can be set through setProfileAccentColor and setChatProfileAccentColor. The colors must be shown in the specififed order updateProfileAccentColors colors:vector available_accent_color_ids:vector = Update; //@description Some language pack strings have been updated @localization_target Localization target to which the language pack belongs @language_pack_id Identifier of the updated language pack @strings List of changed language pack strings; empty if all strings have changed @@ -6608,6 +6709,22 @@ updateNewChatJoinRequest chat_id:int53 request:chatJoinRequest user_chat_id:int5 //@boost New information about the boost updateChatBoost chat_id:int53 boost:chatBoost = Update; +//@description User changed its reactions on a message with public reactions; for bots only +//@chat_id Chat identifier +//@message_id Message identifier +//@actor_id Identifier of the user or chat that changed reactions +//@date Point in time (Unix timestamp) when the reactions were changed +//@old_reaction_types Old list of chosen reactions +//@new_reaction_types New list of chosen reactions +updateMessageReaction chat_id:int53 message_id:int53 actor_id:MessageSender date:int32 old_reaction_types:vector new_reaction_types:vector = Update; + +//@description Reactions added to a message with anonymous reactions have changed; for bots only +//@chat_id Chat identifier +//@message_id Message identifier +//@date Point in time (Unix timestamp) when the reactions were changed +//@reactions The list of reactions added to the message +updateMessageReactions chat_id:int53 message_id:int53 date:int32 reactions:vector = Update; + //@description Contains a list of updates @updates List of updates updates updates:vector = Updates; @@ -6853,8 +6970,8 @@ getMessage chat_id:int53 message_id:int53 = Message; getMessageLocally chat_id:int53 message_id:int53 = Message; //@description Returns information about a non-bundled message that is replied by a given message. Also, returns the pinned message, the game message, the invoice message, -//-the message with a previously set same background, and the topic creation message for messages of the types -//-messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground and topic messages without non-bundled replied message respectively +//-the message with a previously set same background, the giveaway message, and the topic creation message for messages of the types +//-messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground, messagePremiumGiveawayCompleted and topic messages without non-bundled replied message respectively //@chat_id Identifier of the chat the message belongs to //@message_id Identifier of the reply message getRepliedMessage chat_id:int53 message_id:int53 = Message; @@ -6924,6 +7041,11 @@ getChatSimilarChats chat_id:int53 = Chats; //@return_local Pass true to get the number of chats without sending network requests, or -1 if the number of chats is unknown locally getChatSimilarChatCount chat_id:int53 return_local:Bool = Count; +//@description Informs TDLib that a chat was opened from the list of similar chats. The method is independent from openChat and closeChat methods +//@chat_id Identifier of the original chat, which similar chats were requested +//@opened_chat_id Identifier of the opened chat +openChatSimilarChat chat_id:int53 opened_chat_id:int53 = Ok; + //@description Returns a list of frequently used chats @category Category of chats to be returned @limit The maximum number of chats to be returned; up to 30 getTopChats category:TopChatCategory limit:int32 = Chats; @@ -7399,6 +7521,13 @@ addMessageReaction chat_id:int53 message_id:int53 reaction_type:ReactionType is_ //@reaction_type Type of the reaction to remove removeMessageReaction chat_id:int53 message_id:int53 reaction_type:ReactionType = Ok; +//@description Sets reactions on a message; for bots only +//@chat_id Identifier of the chat to which the message belongs +//@message_id Identifier of the message +//@reaction_types Types of the reaction to set +//@is_big Pass true if the reactions are added with a big animation +setMessageReactions chat_id:int53 message_id:int53 reaction_types:vector is_big:Bool = Ok; + //@description Returns reactions added for a message, along with their sender //@chat_id Identifier of the chat to which the message belongs //@message_id Identifier of the message @@ -7496,13 +7625,13 @@ getLoginUrlInfo chat_id:int53 message_id:int53 button_id:int53 = LoginUrlInfo; getLoginUrl chat_id:int53 message_id:int53 button_id:int53 allow_write_access:Bool = HttpUrl; -//@description Shares a user after pressing a keyboardButtonTypeRequestUser button with the bot +//@description Shares users after pressing a keyboardButtonTypeRequestUsers button with the bot //@chat_id Identifier of the chat with the bot //@message_id Identifier of the message with the button //@button_id Identifier of the button -//@shared_user_id Identifier of the shared user -//@only_check Pass true to check that the user can be shared by the button instead of actually sharing them -shareUserWithBot chat_id:int53 message_id:int53 button_id:int32 shared_user_id:int53 only_check:Bool = Ok; +//@shared_user_ids Identifiers of the shared users +//@only_check Pass true to check that the users can be shared by the button instead of actually sharing them +shareUsersWithBot chat_id:int53 message_id:int53 button_id:int32 shared_user_ids:vector only_check:Bool = Ok; //@description Shares a chat after pressing a keyboardButtonTypeRequestChat button with the bot //@chat_id Identifier of the chat with the bot @@ -7811,29 +7940,41 @@ setChatTitle chat_id:int53 title:string = Ok; //@photo New chat photo; pass null to delete the chat photo setChatPhoto chat_id:int53 photo:InputChatPhoto = Ok; -//@description Changes accent color and background custom emoji of a chat. Supported only for channels with getOption("channel_custom_accent_color_boost_level_min") boost level. Requires can_change_info administrator right +//@description Changes accent color and background custom emoji of a chat. Requires can_change_info administrator right //@chat_id Chat identifier -//@accent_color_id Identifier of the accent color to use -//@background_custom_emoji_id Identifier of a custom emoji to be shown on the reply header background; 0 if none +//@accent_color_id Identifier of the accent color to use. The chat must have at least accentColor.min_chat_boost_level boost level to pass the corresponding color +//@background_custom_emoji_id Identifier of a custom emoji to be shown on the reply header and link preview background; 0 if none. Use chatBoostLevelFeatures.can_set_background_custom_emoji to check whether a custom emoji can be set setChatAccentColor chat_id:int53 accent_color_id:int32 background_custom_emoji_id:int64 = Ok; +//@description Changes accent color and background custom emoji for profile of a chat. Requires can_change_info administrator right +//@chat_id Chat identifier +//@profile_accent_color_id Identifier of the accent color to use for profile; pass -1 if none. The chat must have at least profileAccentColor.min_chat_boost_level boost level to pass the corresponding color +//@profile_background_custom_emoji_id Identifier of a custom emoji to be shown on the chat's profile photo background; 0 if none. Use chatBoostLevelFeatures.can_set_profile_background_custom_emoji to check whether a custom emoji can be set +setChatProfileAccentColor chat_id:int53 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 = Ok; + //@description Changes the message auto-delete or self-destruct (for secret chats) time in a chat. Requires change_info administrator right in basic groups, supergroups and channels //-Message auto-delete time can't be changed in a chat with the current user (Saved Messages) and the chat 777000 (Telegram). //@chat_id Chat identifier //@message_auto_delete_time New time value, in seconds; unless the chat is secret, it must be from 0 up to 365 * 86400 and be divisible by 86400. If 0, then messages aren't deleted automatically setChatMessageAutoDeleteTime chat_id:int53 message_auto_delete_time:int32 = Ok; +//@description Changes the emoji status of a chat. Use chatBoostLevelFeatures.can_set_emoji_status to check whether an emoji status can be set. Requires can_change_info administrator right +//@chat_id Chat identifier +//@emoji_status New emoji status; pass null to remove emoji status +setChatEmojiStatus chat_id:int53 emoji_status:emojiStatus = Ok; + //@description Changes the chat members permissions. Supported only for basic groups and supergroups. Requires can_restrict_members administrator right //@chat_id Chat identifier //@permissions New non-administrator members permissions in the chat setChatPermissions chat_id:int53 permissions:chatPermissions = Ok; -//@description Sets the background in a specific chat. Supported only in private and secret chats with non-deleted users +//@description Sets the background in a specific chat. Supported only in private and secret chats with non-deleted users, and in chats with sufficient boost level and can_change_info administrator right //@chat_id Chat identifier -//@background The input background to use; pass null to create a new filled background -//@type Background type; pass null to use default background type for the chosen background -//@dark_theme_dimming Dimming of the background in dark themes, as a percentage; 0-100 -//@only_for_self Pass true to set background only for self; pass false to set background for both chat users. Background can be set for both users only by Telegram Premium users and if set background isn't of the type inputBackgroundPrevious +//@background The input background to use; pass null to create a new filled or chat theme background +//@type Background type; pass null to use default background type for the chosen background; backgroundTypeChatTheme isn't supported for private and secret chats. +//-Use chatBoostLevelFeatures.chat_theme_background_count and chatBoostLevelFeatures.can_set_custom_background to check whether the background type can be set in the boosted chat +//@dark_theme_dimming Dimming of the background in dark themes, as a percentage; 0-100. Applied only to Wallpaper and Fill types of background +//@only_for_self Pass true to set background only for self; pass false to set background for all chat users. Always false for backgrounds set in boosted chats. Background can be set for both users only by Telegram Premium users and if set background isn't of the type inputBackgroundPrevious setChatBackground chat_id:int53 background:InputBackground type:BackgroundType dark_theme_dimming:int32 only_for_self:Bool = Ok; //@description Deletes background in a specific chat @@ -8109,14 +8250,24 @@ getStoryAvailableReactions row_size:int32 = AvailableReactions; //@update_recent_reactions Pass true if the reaction needs to be added to recent reactions setStoryReaction story_sender_chat_id:int53 story_id:int32 reaction_type:ReactionType update_recent_reactions:Bool = Ok; -//@description Returns viewers of a story. The method can be called only for stories posted on behalf of the current user +//@description Returns interactions with a story. The method can be called only for stories posted on behalf of the current user //@story_id Story identifier -//@query Query to search for in names and usernames of the viewers; may be empty to get all relevant viewers -//@only_contacts Pass true to get only contacts; pass false to get all relevant viewers -//@prefer_with_reaction Pass true to get viewers with reaction first; pass false to get viewers sorted just by view_date +//@query Query to search for in names, usernames and titles; may be empty to get all relevant interactions +//@only_contacts Pass true to get only interactions by contacts; pass false to get all relevant interactions +//@prefer_forwards Pass true to get forwards and reposts first, then reactions, then other views; pass false to get interactions sorted just by interaction date +//@prefer_with_reaction Pass true to get interactions with reaction first; pass false to get interactions sorted just by interaction date. Ignored if prefer_forwards == true //@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results -//@limit The maximum number of story viewers to return -getStoryViewers story_id:int32 query:string only_contacts:Bool prefer_with_reaction:Bool offset:string limit:int32 = StoryViewers; +//@limit The maximum number of story interactions to return +getStoryInteractions story_id:int32 query:string only_contacts:Bool prefer_forwards:Bool prefer_with_reaction:Bool offset:string limit:int32 = StoryInteractions; + +//@description Returns interactions with a story posted in a chat. Can be used only if story is posted on behalf of a chat and the user is an administrator in the chat +//@story_sender_chat_id The identifier of the sender of the story +//@story_id Story identifier +//@reaction_type Pass the default heart reaction or a suggested reaction type to receive only interactions with the specified reaction type; pass null to receive all interactions +//@prefer_forwards Pass true to get forwards and reposts first, then reactions, then other views; pass false to get interactions sorted just by interaction date +//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results +//@limit The maximum number of story interactions to return +getChatStoryInteractions story_sender_chat_id:int53 story_id:int32 reaction_type:ReactionType prefer_forwards:Bool offset:string limit:int32 = StoryInteractions; //@description Reports a story to the Telegram moderators //@story_sender_chat_id The identifier of the sender of the story to report @@ -8135,9 +8286,15 @@ activateStoryStealthMode = Ok; //@story_id The identifier of the story //@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results //@limit The maximum number of messages and stories to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned objects is chosen by TDLib and can be smaller than the specified limit -getStoryPublicForwards story_sender_chat_id:int53 story_id:int32 offset:string limit:int32 = StoryPublicForwards; +getStoryPublicForwards story_sender_chat_id:int53 story_id:int32 offset:string limit:int32 = PublicForwards; +//@description Returns list of features available on the specific chat boost level; this is an offline request @level Chat boost level +getChatBoostLevelFeatures level:int32 = ChatBoostLevelFeatures; + +//@description Returns list of features available on the first 10 chat boost levels; this is an offline request +getChatBoostFeatures = ChatBoostFeatures; + //@description Returns the list of available chat boost slots for the current user getAvailableChatBoostSlots = ChatBoostSlots; @@ -8176,19 +8333,29 @@ getAttachmentMenuBot bot_user_id:int53 = AttachmentMenuBot; toggleBotIsAddedToAttachmentMenu bot_user_id:int53 is_added:Bool allow_write_access:Bool = Ok; -//@description Returns up to 8 emoji statuses, which must be shown right after the default Premium Badge in the emoji status list +//@description Returns up to 8 emoji statuses, which must be shown right after the default Premium Badge in the emoji status list for self status getThemedEmojiStatuses = EmojiStatuses; -//@description Returns recent emoji statuses +//@description Returns recent emoji statuses for self status getRecentEmojiStatuses = EmojiStatuses; -//@description Returns default emoji statuses +//@description Returns default emoji statuses for self status getDefaultEmojiStatuses = EmojiStatuses; -//@description Clears the list of recently used emoji statuses +//@description Clears the list of recently used emoji statuses for self status clearRecentEmojiStatuses = Ok; +//@description Returns up to 8 emoji statuses, which must be shown in the emoji status list for chats +getThemedChatEmojiStatuses = EmojiStatuses; + +//@description Returns default emoji statuses for chats +getDefaultChatEmojiStatuses = EmojiStatuses; + +//@description Returns the list of emoji statuses, which can't be used as chat emoji status, even they are from a sticker set with is_allowed_as_chat_emoji_status == true +getDisallowedChatEmojiStatuses = EmojiStatuses; + + //@description Downloads a file from the cloud. Download progress and completion of the download will be notified through updateFile updates //@file_id Identifier of the file to download //@priority Priority of the download (1-32). The higher the priority, the earlier the file will be downloaded. If the priorities of two files are equal, then the last one for which downloadFile/addFileToDownloads was called will be downloaded first @@ -8772,12 +8939,12 @@ deleteProfilePhoto profile_photo_id:int64 = Ok; //@description Changes accent color and background custom emoji for the current user; for Telegram Premium users only //@accent_color_id Identifier of the accent color to use -//@background_custom_emoji_id Identifier of a custom emoji to be shown on the reply header background; 0 if none +//@background_custom_emoji_id Identifier of a custom emoji to be shown on the reply header and link preview background; 0 if none setAccentColor accent_color_id:int32 background_custom_emoji_id:int64 = Ok; //@description Changes accent color and background custom emoji for profile of the current user; for Telegram Premium users only //@profile_accent_color_id Identifier of the accent color to use for profile; pass -1 if none -//@profile_background_custom_emoji_id Identifier of a custom emoji to be shown in the on the user's profile photo background; 0 if none +//@profile_background_custom_emoji_id Identifier of a custom emoji to be shown on the user's profile photo background; 0 if none setProfileAccentColor profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 = Ok; //@description Changes the first and last name of the current user @first_name The new value of the first name for the current user; 1-64 characters @last_name The new value of the optional last name for the current user; 0-64 characters @@ -9065,26 +9232,29 @@ createInvoiceLink invoice:InputMessageContent = HttpUrl; getSupportUser = User; -//@description Returns backgrounds installed by the user @for_dark_theme Pass true to order returned backgrounds for a dark theme -getBackgrounds for_dark_theme:Bool = Backgrounds; - -//@description Constructs a persistent HTTP URL for a background @name Background name @type Background type +//@description Constructs a persistent HTTP URL for a background @name Background name @type Background type; backgroundTypeChatTheme isn't supported getBackgroundUrl name:string type:BackgroundType = HttpUrl; //@description Searches for a background by its name @name The name of the background searchBackground name:string = Background; -//@description Changes the background selected by the user; adds background to the list of installed backgrounds -//@background The input background to use; pass null to create a new filled background or to remove the current background -//@type Background type; pass null to use the default type of the remote background or to remove the current background -//@for_dark_theme Pass true if the background is changed for a dark theme -setBackground background:InputBackground type:BackgroundType for_dark_theme:Bool = Background; +//@description Sets default background for chats; adds the background to the list of installed backgrounds +//@background The input background to use; pass null to create a new filled background +//@type Background type; pass null to use the default type of the remote background; backgroundTypeChatTheme isn't supported +//@for_dark_theme Pass true if the background is set for a dark theme +setDefaultBackground background:InputBackground type:BackgroundType for_dark_theme:Bool = Background; + +//@description Deletes default background for chats @for_dark_theme Pass true if the background is deleted for a dark theme +deleteDefaultBackground for_dark_theme:Bool = Ok; + +//@description Returns backgrounds installed by the user @for_dark_theme Pass true to order returned backgrounds for a dark theme +getInstalledBackgrounds for_dark_theme:Bool = Backgrounds; //@description Removes background from the list of installed backgrounds @background_id The background identifier -removeBackground background_id:int64 = Ok; +removeInstalledBackground background_id:int64 = Ok; //@description Resets list of installed backgrounds to its default value -resetBackgrounds = Ok; +resetInstalledBackgrounds = Ok; //@description Returns information about the current localization target. This is an offline request if only_local is true. Can be called before authorization @only_local Pass true to get only locally available information without sending network requests @@ -9205,12 +9375,12 @@ getChatStatistics chat_id:int53 is_dark:Bool = ChatStatistics; //@description Returns detailed statistics about a message. Can be used only if message.can_get_statistics == true @chat_id Chat identifier @message_id Message identifier @is_dark Pass true if a dark theme is used by the application getMessageStatistics chat_id:int53 message_id:int53 is_dark:Bool = MessageStatistics; -//@description Returns forwarded copies of a channel message to different public channels. Can be used only if message.can_get_statistics == true. For optimal performance, the number of returned messages is chosen by TDLib +//@description Returns forwarded copies of a channel message to different public channels and public reposts as a story. Can be used only if message.can_get_statistics == true. For optimal performance, the number of returned messages and stories is chosen by TDLib //@chat_id Chat identifier of the message //@message_id Message identifier //@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results -//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit -getMessagePublicForwards chat_id:int53 message_id:int53 offset:string limit:int32 = FoundMessages; +//@limit The maximum number of messages and stories to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned objects is chosen by TDLib and can be smaller than the specified limit +getMessagePublicForwards chat_id:int53 message_id:int53 offset:string limit:int32 = PublicForwards; //@description Returns detailed statistics about a story. Can be used only if story.can_get_statistics == true @chat_id Chat identifier @story_id Story identifier @is_dark Pass true if a dark theme is used by the application getStoryStatistics chat_id:int53 story_id:int32 is_dark:Bool = StoryStatistics; @@ -9472,7 +9642,7 @@ launchPrepaidPremiumGiveaway giveaway_id:int64 parameters:premiumGiveawayParamet //@description Returns information about a Telegram Premium giveaway //@chat_id Identifier of the channel chat which started the giveaway -//@message_id Identifier of the giveaway message in the chat +//@message_id Identifier of the giveaway or a giveaway winners message in the chat getPremiumGiveawayInfo chat_id:int53 message_id:int53 = PremiumGiveawayInfo; //@description Checks whether Telegram Premium purchase is possible. Must be called before in-store Premium purchase @purpose Transaction purpose @@ -9534,9 +9704,6 @@ getDeepLinkInfo link:string = DeepLinkInfo; //@description Returns application config, provided by the server. Can be called before authorization getApplicationConfig = JsonValue; -//@description Adds server-provided application changelog as messages to the chat 777000 (Telegram) or as a stories; for official applications only. Returns a 404 error if nothing changed @previous_application_version The previous application version -addApplicationChangelog previous_application_version:string = Ok; - //@description Saves application log event on the server. Can be called before authorization @type Event type @chat_id Optional chat identifier, associated with the event @data The log event data saveApplicationLogEvent type:string chat_id:int53 data:JsonValue = Ok; From 8f4de4d76ebbaaa78c447c9391828fadd58ba0d5 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Mon, 29 Jan 2024 03:02:25 +0800 Subject: [PATCH 12/54] Update to TDLib 1.8.24 --- client/function.go | 626 ++++++++++++++++- client/type.go | 1078 +++++++++++++++++++++++++++--- client/unmarshaler.go | 530 ++++++++++++++- data/td_api.tl | 380 +++++++++-- example/bot/Bot.go | 28 +- example/command/ReplyCommand.go | 28 +- example/media/Photo_or_Album.go | 28 +- example/pending/PendingUpdate.go | 28 +- example/raw_update/raw.go | 28 +- 9 files changed, 2472 insertions(+), 282 deletions(-) diff --git a/client/function.go b/client/function.go index f43e753..61561cf 100755 --- a/client/function.go +++ b/client/function.go @@ -93,10 +93,6 @@ type SetTdlibParametersRequest struct { SystemVersion string `json:"system_version"` // Application version; must be non-empty ApplicationVersion string `json:"application_version"` - // Pass true to automatically delete old files in background - EnableStorageOptimizer bool `json:"enable_storage_optimizer"` - // Pass true to ignore original file names for downloaded files. Otherwise, downloaded files are saved under names as close as possible to the original name - IgnoreFileNames bool `json:"ignore_file_names"` } // Sets the parameters for TDLib initialization. Works only when the current authorization state is authorizationStateWaitTdlibParameters @@ -120,8 +116,6 @@ func (client *Client) SetTdlibParameters(req *SetTdlibParametersRequest) (*Ok, e "device_model": req.DeviceModel, "system_version": req.SystemVersion, "application_version": req.ApplicationVersion, - "enable_storage_optimizer": req.EnableStorageOptimizer, - "ignore_file_names": req.IgnoreFileNames, }, }) if err != nil { @@ -846,6 +840,25 @@ func (client *Client) ResendRecoveryEmailAddressCode() (*PasswordState, error) { return UnmarshalPasswordState(result.Data) } +// Cancels verification of the 2-step verification recovery email address +func (client *Client) CancelRecoveryEmailAddressVerification() (*PasswordState, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "cancelRecoveryEmailAddressVerification", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPasswordState(result.Data) +} + // Requests to send a 2-step verification password recovery code to an email address that was previously set up func (client *Client) RequestPasswordRecovery() (*EmailAddressAuthenticationCodeInfo, error) { result, err := client.Send(Request{ @@ -1451,6 +1464,53 @@ func (client *Client) GetMessageThread(req *GetMessageThreadRequest) (*MessageTh return UnmarshalMessageThreadInfo(result.Data) } +type GetMessageReadDateRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` +} + +// Returns read date of a recent outgoing message in a private chat. The method can be called if message.can_get_read_date == true and the message is read +func (client *Client) GetMessageReadDate(req *GetMessageReadDateRequest) (MessageReadDate, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getMessageReadDate", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypeMessageReadDateRead: + return UnmarshalMessageReadDateRead(result.Data) + + case TypeMessageReadDateUnread: + return UnmarshalMessageReadDateUnread(result.Data) + + case TypeMessageReadDateTooOld: + return UnmarshalMessageReadDateTooOld(result.Data) + + case TypeMessageReadDateUserPrivacyRestricted: + return UnmarshalMessageReadDateUserPrivacyRestricted(result.Data) + + case TypeMessageReadDateMyPrivacyRestricted: + return UnmarshalMessageReadDateMyPrivacyRestricted(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + type GetMessageViewersRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -2137,6 +2197,231 @@ func (client *Client) GetInactiveSupergroupChats() (*Chats, error) { return UnmarshalChats(result.Data) } +// Returns list of all pinned Saved Messages topics +func (client *Client) GetPinnedSavedMessagesTopics() (*FoundSavedMessagesTopics, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getPinnedSavedMessagesTopics", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFoundSavedMessagesTopics(result.Data) +} + +type GetSavedMessagesTopicsRequest struct { + // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results + Offset string `json:"offset"` + // The maximum number of Saved Messages topics to be returned; up to 100 + Limit int32 `json:"limit"` +} + +// Returns list of non-pinned Saved Messages topics from the specified offset +func (client *Client) GetSavedMessagesTopics(req *GetSavedMessagesTopicsRequest) (*FoundSavedMessagesTopics, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getSavedMessagesTopics", + }, + Data: map[string]interface{}{ + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFoundSavedMessagesTopics(result.Data) +} + +type GetSavedMessagesTopicHistoryRequest struct { + // Saved Messages topic which messages will be fetched + SavedMessagesTopic SavedMessagesTopic `json:"saved_messages_topic"` + // Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message + FromMessageId int64 `json:"from_message_id"` + // Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages + Offset int32 `json:"offset"` + // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit + Limit int32 `json:"limit"` +} + +// Returns messages in a Saved Messages topic. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id) +func (client *Client) GetSavedMessagesTopicHistory(req *GetSavedMessagesTopicHistoryRequest) (*Messages, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getSavedMessagesTopicHistory", + }, + Data: map[string]interface{}{ + "saved_messages_topic": req.SavedMessagesTopic, + "from_message_id": req.FromMessageId, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessages(result.Data) +} + +type GetSavedMessagesTopicMessageByDateRequest struct { + // Saved Messages topic which message will be returned + SavedMessagesTopic SavedMessagesTopic `json:"saved_messages_topic"` + // Point in time (Unix timestamp) relative to which to search for messages + Date int32 `json:"date"` +} + +// Returns the last message sent in a Saved Messages topic no later than the specified date +func (client *Client) GetSavedMessagesTopicMessageByDate(req *GetSavedMessagesTopicMessageByDateRequest) (*Message, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getSavedMessagesTopicMessageByDate", + }, + Data: map[string]interface{}{ + "saved_messages_topic": req.SavedMessagesTopic, + "date": req.Date, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessage(result.Data) +} + +type DeleteSavedMessagesTopicHistoryRequest struct { + // Saved Messages topic which messages will be deleted + SavedMessagesTopic SavedMessagesTopic `json:"saved_messages_topic"` +} + +// Deletes all messages in a Saved Messages topic +func (client *Client) DeleteSavedMessagesTopicHistory(req *DeleteSavedMessagesTopicHistoryRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteSavedMessagesTopicHistory", + }, + Data: map[string]interface{}{ + "saved_messages_topic": req.SavedMessagesTopic, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DeleteSavedMessagesTopicMessagesByDateRequest struct { + // Saved Messages topic which messages will be deleted + SavedMessagesTopic SavedMessagesTopic `json:"saved_messages_topic"` + // The minimum date of the messages to delete + MinDate int32 `json:"min_date"` + // The maximum date of the messages to delete + MaxDate int32 `json:"max_date"` +} + +// Deletes all messages between the specified dates in a Saved Messages topic. Messages sent in the last 30 seconds will not be deleted +func (client *Client) DeleteSavedMessagesTopicMessagesByDate(req *DeleteSavedMessagesTopicMessagesByDateRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteSavedMessagesTopicMessagesByDate", + }, + Data: map[string]interface{}{ + "saved_messages_topic": req.SavedMessagesTopic, + "min_date": req.MinDate, + "max_date": req.MaxDate, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ToggleSavedMessagesTopicIsPinnedRequest struct { + // Saved Messages topic to pin or unpin + SavedMessagesTopic SavedMessagesTopic `json:"saved_messages_topic"` + // Pass true to pin the topic; pass false to unpin it + IsPinned bool `json:"is_pinned"` +} + +// Changes the pinned state of a Saved Messages topic. There can be up to getOption("pinned_saved_messages_topic_count_max") pinned topics. The limit can be increased with Telegram Premium +func (client *Client) ToggleSavedMessagesTopicIsPinned(req *ToggleSavedMessagesTopicIsPinnedRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleSavedMessagesTopicIsPinned", + }, + Data: map[string]interface{}{ + "saved_messages_topic": req.SavedMessagesTopic, + "is_pinned": req.IsPinned, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetPinnedSavedMessagesTopicsRequest struct { + // The new list of pinned Saved Messages topics + SavedMessagesTopics []SavedMessagesTopic `json:"saved_messages_topics"` +} + +// Changes the order of pinned Saved Messages topics +func (client *Client) SetPinnedSavedMessagesTopics(req *SetPinnedSavedMessagesTopicsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setPinnedSavedMessagesTopics", + }, + Data: map[string]interface{}{ + "saved_messages_topics": req.SavedMessagesTopics, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type GetGroupsInCommonRequest struct { // User identifier UserId int64 `json:"user_id"` @@ -2174,7 +2459,7 @@ type GetChatHistoryRequest struct { ChatId int64 `json:"chat_id"` // Identifier of the message starting from which history must be fetched; use 0 to get results from the last message FromMessageId int64 `json:"from_message_id"` - // Specify 0 to get results from exactly the from_message_id or a negative offset up to 99 to get additionally some newer messages + // Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages Offset int32 `json:"offset"` // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit Limit int32 `json:"limit"` @@ -2214,7 +2499,7 @@ type GetMessageThreadHistoryRequest struct { MessageId int64 `json:"message_id"` // Identifier of the message starting from which history must be fetched; use 0 to get results from the last message FromMessageId int64 `json:"from_message_id"` - // Specify 0 to get results from exactly the from_message_id or a negative offset up to 99 to get additionally some newer messages + // Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages Offset int32 `json:"offset"` // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit Limit int32 `json:"limit"` @@ -2312,7 +2597,7 @@ type SearchChatMessagesRequest struct { SenderId MessageSender `json:"sender_id"` // Identifier of the message starting from which history must be fetched; use 0 to get results from the last message FromMessageId int64 `json:"from_message_id"` - // Specify 0 to get results from exactly the from_message_id or a negative offset to get the specified message and some newer messages + // Specify 0 to get results from exactly the message from_message_id or a negative offset to get the specified message and some newer messages Offset int32 `json:"offset"` // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit Limit int32 `json:"limit"` @@ -2320,6 +2605,8 @@ type SearchChatMessagesRequest struct { Filter SearchMessagesFilter `json:"filter"` // If not 0, only messages in the specified thread will be returned; supergroups only MessageThreadId int64 `json:"message_thread_id"` + // If not null, only messages in the specified Saved Messages topic will be returned; pass null to return all messages, or for chats other than Saved Messages + SavedMessagesTopic SavedMessagesTopic `json:"saved_messages_topic"` } // Searches for messages with given words in the chat. Returns the results in reverse chronological order, i.e. in order of decreasing message_id. Cannot be used in secret chats with a non-empty query (searchSecretMessages must be used instead), or without an enabled message database. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit. A combination of query, sender_id, filter and message_thread_id search criteria is expected to be supported, only if it is required for Telegram official application implementation @@ -2337,6 +2624,7 @@ func (client *Client) SearchChatMessages(req *SearchChatMessagesRequest) (*Found "limit": req.Limit, "filter": req.Filter, "message_thread_id": req.MessageThreadId, + "saved_messages_topic": req.SavedMessagesTopic, }, }) if err != nil { @@ -2432,6 +2720,44 @@ func (client *Client) SearchSecretMessages(req *SearchSecretMessagesRequest) (*F return UnmarshalFoundMessages(result.Data) } +type SearchSavedMessagesRequest struct { + // Tag to search for; pass null to return all suitable messages + Tag ReactionType `json:"tag"` + // Query to search for + Query string `json:"query"` + // Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message + FromMessageId int64 `json:"from_message_id"` + // Specify 0 to get results from exactly the message from_message_id or a negative offset to get the specified message and some newer messages + Offset int32 `json:"offset"` + // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit + Limit int32 `json:"limit"` +} + +// Searches for messages tagged by the given reaction and with the given words in the Saved Messages chat; for Telegram Premium users only. Returns the results in reverse chronological order, i.e. in order of decreasing message_id For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit +func (client *Client) SearchSavedMessages(req *SearchSavedMessagesRequest) (*FoundChatMessages, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchSavedMessages", + }, + Data: map[string]interface{}{ + "tag": req.Tag, + "query": req.Query, + "from_message_id": req.FromMessageId, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFoundChatMessages(result.Data) +} + type SearchCallMessagesRequest struct { // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results Offset string `json:"offset"` @@ -2605,6 +2931,8 @@ type GetChatSparseMessagePositionsRequest struct { FromMessageId int64 `json:"from_message_id"` // The expected number of message positions to be returned; 50-2000. A smaller number of positions can be returned, if there are not enough appropriate messages Limit int32 `json:"limit"` + // If not null, only messages in the specified Saved Messages topic will be considered; pass null to consider all messages, or for chats other than Saved Messages + SavedMessagesTopic SavedMessagesTopic `json:"saved_messages_topic"` } // Returns sparse positions of messages of the specified type in the chat to be used for shared media scroll implementation. Returns the results in reverse chronological order (i.e., in order of decreasing message_id). Cannot be used in secret chats or with searchMessagesFilterFailedToSend filter without an enabled message database @@ -2618,6 +2946,7 @@ func (client *Client) GetChatSparseMessagePositions(req *GetChatSparseMessagePos "filter": req.Filter, "from_message_id": req.FromMessageId, "limit": req.Limit, + "saved_messages_topic": req.SavedMessagesTopic, }, }) if err != nil { @@ -2638,6 +2967,8 @@ type GetChatMessageCalendarRequest struct { Filter SearchMessagesFilter `json:"filter"` // The message identifier from which to return information about messages; use 0 to get results from the last message FromMessageId int64 `json:"from_message_id"` + // If not null, only messages in the specified Saved Messages topic will be considered; pass null to consider all messages, or for chats other than Saved Messages + SavedMessagesTopic SavedMessagesTopic `json:"saved_messages_topic"` } // Returns information about the next messages of the specified type in the chat split by days. Returns the results in reverse chronological order. Can return partial result for the last returned day. Behavior of this method depends on the value of the option "utc_time_offset" @@ -2650,6 +2981,7 @@ func (client *Client) GetChatMessageCalendar(req *GetChatMessageCalendarRequest) "chat_id": req.ChatId, "filter": req.Filter, "from_message_id": req.FromMessageId, + "saved_messages_topic": req.SavedMessagesTopic, }, }) if err != nil { @@ -2668,6 +3000,8 @@ type GetChatMessageCountRequest struct { ChatId int64 `json:"chat_id"` // Filter for message content; searchMessagesFilterEmpty is unsupported in this function Filter SearchMessagesFilter `json:"filter"` + // If not null, only messages in the specified Saved Messages topic will be counted; pass null to count all messages, or for chats other than Saved Messages + SavedMessagesTopic SavedMessagesTopic `json:"saved_messages_topic"` // Pass true to get the number of messages without sending network requests, or -1 if the number of messages is unknown locally ReturnLocal bool `json:"return_local"` } @@ -2681,6 +3015,7 @@ func (client *Client) GetChatMessageCount(req *GetChatMessageCountRequest) (*Cou Data: map[string]interface{}{ "chat_id": req.ChatId, "filter": req.Filter, + "saved_messages_topic": req.SavedMessagesTopic, "return_local": req.ReturnLocal, }, }) @@ -2704,6 +3039,8 @@ type GetChatMessagePositionRequest struct { Filter SearchMessagesFilter `json:"filter"` // If not 0, only messages in the specified thread will be considered; supergroups only MessageThreadId int64 `json:"message_thread_id"` + // If not null, only messages in the specified Saved Messages topic will be considered; pass null to consider all relevant messages, or for chats other than Saved Messages + SavedMessagesTopic SavedMessagesTopic `json:"saved_messages_topic"` } // Returns approximate 1-based position of a message among messages, which can be found by the specified filter in the chat. Cannot be used in secret chats @@ -2717,6 +3054,7 @@ func (client *Client) GetChatMessagePosition(req *GetChatMessagePositionRequest) "message_id": req.MessageId, "filter": req.Filter, "message_thread_id": req.MessageThreadId, + "saved_messages_topic": req.SavedMessagesTopic, }, }) if err != nil { @@ -3934,7 +4272,7 @@ type CreateForumTopicRequest struct { Icon *ForumTopicIcon `json:"icon"` } -// Creates a topic in a forum supergroup chat; requires can_manage_topics rights in the supergroup +// Creates a topic in a forum supergroup chat; requires can_manage_topics or can_create_topics rights in the supergroup func (client *Client) CreateForumTopic(req *CreateForumTopicRequest) (*ForumTopicInfo, error) { result, err := client.Send(Request{ meta: meta{ @@ -3970,7 +4308,7 @@ type EditForumTopicRequest struct { IconCustomEmojiId JsonInt64 `json:"icon_custom_emoji_id"` } -// Edits title and icon of a topic in a forum supergroup chat; requires can_manage_topics administrator right in the supergroup unless the user is creator of the topic +// Edits title and icon of a topic in a forum supergroup chat; requires can_manage_topics right in the supergroup unless the user is creator of the topic func (client *Client) EditForumTopic(req *EditForumTopicRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -4135,7 +4473,7 @@ type ToggleForumTopicIsClosedRequest struct { IsClosed bool `json:"is_closed"` } -// Toggles whether a topic is closed in a forum supergroup chat; requires can_manage_topics administrator right in the supergroup unless the user is creator of the topic +// Toggles whether a topic is closed in a forum supergroup chat; requires can_manage_topics right in the supergroup unless the user is creator of the topic func (client *Client) ToggleForumTopicIsClosed(req *ToggleForumTopicIsClosedRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -4165,7 +4503,7 @@ type ToggleGeneralForumTopicIsHiddenRequest struct { IsHidden bool `json:"is_hidden"` } -// Toggles whether a General topic is hidden in a forum supergroup chat; requires can_manage_topics administrator right in the supergroup +// Toggles whether a General topic is hidden in a forum supergroup chat; requires can_manage_topics right in the supergroup func (client *Client) ToggleGeneralForumTopicIsHidden(req *ToggleGeneralForumTopicIsHiddenRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -4196,7 +4534,7 @@ type ToggleForumTopicIsPinnedRequest struct { IsPinned bool `json:"is_pinned"` } -// Changes the pinned state of a forum topic; requires can_manage_topics administrator right in the supergroup. There can be up to getOption("pinned_forum_topic_count_max") pinned forum topics +// Changes the pinned state of a forum topic; requires can_manage_topics right in the supergroup. There can be up to getOption("pinned_forum_topic_count_max") pinned forum topics func (client *Client) ToggleForumTopicIsPinned(req *ToggleForumTopicIsPinnedRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -4226,7 +4564,7 @@ type SetPinnedForumTopicsRequest struct { MessageThreadIds []int64 `json:"message_thread_ids"` } -// Changes the order of pinned forum topics +// Changes the order of pinned forum topics; requires can_manage_topics right in the supergroup func (client *Client) SetPinnedForumTopics(req *SetPinnedForumTopicsRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -4282,7 +4620,7 @@ type GetEmojiReactionRequest struct { Emoji string `json:"emoji"` } -// Returns information about a emoji reaction. Returns a 404 error if the reaction is not found +// Returns information about an emoji reaction. Returns a 404 error if the reaction is not found func (client *Client) GetEmojiReaction(req *GetEmojiReactionRequest) (*EmojiReaction, error) { result, err := client.Send(Request{ meta: meta{ @@ -4382,11 +4720,11 @@ type AddMessageReactionRequest struct { ReactionType ReactionType `json:"reaction_type"` // Pass true if the reaction is added with a big animation IsBig bool `json:"is_big"` - // Pass true if the reaction needs to be added to recent reactions + // Pass true if the reaction needs to be added to recent reactions; tags are never added to the list of recent reactions UpdateRecentReactions bool `json:"update_recent_reactions"` } -// Adds a reaction to a message. Use getMessageAvailableReactions to receive the list of available reactions for the message +// Adds a reaction or a tag to a message. Use getMessageAvailableReactions to receive the list of available reactions for the message func (client *Client) AddMessageReaction(req *AddMessageReactionRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -4542,6 +4880,54 @@ func (client *Client) SetDefaultReactionType(req *SetDefaultReactionTypeRequest) return UnmarshalOk(result.Data) } +// Returns tags used in Saved Messages; for Telegram Premium users only +func (client *Client) GetSavedMessagesTags() (*SavedMessagesTags, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getSavedMessagesTags", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalSavedMessagesTags(result.Data) +} + +type SetSavedMessagesTagLabelRequest struct { + // The tag which label will be changed + Tag ReactionType `json:"tag"` + // New label for the tag; 0-12 characters + Label string `json:"label"` +} + +// Changes label of a Saved Messages tag; for Telegram Premium users only +func (client *Client) SetSavedMessagesTagLabel(req *SetSavedMessagesTagLabelRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setSavedMessagesTagLabel", + }, + Data: map[string]interface{}{ + "tag": req.Tag, + "label": req.Label, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type SearchQuoteRequest struct { // Text in which to search for the quote Text *FormattedText `json:"text"` @@ -4706,6 +5092,37 @@ func GetMarkdownText(req *GetMarkdownTextRequest) (*FormattedText, error) { func (client *Client) GetMarkdownText(req *GetMarkdownTextRequest) (*FormattedText, error) { return GetMarkdownText(req)} +type GetCountryFlagEmojiRequest struct { + // A two-letter ISO 3166-1 alpha-2 country code as received from getCountries + CountryCode string `json:"country_code"` +} + +// Returns an emoji for the given country. Returns an empty string on failure. Can be called synchronously +func GetCountryFlagEmoji(req *GetCountryFlagEmojiRequest) (*Text, error) { + result, err := Execute(Request{ + meta: meta{ + Type: "getCountryFlagEmoji", + }, + Data: map[string]interface{}{ + "country_code": req.CountryCode, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalText(result.Data) +} + +// deprecated +// Returns an emoji for the given country. Returns an empty string on failure. Can be called synchronously +func (client *Client) GetCountryFlagEmoji(req *GetCountryFlagEmojiRequest) (*Text, error) { + return GetCountryFlagEmoji(req)} + type GetFileMimeTypeRequest struct { // The name of the file or path to the file FileName string `json:"file_name"` @@ -13191,21 +13608,47 @@ func (client *Client) GetStickerEmojis(req *GetStickerEmojisRequest) (*Emojis, e type SearchEmojisRequest struct { // Text to search for Text string `json:"text"` - // Pass true if only emojis, which exactly match the text, needs to be returned - ExactMatch bool `json:"exact_match"` // List of possible IETF language tags of the user's input language; may be empty if unknown InputLanguageCodes []string `json:"input_language_codes"` } -// Searches for emojis by keywords. Supported only if the file database is enabled -func (client *Client) SearchEmojis(req *SearchEmojisRequest) (*Emojis, error) { +// Searches for emojis by keywords. Supported only if the file database is enabled. Order of results is unspecified +func (client *Client) SearchEmojis(req *SearchEmojisRequest) (*EmojiKeywords, error) { result, err := client.Send(Request{ meta: meta{ Type: "searchEmojis", }, Data: map[string]interface{}{ "text": req.Text, - "exact_match": req.ExactMatch, + "input_language_codes": req.InputLanguageCodes, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalEmojiKeywords(result.Data) +} + +type GetKeywordEmojisRequest struct { + // Text to search for + Text string `json:"text"` + // List of possible IETF language tags of the user's input language; may be empty if unknown + InputLanguageCodes []string `json:"input_language_codes"` +} + +// Return emojis matching the keyword. Supported only if the file database is enabled. Order of results is unspecified +func (client *Client) GetKeywordEmojis(req *GetKeywordEmojisRequest) (*Emojis, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getKeywordEmojis", + }, + Data: map[string]interface{}{ + "text": req.Text, "input_language_codes": req.InputLanguageCodes, }, }) @@ -16157,6 +16600,137 @@ func (client *Client) GetUserPrivacySettingRules(req *GetUserPrivacySettingRules return UnmarshalUserPrivacySettingRules(result.Data) } +type SetReadDatePrivacySettingsRequest struct { + // New settings + Settings *ReadDatePrivacySettings `json:"settings"` +} + +// Changes privacy settings for message read date +func (client *Client) SetReadDatePrivacySettings(req *SetReadDatePrivacySettingsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setReadDatePrivacySettings", + }, + Data: map[string]interface{}{ + "settings": req.Settings, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Returns privacy settings for message read date +func (client *Client) GetReadDatePrivacySettings() (*ReadDatePrivacySettings, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getReadDatePrivacySettings", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalReadDatePrivacySettings(result.Data) +} + +type SetNewChatPrivacySettingsRequest struct { + // New settings + Settings *NewChatPrivacySettings `json:"settings"` +} + +// Changes privacy settings for new chat creation; for Telegram Premium users only +func (client *Client) SetNewChatPrivacySettings(req *SetNewChatPrivacySettingsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setNewChatPrivacySettings", + }, + Data: map[string]interface{}{ + "settings": req.Settings, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Returns privacy settings for new chat creation +func (client *Client) GetNewChatPrivacySettings() (*NewChatPrivacySettings, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getNewChatPrivacySettings", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalNewChatPrivacySettings(result.Data) +} + +type CanSendMessageToUserRequest struct { + // Identifier of the other user + UserId int64 `json:"user_id"` + // Pass true to get only locally available information without sending network requests + OnlyLocal bool `json:"only_local"` +} + +// Check whether the current user can message another user or try to create a chat with them +func (client *Client) CanSendMessageToUser(req *CanSendMessageToUserRequest) (CanSendMessageToUserResult, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "canSendMessageToUser", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "only_local": req.OnlyLocal, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypeCanSendMessageToUserResultOk: + return UnmarshalCanSendMessageToUserResultOk(result.Data) + + case TypeCanSendMessageToUserResultUserIsDeleted: + return UnmarshalCanSendMessageToUserResultUserIsDeleted(result.Data) + + case TypeCanSendMessageToUserResultUserRestrictsNewChats: + return UnmarshalCanSendMessageToUserResultUserRestrictsNewChats(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + type GetOptionRequest struct { // The name of the option Name string `json:"name"` @@ -19777,6 +20351,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateChatOnlineMemberCount: return UnmarshalUpdateChatOnlineMemberCount(result.Data) + case TypeUpdatePinnedSavedMessagesTopics: + return UnmarshalUpdatePinnedSavedMessagesTopics(result.Data) + case TypeUpdateForumTopicInfo: return UnmarshalUpdateForumTopicInfo(result.Data) @@ -19954,6 +20531,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateDefaultReactionType: return UnmarshalUpdateDefaultReactionType(result.Data) + case TypeUpdateSavedMessagesTags: + return UnmarshalUpdateSavedMessagesTags(result.Data) + case TypeUpdateSpeechRecognitionTrial: return UnmarshalUpdateSpeechRecognitionTrial(result.Data) diff --git a/client/type.go b/client/type.go index 13286d6..f024b7e 100755 --- a/client/type.go +++ b/client/type.go @@ -29,6 +29,7 @@ const ( ClassInviteLinkChatType = "InviteLinkChatType" ClassSecretChatState = "SecretChatState" ClassMessageSender = "MessageSender" + ClassMessageReadDate = "MessageReadDate" ClassMessageOrigin = "MessageOrigin" ClassReactionType = "ReactionType" ClassMessageSendingState = "MessageSendingState" @@ -47,6 +48,7 @@ const ( ClassInlineKeyboardButtonType = "InlineKeyboardButtonType" ClassReplyMarkup = "ReplyMarkup" ClassLoginUrlInfo = "LoginUrlInfo" + ClassSavedMessagesTopic = "SavedMessagesTopic" ClassRichText = "RichText" ClassPageBlockHorizontalAlignment = "PageBlockHorizontalAlignment" ClassPageBlockVerticalAlignment = "PageBlockVerticalAlignment" @@ -84,6 +86,7 @@ const ( ClassGroupCallVideoQuality = "GroupCallVideoQuality" ClassCallProblem = "CallProblem" ClassFirebaseAuthenticationSettings = "FirebaseAuthenticationSettings" + ClassReactionUnavailabilityReason = "ReactionUnavailabilityReason" ClassDiceStickers = "DiceStickers" ClassSpeechRecognitionResult = "SpeechRecognitionResult" ClassBotWriteAccessAllowReason = "BotWriteAccessAllowReason" @@ -117,6 +120,7 @@ const ( ClassStoryPrivacySettings = "StoryPrivacySettings" ClassUserPrivacySettingRule = "UserPrivacySettingRule" ClassUserPrivacySetting = "UserPrivacySetting" + ClassCanSendMessageToUserResult = "CanSendMessageToUserResult" ClassSessionType = "SessionType" ClassReportReason = "ReportReason" ClassTargetChat = "TargetChat" @@ -228,10 +232,12 @@ const ( ClassChatMessageSenders = "ChatMessageSenders" ClassMessageViewer = "MessageViewer" ClassMessageViewers = "MessageViewers" + ClassForwardSource = "ForwardSource" ClassMessageForwardInfo = "MessageForwardInfo" ClassMessageImportInfo = "MessageImportInfo" ClassMessageReplyInfo = "MessageReplyInfo" ClassMessageReaction = "MessageReaction" + ClassMessageReactions = "MessageReactions" ClassMessageInteractionInfo = "MessageInteractionInfo" ClassUnreadReaction = "UnreadReaction" ClassTextQuote = "TextQuote" @@ -264,6 +270,8 @@ const ( ClassArchiveChatListSettings = "ArchiveChatListSettings" ClassChatLists = "ChatLists" ClassChatPosition = "ChatPosition" + ClassSavedMessagesTag = "SavedMessagesTag" + ClassSavedMessagesTags = "SavedMessagesTags" ClassVideoChat = "VideoChat" ClassChat = "Chat" ClassChats = "Chats" @@ -274,6 +282,8 @@ const ( ClassFoundWebApp = "FoundWebApp" ClassWebAppInfo = "WebAppInfo" ClassMessageThreadInfo = "MessageThreadInfo" + ClassFoundSavedMessagesTopic = "FoundSavedMessagesTopic" + ClassFoundSavedMessagesTopics = "FoundSavedMessagesTopics" ClassForumTopicIcon = "ForumTopicIcon" ClassForumTopicInfo = "ForumTopicInfo" ClassForumTopic = "ForumTopic" @@ -322,6 +332,8 @@ const ( ClassInputThumbnail = "InputThumbnail" ClassMessageSendOptions = "MessageSendOptions" ClassMessageCopyOptions = "MessageCopyOptions" + ClassEmojiKeyword = "EmojiKeyword" + ClassEmojiKeywords = "EmojiKeywords" ClassStickers = "Stickers" ClassEmojis = "Emojis" ClassStickerSet = "StickerSet" @@ -406,6 +418,8 @@ const ( ClassNotificationGroup = "NotificationGroup" ClassJsonObjectMember = "JsonObjectMember" ClassUserPrivacySettingRules = "UserPrivacySettingRules" + ClassReadDatePrivacySettings = "ReadDatePrivacySettings" + ClassNewChatPrivacySettings = "NewChatPrivacySettings" ClassAccountTtl = "AccountTtl" ClassMessageAutoDeleteTime = "MessageAutoDeleteTime" ClassSession = "Session" @@ -648,18 +662,25 @@ const ( TypeMessageSenders = "messageSenders" TypeChatMessageSender = "chatMessageSender" TypeChatMessageSenders = "chatMessageSenders" + TypeMessageReadDateRead = "messageReadDateRead" + TypeMessageReadDateUnread = "messageReadDateUnread" + TypeMessageReadDateTooOld = "messageReadDateTooOld" + TypeMessageReadDateUserPrivacyRestricted = "messageReadDateUserPrivacyRestricted" + TypeMessageReadDateMyPrivacyRestricted = "messageReadDateMyPrivacyRestricted" TypeMessageViewer = "messageViewer" TypeMessageViewers = "messageViewers" TypeMessageOriginUser = "messageOriginUser" TypeMessageOriginHiddenUser = "messageOriginHiddenUser" TypeMessageOriginChat = "messageOriginChat" TypeMessageOriginChannel = "messageOriginChannel" + TypeForwardSource = "forwardSource" TypeReactionTypeEmoji = "reactionTypeEmoji" TypeReactionTypeCustomEmoji = "reactionTypeCustomEmoji" TypeMessageForwardInfo = "messageForwardInfo" TypeMessageImportInfo = "messageImportInfo" TypeMessageReplyInfo = "messageReplyInfo" TypeMessageReaction = "messageReaction" + TypeMessageReactions = "messageReactions" TypeMessageInteractionInfo = "messageInteractionInfo" TypeUnreadReaction = "unreadReaction" TypeMessageSendingStatePending = "messageSendingStatePending" @@ -727,6 +748,8 @@ const ( TypeChatPosition = "chatPosition" TypeChatAvailableReactionsAll = "chatAvailableReactionsAll" TypeChatAvailableReactionsSome = "chatAvailableReactionsSome" + TypeSavedMessagesTag = "savedMessagesTag" + TypeSavedMessagesTags = "savedMessagesTags" TypeVideoChat = "videoChat" TypeChat = "chat" TypeChats = "chats" @@ -768,6 +791,11 @@ const ( TypeFoundWebApp = "foundWebApp" TypeWebAppInfo = "webAppInfo" TypeMessageThreadInfo = "messageThreadInfo" + TypeSavedMessagesTopicMyNotes = "savedMessagesTopicMyNotes" + TypeSavedMessagesTopicAuthorHidden = "savedMessagesTopicAuthorHidden" + TypeSavedMessagesTopicSavedFromChat = "savedMessagesTopicSavedFromChat" + TypeFoundSavedMessagesTopic = "foundSavedMessagesTopic" + TypeFoundSavedMessagesTopics = "foundSavedMessagesTopics" TypeForumTopicIcon = "forumTopicIcon" TypeForumTopicInfo = "forumTopicInfo" TypeForumTopic = "forumTopic" @@ -941,12 +969,14 @@ const ( TypeMessageAudio = "messageAudio" TypeMessageDocument = "messageDocument" TypeMessagePhoto = "messagePhoto" - TypeMessageExpiredPhoto = "messageExpiredPhoto" TypeMessageSticker = "messageSticker" TypeMessageVideo = "messageVideo" - TypeMessageExpiredVideo = "messageExpiredVideo" TypeMessageVideoNote = "messageVideoNote" TypeMessageVoiceNote = "messageVoiceNote" + TypeMessageExpiredPhoto = "messageExpiredPhoto" + TypeMessageExpiredVideo = "messageExpiredVideo" + TypeMessageExpiredVideoNote = "messageExpiredVideoNote" + TypeMessageExpiredVoiceNote = "messageExpiredVoiceNote" TypeMessageLocation = "messageLocation" TypeMessageVenue = "messageVenue" TypeMessageContact = "messageContact" @@ -1086,6 +1116,8 @@ const ( TypeUserStatusRecently = "userStatusRecently" TypeUserStatusLastWeek = "userStatusLastWeek" TypeUserStatusLastMonth = "userStatusLastMonth" + TypeEmojiKeyword = "emojiKeyword" + TypeEmojiKeywords = "emojiKeywords" TypeStickers = "stickers" TypeEmojis = "emojis" TypeStickerSet = "stickerSet" @@ -1192,6 +1224,8 @@ const ( TypeAvailableReaction = "availableReaction" TypeAvailableReactions = "availableReactions" TypeEmojiReaction = "emojiReaction" + TypeReactionUnavailabilityReasonAnonymousAdministrator = "reactionUnavailabilityReasonAnonymousAdministrator" + TypeReactionUnavailabilityReasonGuest = "reactionUnavailabilityReasonGuest" TypeAnimations = "animations" TypeDiceStickersRegular = "diceStickersRegular" TypeDiceStickersSlotMachine = "diceStickersSlotMachine" @@ -1309,6 +1343,7 @@ const ( TypePremiumLimitTypeChatFolderCount = "premiumLimitTypeChatFolderCount" TypePremiumLimitTypeChatFolderChosenChatCount = "premiumLimitTypeChatFolderChosenChatCount" TypePremiumLimitTypePinnedArchivedChatCount = "premiumLimitTypePinnedArchivedChatCount" + TypePremiumLimitTypePinnedSavedMessagesTopicCount = "premiumLimitTypePinnedSavedMessagesTopicCount" TypePremiumLimitTypeCaptionLength = "premiumLimitTypeCaptionLength" TypePremiumLimitTypeBioLength = "premiumLimitTypeBioLength" TypePremiumLimitTypeChatFolderInviteLinkCount = "premiumLimitTypeChatFolderInviteLinkCount" @@ -1490,6 +1525,11 @@ const ( TypeUserPrivacySettingAllowPeerToPeerCalls = "userPrivacySettingAllowPeerToPeerCalls" TypeUserPrivacySettingAllowFindingByPhoneNumber = "userPrivacySettingAllowFindingByPhoneNumber" TypeUserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages = "userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages" + TypeReadDatePrivacySettings = "readDatePrivacySettings" + TypeNewChatPrivacySettings = "newChatPrivacySettings" + TypeCanSendMessageToUserResultOk = "canSendMessageToUserResultOk" + TypeCanSendMessageToUserResultUserIsDeleted = "canSendMessageToUserResultUserIsDeleted" + TypeCanSendMessageToUserResultUserRestrictsNewChats = "canSendMessageToUserResultUserRestrictsNewChats" TypeAccountTtl = "accountTtl" TypeMessageAutoDeleteTime = "messageAutoDeleteTime" TypeSessionTypeAndroid = "sessionTypeAndroid" @@ -1731,6 +1771,7 @@ const ( TypeUpdateChatHasScheduledMessages = "updateChatHasScheduledMessages" TypeUpdateChatFolders = "updateChatFolders" TypeUpdateChatOnlineMemberCount = "updateChatOnlineMemberCount" + TypeUpdatePinnedSavedMessagesTopics = "updatePinnedSavedMessagesTopics" TypeUpdateForumTopicInfo = "updateForumTopicInfo" TypeUpdateScopeNotificationSettings = "updateScopeNotificationSettings" TypeUpdateNotification = "updateNotification" @@ -1790,6 +1831,7 @@ const ( TypeUpdateWebAppMessageSent = "updateWebAppMessageSent" TypeUpdateActiveEmojiReactions = "updateActiveEmojiReactions" TypeUpdateDefaultReactionType = "updateDefaultReactionType" + TypeUpdateSavedMessagesTags = "updateSavedMessagesTags" TypeUpdateSpeechRecognitionTrial = "updateSpeechRecognitionTrial" TypeUpdateDiceEmojis = "updateDiceEmojis" TypeUpdateAnimatedEmojiMessageClicked = "updateAnimatedEmojiMessageClicked" @@ -1938,6 +1980,11 @@ type MessageSender interface { MessageSenderType() string } +// Describes read date of a recent outgoing message in a private chat +type MessageReadDate interface { + MessageReadDateType() string +} + // Contains information about the origin of a message type MessageOrigin interface { MessageOriginType() string @@ -2028,6 +2075,11 @@ type LoginUrlInfo interface { LoginUrlInfoType() string } +// Contains information about a Saved Messages topic +type SavedMessagesTopic interface { + SavedMessagesTopicType() string +} + // Describes a text object inside an instant-view web page type RichText interface { RichTextType() string @@ -2213,6 +2265,11 @@ type FirebaseAuthenticationSettings interface { FirebaseAuthenticationSettingsType() string } +// Describes why the current user can't add reactions to the message, despite some other users can +type ReactionUnavailabilityReason interface { + ReactionUnavailabilityReasonType() string +} + // Contains animated stickers which must be used for dice animation rendering type DiceStickers interface { DiceStickersType() string @@ -2378,6 +2435,11 @@ type UserPrivacySetting interface { UserPrivacySettingType() string } +// Describes result of canSendMessageToUser +type CanSendMessageToUserResult interface { + CanSendMessageToUserResultType() string +} + // Represents the type of a session type SessionType interface { SessionTypeType() string @@ -5933,8 +5995,8 @@ type ChatPermissions struct { CanInviteUsers bool `json:"can_invite_users"` // True, if the user can pin messages CanPinMessages bool `json:"can_pin_messages"` - // True, if the user can manage topics - CanManageTopics bool `json:"can_manage_topics"` + // True, if the user can create topics + CanCreateTopics bool `json:"can_create_topics"` } func (entity *ChatPermissions) MarshalJSON() ([]byte, error) { @@ -5972,7 +6034,7 @@ type ChatAdministratorRights struct { CanRestrictMembers bool `json:"can_restrict_members"` // True, if the administrator can pin messages; applicable to basic groups and supergroups only CanPinMessages bool `json:"can_pin_messages"` - // True, if the administrator can manage topics; applicable to forum supergroups only + // True, if the administrator can create, rename, close, reopen, hide, and unhide forum topics; applicable to forum supergroups only CanManageTopics bool `json:"can_manage_topics"` // True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that were directly or indirectly promoted by them CanPromoteMembers bool `json:"can_promote_members"` @@ -6646,6 +6708,8 @@ type User struct { HasActiveStories bool `json:"has_active_stories"` // True, if the user has unread non-expired stories available to the current user HasUnreadActiveStories bool `json:"has_unread_active_stories"` + // True, if the user may restrict new chats with non-contacts. Use canSendMessageToUser to check whether the current user can message the user or try to create a chat with them + RestrictsNewChats bool `json:"restricts_new_chats"` // If false, the user is inaccessible, and the only information known about the user is inside this class. Identifier of the user can't be passed to any method HaveAccess bool `json:"have_access"` // Type of the user @@ -6698,6 +6762,7 @@ func (user *User) UnmarshalJSON(data []byte) error { IsFake bool `json:"is_fake"` HasActiveStories bool `json:"has_active_stories"` HasUnreadActiveStories bool `json:"has_unread_active_stories"` + RestrictsNewChats bool `json:"restricts_new_chats"` HaveAccess bool `json:"have_access"` Type json.RawMessage `json:"type"` LanguageCode string `json:"language_code"` @@ -6732,6 +6797,7 @@ func (user *User) UnmarshalJSON(data []byte) error { user.IsFake = tmp.IsFake user.HasActiveStories = tmp.HasActiveStories user.HasUnreadActiveStories = tmp.HasUnreadActiveStories + user.RestrictsNewChats = tmp.RestrictsNewChats user.HaveAccess = tmp.HaveAccess user.LanguageCode = tmp.LanguageCode user.AddedToAttachmentMenu = tmp.AddedToAttachmentMenu @@ -8658,6 +8724,133 @@ func (*ChatMessageSenders) GetType() string { return TypeChatMessageSenders } +// Contains read date of the message +type MessageReadDateRead struct { + meta + // Point in time (Unix timestamp) when the message was read by the other user + ReadDate int32 `json:"read_date"` +} + +func (entity *MessageReadDateRead) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageReadDateRead + + return json.Marshal((*stub)(entity)) +} + +func (*MessageReadDateRead) GetClass() string { + return ClassMessageReadDate +} + +func (*MessageReadDateRead) GetType() string { + return TypeMessageReadDateRead +} + +func (*MessageReadDateRead) MessageReadDateType() string { + return TypeMessageReadDateRead +} + +// The message is unread yet +type MessageReadDateUnread struct{ + meta +} + +func (entity *MessageReadDateUnread) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageReadDateUnread + + return json.Marshal((*stub)(entity)) +} + +func (*MessageReadDateUnread) GetClass() string { + return ClassMessageReadDate +} + +func (*MessageReadDateUnread) GetType() string { + return TypeMessageReadDateUnread +} + +func (*MessageReadDateUnread) MessageReadDateType() string { + return TypeMessageReadDateUnread +} + +// The message is too old to get read date +type MessageReadDateTooOld struct{ + meta +} + +func (entity *MessageReadDateTooOld) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageReadDateTooOld + + return json.Marshal((*stub)(entity)) +} + +func (*MessageReadDateTooOld) GetClass() string { + return ClassMessageReadDate +} + +func (*MessageReadDateTooOld) GetType() string { + return TypeMessageReadDateTooOld +} + +func (*MessageReadDateTooOld) MessageReadDateType() string { + return TypeMessageReadDateTooOld +} + +// The read date is unknown due to privacy settings of the other user +type MessageReadDateUserPrivacyRestricted struct{ + meta +} + +func (entity *MessageReadDateUserPrivacyRestricted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageReadDateUserPrivacyRestricted + + return json.Marshal((*stub)(entity)) +} + +func (*MessageReadDateUserPrivacyRestricted) GetClass() string { + return ClassMessageReadDate +} + +func (*MessageReadDateUserPrivacyRestricted) GetType() string { + return TypeMessageReadDateUserPrivacyRestricted +} + +func (*MessageReadDateUserPrivacyRestricted) MessageReadDateType() string { + return TypeMessageReadDateUserPrivacyRestricted +} + +// The read date is unknown due to privacy settings of the current user, but will be known if the user subscribes to Telegram Premium +type MessageReadDateMyPrivacyRestricted struct{ + meta +} + +func (entity *MessageReadDateMyPrivacyRestricted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageReadDateMyPrivacyRestricted + + return json.Marshal((*stub)(entity)) +} + +func (*MessageReadDateMyPrivacyRestricted) GetClass() string { + return ClassMessageReadDate +} + +func (*MessageReadDateMyPrivacyRestricted) GetType() string { + return TypeMessageReadDateMyPrivacyRestricted +} + +func (*MessageReadDateMyPrivacyRestricted) MessageReadDateType() string { + return TypeMessageReadDateMyPrivacyRestricted +} + // Represents a viewer of a message type MessageViewer struct { meta @@ -8820,6 +9013,66 @@ func (*MessageOriginChannel) MessageOriginType() string { return TypeMessageOriginChannel } +// Contains information about the last message from which a new message was forwarded last time +type ForwardSource struct { + meta + // Identifier of the chat to which the message that was forwarded belonged; may be 0 if unknown + ChatId int64 `json:"chat_id"` + // Identifier of the message; may be 0 if unknown + MessageId int64 `json:"message_id"` + // Identifier of the sender of the message; may be null if unknown or the new message was forwarded not to Saved Messages + SenderId MessageSender `json:"sender_id"` + // Name of the sender of the message if the sender is hidden by their privacy settings + SenderName string `json:"sender_name"` + // Point in time (Unix timestamp) when the message is sent; 0 if unknown + Date int32 `json:"date"` + // True, if the message that was forwarded is outgoing; always false if sender is unknown + IsOutgoing bool `json:"is_outgoing"` +} + +func (entity *ForwardSource) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ForwardSource + + return json.Marshal((*stub)(entity)) +} + +func (*ForwardSource) GetClass() string { + return ClassForwardSource +} + +func (*ForwardSource) GetType() string { + return TypeForwardSource +} + +func (forwardSource *ForwardSource) UnmarshalJSON(data []byte) error { + var tmp struct { + ChatId int64 `json:"chat_id"` + MessageId int64 `json:"message_id"` + SenderId json.RawMessage `json:"sender_id"` + SenderName string `json:"sender_name"` + Date int32 `json:"date"` + IsOutgoing bool `json:"is_outgoing"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + forwardSource.ChatId = tmp.ChatId + forwardSource.MessageId = tmp.MessageId + forwardSource.SenderName = tmp.SenderName + forwardSource.Date = tmp.Date + forwardSource.IsOutgoing = tmp.IsOutgoing + + fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) + forwardSource.SenderId = fieldSenderId + + return nil +} + // A reaction with an emoji type ReactionTypeEmoji struct { meta @@ -8881,12 +9134,10 @@ type MessageForwardInfo struct { Origin MessageOrigin `json:"origin"` // Point in time (Unix timestamp) when the message was originally sent Date int32 `json:"date"` + // For messages forwarded to the chat with the current user (Saved Messages), to the Replies bot chat, or to the channel's discussion group, information about the source message from which the message was forwarded last time; may be null for other forwards or if unknown + Source *ForwardSource `json:"source"` // The type of a public service announcement for the forwarded message PublicServiceAnnouncementType string `json:"public_service_announcement_type"` - // For messages forwarded to the chat with the current user (Saved Messages), to the Replies bot chat, or to the channel's discussion group, the identifier of the chat from which the message was forwarded last time; 0 if unknown - FromChatId int64 `json:"from_chat_id"` - // For messages forwarded to the chat with the current user (Saved Messages), to the Replies bot chat, or to the channel's discussion group, the identifier of the original message from which the new message was forwarded last time; 0 if unknown - FromMessageId int64 `json:"from_message_id"` } func (entity *MessageForwardInfo) MarshalJSON() ([]byte, error) { @@ -8909,9 +9160,8 @@ func (messageForwardInfo *MessageForwardInfo) UnmarshalJSON(data []byte) error { var tmp struct { Origin json.RawMessage `json:"origin"` Date int32 `json:"date"` + Source *ForwardSource `json:"source"` PublicServiceAnnouncementType string `json:"public_service_announcement_type"` - FromChatId int64 `json:"from_chat_id"` - FromMessageId int64 `json:"from_message_id"` } err := json.Unmarshal(data, &tmp) @@ -8920,9 +9170,8 @@ func (messageForwardInfo *MessageForwardInfo) UnmarshalJSON(data []byte) error { } messageForwardInfo.Date = tmp.Date + messageForwardInfo.Source = tmp.Source messageForwardInfo.PublicServiceAnnouncementType = tmp.PublicServiceAnnouncementType - messageForwardInfo.FromChatId = tmp.FromChatId - messageForwardInfo.FromMessageId = tmp.FromMessageId fieldOrigin, _ := UnmarshalMessageOrigin(tmp.Origin) messageForwardInfo.Origin = fieldOrigin @@ -9071,6 +9320,31 @@ func (messageReaction *MessageReaction) UnmarshalJSON(data []byte) error { return nil } +// Contains a list of reactions added to a message +type MessageReactions struct { + meta + // List of added reactions + Reactions []*MessageReaction `json:"reactions"` + // True, if the reactions are tags and Telegram Premium users can filter messages by them; currently, always false + AreTags bool `json:"are_tags"` +} + +func (entity *MessageReactions) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageReactions + + return json.Marshal((*stub)(entity)) +} + +func (*MessageReactions) GetClass() string { + return ClassMessageReactions +} + +func (*MessageReactions) GetType() string { + return TypeMessageReactions +} + // Contains information about interactions with a message type MessageInteractionInfo struct { meta @@ -9080,8 +9354,8 @@ type MessageInteractionInfo struct { ForwardCount int32 `json:"forward_count"` // Information about direct or indirect replies to the message; may be null. Currently, available only in channels with a discussion supergroup and discussion supergroups for messages, which are not replies itself ReplyInfo *MessageReplyInfo `json:"reply_info"` - // The list of reactions added to the message - Reactions []*MessageReaction `json:"reactions"` + // The list of reactions or tags added to the message; may be null + Reactions *MessageReactions `json:"reactions"` } func (entity *MessageInteractionInfo) MarshalJSON() ([]byte, error) { @@ -9456,6 +9730,8 @@ type Message struct { CanGetStatistics bool `json:"can_get_statistics"` // True, if information about the message thread is available through getMessageThread and getMessageThreadHistory CanGetMessageThread bool `json:"can_get_message_thread"` + // True, if read date of the message can be received through getMessageReadDate + CanGetReadDate bool `json:"can_get_read_date"` // True, if chat members already viewed the message can be received through getMessageViewers CanGetViewers bool `json:"can_get_viewers"` // True, if media timestamp links can be generated for media timestamp entities in the message text, caption or web page description through getMessageLink @@ -9486,6 +9762,8 @@ type Message struct { ReplyTo MessageReplyTo `json:"reply_to"` // If non-zero, the identifier of the message thread the message belongs to; unique within the chat to which the message belongs MessageThreadId int64 `json:"message_thread_id"` + // Information about topic of the message in the Saved Messages chat; may be null for messages not from Saved Messages + SavedMessagesTopic SavedMessagesTopic `json:"saved_messages_topic"` // The message's self-destruct type; may be null if none SelfDestructType MessageSelfDestructType `json:"self_destruct_type"` // Time left before the message self-destruct timer expires, in seconds; 0 if self-destruction isn't scheduled yet @@ -9540,6 +9818,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { CanGetAddedReactions bool `json:"can_get_added_reactions"` CanGetStatistics bool `json:"can_get_statistics"` CanGetMessageThread bool `json:"can_get_message_thread"` + CanGetReadDate bool `json:"can_get_read_date"` CanGetViewers bool `json:"can_get_viewers"` CanGetMediaTimestampLinks bool `json:"can_get_media_timestamp_links"` CanReportReactions bool `json:"can_report_reactions"` @@ -9555,6 +9834,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { UnreadReactions []*UnreadReaction `json:"unread_reactions"` ReplyTo json.RawMessage `json:"reply_to"` MessageThreadId int64 `json:"message_thread_id"` + SavedMessagesTopic json.RawMessage `json:"saved_messages_topic"` SelfDestructType json.RawMessage `json:"self_destruct_type"` SelfDestructIn float64 `json:"self_destruct_in"` AutoDeleteIn float64 `json:"auto_delete_in"` @@ -9584,6 +9864,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { message.CanGetAddedReactions = tmp.CanGetAddedReactions message.CanGetStatistics = tmp.CanGetStatistics message.CanGetMessageThread = tmp.CanGetMessageThread + message.CanGetReadDate = tmp.CanGetReadDate message.CanGetViewers = tmp.CanGetViewers message.CanGetMediaTimestampLinks = tmp.CanGetMediaTimestampLinks message.CanReportReactions = tmp.CanReportReactions @@ -9617,6 +9898,9 @@ func (message *Message) UnmarshalJSON(data []byte) error { fieldReplyTo, _ := UnmarshalMessageReplyTo(tmp.ReplyTo) message.ReplyTo = fieldReplyTo + fieldSavedMessagesTopic, _ := UnmarshalSavedMessagesTopic(tmp.SavedMessagesTopic) + message.SavedMessagesTopic = fieldSavedMessagesTopic + fieldSelfDestructType, _ := UnmarshalMessageSelfDestructType(tmp.SelfDestructType) message.SelfDestructType = fieldSelfDestructType @@ -11356,6 +11640,77 @@ func (chatAvailableReactionsSome *ChatAvailableReactionsSome) UnmarshalJSON(data return nil } +// Represents a tag used in Saved Messages +type SavedMessagesTag struct { + meta + // The tag + Tag ReactionType `json:"tag"` + // Label of the tag; 0-12 characters + Label string `json:"label"` + // Number of times the tag was used; may be 0 if the tag has non-empty label + Count int32 `json:"count"` +} + +func (entity *SavedMessagesTag) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SavedMessagesTag + + return json.Marshal((*stub)(entity)) +} + +func (*SavedMessagesTag) GetClass() string { + return ClassSavedMessagesTag +} + +func (*SavedMessagesTag) GetType() string { + return TypeSavedMessagesTag +} + +func (savedMessagesTag *SavedMessagesTag) UnmarshalJSON(data []byte) error { + var tmp struct { + Tag json.RawMessage `json:"tag"` + Label string `json:"label"` + Count int32 `json:"count"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + savedMessagesTag.Label = tmp.Label + savedMessagesTag.Count = tmp.Count + + fieldTag, _ := UnmarshalReactionType(tmp.Tag) + savedMessagesTag.Tag = fieldTag + + return nil +} + +// Contains a list of tags used in Saved Messages +type SavedMessagesTags struct { + meta + // List of tags + Tags []*SavedMessagesTag `json:"tags"` +} + +func (entity *SavedMessagesTags) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SavedMessagesTags + + return json.Marshal((*stub)(entity)) +} + +func (*SavedMessagesTags) GetClass() string { + return ClassSavedMessagesTags +} + +func (*SavedMessagesTags) GetType() string { + return TypeSavedMessagesTags +} + // Describes a video chat type VideoChat struct { meta @@ -12748,6 +13103,154 @@ func (*MessageThreadInfo) GetType() string { return TypeMessageThreadInfo } +// Topic containing messages sent by the current user of forwarded from an unknown chat +type SavedMessagesTopicMyNotes struct{ + meta +} + +func (entity *SavedMessagesTopicMyNotes) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SavedMessagesTopicMyNotes + + return json.Marshal((*stub)(entity)) +} + +func (*SavedMessagesTopicMyNotes) GetClass() string { + return ClassSavedMessagesTopic +} + +func (*SavedMessagesTopicMyNotes) GetType() string { + return TypeSavedMessagesTopicMyNotes +} + +func (*SavedMessagesTopicMyNotes) SavedMessagesTopicType() string { + return TypeSavedMessagesTopicMyNotes +} + +// Topic containing messages forwarded from a user with hidden privacy +type SavedMessagesTopicAuthorHidden struct{ + meta +} + +func (entity *SavedMessagesTopicAuthorHidden) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SavedMessagesTopicAuthorHidden + + return json.Marshal((*stub)(entity)) +} + +func (*SavedMessagesTopicAuthorHidden) GetClass() string { + return ClassSavedMessagesTopic +} + +func (*SavedMessagesTopicAuthorHidden) GetType() string { + return TypeSavedMessagesTopicAuthorHidden +} + +func (*SavedMessagesTopicAuthorHidden) SavedMessagesTopicType() string { + return TypeSavedMessagesTopicAuthorHidden +} + +// Topic containing messages forwarded from a specific chat +type SavedMessagesTopicSavedFromChat struct { + meta + // Identifier of the chat + ChatId int64 `json:"chat_id"` +} + +func (entity *SavedMessagesTopicSavedFromChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SavedMessagesTopicSavedFromChat + + return json.Marshal((*stub)(entity)) +} + +func (*SavedMessagesTopicSavedFromChat) GetClass() string { + return ClassSavedMessagesTopic +} + +func (*SavedMessagesTopicSavedFromChat) GetType() string { + return TypeSavedMessagesTopicSavedFromChat +} + +func (*SavedMessagesTopicSavedFromChat) SavedMessagesTopicType() string { + return TypeSavedMessagesTopicSavedFromChat +} + +// Contains information about a found Saved Messages topic +type FoundSavedMessagesTopic struct { + meta + // The topic + Topic SavedMessagesTopic `json:"topic"` + // Last message in the topic; may be null if none or unknown + LastMessage *Message `json:"last_message"` +} + +func (entity *FoundSavedMessagesTopic) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FoundSavedMessagesTopic + + return json.Marshal((*stub)(entity)) +} + +func (*FoundSavedMessagesTopic) GetClass() string { + return ClassFoundSavedMessagesTopic +} + +func (*FoundSavedMessagesTopic) GetType() string { + return TypeFoundSavedMessagesTopic +} + +func (foundSavedMessagesTopic *FoundSavedMessagesTopic) UnmarshalJSON(data []byte) error { + var tmp struct { + Topic json.RawMessage `json:"topic"` + LastMessage *Message `json:"last_message"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + foundSavedMessagesTopic.LastMessage = tmp.LastMessage + + fieldTopic, _ := UnmarshalSavedMessagesTopic(tmp.Topic) + foundSavedMessagesTopic.Topic = fieldTopic + + return nil +} + +// Contains a list of Saved Messages topics +type FoundSavedMessagesTopics struct { + meta + // Total number of Saved Messages topics found + TotalCount int32 `json:"total_count"` + // List of Saved Messages topics + Topics []*FoundSavedMessagesTopic `json:"topics"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` +} + +func (entity *FoundSavedMessagesTopics) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FoundSavedMessagesTopics + + return json.Marshal((*stub)(entity)) +} + +func (*FoundSavedMessagesTopics) GetClass() string { + return ClassFoundSavedMessagesTopics +} + +func (*FoundSavedMessagesTopics) GetType() string { + return TypeFoundSavedMessagesTopics +} + // Describes a forum topic icon type ForumTopicIcon struct { meta @@ -18673,31 +19176,6 @@ func (*MessagePhoto) MessageContentType() string { return TypeMessagePhoto } -// A self-destructed photo message -type MessageExpiredPhoto struct{ - meta -} - -func (entity *MessageExpiredPhoto) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageExpiredPhoto - - return json.Marshal((*stub)(entity)) -} - -func (*MessageExpiredPhoto) GetClass() string { - return ClassMessageContent -} - -func (*MessageExpiredPhoto) GetType() string { - return TypeMessageExpiredPhoto -} - -func (*MessageExpiredPhoto) MessageContentType() string { - return TypeMessageExpiredPhoto -} - // A sticker message type MessageSticker struct { meta @@ -18760,31 +19238,6 @@ func (*MessageVideo) MessageContentType() string { return TypeMessageVideo } -// A self-destructed video message -type MessageExpiredVideo struct{ - meta -} - -func (entity *MessageExpiredVideo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageExpiredVideo - - return json.Marshal((*stub)(entity)) -} - -func (*MessageExpiredVideo) GetClass() string { - return ClassMessageContent -} - -func (*MessageExpiredVideo) GetType() string { - return TypeMessageExpiredVideo -} - -func (*MessageExpiredVideo) MessageContentType() string { - return TypeMessageExpiredVideo -} - // A video note message type MessageVideoNote struct { meta @@ -18847,6 +19300,106 @@ func (*MessageVoiceNote) MessageContentType() string { return TypeMessageVoiceNote } +// A self-destructed photo message +type MessageExpiredPhoto struct{ + meta +} + +func (entity *MessageExpiredPhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageExpiredPhoto + + return json.Marshal((*stub)(entity)) +} + +func (*MessageExpiredPhoto) GetClass() string { + return ClassMessageContent +} + +func (*MessageExpiredPhoto) GetType() string { + return TypeMessageExpiredPhoto +} + +func (*MessageExpiredPhoto) MessageContentType() string { + return TypeMessageExpiredPhoto +} + +// A self-destructed video message +type MessageExpiredVideo struct{ + meta +} + +func (entity *MessageExpiredVideo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageExpiredVideo + + return json.Marshal((*stub)(entity)) +} + +func (*MessageExpiredVideo) GetClass() string { + return ClassMessageContent +} + +func (*MessageExpiredVideo) GetType() string { + return TypeMessageExpiredVideo +} + +func (*MessageExpiredVideo) MessageContentType() string { + return TypeMessageExpiredVideo +} + +// A self-destructed video note message +type MessageExpiredVideoNote struct{ + meta +} + +func (entity *MessageExpiredVideoNote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageExpiredVideoNote + + return json.Marshal((*stub)(entity)) +} + +func (*MessageExpiredVideoNote) GetClass() string { + return ClassMessageContent +} + +func (*MessageExpiredVideoNote) GetType() string { + return TypeMessageExpiredVideoNote +} + +func (*MessageExpiredVideoNote) MessageContentType() string { + return TypeMessageExpiredVideoNote +} + +// A self-destructed voice note message +type MessageExpiredVoiceNote struct{ + meta +} + +func (entity *MessageExpiredVoiceNote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageExpiredVoiceNote + + return json.Marshal((*stub)(entity)) +} + +func (*MessageExpiredVoiceNote) GetClass() string { + return ClassMessageContent +} + +func (*MessageExpiredVoiceNote) GetType() string { + return TypeMessageExpiredVoiceNote +} + +func (*MessageExpiredVoiceNote) MessageContentType() string { + return TypeMessageExpiredVoiceNote +} + // A message with a location type MessageLocation struct { meta @@ -21887,6 +22440,8 @@ type InputMessageVideoNote struct { Duration int32 `json:"duration"` // Video width and height; must be positive and not greater than 640 Length int32 `json:"length"` + // Video note self-destruct type; pass null if none; private chats only + SelfDestructType MessageSelfDestructType `json:"self_destruct_type"` } func (entity *InputMessageVideoNote) MarshalJSON() ([]byte, error) { @@ -21915,6 +22470,7 @@ func (inputMessageVideoNote *InputMessageVideoNote) UnmarshalJSON(data []byte) e Thumbnail *InputThumbnail `json:"thumbnail"` Duration int32 `json:"duration"` Length int32 `json:"length"` + SelfDestructType json.RawMessage `json:"self_destruct_type"` } err := json.Unmarshal(data, &tmp) @@ -21929,6 +22485,9 @@ func (inputMessageVideoNote *InputMessageVideoNote) UnmarshalJSON(data []byte) e fieldVideoNote, _ := UnmarshalInputFile(tmp.VideoNote) inputMessageVideoNote.VideoNote = fieldVideoNote + fieldSelfDestructType, _ := UnmarshalMessageSelfDestructType(tmp.SelfDestructType) + inputMessageVideoNote.SelfDestructType = fieldSelfDestructType + return nil } @@ -21943,6 +22502,8 @@ type InputMessageVoiceNote struct { Waveform []byte `json:"waveform"` // Voice note caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters Caption *FormattedText `json:"caption"` + // Voice note self-destruct type; pass null if none; private chats only + SelfDestructType MessageSelfDestructType `json:"self_destruct_type"` } func (entity *InputMessageVoiceNote) MarshalJSON() ([]byte, error) { @@ -21971,6 +22532,7 @@ func (inputMessageVoiceNote *InputMessageVoiceNote) UnmarshalJSON(data []byte) e Duration int32 `json:"duration"` Waveform []byte `json:"waveform"` Caption *FormattedText `json:"caption"` + SelfDestructType json.RawMessage `json:"self_destruct_type"` } err := json.Unmarshal(data, &tmp) @@ -21985,6 +22547,9 @@ func (inputMessageVoiceNote *InputMessageVoiceNote) UnmarshalJSON(data []byte) e fieldVoiceNote, _ := UnmarshalInputFile(tmp.VoiceNote) inputMessageVoiceNote.VoiceNote = fieldVoiceNote + fieldSelfDestructType, _ := UnmarshalMessageSelfDestructType(tmp.SelfDestructType) + inputMessageVoiceNote.SelfDestructType = fieldSelfDestructType + return nil } @@ -23163,7 +23728,7 @@ func (*ChatActionCancel) ChatActionType() string { return TypeChatActionCancel } -// The user status was never changed +// The user's status has never been changed type UserStatusEmpty struct{ meta } @@ -23243,8 +23808,10 @@ func (*UserStatusOffline) UserStatusType() string { } // The user was online recently -type UserStatusRecently struct{ +type UserStatusRecently struct { meta + // Exact user's status is hidden because the current user enabled userPrivacySettingShowStatus privacy setting for the user and has no Telegram Premium + ByMyPrivacySettings bool `json:"by_my_privacy_settings"` } func (entity *UserStatusRecently) MarshalJSON() ([]byte, error) { @@ -23268,8 +23835,10 @@ func (*UserStatusRecently) UserStatusType() string { } // The user is offline, but was online last week -type UserStatusLastWeek struct{ +type UserStatusLastWeek struct { meta + // Exact user's status is hidden because the current user enabled userPrivacySettingShowStatus privacy setting for the user and has no Telegram Premium + ByMyPrivacySettings bool `json:"by_my_privacy_settings"` } func (entity *UserStatusLastWeek) MarshalJSON() ([]byte, error) { @@ -23293,8 +23862,10 @@ func (*UserStatusLastWeek) UserStatusType() string { } // The user is offline, but was online last month -type UserStatusLastMonth struct{ +type UserStatusLastMonth struct { meta + // Exact user's status is hidden because the current user enabled userPrivacySettingShowStatus privacy setting for the user and has no Telegram Premium + ByMyPrivacySettings bool `json:"by_my_privacy_settings"` } func (entity *UserStatusLastMonth) MarshalJSON() ([]byte, error) { @@ -23317,6 +23888,54 @@ func (*UserStatusLastMonth) UserStatusType() string { return TypeUserStatusLastMonth } +// Represents an emoji with its keyword +type EmojiKeyword struct { + meta + // The emoji + Emoji string `json:"emoji"` + // The keyword + Keyword string `json:"keyword"` +} + +func (entity *EmojiKeyword) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub EmojiKeyword + + return json.Marshal((*stub)(entity)) +} + +func (*EmojiKeyword) GetClass() string { + return ClassEmojiKeyword +} + +func (*EmojiKeyword) GetType() string { + return TypeEmojiKeyword +} + +// Represents a list of emoji with their keywords +type EmojiKeywords struct { + meta + // List of emoji with their keywords + EmojiKeywords []*EmojiKeyword `json:"emoji_keywords"` +} + +func (entity *EmojiKeywords) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub EmojiKeywords + + return json.Marshal((*stub)(entity)) +} + +func (*EmojiKeywords) GetClass() string { + return ClassEmojiKeywords +} + +func (*EmojiKeywords) GetType() string { + return TypeEmojiKeywords +} + // Represents a list of stickers type Stickers struct { meta @@ -25185,6 +25804,16 @@ type ChatBoostFeatures struct { meta // The list of features Features []*ChatBoostLevelFeatures `json:"features"` + // The minimum boost level required to set custom emoji for profile background + MinProfileBackgroundCustomEmojiBoostLevel int32 `json:"min_profile_background_custom_emoji_boost_level"` + // The minimum boost level required to set custom emoji for reply header and link preview background + MinBackgroundCustomEmojiBoostLevel int32 `json:"min_background_custom_emoji_boost_level"` + // The minimum boost level required to set emoji status + MinEmojiStatusBoostLevel int32 `json:"min_emoji_status_boost_level"` + // The minimum boost level required to set a chat theme background as chat background + MinChatThemeBackgroundBoostLevel int32 `json:"min_chat_theme_background_boost_level"` + // The minimum boost level required to set custom chat background + MinCustomBackgroundBoostLevel int32 `json:"min_custom_background_boost_level"` } func (entity *ChatBoostFeatures) MarshalJSON() ([]byte, error) { @@ -26966,6 +27595,10 @@ type AvailableReactions struct { PopularReactions []*AvailableReaction `json:"popular_reactions"` // True, if any custom emoji reaction can be added by Telegram Premium subscribers AllowCustomEmoji bool `json:"allow_custom_emoji"` + // True, if the reactions will be tags and the message can be found by them; currently, always false + AreTags bool `json:"are_tags"` + // The reason why the current user can't add reactions to the message, despite some other users can; may be null if none + UnavailabilityReason ReactionUnavailabilityReason `json:"unavailability_reason"` } func (entity *AvailableReactions) MarshalJSON() ([]byte, error) { @@ -26984,7 +27617,34 @@ func (*AvailableReactions) GetType() string { return TypeAvailableReactions } -// Contains information about a emoji reaction +func (availableReactions *AvailableReactions) UnmarshalJSON(data []byte) error { + var tmp struct { + TopReactions []*AvailableReaction `json:"top_reactions"` + RecentReactions []*AvailableReaction `json:"recent_reactions"` + PopularReactions []*AvailableReaction `json:"popular_reactions"` + AllowCustomEmoji bool `json:"allow_custom_emoji"` + AreTags bool `json:"are_tags"` + UnavailabilityReason json.RawMessage `json:"unavailability_reason"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + availableReactions.TopReactions = tmp.TopReactions + availableReactions.RecentReactions = tmp.RecentReactions + availableReactions.PopularReactions = tmp.PopularReactions + availableReactions.AllowCustomEmoji = tmp.AllowCustomEmoji + availableReactions.AreTags = tmp.AreTags + + fieldUnavailabilityReason, _ := UnmarshalReactionUnavailabilityReason(tmp.UnavailabilityReason) + availableReactions.UnavailabilityReason = fieldUnavailabilityReason + + return nil +} + +// Contains information about an emoji reaction type EmojiReaction struct { meta // Text representation of the reaction @@ -27025,6 +27685,56 @@ func (*EmojiReaction) GetType() string { return TypeEmojiReaction } +// The user is an anonymous administrator in the supergroup, but isn't a creator of it, so they can't vote on behalf of the supergroup +type ReactionUnavailabilityReasonAnonymousAdministrator struct{ + meta +} + +func (entity *ReactionUnavailabilityReasonAnonymousAdministrator) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReactionUnavailabilityReasonAnonymousAdministrator + + return json.Marshal((*stub)(entity)) +} + +func (*ReactionUnavailabilityReasonAnonymousAdministrator) GetClass() string { + return ClassReactionUnavailabilityReason +} + +func (*ReactionUnavailabilityReasonAnonymousAdministrator) GetType() string { + return TypeReactionUnavailabilityReasonAnonymousAdministrator +} + +func (*ReactionUnavailabilityReasonAnonymousAdministrator) ReactionUnavailabilityReasonType() string { + return TypeReactionUnavailabilityReasonAnonymousAdministrator +} + +// The user isn't a member of the supergroup and can't send messages and reactions there without joining +type ReactionUnavailabilityReasonGuest struct{ + meta +} + +func (entity *ReactionUnavailabilityReasonGuest) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReactionUnavailabilityReasonGuest + + return json.Marshal((*stub)(entity)) +} + +func (*ReactionUnavailabilityReasonGuest) GetClass() string { + return ClassReactionUnavailabilityReason +} + +func (*ReactionUnavailabilityReasonGuest) GetType() string { + return TypeReactionUnavailabilityReasonGuest +} + +func (*ReactionUnavailabilityReasonGuest) ReactionUnavailabilityReasonType() string { + return TypeReactionUnavailabilityReasonGuest +} + // Represents a list of animations type Animations struct { meta @@ -31120,6 +31830,31 @@ func (*PremiumLimitTypePinnedArchivedChatCount) PremiumLimitTypeType() string { return TypePremiumLimitTypePinnedArchivedChatCount } +// The maximum number of pinned Saved Messages topics +type PremiumLimitTypePinnedSavedMessagesTopicCount struct{ + meta +} + +func (entity *PremiumLimitTypePinnedSavedMessagesTopicCount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumLimitTypePinnedSavedMessagesTopicCount + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumLimitTypePinnedSavedMessagesTopicCount) GetClass() string { + return ClassPremiumLimitType +} + +func (*PremiumLimitTypePinnedSavedMessagesTopicCount) GetType() string { + return TypePremiumLimitTypePinnedSavedMessagesTopicCount +} + +func (*PremiumLimitTypePinnedSavedMessagesTopicCount) PremiumLimitTypeType() string { + return TypePremiumLimitTypePinnedSavedMessagesTopicCount +} + // The maximum length of sent media caption type PremiumLimitTypeCaptionLength struct{ meta @@ -36290,6 +37025,127 @@ func (*UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages) UserPrivacySetti return TypeUserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages } +// Contains privacy settings for message read date in private chats. Read dates are always shown to the users that can see online status of the current user regardless of this setting +type ReadDatePrivacySettings struct { + meta + // True, if message read date is shown to other users in private chats. If false and the current user isn't a Telegram Premium user, then they will not be able to see other's message read date. + ShowReadDate bool `json:"show_read_date"` +} + +func (entity *ReadDatePrivacySettings) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReadDatePrivacySettings + + return json.Marshal((*stub)(entity)) +} + +func (*ReadDatePrivacySettings) GetClass() string { + return ClassReadDatePrivacySettings +} + +func (*ReadDatePrivacySettings) GetType() string { + return TypeReadDatePrivacySettings +} + +// Contains privacy settings for new chats with non-contacts +type NewChatPrivacySettings struct { + meta + // True, if non-contacts users are able to write first to the current user. Telegram Premium subscribers are able to write first regardless of this setting + AllowNewChatsFromUnknownUsers bool `json:"allow_new_chats_from_unknown_users"` +} + +func (entity *NewChatPrivacySettings) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub NewChatPrivacySettings + + return json.Marshal((*stub)(entity)) +} + +func (*NewChatPrivacySettings) GetClass() string { + return ClassNewChatPrivacySettings +} + +func (*NewChatPrivacySettings) GetType() string { + return TypeNewChatPrivacySettings +} + +// The user can be messaged +type CanSendMessageToUserResultOk struct{ + meta +} + +func (entity *CanSendMessageToUserResultOk) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CanSendMessageToUserResultOk + + return json.Marshal((*stub)(entity)) +} + +func (*CanSendMessageToUserResultOk) GetClass() string { + return ClassCanSendMessageToUserResult +} + +func (*CanSendMessageToUserResultOk) GetType() string { + return TypeCanSendMessageToUserResultOk +} + +func (*CanSendMessageToUserResultOk) CanSendMessageToUserResultType() string { + return TypeCanSendMessageToUserResultOk +} + +// The user can't be messaged, because they are deleted or unknown +type CanSendMessageToUserResultUserIsDeleted struct{ + meta +} + +func (entity *CanSendMessageToUserResultUserIsDeleted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CanSendMessageToUserResultUserIsDeleted + + return json.Marshal((*stub)(entity)) +} + +func (*CanSendMessageToUserResultUserIsDeleted) GetClass() string { + return ClassCanSendMessageToUserResult +} + +func (*CanSendMessageToUserResultUserIsDeleted) GetType() string { + return TypeCanSendMessageToUserResultUserIsDeleted +} + +func (*CanSendMessageToUserResultUserIsDeleted) CanSendMessageToUserResultType() string { + return TypeCanSendMessageToUserResultUserIsDeleted +} + +// The user can't be messaged, because they restrict new chats with non-contacts +type CanSendMessageToUserResultUserRestrictsNewChats struct{ + meta +} + +func (entity *CanSendMessageToUserResultUserRestrictsNewChats) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CanSendMessageToUserResultUserRestrictsNewChats + + return json.Marshal((*stub)(entity)) +} + +func (*CanSendMessageToUserResultUserRestrictsNewChats) GetClass() string { + return ClassCanSendMessageToUserResult +} + +func (*CanSendMessageToUserResultUserRestrictsNewChats) GetType() string { + return TypeCanSendMessageToUserResultUserRestrictsNewChats +} + +func (*CanSendMessageToUserResultUserRestrictsNewChats) CanSendMessageToUserResultType() string { + return TypeCanSendMessageToUserResultUserRestrictsNewChats +} + // Contains information about the period of inactivity after which the current user's account will automatically be deleted type AccountTtl struct { meta @@ -37336,7 +38192,7 @@ func (targetChatInternalLink *TargetChatInternalLink) UnmarshalJSON(data []byte) return nil } -// The link is a link to the active sessions section of the application. Use getActiveSessions to handle the link +// The link is a link to the Devices section of the application. Use getActiveSessions to get the list of active sessions and show them to the user type InternalLinkTypeActiveSessions struct{ meta } @@ -37440,7 +38296,7 @@ func (*InternalLinkTypeAuthenticationCode) InternalLinkTypeType() string { return TypeInternalLinkTypeAuthenticationCode } -// The link is a link to a background. Call searchBackground with the given background name to process the link +// The link is a link to a background. Call searchBackground with the given background name to process the link If background is found and the user wants to apply it, then call setDefaultBackground type InternalLinkTypeBackground struct { meta // Name of the background @@ -37610,7 +38466,7 @@ func (*InternalLinkTypeChatBoost) InternalLinkTypeType() string { return TypeInternalLinkTypeChatBoost } -// The link is an invite link to a chat folder. Call checkChatFolderInviteLink with the given invite link to process the link +// The link is an invite link to a chat folder. Call checkChatFolderInviteLink with the given invite link to process the link. If the link is valid and the user wants to join the chat folder, then call addChatFolderByInviteLink type InternalLinkTypeChatFolderInvite struct { meta // Internal representation of the invite link @@ -37662,7 +38518,7 @@ func (*InternalLinkTypeChatFolderSettings) InternalLinkTypeType() string { return TypeInternalLinkTypeChatFolderSettings } -// The link is a chat invite link. Call checkChatInviteLink with the given invite link to process the link +// The link is a chat invite link. Call checkChatInviteLink with the given invite link to process the link. If the link is valid and the user wants to join the chat, then call joinChatByInviteLink type InternalLinkTypeChatInvite struct { meta // Internal representation of the invite link @@ -37768,7 +38624,7 @@ func (*InternalLinkTypeGame) InternalLinkTypeType() string { return TypeInternalLinkTypeGame } -// The link must be opened in an Instant View. Call getWebPageInstantView with the given URL to process the link +// The link must be opened in an Instant View. Call getWebPageInstantView with the given URL to process the link. If Instant View is found, then show it, otherwise, open the fallback URL in an external browser type InternalLinkTypeInstantView struct { meta // URL to be passed to getWebPageInstantView @@ -37824,7 +38680,7 @@ func (*InternalLinkTypeInvoice) InternalLinkTypeType() string { return TypeInternalLinkTypeInvoice } -// The link is a link to a language pack. Call getLanguagePackInfo with the given language pack identifier to process the link +// The link is a link to a language pack. Call getLanguagePackInfo with the given language pack identifier to process the link. If the language pack is found and the user wants to apply it, then call setOption for the option "language_pack_id" type InternalLinkTypeLanguagePack struct { meta // Language pack identifier @@ -37876,7 +38732,7 @@ func (*InternalLinkTypeLanguageSettings) InternalLinkTypeType() string { return TypeInternalLinkTypeLanguageSettings } -// The link is a link to a Telegram message or a forum topic. Call getMessageLinkInfo with the given URL to process the link +// The link is a link to a Telegram message or a forum topic. Call getMessageLinkInfo with the given URL to process the link, and then open received forum topic or chat and show the message there type InternalLinkTypeMessage struct { meta // URL to be passed to getMessageLinkInfo @@ -37967,7 +38823,7 @@ func (*InternalLinkTypePassportDataRequest) InternalLinkTypeType() string { return TypeInternalLinkTypePassportDataRequest } -// The link can be used to confirm ownership of a phone number to prevent account deletion. Call sendPhoneNumberConfirmationCode with the given hash and phone number to process the link +// The link can be used to confirm ownership of a phone number to prevent account deletion. Call sendPhoneNumberConfirmationCode with the given hash and phone number to process the link. If succeeded, call checkPhoneNumberConfirmationCode to check entered by the user code, or resendPhoneNumberConfirmationCode to resend it type InternalLinkTypePhoneNumberConfirmation struct { meta // Hash value from the link @@ -38023,7 +38879,7 @@ func (*InternalLinkTypePremiumFeatures) InternalLinkTypeType() string { return TypeInternalLinkTypePremiumFeatures } -// The link is a link to the screen for gifting Telegram Premium subscriptions to friends +// The link is a link to the screen for gifting Telegram Premium subscriptions to friends via inputInvoiceTelegram payments or in-store purchases type InternalLinkTypePremiumGift struct { meta // Referrer specified in the link @@ -38154,7 +39010,7 @@ func (internalLinkTypeProxy *InternalLinkTypeProxy) UnmarshalJSON(data []byte) e return nil } -// The link is a link to a chat by its username. Call searchPublicChat with the given chat username to process the link +// The link is a link to a chat by its username. Call searchPublicChat with the given chat username to process the link If the chat is found, open its profile information screen or the chat itself type InternalLinkTypePublicChat struct { meta // Username of the chat @@ -38256,7 +39112,7 @@ func (*InternalLinkTypeSettings) InternalLinkTypeType() string { return TypeInternalLinkTypeSettings } -// The link is a link to a bot, which can be installed to the side menu. Call searchPublicChat with the given bot username, check that the user is a bot and can be added to attachment menu. Then, use getAttachmentMenuBot to receive information about the bot. If the bot isn't added to side menu, then show a disclaimer about Mini Apps being a third-party apps, ask the user to accept their Terms of service and confirm adding the bot to side and attachment menu. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. If the bot is added to side menu, then use getWebAppUrl with the given URL +// The link is a link to a bot, which can be installed to the side menu. Call searchPublicChat with the given bot username, check that the user is a bot and can be added to attachment menu. Then, use getAttachmentMenuBot to receive information about the bot. If the bot isn't added to side menu, then show a disclaimer about Mini Apps being a third-party apps, ask the user to accept their Terms of service and confirm adding the bot to side and attachment menu. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. If the bot is added to side menu, then use getWebAppUrl with the given URL and open the returned URL as a Web App type InternalLinkTypeSideMenuBot struct { meta // Username of the bot @@ -38285,7 +39141,7 @@ func (*InternalLinkTypeSideMenuBot) InternalLinkTypeType() string { return TypeInternalLinkTypeSideMenuBot } -// The link is a link to a sticker set. Call searchStickerSet with the given sticker set name to process the link and show the sticker set +// The link is a link to a sticker set. Call searchStickerSet with the given sticker set name to process the link and show the sticker set. If the sticker set is found and the user wants to add it, then call changeStickerSet type InternalLinkTypeStickerSet struct { meta // Name of the sticker set @@ -38314,7 +39170,7 @@ func (*InternalLinkTypeStickerSet) InternalLinkTypeType() string { return TypeInternalLinkTypeStickerSet } -// The link is a link to a story. Call searchPublicChat with the given sender username, then call getStory with the received chat identifier and the given story identifier +// The link is a link to a story. Call searchPublicChat with the given sender username, then call getStory with the received chat identifier and the given story identifier, then show the story if received type InternalLinkTypeStory struct { meta // Username of the sender of the story @@ -38447,7 +39303,7 @@ func (*InternalLinkTypeUnsupportedProxy) InternalLinkTypeType() string { return TypeInternalLinkTypeUnsupportedProxy } -// The link is a link to a user by its phone number. Call searchUserByPhoneNumber with the given phone number to process the link +// The link is a link to a user by its phone number. Call searchUserByPhoneNumber with the given phone number to process the link. If the user is found, then call createPrivateChat and open the chat type InternalLinkTypeUserPhoneNumber struct { meta // Phone number of the user @@ -38474,7 +39330,7 @@ func (*InternalLinkTypeUserPhoneNumber) InternalLinkTypeType() string { return TypeInternalLinkTypeUserPhoneNumber } -// The link is a link to a user by a temporary token. Call searchUserByToken with the given token to process the link +// The link is a link to a user by a temporary token. Call searchUserByToken with the given token to process the link. If the user is found, then call createPrivateChat and open the chat type InternalLinkTypeUserToken struct { meta // The token @@ -43488,6 +44344,31 @@ func (*UpdateChatOnlineMemberCount) UpdateType() string { return TypeUpdateChatOnlineMemberCount } +// The list of pinned Saved Messages topics has changed. The app can call getPinnedSavedMessagesTopics to get the new list +type UpdatePinnedSavedMessagesTopics struct{ + meta +} + +func (entity *UpdatePinnedSavedMessagesTopics) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdatePinnedSavedMessagesTopics + + return json.Marshal((*stub)(entity)) +} + +func (*UpdatePinnedSavedMessagesTopics) GetClass() string { + return ClassUpdate +} + +func (*UpdatePinnedSavedMessagesTopics) GetType() string { + return TypeUpdatePinnedSavedMessagesTopics +} + +func (*UpdatePinnedSavedMessagesTopics) UpdateType() string { + return TypeUpdatePinnedSavedMessagesTopics +} + // Basic information about a topic in a forum chat was changed type UpdateForumTopicInfo struct { meta @@ -45506,6 +46387,33 @@ func (updateDefaultReactionType *UpdateDefaultReactionType) UnmarshalJSON(data [ return nil } +// Used Saved Messages tags have changed +type UpdateSavedMessagesTags struct { + meta + // The new used tags + Tags *SavedMessagesTags `json:"tags"` +} + +func (entity *UpdateSavedMessagesTags) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateSavedMessagesTags + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateSavedMessagesTags) GetClass() string { + return ClassUpdate +} + +func (*UpdateSavedMessagesTags) GetType() string { + return TypeUpdateSavedMessagesTags +} + +func (*UpdateSavedMessagesTags) UpdateType() string { + return TypeUpdateSavedMessagesTags +} + // The parameters of speech recognition without Telegram Premium subscription has changed type UpdateSpeechRecognitionTrial struct { meta diff --git a/client/unmarshaler.go b/client/unmarshaler.go index c66335e..b9ac0e7 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -914,6 +914,49 @@ func UnmarshalListOfMessageSender(dataList []json.RawMessage) ([]MessageSender, return list, nil } +func UnmarshalMessageReadDate(data json.RawMessage) (MessageReadDate, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeMessageReadDateRead: + return UnmarshalMessageReadDateRead(data) + + case TypeMessageReadDateUnread: + return UnmarshalMessageReadDateUnread(data) + + case TypeMessageReadDateTooOld: + return UnmarshalMessageReadDateTooOld(data) + + case TypeMessageReadDateUserPrivacyRestricted: + return UnmarshalMessageReadDateUserPrivacyRestricted(data) + + case TypeMessageReadDateMyPrivacyRestricted: + return UnmarshalMessageReadDateMyPrivacyRestricted(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfMessageReadDate(dataList []json.RawMessage) ([]MessageReadDate, error) { + list := []MessageReadDate{} + + for _, data := range dataList { + entity, err := UnmarshalMessageReadDate(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalMessageOrigin(data json.RawMessage) (MessageOrigin, error) { var meta meta @@ -1634,6 +1677,43 @@ func UnmarshalListOfLoginUrlInfo(dataList []json.RawMessage) ([]LoginUrlInfo, er return list, nil } +func UnmarshalSavedMessagesTopic(data json.RawMessage) (SavedMessagesTopic, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeSavedMessagesTopicMyNotes: + return UnmarshalSavedMessagesTopicMyNotes(data) + + case TypeSavedMessagesTopicAuthorHidden: + return UnmarshalSavedMessagesTopicAuthorHidden(data) + + case TypeSavedMessagesTopicSavedFromChat: + return UnmarshalSavedMessagesTopicSavedFromChat(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfSavedMessagesTopic(dataList []json.RawMessage) ([]SavedMessagesTopic, error) { + list := []SavedMessagesTopic{} + + for _, data := range dataList { + entity, err := UnmarshalSavedMessagesTopic(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalRichText(data json.RawMessage) (RichText, error) { var meta meta @@ -2391,24 +2471,30 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessagePhoto: return UnmarshalMessagePhoto(data) - case TypeMessageExpiredPhoto: - return UnmarshalMessageExpiredPhoto(data) - case TypeMessageSticker: return UnmarshalMessageSticker(data) case TypeMessageVideo: return UnmarshalMessageVideo(data) - case TypeMessageExpiredVideo: - return UnmarshalMessageExpiredVideo(data) - case TypeMessageVideoNote: return UnmarshalMessageVideoNote(data) case TypeMessageVoiceNote: return UnmarshalMessageVoiceNote(data) + case TypeMessageExpiredPhoto: + return UnmarshalMessageExpiredPhoto(data) + + case TypeMessageExpiredVideo: + return UnmarshalMessageExpiredVideo(data) + + case TypeMessageExpiredVideoNote: + return UnmarshalMessageExpiredVideoNote(data) + + case TypeMessageExpiredVoiceNote: + return UnmarshalMessageExpiredVoiceNote(data) + case TypeMessageLocation: return UnmarshalMessageLocation(data) @@ -3648,6 +3734,40 @@ func UnmarshalListOfFirebaseAuthenticationSettings(dataList []json.RawMessage) ( return list, nil } +func UnmarshalReactionUnavailabilityReason(data json.RawMessage) (ReactionUnavailabilityReason, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeReactionUnavailabilityReasonAnonymousAdministrator: + return UnmarshalReactionUnavailabilityReasonAnonymousAdministrator(data) + + case TypeReactionUnavailabilityReasonGuest: + return UnmarshalReactionUnavailabilityReasonGuest(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfReactionUnavailabilityReason(dataList []json.RawMessage) ([]ReactionUnavailabilityReason, error) { + list := []ReactionUnavailabilityReason{} + + for _, data := range dataList { + entity, err := UnmarshalReactionUnavailabilityReason(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalDiceStickers(data json.RawMessage) (DiceStickers, error) { var meta meta @@ -4200,6 +4320,9 @@ func UnmarshalPremiumLimitType(data json.RawMessage) (PremiumLimitType, error) { case TypePremiumLimitTypePinnedArchivedChatCount: return UnmarshalPremiumLimitTypePinnedArchivedChatCount(data) + case TypePremiumLimitTypePinnedSavedMessagesTopicCount: + return UnmarshalPremiumLimitTypePinnedSavedMessagesTopicCount(data) + case TypePremiumLimitTypeCaptionLength: return UnmarshalPremiumLimitTypeCaptionLength(data) @@ -5364,6 +5487,43 @@ func UnmarshalListOfUserPrivacySetting(dataList []json.RawMessage) ([]UserPrivac return list, nil } +func UnmarshalCanSendMessageToUserResult(data json.RawMessage) (CanSendMessageToUserResult, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeCanSendMessageToUserResultOk: + return UnmarshalCanSendMessageToUserResultOk(data) + + case TypeCanSendMessageToUserResultUserIsDeleted: + return UnmarshalCanSendMessageToUserResultUserIsDeleted(data) + + case TypeCanSendMessageToUserResultUserRestrictsNewChats: + return UnmarshalCanSendMessageToUserResultUserRestrictsNewChats(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfCanSendMessageToUserResult(dataList []json.RawMessage) ([]CanSendMessageToUserResult, error) { + list := []CanSendMessageToUserResult{} + + for _, data := range dataList { + entity, err := UnmarshalCanSendMessageToUserResult(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalSessionType(data json.RawMessage) (SessionType, error) { var meta meta @@ -6524,6 +6684,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateChatOnlineMemberCount: return UnmarshalUpdateChatOnlineMemberCount(data) + case TypeUpdatePinnedSavedMessagesTopics: + return UnmarshalUpdatePinnedSavedMessagesTopics(data) + case TypeUpdateForumTopicInfo: return UnmarshalUpdateForumTopicInfo(data) @@ -6701,6 +6864,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateDefaultReactionType: return UnmarshalUpdateDefaultReactionType(data) + case TypeUpdateSavedMessagesTags: + return UnmarshalUpdateSavedMessagesTags(data) + case TypeUpdateSpeechRecognitionTrial: return UnmarshalUpdateSpeechRecognitionTrial(data) @@ -8295,6 +8461,46 @@ func UnmarshalChatMessageSenders(data json.RawMessage) (*ChatMessageSenders, err return &resp, err } +func UnmarshalMessageReadDateRead(data json.RawMessage) (*MessageReadDateRead, error) { + var resp MessageReadDateRead + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageReadDateUnread(data json.RawMessage) (*MessageReadDateUnread, error) { + var resp MessageReadDateUnread + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageReadDateTooOld(data json.RawMessage) (*MessageReadDateTooOld, error) { + var resp MessageReadDateTooOld + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageReadDateUserPrivacyRestricted(data json.RawMessage) (*MessageReadDateUserPrivacyRestricted, error) { + var resp MessageReadDateUserPrivacyRestricted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageReadDateMyPrivacyRestricted(data json.RawMessage) (*MessageReadDateMyPrivacyRestricted, error) { + var resp MessageReadDateMyPrivacyRestricted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageViewer(data json.RawMessage) (*MessageViewer, error) { var resp MessageViewer @@ -8343,6 +8549,14 @@ func UnmarshalMessageOriginChannel(data json.RawMessage) (*MessageOriginChannel, return &resp, err } +func UnmarshalForwardSource(data json.RawMessage) (*ForwardSource, error) { + var resp ForwardSource + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalReactionTypeEmoji(data json.RawMessage) (*ReactionTypeEmoji, error) { var resp ReactionTypeEmoji @@ -8391,6 +8605,14 @@ func UnmarshalMessageReaction(data json.RawMessage) (*MessageReaction, error) { return &resp, err } +func UnmarshalMessageReactions(data json.RawMessage) (*MessageReactions, error) { + var resp MessageReactions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageInteractionInfo(data json.RawMessage) (*MessageInteractionInfo, error) { var resp MessageInteractionInfo @@ -8927,6 +9149,22 @@ func UnmarshalChatAvailableReactionsSome(data json.RawMessage) (*ChatAvailableRe return &resp, err } +func UnmarshalSavedMessagesTag(data json.RawMessage) (*SavedMessagesTag, error) { + var resp SavedMessagesTag + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSavedMessagesTags(data json.RawMessage) (*SavedMessagesTags, error) { + var resp SavedMessagesTags + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalVideoChat(data json.RawMessage) (*VideoChat, error) { var resp VideoChat @@ -9255,6 +9493,46 @@ func UnmarshalMessageThreadInfo(data json.RawMessage) (*MessageThreadInfo, error return &resp, err } +func UnmarshalSavedMessagesTopicMyNotes(data json.RawMessage) (*SavedMessagesTopicMyNotes, error) { + var resp SavedMessagesTopicMyNotes + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSavedMessagesTopicAuthorHidden(data json.RawMessage) (*SavedMessagesTopicAuthorHidden, error) { + var resp SavedMessagesTopicAuthorHidden + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSavedMessagesTopicSavedFromChat(data json.RawMessage) (*SavedMessagesTopicSavedFromChat, error) { + var resp SavedMessagesTopicSavedFromChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFoundSavedMessagesTopic(data json.RawMessage) (*FoundSavedMessagesTopic, error) { + var resp FoundSavedMessagesTopic + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFoundSavedMessagesTopics(data json.RawMessage) (*FoundSavedMessagesTopics, error) { + var resp FoundSavedMessagesTopics + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalForumTopicIcon(data json.RawMessage) (*ForumTopicIcon, error) { var resp ForumTopicIcon @@ -10639,14 +10917,6 @@ func UnmarshalMessagePhoto(data json.RawMessage) (*MessagePhoto, error) { return &resp, err } -func UnmarshalMessageExpiredPhoto(data json.RawMessage) (*MessageExpiredPhoto, error) { - var resp MessageExpiredPhoto - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - func UnmarshalMessageSticker(data json.RawMessage) (*MessageSticker, error) { var resp MessageSticker @@ -10663,14 +10933,6 @@ func UnmarshalMessageVideo(data json.RawMessage) (*MessageVideo, error) { return &resp, err } -func UnmarshalMessageExpiredVideo(data json.RawMessage) (*MessageExpiredVideo, error) { - var resp MessageExpiredVideo - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - func UnmarshalMessageVideoNote(data json.RawMessage) (*MessageVideoNote, error) { var resp MessageVideoNote @@ -10687,6 +10949,38 @@ func UnmarshalMessageVoiceNote(data json.RawMessage) (*MessageVoiceNote, error) return &resp, err } +func UnmarshalMessageExpiredPhoto(data json.RawMessage) (*MessageExpiredPhoto, error) { + var resp MessageExpiredPhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageExpiredVideo(data json.RawMessage) (*MessageExpiredVideo, error) { + var resp MessageExpiredVideo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageExpiredVideoNote(data json.RawMessage) (*MessageExpiredVideoNote, error) { + var resp MessageExpiredVideoNote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageExpiredVoiceNote(data json.RawMessage) (*MessageExpiredVoiceNote, error) { + var resp MessageExpiredVoiceNote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageLocation(data json.RawMessage) (*MessageLocation, error) { var resp MessageLocation @@ -11799,6 +12093,22 @@ func UnmarshalUserStatusLastMonth(data json.RawMessage) (*UserStatusLastMonth, e return &resp, err } +func UnmarshalEmojiKeyword(data json.RawMessage) (*EmojiKeyword, error) { + var resp EmojiKeyword + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalEmojiKeywords(data json.RawMessage) (*EmojiKeywords, error) { + var resp EmojiKeywords + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStickers(data json.RawMessage) (*Stickers, error) { var resp Stickers @@ -12647,6 +12957,22 @@ func UnmarshalEmojiReaction(data json.RawMessage) (*EmojiReaction, error) { return &resp, err } +func UnmarshalReactionUnavailabilityReasonAnonymousAdministrator(data json.RawMessage) (*ReactionUnavailabilityReasonAnonymousAdministrator, error) { + var resp ReactionUnavailabilityReasonAnonymousAdministrator + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReactionUnavailabilityReasonGuest(data json.RawMessage) (*ReactionUnavailabilityReasonGuest, error) { + var resp ReactionUnavailabilityReasonGuest + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalAnimations(data json.RawMessage) (*Animations, error) { var resp Animations @@ -13583,6 +13909,14 @@ func UnmarshalPremiumLimitTypePinnedArchivedChatCount(data json.RawMessage) (*Pr return &resp, err } +func UnmarshalPremiumLimitTypePinnedSavedMessagesTopicCount(data json.RawMessage) (*PremiumLimitTypePinnedSavedMessagesTopicCount, error) { + var resp PremiumLimitTypePinnedSavedMessagesTopicCount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPremiumLimitTypeCaptionLength(data json.RawMessage) (*PremiumLimitTypeCaptionLength, error) { var resp PremiumLimitTypeCaptionLength @@ -15031,6 +15365,46 @@ func UnmarshalUserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages(data json. return &resp, err } +func UnmarshalReadDatePrivacySettings(data json.RawMessage) (*ReadDatePrivacySettings, error) { + var resp ReadDatePrivacySettings + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalNewChatPrivacySettings(data json.RawMessage) (*NewChatPrivacySettings, error) { + var resp NewChatPrivacySettings + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCanSendMessageToUserResultOk(data json.RawMessage) (*CanSendMessageToUserResultOk, error) { + var resp CanSendMessageToUserResultOk + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCanSendMessageToUserResultUserIsDeleted(data json.RawMessage) (*CanSendMessageToUserResultUserIsDeleted, error) { + var resp CanSendMessageToUserResultUserIsDeleted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCanSendMessageToUserResultUserRestrictsNewChats(data json.RawMessage) (*CanSendMessageToUserResultUserRestrictsNewChats, error) { + var resp CanSendMessageToUserResultUserRestrictsNewChats + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalAccountTtl(data json.RawMessage) (*AccountTtl, error) { var resp AccountTtl @@ -16959,6 +17333,14 @@ func UnmarshalUpdateChatOnlineMemberCount(data json.RawMessage) (*UpdateChatOnli return &resp, err } +func UnmarshalUpdatePinnedSavedMessagesTopics(data json.RawMessage) (*UpdatePinnedSavedMessagesTopics, error) { + var resp UpdatePinnedSavedMessagesTopics + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateForumTopicInfo(data json.RawMessage) (*UpdateForumTopicInfo, error) { var resp UpdateForumTopicInfo @@ -17431,6 +17813,14 @@ func UnmarshalUpdateDefaultReactionType(data json.RawMessage) (*UpdateDefaultRea return &resp, err } +func UnmarshalUpdateSavedMessagesTags(data json.RawMessage) (*UpdateSavedMessagesTags, error) { + var resp UpdateSavedMessagesTags + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateSpeechRecognitionTrial(data json.RawMessage) (*UpdateSpeechRecognitionTrial, error) { var resp UpdateSpeechRecognitionTrial @@ -18280,6 +18670,21 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatMessageSenders: return UnmarshalChatMessageSenders(data) + case TypeMessageReadDateRead: + return UnmarshalMessageReadDateRead(data) + + case TypeMessageReadDateUnread: + return UnmarshalMessageReadDateUnread(data) + + case TypeMessageReadDateTooOld: + return UnmarshalMessageReadDateTooOld(data) + + case TypeMessageReadDateUserPrivacyRestricted: + return UnmarshalMessageReadDateUserPrivacyRestricted(data) + + case TypeMessageReadDateMyPrivacyRestricted: + return UnmarshalMessageReadDateMyPrivacyRestricted(data) + case TypeMessageViewer: return UnmarshalMessageViewer(data) @@ -18298,6 +18703,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageOriginChannel: return UnmarshalMessageOriginChannel(data) + case TypeForwardSource: + return UnmarshalForwardSource(data) + case TypeReactionTypeEmoji: return UnmarshalReactionTypeEmoji(data) @@ -18316,6 +18724,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageReaction: return UnmarshalMessageReaction(data) + case TypeMessageReactions: + return UnmarshalMessageReactions(data) + case TypeMessageInteractionInfo: return UnmarshalMessageInteractionInfo(data) @@ -18517,6 +18928,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatAvailableReactionsSome: return UnmarshalChatAvailableReactionsSome(data) + case TypeSavedMessagesTag: + return UnmarshalSavedMessagesTag(data) + + case TypeSavedMessagesTags: + return UnmarshalSavedMessagesTags(data) + case TypeVideoChat: return UnmarshalVideoChat(data) @@ -18640,6 +19057,21 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageThreadInfo: return UnmarshalMessageThreadInfo(data) + case TypeSavedMessagesTopicMyNotes: + return UnmarshalSavedMessagesTopicMyNotes(data) + + case TypeSavedMessagesTopicAuthorHidden: + return UnmarshalSavedMessagesTopicAuthorHidden(data) + + case TypeSavedMessagesTopicSavedFromChat: + return UnmarshalSavedMessagesTopicSavedFromChat(data) + + case TypeFoundSavedMessagesTopic: + return UnmarshalFoundSavedMessagesTopic(data) + + case TypeFoundSavedMessagesTopics: + return UnmarshalFoundSavedMessagesTopics(data) + case TypeForumTopicIcon: return UnmarshalForumTopicIcon(data) @@ -19159,24 +19591,30 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessagePhoto: return UnmarshalMessagePhoto(data) - case TypeMessageExpiredPhoto: - return UnmarshalMessageExpiredPhoto(data) - case TypeMessageSticker: return UnmarshalMessageSticker(data) case TypeMessageVideo: return UnmarshalMessageVideo(data) - case TypeMessageExpiredVideo: - return UnmarshalMessageExpiredVideo(data) - case TypeMessageVideoNote: return UnmarshalMessageVideoNote(data) case TypeMessageVoiceNote: return UnmarshalMessageVoiceNote(data) + case TypeMessageExpiredPhoto: + return UnmarshalMessageExpiredPhoto(data) + + case TypeMessageExpiredVideo: + return UnmarshalMessageExpiredVideo(data) + + case TypeMessageExpiredVideoNote: + return UnmarshalMessageExpiredVideoNote(data) + + case TypeMessageExpiredVoiceNote: + return UnmarshalMessageExpiredVoiceNote(data) + case TypeMessageLocation: return UnmarshalMessageLocation(data) @@ -19594,6 +20032,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUserStatusLastMonth: return UnmarshalUserStatusLastMonth(data) + case TypeEmojiKeyword: + return UnmarshalEmojiKeyword(data) + + case TypeEmojiKeywords: + return UnmarshalEmojiKeywords(data) + case TypeStickers: return UnmarshalStickers(data) @@ -19912,6 +20356,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeEmojiReaction: return UnmarshalEmojiReaction(data) + case TypeReactionUnavailabilityReasonAnonymousAdministrator: + return UnmarshalReactionUnavailabilityReasonAnonymousAdministrator(data) + + case TypeReactionUnavailabilityReasonGuest: + return UnmarshalReactionUnavailabilityReasonGuest(data) + case TypeAnimations: return UnmarshalAnimations(data) @@ -20263,6 +20713,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePremiumLimitTypePinnedArchivedChatCount: return UnmarshalPremiumLimitTypePinnedArchivedChatCount(data) + case TypePremiumLimitTypePinnedSavedMessagesTopicCount: + return UnmarshalPremiumLimitTypePinnedSavedMessagesTopicCount(data) + case TypePremiumLimitTypeCaptionLength: return UnmarshalPremiumLimitTypeCaptionLength(data) @@ -20806,6 +21259,21 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages: return UnmarshalUserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages(data) + case TypeReadDatePrivacySettings: + return UnmarshalReadDatePrivacySettings(data) + + case TypeNewChatPrivacySettings: + return UnmarshalNewChatPrivacySettings(data) + + case TypeCanSendMessageToUserResultOk: + return UnmarshalCanSendMessageToUserResultOk(data) + + case TypeCanSendMessageToUserResultUserIsDeleted: + return UnmarshalCanSendMessageToUserResultUserIsDeleted(data) + + case TypeCanSendMessageToUserResultUserRestrictsNewChats: + return UnmarshalCanSendMessageToUserResultUserRestrictsNewChats(data) + case TypeAccountTtl: return UnmarshalAccountTtl(data) @@ -21529,6 +21997,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateChatOnlineMemberCount: return UnmarshalUpdateChatOnlineMemberCount(data) + case TypeUpdatePinnedSavedMessagesTopics: + return UnmarshalUpdatePinnedSavedMessagesTopics(data) + case TypeUpdateForumTopicInfo: return UnmarshalUpdateForumTopicInfo(data) @@ -21706,6 +22177,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateDefaultReactionType: return UnmarshalUpdateDefaultReactionType(data) + case TypeUpdateSavedMessagesTags: + return UnmarshalUpdateSavedMessagesTags(data) + case TypeUpdateSpeechRecognitionTrial: return UnmarshalUpdateSpeechRecognitionTrial(data) diff --git a/data/td_api.tl b/data/td_api.tl index 82d9295..3f56509 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -649,8 +649,8 @@ inputChatPhotoSticker sticker:chatPhotoSticker = InputChatPhoto; //@can_change_info True, if the user can change the chat title, photo, and other settings //@can_invite_users True, if the user can invite new users to the chat //@can_pin_messages True, if the user can pin messages -//@can_manage_topics True, if the user can manage topics -chatPermissions can_send_basic_messages:Bool can_send_audios:Bool can_send_documents:Bool can_send_photos:Bool can_send_videos:Bool can_send_video_notes:Bool can_send_voice_notes:Bool can_send_polls:Bool can_send_stickers:Bool can_send_animations:Bool can_send_games:Bool can_use_inline_bots:Bool can_add_web_page_previews:Bool can_change_info:Bool can_invite_users:Bool can_pin_messages:Bool can_manage_topics:Bool = ChatPermissions; +//@can_create_topics True, if the user can create topics +chatPermissions can_send_basic_messages:Bool can_send_audios:Bool can_send_documents:Bool can_send_photos:Bool can_send_videos:Bool can_send_video_notes:Bool can_send_voice_notes:Bool can_send_polls:Bool can_send_stickers:Bool can_send_animations:Bool can_send_games:Bool can_use_inline_bots:Bool can_add_web_page_previews:Bool can_change_info:Bool can_invite_users:Bool can_pin_messages:Bool can_create_topics:Bool = ChatPermissions; //@description Describes rights of the administrator //@can_manage_chat True, if the administrator can get chat event log, get chat boosts in channels, get channel members, report supergroup spam messages, see anonymous administrators in supergroups and ignore slow mode. Implied by any other privilege; applicable to supergroups and channels only @@ -661,7 +661,7 @@ chatPermissions can_send_basic_messages:Bool can_send_audios:Bool can_send_docum //@can_invite_users True, if the administrator can invite new users to the chat //@can_restrict_members True, if the administrator can restrict, ban, or unban chat members or view supergroup statistics; always true for channels //@can_pin_messages True, if the administrator can pin messages; applicable to basic groups and supergroups only -//@can_manage_topics True, if the administrator can manage topics; applicable to forum supergroups only +//@can_manage_topics True, if the administrator can create, rename, close, reopen, hide, and unhide forum topics; applicable to forum supergroups only //@can_promote_members True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that were directly or indirectly promoted by them //@can_manage_video_chats True, if the administrator can manage video chats //@can_post_stories True, if the administrator can create new channel stories, or edit and delete posted stories; applicable to channels only @@ -809,11 +809,12 @@ usernames active_usernames:vector disabled_usernames:vector edit //@is_fake True, if many users reported this user as a fake account //@has_active_stories True, if the user has non-expired stories available to the current user //@has_unread_active_stories True, if the user has unread non-expired stories available to the current user +//@restricts_new_chats True, if the user may restrict new chats with non-contacts. Use canSendMessageToUser to check whether the current user can message the user or try to create a chat with them //@have_access If false, the user is inaccessible, and the only information known about the user is inside this class. Identifier of the user can't be passed to any method //@type Type of the user //@language_code IETF language tag of the user's language; only available to bots //@added_to_attachment_menu True, if the user added the current bot to attachment menu; only available to bots -user id:int53 access_hash:int64 first_name:string last_name:string usernames:usernames phone_number:string status:UserStatus profile_photo:profilePhoto accent_color_id:int32 background_custom_emoji_id:int64 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 emoji_status:emojiStatus is_contact:Bool is_mutual_contact:Bool is_close_friend:Bool is_verified:Bool is_premium:Bool is_support:Bool restriction_reason:string is_scam:Bool is_fake:Bool has_active_stories:Bool has_unread_active_stories:Bool have_access:Bool type:UserType language_code:string added_to_attachment_menu:Bool = User; +user id:int53 access_hash:int64 first_name:string last_name:string usernames:usernames phone_number:string status:UserStatus profile_photo:profilePhoto accent_color_id:int32 background_custom_emoji_id:int64 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 emoji_status:emojiStatus is_contact:Bool is_mutual_contact:Bool is_close_friend:Bool is_verified:Bool is_premium:Bool is_support:Bool restriction_reason:string is_scam:Bool is_fake:Bool has_active_stories:Bool has_unread_active_stories:Bool restricts_new_chats:Bool have_access:Bool type:UserType language_code:string added_to_attachment_menu:Bool = User; //@description Contains information about a bot @@ -1161,6 +1162,24 @@ chatMessageSender sender:MessageSender needs_premium:Bool = ChatMessageSender; chatMessageSenders senders:vector = ChatMessageSenders; +//@class MessageReadDate @description Describes read date of a recent outgoing message in a private chat + +//@description Contains read date of the message @read_date Point in time (Unix timestamp) when the message was read by the other user +messageReadDateRead read_date:int32 = MessageReadDate; + +//@description The message is unread yet +messageReadDateUnread = MessageReadDate; + +//@description The message is too old to get read date +messageReadDateTooOld = MessageReadDate; + +//@description The read date is unknown due to privacy settings of the other user +messageReadDateUserPrivacyRestricted = MessageReadDate; + +//@description The read date is unknown due to privacy settings of the current user, but will be known if the user subscribes to Telegram Premium +messageReadDateMyPrivacyRestricted = MessageReadDate; + + //@description Represents a viewer of a message @user_id User identifier of the viewer @view_date Approximate point in time (Unix timestamp) when the message was viewed messageViewer user_id:int53 view_date:int32 = MessageViewer; @@ -1188,6 +1207,16 @@ messageOriginChat sender_chat_id:int53 author_signature:string = MessageOrigin; messageOriginChannel chat_id:int53 message_id:int53 author_signature:string = MessageOrigin; +//@description Contains information about the last message from which a new message was forwarded last time +//@chat_id Identifier of the chat to which the message that was forwarded belonged; may be 0 if unknown +//@message_id Identifier of the message; may be 0 if unknown +//@sender_id Identifier of the sender of the message; may be null if unknown or the new message was forwarded not to Saved Messages +//@sender_name Name of the sender of the message if the sender is hidden by their privacy settings +//@date Point in time (Unix timestamp) when the message is sent; 0 if unknown +//@is_outgoing True, if the message that was forwarded is outgoing; always false if sender is unknown +forwardSource chat_id:int53 message_id:int53 sender_id:MessageSender sender_name:string date:int32 is_outgoing:Bool = ForwardSource; + + //@class ReactionType @description Describes type of message reaction //@description A reaction with an emoji @emoji Text representation of the reaction @@ -1200,10 +1229,9 @@ reactionTypeCustomEmoji custom_emoji_id:int64 = ReactionType; //@description Contains information about a forwarded message //@origin Origin of the forwarded message //@date Point in time (Unix timestamp) when the message was originally sent +//@source For messages forwarded to the chat with the current user (Saved Messages), to the Replies bot chat, or to the channel's discussion group, information about the source message from which the message was forwarded last time; may be null for other forwards or if unknown //@public_service_announcement_type The type of a public service announcement for the forwarded message -//@from_chat_id For messages forwarded to the chat with the current user (Saved Messages), to the Replies bot chat, or to the channel's discussion group, the identifier of the chat from which the message was forwarded last time; 0 if unknown -//@from_message_id For messages forwarded to the chat with the current user (Saved Messages), to the Replies bot chat, or to the channel's discussion group, the identifier of the original message from which the new message was forwarded last time; 0 if unknown -messageForwardInfo origin:MessageOrigin date:int32 public_service_announcement_type:string from_chat_id:int53 from_message_id:int53 = MessageForwardInfo; +messageForwardInfo origin:MessageOrigin date:int32 source:forwardSource public_service_announcement_type:string = MessageForwardInfo; //@description Contains information about a message created with importMessages //@sender_name Name of the original sender @@ -1226,13 +1254,16 @@ messageReplyInfo reply_count:int32 recent_replier_ids:vector last //@recent_sender_ids Identifiers of at most 3 recent message senders, added the reaction; available in private, basic group and supergroup chats messageReaction type:ReactionType total_count:int32 is_chosen:Bool used_sender_id:MessageSender recent_sender_ids:vector = MessageReaction; +//@description Contains a list of reactions added to a message @reactions List of added reactions @are_tags True, if the reactions are tags and Telegram Premium users can filter messages by them; currently, always false +messageReactions reactions:vector are_tags:Bool = MessageReactions; + //@description Contains information about interactions with a message //@view_count Number of times the message was viewed //@forward_count Number of times the message was forwarded //@reply_info Information about direct or indirect replies to the message; may be null. Currently, available only in channels with a discussion supergroup and discussion supergroups for messages, which are not replies itself -//@reactions The list of reactions added to the message -messageInteractionInfo view_count:int32 forward_count:int32 reply_info:messageReplyInfo reactions:vector = MessageInteractionInfo; +//@reactions The list of reactions or tags added to the message; may be null +messageInteractionInfo view_count:int32 forward_count:int32 reply_info:messageReplyInfo reactions:messageReactions = MessageInteractionInfo; //@description Contains information about an unread reaction to a message //@type Type of the reaction @@ -1315,6 +1346,7 @@ inputMessageReplyToStory story_sender_chat_id:int53 story_id:int32 = InputMessag //@can_get_added_reactions True, if the list of added reactions is available through getMessageAddedReactions //@can_get_statistics True, if the message statistics are available through getMessageStatistics //@can_get_message_thread True, if information about the message thread is available through getMessageThread and getMessageThreadHistory +//@can_get_read_date True, if read date of the message can be received through getMessageReadDate //@can_get_viewers True, if chat members already viewed the message can be received through getMessageViewers //@can_get_media_timestamp_links True, if media timestamp links can be generated for media timestamp entities in the message text, caption or web page description through getMessageLink //@can_report_reactions True, if reactions on the message can be reported through reportMessageReactions @@ -1330,6 +1362,7 @@ inputMessageReplyToStory story_sender_chat_id:int53 story_id:int32 = InputMessag //@unread_reactions Information about unread reactions added to the message //@reply_to Information about the message or the story this message is replying to; may be null if none //@message_thread_id If non-zero, the identifier of the message thread the message belongs to; unique within the chat to which the message belongs +//@saved_messages_topic Information about topic of the message in the Saved Messages chat; may be null for messages not from Saved Messages //@self_destruct_type The message's self-destruct type; may be null if none //@self_destruct_in Time left before the message self-destruct timer expires, in seconds; 0 if self-destruction isn't scheduled yet //@auto_delete_in Time left before the message will be automatically deleted by message_auto_delete_time setting of the chat, in seconds; 0 if never @@ -1339,7 +1372,7 @@ inputMessageReplyToStory story_sender_chat_id:int53 story_id:int32 = InputMessag //@restriction_reason If non-empty, contains a human-readable description of the reason why access to this message must be restricted //@content Content of the message //@reply_markup Reply markup for the message; may be null if none -message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_get_added_reactions:Bool can_get_statistics:Bool can_get_message_thread:Bool can_get_viewers:Bool can_get_media_timestamp_links:Bool can_report_reactions:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector reply_to:MessageReplyTo message_thread_id:int53 self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 author_signature:string media_album_id:int64 restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; +message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_get_added_reactions:Bool can_get_statistics:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_viewers:Bool can_get_media_timestamp_links:Bool can_report_reactions:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector reply_to:MessageReplyTo message_thread_id:int53 saved_messages_topic:SavedMessagesTopic self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 author_signature:string media_album_id:int64 restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; //@description Contains a list of messages @total_count Approximate total number of messages found @messages List of messages; messages may be null messages total_count:int32 messages:vector = Messages; @@ -1618,6 +1651,13 @@ chatAvailableReactionsAll = ChatAvailableReactions; chatAvailableReactionsSome reactions:vector = ChatAvailableReactions; +//@description Represents a tag used in Saved Messages @tag The tag @label Label of the tag; 0-12 characters @count Number of times the tag was used; may be 0 if the tag has non-empty label +savedMessagesTag tag:ReactionType label:string count:int32 = SavedMessagesTag; + +//@description Contains a list of tags used in Saved Messages @tags List of tags +savedMessagesTags tags:vector = SavedMessagesTags; + + //@description Describes a video chat //@group_call_id Group call identifier of an active video chat; 0 if none. Full information about the video chat can be received through the method getGroupCall //@has_participants True, if the video chat has participants @@ -1854,6 +1894,28 @@ webAppInfo launch_id:int64 url:string = WebAppInfo; messageThreadInfo chat_id:int53 message_thread_id:int53 reply_info:messageReplyInfo unread_message_count:int32 messages:vector draft_message:draftMessage = MessageThreadInfo; +//@class SavedMessagesTopic @description Contains information about a Saved Messages topic + +//@description Topic containing messages sent by the current user of forwarded from an unknown chat +savedMessagesTopicMyNotes = SavedMessagesTopic; + +//@description Topic containing messages forwarded from a user with hidden privacy +savedMessagesTopicAuthorHidden = SavedMessagesTopic; + +//@description Topic containing messages forwarded from a specific chat @chat_id Identifier of the chat +savedMessagesTopicSavedFromChat chat_id:int53 = SavedMessagesTopic; + + +//@description Contains information about a found Saved Messages topic @topic The topic @last_message Last message in the topic; may be null if none or unknown +foundSavedMessagesTopic topic:SavedMessagesTopic last_message:message = FoundSavedMessagesTopic; + +//@description Contains a list of Saved Messages topics +//@total_count Total number of Saved Messages topics found +//@topics List of Saved Messages topics +//@next_offset The offset for the next request. If empty, then there are no more results +foundSavedMessagesTopics total_count:int32 topics:vector next_offset:string = FoundSavedMessagesTopics; + + //@description Describes a forum topic icon @color Color of the topic icon in RGB format @custom_emoji_id Unique identifier of the custom emoji shown on the topic icon; 0 if none forumTopicIcon color:int32 custom_emoji_id:int64 = ForumTopicIcon; @@ -2704,9 +2766,6 @@ messageDocument document:document caption:formattedText = MessageContent; //@is_secret True, if the photo must be blurred and must be shown only while tapped messagePhoto photo:photo caption:formattedText has_spoiler:Bool is_secret:Bool = MessageContent; -//@description A self-destructed photo message -messageExpiredPhoto = MessageContent; - //@description A sticker message @sticker The sticker description @is_premium True, if premium animation of the sticker must be played messageSticker sticker:sticker is_premium:Bool = MessageContent; @@ -2717,15 +2776,24 @@ messageSticker sticker:sticker is_premium:Bool = MessageContent; //@is_secret True, if the video thumbnail must be blurred and the video must be shown only while tapped messageVideo video:video caption:formattedText has_spoiler:Bool is_secret:Bool = MessageContent; -//@description A self-destructed video message -messageExpiredVideo = MessageContent; - //@description A video note message @video_note The video note description @is_viewed True, if at least one of the recipients has viewed the video note @is_secret True, if the video note thumbnail must be blurred and the video note must be shown only while tapped messageVideoNote video_note:videoNote is_viewed:Bool is_secret:Bool = MessageContent; //@description A voice note message @voice_note The voice note description @caption Voice note caption @is_listened True, if at least one of the recipients has listened to the voice note messageVoiceNote voice_note:voiceNote caption:formattedText is_listened:Bool = MessageContent; +//@description A self-destructed photo message +messageExpiredPhoto = MessageContent; + +//@description A self-destructed video message +messageExpiredVideo = MessageContent; + +//@description A self-destructed video note message +messageExpiredVideoNote = MessageContent; + +//@description A self-destructed voice note message +messageExpiredVoiceNote = MessageContent; + //@description A message with a location //@location The location description //@live_period Time relative to the message send date, for which the location can be updated, in seconds @@ -3126,7 +3194,6 @@ inputMessageDocument document:InputFile thumbnail:inputThumbnail disable_content //@has_spoiler True, if the photo preview must be covered by a spoiler animation; not supported in secret chats inputMessagePhoto photo:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector width:int32 height:int32 caption:formattedText self_destruct_type:MessageSelfDestructType has_spoiler:Bool = InputMessageContent; - //@description A sticker message //@sticker Sticker to be sent //@thumbnail Sticker thumbnail; pass null to skip thumbnail uploading @@ -3153,14 +3220,16 @@ inputMessageVideo video:InputFile thumbnail:inputThumbnail added_sticker_file_id //@thumbnail Video thumbnail; pass null to skip thumbnail uploading //@duration Duration of the video, in seconds //@length Video width and height; must be positive and not greater than 640 -inputMessageVideoNote video_note:InputFile thumbnail:inputThumbnail duration:int32 length:int32 = InputMessageContent; +//@self_destruct_type Video note self-destruct type; pass null if none; private chats only +inputMessageVideoNote video_note:InputFile thumbnail:inputThumbnail duration:int32 length:int32 self_destruct_type:MessageSelfDestructType = InputMessageContent; //@description A voice note message //@voice_note Voice note to be sent //@duration Duration of the voice note, in seconds //@waveform Waveform representation of the voice note in 5-bit format //@caption Voice note caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters -inputMessageVoiceNote voice_note:InputFile duration:int32 waveform:bytes caption:formattedText = InputMessageContent; +//@self_destruct_type Voice note self-destruct type; pass null if none; private chats only +inputMessageVoiceNote voice_note:InputFile duration:int32 waveform:bytes caption:formattedText self_destruct_type:MessageSelfDestructType = InputMessageContent; //@description A message with a location //@location Location to be sent @@ -3323,7 +3392,7 @@ chatActionCancel = ChatAction; //@class UserStatus @description Describes the last time the user was online -//@description The user status was never changed +//@description The user's status has never been changed userStatusEmpty = UserStatus; //@description The user is online @expires Point in time (Unix timestamp) when the user's online status will expire @@ -3332,16 +3401,22 @@ userStatusOnline expires:int32 = UserStatus; //@description The user is offline @was_online Point in time (Unix timestamp) when the user was last online userStatusOffline was_online:int32 = UserStatus; -//@description The user was online recently -userStatusRecently = UserStatus; +//@description The user was online recently @by_my_privacy_settings Exact user's status is hidden because the current user enabled userPrivacySettingShowStatus privacy setting for the user and has no Telegram Premium +userStatusRecently by_my_privacy_settings:Bool = UserStatus; -//@description The user is offline, but was online last week -userStatusLastWeek = UserStatus; +//@description The user is offline, but was online last week @by_my_privacy_settings Exact user's status is hidden because the current user enabled userPrivacySettingShowStatus privacy setting for the user and has no Telegram Premium +userStatusLastWeek by_my_privacy_settings:Bool = UserStatus; -//@description The user is offline, but was online last month -userStatusLastMonth = UserStatus; +//@description The user is offline, but was online last month @by_my_privacy_settings Exact user's status is hidden because the current user enabled userPrivacySettingShowStatus privacy setting for the user and has no Telegram Premium +userStatusLastMonth by_my_privacy_settings:Bool = UserStatus; +//@description Represents an emoji with its keyword @emoji The emoji @keyword The keyword +emojiKeyword emoji:string keyword:string = EmojiKeyword; + +//@description Represents a list of emoji with their keywords @emoji_keywords List of emoji with their keywords +emojiKeywords emoji_keywords:vector = EmojiKeywords; + //@description Represents a list of stickers @stickers List of stickers stickers stickers:vector = Stickers; @@ -3658,8 +3733,14 @@ publicForwards total_count:int32 forwards:vector next_offset:stri //@can_set_custom_background True, if custom background can be set in the chat for all users chatBoostLevelFeatures level:int32 story_per_day_count:int32 custom_emoji_reaction_count:int32 title_color_count:int32 profile_accent_color_count:int32 can_set_profile_background_custom_emoji:Bool accent_color_count:int32 can_set_background_custom_emoji:Bool can_set_emoji_status:Bool chat_theme_background_count:int32 can_set_custom_background:Bool = ChatBoostLevelFeatures; -//@description Contains a list of features available on the first chat boost levels @features The list of features -chatBoostFeatures features:vector = ChatBoostFeatures; +//@description Contains a list of features available on the first chat boost levels +//@features The list of features +//@min_profile_background_custom_emoji_boost_level The minimum boost level required to set custom emoji for profile background +//@min_background_custom_emoji_boost_level The minimum boost level required to set custom emoji for reply header and link preview background +//@min_emoji_status_boost_level The minimum boost level required to set emoji status +//@min_chat_theme_background_boost_level The minimum boost level required to set a chat theme background as chat background +//@min_custom_background_boost_level The minimum boost level required to set custom chat background +chatBoostFeatures features:vector min_profile_background_custom_emoji_boost_level:int32 min_background_custom_emoji_boost_level:int32 min_emoji_status_boost_level:int32 min_chat_theme_background_boost_level:int32 min_custom_background_boost_level:int32 = ChatBoostFeatures; //@class ChatBoostSource @description Describes source of a chat boost @@ -3970,9 +4051,11 @@ availableReaction type:ReactionType needs_premium:Bool = AvailableReaction; //@recent_reactions List of recently used reactions //@popular_reactions List of popular reactions //@allow_custom_emoji True, if any custom emoji reaction can be added by Telegram Premium subscribers -availableReactions top_reactions:vector recent_reactions:vector popular_reactions:vector allow_custom_emoji:Bool = AvailableReactions; +//@are_tags True, if the reactions will be tags and the message can be found by them; currently, always false +//@unavailability_reason The reason why the current user can't add reactions to the message, despite some other users can; may be null if none +availableReactions top_reactions:vector recent_reactions:vector popular_reactions:vector allow_custom_emoji:Bool are_tags:Bool unavailability_reason:ReactionUnavailabilityReason = AvailableReactions; -//@description Contains information about a emoji reaction +//@description Contains information about an emoji reaction //@emoji Text representation of the reaction //@title Reaction title //@is_active True, if the reaction can be added to new messages and enabled in chats @@ -3986,6 +4069,15 @@ availableReactions top_reactions:vector recent_reactions:vect emojiReaction emoji:string title:string is_active:Bool static_icon:sticker appear_animation:sticker select_animation:sticker activate_animation:sticker effect_animation:sticker around_animation:sticker center_animation:sticker = EmojiReaction; +//@class ReactionUnavailabilityReason @description Describes why the current user can't add reactions to the message, despite some other users can + +//@description The user is an anonymous administrator in the supergroup, but isn't a creator of it, so they can't vote on behalf of the supergroup +reactionUnavailabilityReasonAnonymousAdministrator = ReactionUnavailabilityReason; + +//@description The user isn't a member of the supergroup and can't send messages and reactions there without joining +reactionUnavailabilityReasonGuest = ReactionUnavailabilityReason; + + //@description Represents a list of animations @animations List of animations animations animations:vector = Animations; @@ -4592,6 +4684,9 @@ premiumLimitTypeChatFolderChosenChatCount = PremiumLimitType; //@description The maximum number of pinned chats in the archive chat list premiumLimitTypePinnedArchivedChatCount = PremiumLimitType; +//@description The maximum number of pinned Saved Messages topics +premiumLimitTypePinnedSavedMessagesTopicCount = PremiumLimitType; + //@description The maximum length of sent media caption premiumLimitTypeCaptionLength = PremiumLimitType; @@ -5305,6 +5400,27 @@ userPrivacySettingAllowFindingByPhoneNumber = UserPrivacySetting; userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages = UserPrivacySetting; +//@description Contains privacy settings for message read date in private chats. Read dates are always shown to the users that can see online status of the current user regardless of this setting +//@show_read_date True, if message read date is shown to other users in private chats. If false and the current user isn't a Telegram Premium user, then they will not be able to see other's message read date. +readDatePrivacySettings show_read_date:Bool = ReadDatePrivacySettings; + +//@description Contains privacy settings for new chats with non-contacts +//@allow_new_chats_from_unknown_users True, if non-contacts users are able to write first to the current user. Telegram Premium subscribers are able to write first regardless of this setting +newChatPrivacySettings allow_new_chats_from_unknown_users:Bool = NewChatPrivacySettings; + + +//@class CanSendMessageToUserResult @description Describes result of canSendMessageToUser + +//@description The user can be messaged +canSendMessageToUserResultOk = CanSendMessageToUserResult; + +//@description The user can't be messaged, because they are deleted or unknown +canSendMessageToUserResultUserIsDeleted = CanSendMessageToUserResult; + +//@description The user can't be messaged, because they restrict new chats with non-contacts +canSendMessageToUserResultUserRestrictsNewChats = CanSendMessageToUserResult; + + //@description Contains information about the period of inactivity after which the current user's account will automatically be deleted @days Number of days of inactivity before the account will be flagged for deletion; 30-366 days accountTtl days:int32 = AccountTtl; @@ -5466,7 +5582,7 @@ targetChatInternalLink link:InternalLinkType = TargetChat; //@class InternalLinkType @description Describes an internal https://t.me or tg: link, which must be processed by the application in a special way -//@description The link is a link to the active sessions section of the application. Use getActiveSessions to handle the link +//@description The link is a link to the Devices section of the application. Use getActiveSessions to get the list of active sessions and show them to the user internalLinkTypeActiveSessions = InternalLinkType; //@description The link is a link to an attachment menu bot to be opened in the specified or a chosen chat. Process given target_chat to open the chat. @@ -5482,7 +5598,9 @@ internalLinkTypeAttachmentMenuBot target_chat:TargetChat bot_username:string url //@description The link contains an authentication code. Call checkAuthenticationCode with the code if the current authorization state is authorizationStateWaitCode @code The authentication code internalLinkTypeAuthenticationCode code:string = InternalLinkType; -//@description The link is a link to a background. Call searchBackground with the given background name to process the link @background_name Name of the background +//@description The link is a link to a background. Call searchBackground with the given background name to process the link +//-If background is found and the user wants to apply it, then call setDefaultBackground +//@background_name Name of the background internalLinkTypeBackground background_name:string = InternalLinkType; //@description The link is a link to a Telegram bot, which is supposed to be added to a channel chat as an administrator. Call searchPublicChat with the given bot username and check that the user is a bot, @@ -5519,13 +5637,17 @@ internalLinkTypeChangePhoneNumber = InternalLinkType; //@url URL to be passed to getChatBoostLinkInfo internalLinkTypeChatBoost url:string = InternalLinkType; -//@description The link is an invite link to a chat folder. Call checkChatFolderInviteLink with the given invite link to process the link @invite_link Internal representation of the invite link +//@description The link is an invite link to a chat folder. Call checkChatFolderInviteLink with the given invite link to process the link. +//-If the link is valid and the user wants to join the chat folder, then call addChatFolderByInviteLink +//@invite_link Internal representation of the invite link internalLinkTypeChatFolderInvite invite_link:string = InternalLinkType; //@description The link is a link to the folder section of the app settings internalLinkTypeChatFolderSettings = InternalLinkType; -//@description The link is a chat invite link. Call checkChatInviteLink with the given invite link to process the link @invite_link Internal representation of the invite link +//@description The link is a chat invite link. Call checkChatInviteLink with the given invite link to process the link. +//-If the link is valid and the user wants to join the chat, then call joinChatByInviteLink +//@invite_link Internal representation of the invite link internalLinkTypeChatInvite invite_link:string = InternalLinkType; //@description The link is a link to the default message auto-delete timer settings section of the app settings @@ -5534,24 +5656,32 @@ internalLinkTypeDefaultMessageAutoDeleteTimerSettings = InternalLinkType; //@description The link is a link to the edit profile section of the app settings internalLinkTypeEditProfileSettings = InternalLinkType; -//@description The link is a link to a game. Call searchPublicChat with the given bot username, check that the user is a bot, ask the current user to select a chat to send the game, and then call sendMessage with inputMessageGame +//@description The link is a link to a game. Call searchPublicChat with the given bot username, check that the user is a bot, +//-ask the current user to select a chat to send the game, and then call sendMessage with inputMessageGame //@bot_username Username of the bot that owns the game //@game_short_name Short name of the game internalLinkTypeGame bot_username:string game_short_name:string = InternalLinkType; -//@description The link must be opened in an Instant View. Call getWebPageInstantView with the given URL to process the link @url URL to be passed to getWebPageInstantView @fallback_url An URL to open if getWebPageInstantView fails +//@description The link must be opened in an Instant View. Call getWebPageInstantView with the given URL to process the link. +//-If Instant View is found, then show it, otherwise, open the fallback URL in an external browser +//@url URL to be passed to getWebPageInstantView +//@fallback_url An URL to open if getWebPageInstantView fails internalLinkTypeInstantView url:string fallback_url:string = InternalLinkType; //@description The link is a link to an invoice. Call getPaymentForm with the given invoice name to process the link @invoice_name Name of the invoice internalLinkTypeInvoice invoice_name:string = InternalLinkType; -//@description The link is a link to a language pack. Call getLanguagePackInfo with the given language pack identifier to process the link @language_pack_id Language pack identifier +//@description The link is a link to a language pack. Call getLanguagePackInfo with the given language pack identifier to process the link. +//-If the language pack is found and the user wants to apply it, then call setOption for the option "language_pack_id" +//@language_pack_id Language pack identifier internalLinkTypeLanguagePack language_pack_id:string = InternalLinkType; //@description The link is a link to the language section of the app settings internalLinkTypeLanguageSettings = InternalLinkType; -//@description The link is a link to a Telegram message or a forum topic. Call getMessageLinkInfo with the given URL to process the link @url URL to be passed to getMessageLinkInfo +//@description The link is a link to a Telegram message or a forum topic. Call getMessageLinkInfo with the given URL to process the link, +//-and then open received forum topic or chat and show the message there +//@url URL to be passed to getMessageLinkInfo internalLinkTypeMessage url:string = InternalLinkType; //@description The link contains a message draft text. A share screen needs to be shown to the user, then the chosen chat must be opened and the text is added to the input field @@ -5568,18 +5698,21 @@ internalLinkTypeMessageDraft text:formattedText contains_link:Bool = InternalLin //-If empty, then onActivityResult method must be used to return response on Android, or the link tgbot{bot_user_id}://passport/success or tgbot{bot_user_id}://passport/cancel must be opened otherwise internalLinkTypePassportDataRequest bot_user_id:int53 scope:string public_key:string nonce:string callback_url:string = InternalLinkType; -//@description The link can be used to confirm ownership of a phone number to prevent account deletion. Call sendPhoneNumberConfirmationCode with the given hash and phone number to process the link +//@description The link can be used to confirm ownership of a phone number to prevent account deletion. Call sendPhoneNumberConfirmationCode with the given hash and phone number to process the link. +//-If succeeded, call checkPhoneNumberConfirmationCode to check entered by the user code, or resendPhoneNumberConfirmationCode to resend it //@hash Hash value from the link //@phone_number Phone number value from the link internalLinkTypePhoneNumberConfirmation hash:string phone_number:string = InternalLinkType; -//@description The link is a link to the Premium features screen of the application from which the user can subscribe to Telegram Premium. Call getPremiumFeatures with the given referrer to process the link @referrer Referrer specified in the link +//@description The link is a link to the Premium features screen of the application from which the user can subscribe to Telegram Premium. Call getPremiumFeatures with the given referrer to process the link +//@referrer Referrer specified in the link internalLinkTypePremiumFeatures referrer:string = InternalLinkType; -//@description The link is a link to the screen for gifting Telegram Premium subscriptions to friends @referrer Referrer specified in the link +//@description The link is a link to the screen for gifting Telegram Premium subscriptions to friends via inputInvoiceTelegram payments or in-store purchases @referrer Referrer specified in the link internalLinkTypePremiumGift referrer:string = InternalLinkType; -//@description The link is a link with a Telegram Premium gift code. Call checkPremiumGiftCode with the given code to process the link. If the code is valid and the user wants to apply it, then call applyPremiumGiftCode +//@description The link is a link with a Telegram Premium gift code. Call checkPremiumGiftCode with the given code to process the link. +//-If the code is valid and the user wants to apply it, then call applyPremiumGiftCode //@code The Telegram Premium gift code internalLinkTypePremiumGiftCode code:string = InternalLinkType; @@ -5592,7 +5725,9 @@ internalLinkTypePrivacyAndSecuritySettings = InternalLinkType; //@type Type of the proxy internalLinkTypeProxy server:string port:int32 type:ProxyType = InternalLinkType; -//@description The link is a link to a chat by its username. Call searchPublicChat with the given chat username to process the link @chat_username Username of the chat +//@description The link is a link to a chat by its username. Call searchPublicChat with the given chat username to process the link +//-If the chat is found, open its profile information screen or the chat itself +//@chat_username Username of the chat internalLinkTypePublicChat chat_username:string = InternalLinkType; //@description The link can be used to login the current user on another device, but it must be scanned from QR-code using in-app camera. An alert similar to @@ -5608,17 +5743,18 @@ internalLinkTypeSettings = InternalLinkType; //@description The link is a link to a bot, which can be installed to the side menu. Call searchPublicChat with the given bot username, check that the user is a bot and can be added to attachment menu. //-Then, use getAttachmentMenuBot to receive information about the bot. If the bot isn't added to side menu, then show a disclaimer about Mini Apps being a third-party apps, //-ask the user to accept their Terms of service and confirm adding the bot to side and attachment menu. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. -//-If the bot is added to side menu, then use getWebAppUrl with the given URL +//-If the bot is added to side menu, then use getWebAppUrl with the given URL and open the returned URL as a Web App //@bot_username Username of the bot //@url URL to be passed to getWebAppUrl internalLinkTypeSideMenuBot bot_username:string url:string = InternalLinkType; -//@description The link is a link to a sticker set. Call searchStickerSet with the given sticker set name to process the link and show the sticker set +//@description The link is a link to a sticker set. Call searchStickerSet with the given sticker set name to process the link and show the sticker set. +//-If the sticker set is found and the user wants to add it, then call changeStickerSet //@sticker_set_name Name of the sticker set //@expect_custom_emoji True, if the sticker set is expected to contain custom emoji internalLinkTypeStickerSet sticker_set_name:string expect_custom_emoji:Bool = InternalLinkType; -//@description The link is a link to a story. Call searchPublicChat with the given sender username, then call getStory with the received chat identifier and the given story identifier +//@description The link is a link to a story. Call searchPublicChat with the given sender username, then call getStory with the received chat identifier and the given story identifier, then show the story if received //@story_sender_username Username of the sender of the story //@story_id Story identifier internalLinkTypeStory story_sender_username:string story_id:int32 = InternalLinkType; @@ -5635,10 +5771,14 @@ internalLinkTypeUnknownDeepLink link:string = InternalLinkType; //@description The link is a link to an unsupported proxy. An alert can be shown to the user internalLinkTypeUnsupportedProxy = InternalLinkType; -//@description The link is a link to a user by its phone number. Call searchUserByPhoneNumber with the given phone number to process the link @phone_number Phone number of the user +//@description The link is a link to a user by its phone number. Call searchUserByPhoneNumber with the given phone number to process the link. +//-If the user is found, then call createPrivateChat and open the chat +//@phone_number Phone number of the user internalLinkTypeUserPhoneNumber phone_number:string = InternalLinkType; -//@description The link is a link to a user by a temporary token. Call searchUserByToken with the given token to process the link @token The token +//@description The link is a link to a user by a temporary token. Call searchUserByToken with the given token to process the link. +//-If the user is found, then call createPrivateChat and open the chat +//@token The token internalLinkTypeUserToken token:string = InternalLinkType; //@description The link is a link to a video chat. Call searchPublicChat with the given chat username, and then joinGroupCall with the given invite hash to process the link @@ -6363,6 +6503,9 @@ updateChatFolders chat_folders:vector main_chat_list_position:in //@online_member_count New number of online members in the chat, or 0 if unknown updateChatOnlineMemberCount chat_id:int53 online_member_count:int32 = Update; +//@description The list of pinned Saved Messages topics has changed. The app can call getPinnedSavedMessagesTopics to get the new list +updatePinnedSavedMessagesTopics = Update; + //@description Basic information about a topic in a forum chat was changed @chat_id Chat identifier @info New information about the topic updateForumTopicInfo chat_id:int53 info:forumTopicInfo = Update; @@ -6593,6 +6736,9 @@ updateActiveEmojiReactions emojis:vector = Update; //@description The type of default reaction has changed @reaction_type The new type of the default reaction updateDefaultReactionType reaction_type:ReactionType = Update; +//@description Used Saved Messages tags have changed @tags The new used tags +updateSavedMessagesTags tags:savedMessagesTags = Update; + //@description The parameters of speech recognition without Telegram Premium subscription has changed //@max_media_duration The maximum allowed duration of media for speech recognition without Telegram Premium subscription //@weekly_count The total number of allowed speech recognitions per week; 0 if none @@ -6792,9 +6938,7 @@ getAuthorizationState = AuthorizationState; //@device_model Model of the device the application is being run on; must be non-empty //@system_version Version of the operating system the application is being run on. If empty, the version is automatically detected by TDLib //@application_version Application version; must be non-empty -//@enable_storage_optimizer Pass true to automatically delete old files in background -//@ignore_file_names Pass true to ignore original file names for downloaded files. Otherwise, downloaded files are saved under names as close as possible to the original name -setTdlibParameters use_test_dc:Bool database_directory:string files_directory:string database_encryption_key:bytes use_file_database:Bool use_chat_info_database:Bool use_message_database:Bool use_secret_chats:Bool api_id:int32 api_hash:string system_language_code:string device_model:string system_version:string application_version:string enable_storage_optimizer:Bool ignore_file_names:Bool = Ok; +setTdlibParameters use_test_dc:Bool database_directory:string files_directory:string database_encryption_key:bytes use_file_database:Bool use_chat_info_database:Bool use_message_database:Bool use_secret_chats:Bool api_id:int32 api_hash:string system_language_code:string device_model:string system_version:string application_version:string = Ok; //@description Sets the phone number of the user and sends an authentication code to the user. Works only when the current authorization state is authorizationStateWaitPhoneNumber, //-or if there is no pending authentication query and the current authorization state is authorizationStateWaitEmailAddress, authorizationStateWaitEmailCode, authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword @@ -6911,6 +7055,9 @@ checkRecoveryEmailAddressCode code:string = PasswordState; //@description Resends the 2-step verification recovery email address verification code resendRecoveryEmailAddressCode = PasswordState; +//@description Cancels verification of the 2-step verification recovery email address +cancelRecoveryEmailAddressVerification = PasswordState; + //@description Requests to send a 2-step verification password recovery code to an email address that was previously set up requestPasswordRecovery = EmailAddressAuthenticationCodeInfo; @@ -6988,6 +7135,11 @@ getMessages chat_id:int53 message_ids:vector = Messages; //@description Returns information about a message thread. Can be used only if message.can_get_message_thread == true @chat_id Chat identifier @message_id Identifier of the message getMessageThread chat_id:int53 message_id:int53 = MessageThreadInfo; +//@description Returns read date of a recent outgoing message in a private chat. The method can be called if message.can_get_read_date == true and the message is read +//@chat_id Chat identifier +//@message_id Identifier of the message +getMessageReadDate chat_id:int53 message_id:int53 = MessageReadDate; + //@description Returns viewers of a recent outgoing message in a basic group or a supergroup chat. For video notes and voice notes only users, opened content of the message, are returned. The method can be called if message.can_get_viewers == true //@chat_id Chat identifier //@message_id Identifier of the message @@ -7086,6 +7238,45 @@ getSuitableDiscussionChats = Chats; getInactiveSupergroupChats = Chats; +//@description Returns list of all pinned Saved Messages topics +getPinnedSavedMessagesTopics = FoundSavedMessagesTopics; + +//@description Returns list of non-pinned Saved Messages topics from the specified offset +//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results +//@limit The maximum number of Saved Messages topics to be returned; up to 100 +getSavedMessagesTopics offset:string limit:int32 = FoundSavedMessagesTopics; + +//@description Returns messages in a Saved Messages topic. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id) +//@saved_messages_topic Saved Messages topic which messages will be fetched +//@from_message_id Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message +//@offset Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages +//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. +//-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit +getSavedMessagesTopicHistory saved_messages_topic:SavedMessagesTopic from_message_id:int53 offset:int32 limit:int32 = Messages; + +//@description Returns the last message sent in a Saved Messages topic no later than the specified date +//@saved_messages_topic Saved Messages topic which message will be returned +//@date Point in time (Unix timestamp) relative to which to search for messages +getSavedMessagesTopicMessageByDate saved_messages_topic:SavedMessagesTopic date:int32 = Message; + +//@description Deletes all messages in a Saved Messages topic @saved_messages_topic Saved Messages topic which messages will be deleted +deleteSavedMessagesTopicHistory saved_messages_topic:SavedMessagesTopic = Ok; + +//@description Deletes all messages between the specified dates in a Saved Messages topic. Messages sent in the last 30 seconds will not be deleted +//@saved_messages_topic Saved Messages topic which messages will be deleted +//@min_date The minimum date of the messages to delete +//@max_date The maximum date of the messages to delete +deleteSavedMessagesTopicMessagesByDate saved_messages_topic:SavedMessagesTopic min_date:int32 max_date:int32 = Ok; + +//@description Changes the pinned state of a Saved Messages topic. There can be up to getOption("pinned_saved_messages_topic_count_max") pinned topics. The limit can be increased with Telegram Premium +//@saved_messages_topic Saved Messages topic to pin or unpin +//@is_pinned Pass true to pin the topic; pass false to unpin it +toggleSavedMessagesTopicIsPinned saved_messages_topic:SavedMessagesTopic is_pinned:Bool = Ok; + +//@description Changes the order of pinned Saved Messages topics @saved_messages_topics The new list of pinned Saved Messages topics +setPinnedSavedMessagesTopics saved_messages_topics:vector = Ok; + + //@description Returns a list of common group chats with a given user. Chats are sorted by their type and creation date //@user_id User identifier //@offset_chat_id Chat identifier starting from which to return chats; use 0 for the first request @@ -7097,7 +7288,7 @@ getGroupsInCommon user_id:int53 offset_chat_id:int53 limit:int32 = Chats; //-For optimal performance, the number of returned messages is chosen by TDLib. This is an offline request if only_local is true //@chat_id Chat identifier //@from_message_id Identifier of the message starting from which history must be fetched; use 0 to get results from the last message -//@offset Specify 0 to get results from exactly the from_message_id or a negative offset up to 99 to get additionally some newer messages +//@offset Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages //@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit //@only_local Pass true to get only messages that are available without sending network requests @@ -7108,7 +7299,7 @@ getChatHistory chat_id:int53 from_message_id:int53 offset:int32 limit:int32 only //@chat_id Chat identifier //@message_id Message identifier, which thread history needs to be returned //@from_message_id Identifier of the message starting from which history must be fetched; use 0 to get results from the last message -//@offset Specify 0 to get results from exactly the from_message_id or a negative offset up to 99 to get additionally some newer messages +//@offset Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages //@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit getMessageThreadHistory chat_id:int53 message_id:int53 from_message_id:int53 offset:int32 limit:int32 = Messages; @@ -7131,12 +7322,13 @@ deleteChat chat_id:int53 = Ok; //@query Query to search for //@sender_id Identifier of the sender of messages to search for; pass null to search for messages from any sender. Not supported in secret chats //@from_message_id Identifier of the message starting from which history must be fetched; use 0 to get results from the last message -//@offset Specify 0 to get results from exactly the from_message_id or a negative offset to get the specified message and some newer messages +//@offset Specify 0 to get results from exactly the message from_message_id or a negative offset to get the specified message and some newer messages //@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than -offset. //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit //@filter Additional filter for messages to search; pass null to search for all messages //@message_thread_id If not 0, only messages in the specified thread will be returned; supergroups only -searchChatMessages chat_id:int53 query:string sender_id:MessageSender from_message_id:int53 offset:int32 limit:int32 filter:SearchMessagesFilter message_thread_id:int53 = FoundChatMessages; +//@saved_messages_topic If not null, only messages in the specified Saved Messages topic will be returned; pass null to return all messages, or for chats other than Saved Messages +searchChatMessages chat_id:int53 query:string sender_id:MessageSender from_message_id:int53 offset:int32 limit:int32 filter:SearchMessagesFilter message_thread_id:int53 saved_messages_topic:SavedMessagesTopic = FoundChatMessages; //@description Searches for messages in all chats except secret chats. Returns the results in reverse chronological order (i.e., in order of decreasing (date, chat_id, message_id)). //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit @@ -7157,6 +7349,17 @@ searchMessages chat_list:ChatList query:string offset:string limit:int32 filter: //@filter Additional filter for messages to search; pass null to search for all messages searchSecretMessages chat_id:int53 query:string offset:string limit:int32 filter:SearchMessagesFilter = FoundMessages; +//@description Searches for messages tagged by the given reaction and with the given words in the Saved Messages chat; for Telegram Premium users only. +//-Returns the results in reverse chronological order, i.e. in order of decreasing message_id +//-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit +//@tag Tag to search for; pass null to return all suitable messages +//@query Query to search for +//@from_message_id Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message +//@offset Specify 0 to get results from exactly the message from_message_id or a negative offset to get the specified message and some newer messages +//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than -offset. +//-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit +searchSavedMessages tag:ReactionType query:string from_message_id:int53 offset:int32 limit:int32 = FoundChatMessages; + //@description Searches for call messages. Returns the results in reverse chronological order (i.e., in order of decreasing message_id). For optimal performance, the number of returned messages is chosen by TDLib //@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results //@limit The maximum number of messages to be returned; up to 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit @@ -7186,26 +7389,30 @@ getChatMessageByDate chat_id:int53 date:int32 = Message; //@filter Filter for message content. Filters searchMessagesFilterEmpty, searchMessagesFilterMention, searchMessagesFilterUnreadMention, and searchMessagesFilterUnreadReaction are unsupported in this function //@from_message_id The message identifier from which to return information about message positions //@limit The expected number of message positions to be returned; 50-2000. A smaller number of positions can be returned, if there are not enough appropriate messages -getChatSparseMessagePositions chat_id:int53 filter:SearchMessagesFilter from_message_id:int53 limit:int32 = MessagePositions; +//@saved_messages_topic If not null, only messages in the specified Saved Messages topic will be considered; pass null to consider all messages, or for chats other than Saved Messages +getChatSparseMessagePositions chat_id:int53 filter:SearchMessagesFilter from_message_id:int53 limit:int32 saved_messages_topic:SavedMessagesTopic = MessagePositions; //@description Returns information about the next messages of the specified type in the chat split by days. Returns the results in reverse chronological order. Can return partial result for the last returned day. Behavior of this method depends on the value of the option "utc_time_offset" //@chat_id Identifier of the chat in which to return information about messages //@filter Filter for message content. Filters searchMessagesFilterEmpty, searchMessagesFilterMention, searchMessagesFilterUnreadMention, and searchMessagesFilterUnreadReaction are unsupported in this function //@from_message_id The message identifier from which to return information about messages; use 0 to get results from the last message -getChatMessageCalendar chat_id:int53 filter:SearchMessagesFilter from_message_id:int53 = MessageCalendar; +//@saved_messages_topic If not null, only messages in the specified Saved Messages topic will be considered; pass null to consider all messages, or for chats other than Saved Messages +getChatMessageCalendar chat_id:int53 filter:SearchMessagesFilter from_message_id:int53 saved_messages_topic:SavedMessagesTopic = MessageCalendar; //@description Returns approximate number of messages of the specified type in the chat //@chat_id Identifier of the chat in which to count messages //@filter Filter for message content; searchMessagesFilterEmpty is unsupported in this function +//@saved_messages_topic If not null, only messages in the specified Saved Messages topic will be counted; pass null to count all messages, or for chats other than Saved Messages //@return_local Pass true to get the number of messages without sending network requests, or -1 if the number of messages is unknown locally -getChatMessageCount chat_id:int53 filter:SearchMessagesFilter return_local:Bool = Count; +getChatMessageCount chat_id:int53 filter:SearchMessagesFilter saved_messages_topic:SavedMessagesTopic return_local:Bool = Count; //@description Returns approximate 1-based position of a message among messages, which can be found by the specified filter in the chat. Cannot be used in secret chats //@chat_id Identifier of the chat in which to find message position //@message_id Message identifier //@filter Filter for message content; searchMessagesFilterEmpty, searchMessagesFilterUnreadMention, searchMessagesFilterUnreadReaction, and searchMessagesFilterFailedToSend are unsupported in this function //@message_thread_id If not 0, only messages in the specified thread will be considered; supergroups only -getChatMessagePosition chat_id:int53 message_id:int53 filter:SearchMessagesFilter message_thread_id:int53 = Count; +//@saved_messages_topic If not null, only messages in the specified Saved Messages topic will be considered; pass null to consider all relevant messages, or for chats other than Saved Messages +getChatMessagePosition chat_id:int53 message_id:int53 filter:SearchMessagesFilter message_thread_id:int53 saved_messages_topic:SavedMessagesTopic = Count; //@description Returns all scheduled messages in a chat. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id) @chat_id Chat identifier getChatScheduledMessages chat_id:int53 = Messages; @@ -7431,13 +7638,13 @@ editMessageSchedulingState chat_id:int53 message_id:int53 scheduling_state:Messa //@description Returns list of custom emojis, which can be used as forum topic icon by all users getForumTopicDefaultIcons = Stickers; -//@description Creates a topic in a forum supergroup chat; requires can_manage_topics rights in the supergroup +//@description Creates a topic in a forum supergroup chat; requires can_manage_topics or can_create_topics rights in the supergroup //@chat_id Identifier of the chat //@name Name of the topic; 1-128 characters //@icon Icon of the topic. Icon color must be one of 0x6FB9F0, 0xFFD67E, 0xCB86DB, 0x8EEE98, 0xFF93B2, or 0xFB6F5F. Telegram Premium users can use any custom emoji as topic icon, other users can use only a custom emoji returned by getForumTopicDefaultIcons createForumTopic chat_id:int53 name:string icon:forumTopicIcon = ForumTopicInfo; -//@description Edits title and icon of a topic in a forum supergroup chat; requires can_manage_topics administrator right in the supergroup unless the user is creator of the topic +//@description Edits title and icon of a topic in a forum supergroup chat; requires can_manage_topics right in the supergroup unless the user is creator of the topic //@chat_id Identifier of the chat //@message_thread_id Message thread identifier of the forum topic //@name New name of the topic; 0-128 characters. If empty, the previous topic name is kept @@ -7466,24 +7673,24 @@ getForumTopics chat_id:int53 query:string offset_date:int32 offset_message_id:in //@notification_settings New notification settings for the forum topic. If the topic is muted for more than 366 days, it is considered to be muted forever setForumTopicNotificationSettings chat_id:int53 message_thread_id:int53 notification_settings:chatNotificationSettings = Ok; -//@description Toggles whether a topic is closed in a forum supergroup chat; requires can_manage_topics administrator right in the supergroup unless the user is creator of the topic +//@description Toggles whether a topic is closed in a forum supergroup chat; requires can_manage_topics right in the supergroup unless the user is creator of the topic //@chat_id Identifier of the chat //@message_thread_id Message thread identifier of the forum topic //@is_closed Pass true to close the topic; pass false to reopen it toggleForumTopicIsClosed chat_id:int53 message_thread_id:int53 is_closed:Bool = Ok; -//@description Toggles whether a General topic is hidden in a forum supergroup chat; requires can_manage_topics administrator right in the supergroup +//@description Toggles whether a General topic is hidden in a forum supergroup chat; requires can_manage_topics right in the supergroup //@chat_id Identifier of the chat //@is_hidden Pass true to hide and close the General topic; pass false to unhide it toggleGeneralForumTopicIsHidden chat_id:int53 is_hidden:Bool = Ok; -//@description Changes the pinned state of a forum topic; requires can_manage_topics administrator right in the supergroup. There can be up to getOption("pinned_forum_topic_count_max") pinned forum topics +//@description Changes the pinned state of a forum topic; requires can_manage_topics right in the supergroup. There can be up to getOption("pinned_forum_topic_count_max") pinned forum topics //@chat_id Chat identifier //@message_thread_id Message thread identifier of the forum topic //@is_pinned Pass true to pin the topic; pass false to unpin it toggleForumTopicIsPinned chat_id:int53 message_thread_id:int53 is_pinned:Bool = Ok; -//@description Changes the order of pinned forum topics @chat_id Chat identifier @message_thread_ids The new list of pinned forum topics +//@description Changes the order of pinned forum topics; requires can_manage_topics right in the supergroup @chat_id Chat identifier @message_thread_ids The new list of pinned forum topics setPinnedForumTopics chat_id:int53 message_thread_ids:vector = Ok; //@description Deletes all messages in a forum topic; requires can_delete_messages administrator right in the supergroup unless the user is creator of the topic, the topic has no messages from other users and has at most 11 messages @@ -7492,7 +7699,7 @@ setPinnedForumTopics chat_id:int53 message_thread_ids:vector = Ok; deleteForumTopic chat_id:int53 message_thread_id:int53 = Ok; -//@description Returns information about a emoji reaction. Returns a 404 error if the reaction is not found @emoji Text representation of the reaction +//@description Returns information about an emoji reaction. Returns a 404 error if the reaction is not found @emoji Text representation of the reaction getEmojiReaction emoji:string = EmojiReaction; //@description Returns TGS stickers with generic animations for custom emoji reactions @@ -7507,12 +7714,12 @@ getMessageAvailableReactions chat_id:int53 message_id:int53 row_size:int32 = Ava //@description Clears the list of recently used reactions clearRecentReactions = Ok; -//@description Adds a reaction to a message. Use getMessageAvailableReactions to receive the list of available reactions for the message +//@description Adds a reaction or a tag to a message. Use getMessageAvailableReactions to receive the list of available reactions for the message //@chat_id Identifier of the chat to which the message belongs //@message_id Identifier of the message //@reaction_type Type of the reaction to add //@is_big Pass true if the reaction is added with a big animation -//@update_recent_reactions Pass true if the reaction needs to be added to recent reactions +//@update_recent_reactions Pass true if the reaction needs to be added to recent reactions; tags are never added to the list of recent reactions addMessageReaction chat_id:int53 message_id:int53 reaction_type:ReactionType is_big:Bool update_recent_reactions:Bool = Ok; //@description Removes a reaction from a message. A chosen reaction can always be removed @@ -7539,6 +7746,12 @@ getMessageAddedReactions chat_id:int53 message_id:int53 reaction_type:ReactionTy //@description Changes type of default reaction for the current user @reaction_type New type of the default reaction setDefaultReactionType reaction_type:ReactionType = Ok; +//@description Returns tags used in Saved Messages; for Telegram Premium users only +getSavedMessagesTags = SavedMessagesTags; + +//@description Changes label of a Saved Messages tag; for Telegram Premium users only @tag The tag which label will be changed @label New label for the tag; 0-12 characters +setSavedMessagesTagLabel tag:ReactionType label:string = Ok; + //@description Searches for a given quote in a text. Returns found quote start position in UTF-16 code units. Returns a 404 error if the quote is not found. Can be called synchronously //@text Text in which to search for the quote @@ -7559,6 +7772,9 @@ parseMarkdown text:formattedText = FormattedText; //@description Replaces text entities with Markdown formatting in a human-friendly format. Entities that can't be represented in Markdown unambiguously are kept as is. Can be called synchronously @text The text getMarkdownText text:formattedText = FormattedText; +//@description Returns an emoji for the given country. Returns an empty string on failure. Can be called synchronously @country_code A two-letter ISO 3166-1 alpha-2 country code as received from getCountries +getCountryFlagEmoji country_code:string = Text; + //@description Returns the MIME type of a file, guessed by its extension. Returns an empty string on failure. Can be called synchronously @file_name The name of the file or path to the file getFileMimeType file_name:string = Text; @@ -8870,11 +9086,15 @@ removeFavoriteSticker sticker:InputFile = Ok; //@description Returns emoji corresponding to a sticker. The list is only for informational purposes, because a sticker is always sent with a fixed emoji from the corresponding Sticker object @sticker Sticker file identifier getStickerEmojis sticker:InputFile = Emojis; -//@description Searches for emojis by keywords. Supported only if the file database is enabled +//@description Searches for emojis by keywords. Supported only if the file database is enabled. Order of results is unspecified //@text Text to search for -//@exact_match Pass true if only emojis, which exactly match the text, needs to be returned //@input_language_codes List of possible IETF language tags of the user's input language; may be empty if unknown -searchEmojis text:string exact_match:Bool input_language_codes:vector = Emojis; +searchEmojis text:string input_language_codes:vector = EmojiKeywords; + +//@description Return emojis matching the keyword. Supported only if the file database is enabled. Order of results is unspecified +//@text Text to search for +//@input_language_codes List of possible IETF language tags of the user's input language; may be empty if unknown +getKeywordEmojis text:string input_language_codes:vector = Emojis; //@description Returns available emojis categories @type Type of emoji categories to return; pass null to get default emoji categories getEmojiCategories type:EmojiCategoryType = EmojiCategories; @@ -9314,6 +9534,24 @@ setUserPrivacySettingRules setting:UserPrivacySetting rules:userPrivacySettingRu //@description Returns the current privacy settings @setting The privacy setting getUserPrivacySettingRules setting:UserPrivacySetting = UserPrivacySettingRules; +//@description Changes privacy settings for message read date @settings New settings +setReadDatePrivacySettings settings:readDatePrivacySettings = Ok; + +//@description Returns privacy settings for message read date +getReadDatePrivacySettings = ReadDatePrivacySettings; + +//@description Changes privacy settings for new chat creation; for Telegram Premium users only @settings New settings +setNewChatPrivacySettings settings:newChatPrivacySettings = Ok; + +//@description Returns privacy settings for new chat creation +getNewChatPrivacySettings = NewChatPrivacySettings; + + +//@description Check whether the current user can message another user or try to create a chat with them +//@user_id Identifier of the other user +//@only_local Pass true to get only locally available information without sending network requests +canSendMessageToUser user_id:int53 only_local:Bool = CanSendMessageToUserResult; + //@description Returns the value of an option by its name. (Check the list of available options on https://core.telegram.org/tdlib/options.) Can be called before authorization. Can be called synchronously for options "version" and "commit_hash" //@name The name of the option diff --git a/example/bot/Bot.go b/example/bot/Bot.go index 8880ff0..4471dea 100644 --- a/example/bot/Bot.go +++ b/example/bot/Bot.go @@ -11,21 +11,19 @@ import ( func GetTdParameters() *tdlib.SetTdlibParametersRequest { return &tdlib.SetTdlibParametersRequest{ - UseTestDc: false, - DatabaseDirectory: "./tdlib-db", - FilesDirectory: "./tdlib-files", - UseFileDatabase: true, - UseChatInfoDatabase: true, - UseMessageDatabase: true, - UseSecretChats: false, - ApiId: 132712, - ApiHash: "e82c07ad653399a37baca8d1e498e472", - SystemLanguageCode: "en", - DeviceModel: "HuskyNG", - SystemVersion: "3.0", - ApplicationVersion: "3.0", - EnableStorageOptimizer: true, - IgnoreFileNames: false, + UseTestDc: false, + DatabaseDirectory: "./tdlib-db", + FilesDirectory: "./tdlib-files", + UseFileDatabase: true, + UseChatInfoDatabase: true, + UseMessageDatabase: true, + UseSecretChats: false, + ApiId: 132712, + ApiHash: "e82c07ad653399a37baca8d1e498e472", + SystemLanguageCode: "en", + DeviceModel: "HuskyNG", + SystemVersion: "3.0", + ApplicationVersion: "3.0", } } diff --git a/example/command/ReplyCommand.go b/example/command/ReplyCommand.go index 5d898d6..80015d3 100644 --- a/example/command/ReplyCommand.go +++ b/example/command/ReplyCommand.go @@ -19,21 +19,19 @@ func GetSenderId(sender tdlib.MessageSender) int64 { func GetTdParameters() *tdlib.SetTdlibParametersRequest { return &tdlib.SetTdlibParametersRequest{ - UseTestDc: false, - DatabaseDirectory: "./tdlib-db", - FilesDirectory: "./tdlib-files", - UseFileDatabase: true, - UseChatInfoDatabase: true, - UseMessageDatabase: true, - UseSecretChats: false, - ApiId: 132712, - ApiHash: "e82c07ad653399a37baca8d1e498e472", - SystemLanguageCode: "en", - DeviceModel: "HuskyNG", - SystemVersion: "3.0", - ApplicationVersion: "3.0", - EnableStorageOptimizer: true, - IgnoreFileNames: false, + UseTestDc: false, + DatabaseDirectory: "./tdlib-db", + FilesDirectory: "./tdlib-files", + UseFileDatabase: true, + UseChatInfoDatabase: true, + UseMessageDatabase: true, + UseSecretChats: false, + ApiId: 132712, + ApiHash: "e82c07ad653399a37baca8d1e498e472", + SystemLanguageCode: "en", + DeviceModel: "HuskyNG", + SystemVersion: "3.0", + ApplicationVersion: "3.0", } } diff --git a/example/media/Photo_or_Album.go b/example/media/Photo_or_Album.go index fe153bf..4caad1d 100644 --- a/example/media/Photo_or_Album.go +++ b/example/media/Photo_or_Album.go @@ -19,21 +19,19 @@ func GetSenderId(sender tdlib.MessageSender) int64 { func GetTdParameters() *tdlib.SetTdlibParametersRequest { return &tdlib.SetTdlibParametersRequest{ - UseTestDc: false, - DatabaseDirectory: "./tdlib-db", - FilesDirectory: "./tdlib-files", - UseFileDatabase: true, - UseChatInfoDatabase: true, - UseMessageDatabase: true, - UseSecretChats: false, - ApiId: 132712, - ApiHash: "e82c07ad653399a37baca8d1e498e472", - SystemLanguageCode: "en", - DeviceModel: "HuskyNG", - SystemVersion: "3.0", - ApplicationVersion: "3.0", - EnableStorageOptimizer: true, - IgnoreFileNames: false, + UseTestDc: false, + DatabaseDirectory: "./tdlib-db", + FilesDirectory: "./tdlib-files", + UseFileDatabase: true, + UseChatInfoDatabase: true, + UseMessageDatabase: true, + UseSecretChats: false, + ApiId: 132712, + ApiHash: "e82c07ad653399a37baca8d1e498e472", + SystemLanguageCode: "en", + DeviceModel: "HuskyNG", + SystemVersion: "3.0", + ApplicationVersion: "3.0", } } diff --git a/example/pending/PendingUpdate.go b/example/pending/PendingUpdate.go index 3256a6d..c314659 100644 --- a/example/pending/PendingUpdate.go +++ b/example/pending/PendingUpdate.go @@ -11,21 +11,19 @@ import ( func GetTdParameters() *tdlib.SetTdlibParametersRequest { return &tdlib.SetTdlibParametersRequest{ - UseTestDc: false, - DatabaseDirectory: "./tdlib-db", - FilesDirectory: "./tdlib-files", - UseFileDatabase: true, - UseChatInfoDatabase: true, - UseMessageDatabase: true, - UseSecretChats: false, - ApiId: 132712, - ApiHash: "e82c07ad653399a37baca8d1e498e472", - SystemLanguageCode: "en", - DeviceModel: "HuskyNG", - SystemVersion: "3.0", - ApplicationVersion: "3.0", - EnableStorageOptimizer: true, - IgnoreFileNames: false, + UseTestDc: false, + DatabaseDirectory: "./tdlib-db", + FilesDirectory: "./tdlib-files", + UseFileDatabase: true, + UseChatInfoDatabase: true, + UseMessageDatabase: true, + UseSecretChats: false, + ApiId: 132712, + ApiHash: "e82c07ad653399a37baca8d1e498e472", + SystemLanguageCode: "en", + DeviceModel: "HuskyNG", + SystemVersion: "3.0", + ApplicationVersion: "3.0", } } diff --git a/example/raw_update/raw.go b/example/raw_update/raw.go index b4edaad..dbca414 100644 --- a/example/raw_update/raw.go +++ b/example/raw_update/raw.go @@ -19,21 +19,19 @@ func GetSenderId(sender tdlib.MessageSender) int64 { func GetTdParameters() *tdlib.SetTdlibParametersRequest { return &tdlib.SetTdlibParametersRequest{ - UseTestDc: false, - DatabaseDirectory: "./tdlib-db", - FilesDirectory: "./tdlib-files", - UseFileDatabase: true, - UseChatInfoDatabase: true, - UseMessageDatabase: true, - UseSecretChats: false, - ApiId: 132712, - ApiHash: "e82c07ad653399a37baca8d1e498e472", - SystemLanguageCode: "en", - DeviceModel: "HuskyNG", - SystemVersion: "3.0", - ApplicationVersion: "3.0", - EnableStorageOptimizer: true, - IgnoreFileNames: false, + UseTestDc: false, + DatabaseDirectory: "./tdlib-db", + FilesDirectory: "./tdlib-files", + UseFileDatabase: true, + UseChatInfoDatabase: true, + UseMessageDatabase: true, + UseSecretChats: false, + ApiId: 132712, + ApiHash: "e82c07ad653399a37baca8d1e498e472", + SystemLanguageCode: "en", + DeviceModel: "HuskyNG", + SystemVersion: "3.0", + ApplicationVersion: "3.0", } } From 97ffe5213aa14dfa04d70d46c1693661329e5e79 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Fri, 16 Feb 2024 22:13:34 +0800 Subject: [PATCH 13/54] Update to TDLib 1.8.25 --- client/function.go | 311 +++++++++++++++----------- client/type.go | 505 +++++++++++++++++++++++++++++------------- client/unmarshaler.go | 173 +++++++++++---- data/td_api.tl | 368 +++++++++++++++++------------- 4 files changed, 887 insertions(+), 470 deletions(-) diff --git a/client/function.go b/client/function.go index 61561cf..021b491 100755 --- a/client/function.go +++ b/client/function.go @@ -286,6 +286,8 @@ type RegisterUserRequest struct { FirstName string `json:"first_name"` // The last name of the user; 0-64 characters LastName string `json:"last_name"` + // Pass true to disable notification about the current user joining Telegram for other users that added them to contact list + DisableNotification bool `json:"disable_notification"` } // Finishes user registration. Works only when the current authorization state is authorizationStateWaitRegistration @@ -297,6 +299,7 @@ func (client *Client) RegisterUser(req *RegisterUserRequest) (*Ok, error) { Data: map[string]interface{}{ "first_name": req.FirstName, "last_name": req.LastName, + "disable_notification": req.DisableNotification, }, }) if err != nil { @@ -2197,40 +2200,18 @@ func (client *Client) GetInactiveSupergroupChats() (*Chats, error) { return UnmarshalChats(result.Data) } -// Returns list of all pinned Saved Messages topics -func (client *Client) GetPinnedSavedMessagesTopics() (*FoundSavedMessagesTopics, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "getPinnedSavedMessagesTopics", - }, - Data: map[string]interface{}{}, - }) - if err != nil { - return nil, err - } - - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } - - return UnmarshalFoundSavedMessagesTopics(result.Data) -} - -type GetSavedMessagesTopicsRequest struct { - // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results - Offset string `json:"offset"` - // The maximum number of Saved Messages topics to be returned; up to 100 +type LoadSavedMessagesTopicsRequest struct { + // The maximum number of topics to be loaded. For optimal performance, the number of loaded topics is chosen by TDLib and can be smaller than the specified limit, even if the end of the list is not reached Limit int32 `json:"limit"` } -// Returns list of non-pinned Saved Messages topics from the specified offset -func (client *Client) GetSavedMessagesTopics(req *GetSavedMessagesTopicsRequest) (*FoundSavedMessagesTopics, error) { +// Loads more Saved Messages topics. The loaded topics will be sent through updateSavedMessagesTopic. Topics are sorted by their topic.order in descending order. Returns a 404 error if all topics have been loaded +func (client *Client) LoadSavedMessagesTopics(req *LoadSavedMessagesTopicsRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getSavedMessagesTopics", + Type: "loadSavedMessagesTopics", }, Data: map[string]interface{}{ - "offset": req.Offset, "limit": req.Limit, }, }) @@ -2242,12 +2223,12 @@ func (client *Client) GetSavedMessagesTopics(req *GetSavedMessagesTopicsRequest) return nil, buildResponseError(result.Data) } - return UnmarshalFoundSavedMessagesTopics(result.Data) + return UnmarshalOk(result.Data) } type GetSavedMessagesTopicHistoryRequest struct { - // Saved Messages topic which messages will be fetched - SavedMessagesTopic SavedMessagesTopic `json:"saved_messages_topic"` + // Identifier of Saved Messages topic which messages will be fetched + SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` // Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message FromMessageId int64 `json:"from_message_id"` // Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages @@ -2263,7 +2244,7 @@ func (client *Client) GetSavedMessagesTopicHistory(req *GetSavedMessagesTopicHis Type: "getSavedMessagesTopicHistory", }, Data: map[string]interface{}{ - "saved_messages_topic": req.SavedMessagesTopic, + "saved_messages_topic_id": req.SavedMessagesTopicId, "from_message_id": req.FromMessageId, "offset": req.Offset, "limit": req.Limit, @@ -2281,8 +2262,8 @@ func (client *Client) GetSavedMessagesTopicHistory(req *GetSavedMessagesTopicHis } type GetSavedMessagesTopicMessageByDateRequest struct { - // Saved Messages topic which message will be returned - SavedMessagesTopic SavedMessagesTopic `json:"saved_messages_topic"` + // Identifier of Saved Messages topic which message will be returned + SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` // Point in time (Unix timestamp) relative to which to search for messages Date int32 `json:"date"` } @@ -2294,7 +2275,7 @@ func (client *Client) GetSavedMessagesTopicMessageByDate(req *GetSavedMessagesTo Type: "getSavedMessagesTopicMessageByDate", }, Data: map[string]interface{}{ - "saved_messages_topic": req.SavedMessagesTopic, + "saved_messages_topic_id": req.SavedMessagesTopicId, "date": req.Date, }, }) @@ -2310,8 +2291,8 @@ func (client *Client) GetSavedMessagesTopicMessageByDate(req *GetSavedMessagesTo } type DeleteSavedMessagesTopicHistoryRequest struct { - // Saved Messages topic which messages will be deleted - SavedMessagesTopic SavedMessagesTopic `json:"saved_messages_topic"` + // Identifier of Saved Messages topic which messages will be deleted + SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` } // Deletes all messages in a Saved Messages topic @@ -2321,7 +2302,7 @@ func (client *Client) DeleteSavedMessagesTopicHistory(req *DeleteSavedMessagesTo Type: "deleteSavedMessagesTopicHistory", }, Data: map[string]interface{}{ - "saved_messages_topic": req.SavedMessagesTopic, + "saved_messages_topic_id": req.SavedMessagesTopicId, }, }) if err != nil { @@ -2336,8 +2317,8 @@ func (client *Client) DeleteSavedMessagesTopicHistory(req *DeleteSavedMessagesTo } type DeleteSavedMessagesTopicMessagesByDateRequest struct { - // Saved Messages topic which messages will be deleted - SavedMessagesTopic SavedMessagesTopic `json:"saved_messages_topic"` + // Identifier of Saved Messages topic which messages will be deleted + SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` // The minimum date of the messages to delete MinDate int32 `json:"min_date"` // The maximum date of the messages to delete @@ -2351,7 +2332,7 @@ func (client *Client) DeleteSavedMessagesTopicMessagesByDate(req *DeleteSavedMes Type: "deleteSavedMessagesTopicMessagesByDate", }, Data: map[string]interface{}{ - "saved_messages_topic": req.SavedMessagesTopic, + "saved_messages_topic_id": req.SavedMessagesTopicId, "min_date": req.MinDate, "max_date": req.MaxDate, }, @@ -2368,8 +2349,8 @@ func (client *Client) DeleteSavedMessagesTopicMessagesByDate(req *DeleteSavedMes } type ToggleSavedMessagesTopicIsPinnedRequest struct { - // Saved Messages topic to pin or unpin - SavedMessagesTopic SavedMessagesTopic `json:"saved_messages_topic"` + // Identifier of Saved Messages topic to pin or unpin + SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` // Pass true to pin the topic; pass false to unpin it IsPinned bool `json:"is_pinned"` } @@ -2381,7 +2362,7 @@ func (client *Client) ToggleSavedMessagesTopicIsPinned(req *ToggleSavedMessagesT Type: "toggleSavedMessagesTopicIsPinned", }, Data: map[string]interface{}{ - "saved_messages_topic": req.SavedMessagesTopic, + "saved_messages_topic_id": req.SavedMessagesTopicId, "is_pinned": req.IsPinned, }, }) @@ -2397,8 +2378,8 @@ func (client *Client) ToggleSavedMessagesTopicIsPinned(req *ToggleSavedMessagesT } type SetPinnedSavedMessagesTopicsRequest struct { - // The new list of pinned Saved Messages topics - SavedMessagesTopics []SavedMessagesTopic `json:"saved_messages_topics"` + // Identifiers of the new pinned Saved Messages topics + SavedMessagesTopicIds []int64 `json:"saved_messages_topic_ids"` } // Changes the order of pinned Saved Messages topics @@ -2408,7 +2389,7 @@ func (client *Client) SetPinnedSavedMessagesTopics(req *SetPinnedSavedMessagesTo Type: "setPinnedSavedMessagesTopics", }, Data: map[string]interface{}{ - "saved_messages_topics": req.SavedMessagesTopics, + "saved_messages_topic_ids": req.SavedMessagesTopicIds, }, }) if err != nil { @@ -2605,8 +2586,8 @@ type SearchChatMessagesRequest struct { Filter SearchMessagesFilter `json:"filter"` // If not 0, only messages in the specified thread will be returned; supergroups only MessageThreadId int64 `json:"message_thread_id"` - // If not null, only messages in the specified Saved Messages topic will be returned; pass null to return all messages, or for chats other than Saved Messages - SavedMessagesTopic SavedMessagesTopic `json:"saved_messages_topic"` + // If not 0, only messages in the specified Saved Messages topic will be returned; pass 0 to return all messages, or for chats other than Saved Messages + SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` } // Searches for messages with given words in the chat. Returns the results in reverse chronological order, i.e. in order of decreasing message_id. Cannot be used in secret chats with a non-empty query (searchSecretMessages must be used instead), or without an enabled message database. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit. A combination of query, sender_id, filter and message_thread_id search criteria is expected to be supported, only if it is required for Telegram official application implementation @@ -2624,7 +2605,7 @@ func (client *Client) SearchChatMessages(req *SearchChatMessagesRequest) (*Found "limit": req.Limit, "filter": req.Filter, "message_thread_id": req.MessageThreadId, - "saved_messages_topic": req.SavedMessagesTopic, + "saved_messages_topic_id": req.SavedMessagesTopicId, }, }) if err != nil { @@ -2721,6 +2702,8 @@ func (client *Client) SearchSecretMessages(req *SearchSecretMessagesRequest) (*F } type SearchSavedMessagesRequest struct { + // If not 0, only messages in the specified Saved Messages topic will be considered; pass 0 to consider all messages + SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` // Tag to search for; pass null to return all suitable messages Tag ReactionType `json:"tag"` // Query to search for @@ -2740,6 +2723,7 @@ func (client *Client) SearchSavedMessages(req *SearchSavedMessagesRequest) (*Fou Type: "searchSavedMessages", }, Data: map[string]interface{}{ + "saved_messages_topic_id": req.SavedMessagesTopicId, "tag": req.Tag, "query": req.Query, "from_message_id": req.FromMessageId, @@ -2931,8 +2915,8 @@ type GetChatSparseMessagePositionsRequest struct { FromMessageId int64 `json:"from_message_id"` // The expected number of message positions to be returned; 50-2000. A smaller number of positions can be returned, if there are not enough appropriate messages Limit int32 `json:"limit"` - // If not null, only messages in the specified Saved Messages topic will be considered; pass null to consider all messages, or for chats other than Saved Messages - SavedMessagesTopic SavedMessagesTopic `json:"saved_messages_topic"` + // If not 0, only messages in the specified Saved Messages topic will be considered; pass 0 to consider all messages, or for chats other than Saved Messages + SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` } // Returns sparse positions of messages of the specified type in the chat to be used for shared media scroll implementation. Returns the results in reverse chronological order (i.e., in order of decreasing message_id). Cannot be used in secret chats or with searchMessagesFilterFailedToSend filter without an enabled message database @@ -2946,7 +2930,7 @@ func (client *Client) GetChatSparseMessagePositions(req *GetChatSparseMessagePos "filter": req.Filter, "from_message_id": req.FromMessageId, "limit": req.Limit, - "saved_messages_topic": req.SavedMessagesTopic, + "saved_messages_topic_id": req.SavedMessagesTopicId, }, }) if err != nil { @@ -2967,8 +2951,8 @@ type GetChatMessageCalendarRequest struct { Filter SearchMessagesFilter `json:"filter"` // The message identifier from which to return information about messages; use 0 to get results from the last message FromMessageId int64 `json:"from_message_id"` - // If not null, only messages in the specified Saved Messages topic will be considered; pass null to consider all messages, or for chats other than Saved Messages - SavedMessagesTopic SavedMessagesTopic `json:"saved_messages_topic"` + // If not0, only messages in the specified Saved Messages topic will be considered; pass 0 to consider all messages, or for chats other than Saved Messages + SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` } // Returns information about the next messages of the specified type in the chat split by days. Returns the results in reverse chronological order. Can return partial result for the last returned day. Behavior of this method depends on the value of the option "utc_time_offset" @@ -2981,7 +2965,7 @@ func (client *Client) GetChatMessageCalendar(req *GetChatMessageCalendarRequest) "chat_id": req.ChatId, "filter": req.Filter, "from_message_id": req.FromMessageId, - "saved_messages_topic": req.SavedMessagesTopic, + "saved_messages_topic_id": req.SavedMessagesTopicId, }, }) if err != nil { @@ -3000,8 +2984,8 @@ type GetChatMessageCountRequest struct { ChatId int64 `json:"chat_id"` // Filter for message content; searchMessagesFilterEmpty is unsupported in this function Filter SearchMessagesFilter `json:"filter"` - // If not null, only messages in the specified Saved Messages topic will be counted; pass null to count all messages, or for chats other than Saved Messages - SavedMessagesTopic SavedMessagesTopic `json:"saved_messages_topic"` + // If not 0, only messages in the specified Saved Messages topic will be counted; pass 0 to count all messages, or for chats other than Saved Messages + SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` // Pass true to get the number of messages without sending network requests, or -1 if the number of messages is unknown locally ReturnLocal bool `json:"return_local"` } @@ -3015,7 +2999,7 @@ func (client *Client) GetChatMessageCount(req *GetChatMessageCountRequest) (*Cou Data: map[string]interface{}{ "chat_id": req.ChatId, "filter": req.Filter, - "saved_messages_topic": req.SavedMessagesTopic, + "saved_messages_topic_id": req.SavedMessagesTopicId, "return_local": req.ReturnLocal, }, }) @@ -3039,8 +3023,8 @@ type GetChatMessagePositionRequest struct { Filter SearchMessagesFilter `json:"filter"` // If not 0, only messages in the specified thread will be considered; supergroups only MessageThreadId int64 `json:"message_thread_id"` - // If not null, only messages in the specified Saved Messages topic will be considered; pass null to consider all relevant messages, or for chats other than Saved Messages - SavedMessagesTopic SavedMessagesTopic `json:"saved_messages_topic"` + // If not 0, only messages in the specified Saved Messages topic will be considered; pass 0 to consider all relevant messages, or for chats other than Saved Messages + SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` } // Returns approximate 1-based position of a message among messages, which can be found by the specified filter in the chat. Cannot be used in secret chats @@ -3054,7 +3038,7 @@ func (client *Client) GetChatMessagePosition(req *GetChatMessagePositionRequest) "message_id": req.MessageId, "filter": req.Filter, "message_thread_id": req.MessageThreadId, - "saved_messages_topic": req.SavedMessagesTopic, + "saved_messages_topic_id": req.SavedMessagesTopicId, }, }) if err != nil { @@ -3483,7 +3467,7 @@ func (client *Client) SetChatMessageSender(req *SetChatMessageSenderRequest) (*O type SendMessageRequest struct { // Target chat ChatId int64 `json:"chat_id"` - // If not 0, a message thread identifier in which the message will be sent + // If not 0, the message thread identifier in which the message will be sent MessageThreadId int64 `json:"message_thread_id"` // Information about the message or story to be replied; pass null if none ReplyTo InputMessageReplyTo `json:"reply_to"` @@ -3524,7 +3508,7 @@ func (client *Client) SendMessage(req *SendMessageRequest) (*Message, error) { type SendMessageAlbumRequest struct { // Target chat ChatId int64 `json:"chat_id"` - // If not 0, a message thread identifier in which the messages will be sent + // If not 0, the message thread identifier in which the messages will be sent MessageThreadId int64 `json:"message_thread_id"` // Information about the message or story to be replied; pass null if none ReplyTo InputMessageReplyTo `json:"reply_to"` @@ -3568,7 +3552,7 @@ type SendBotStartMessageRequest struct { Parameter string `json:"parameter"` } -// Invites a bot to a chat (if it is not yet a member) and sends it the /start command. Bots can't be invited to a private chat other than the chat with the bot. Bots can't be invited to channels (although they can be added as admins) and secret chats. Returns the sent message +// Invites a bot to a chat (if it is not yet a member) and sends it the /start command; requires can_invite_users member right. Bots can't be invited to a private chat other than the chat with the bot. Bots can't be invited to channels (although they can be added as admins) and secret chats. Returns the sent message func (client *Client) SendBotStartMessage(req *SendBotStartMessageRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -3594,7 +3578,7 @@ func (client *Client) SendBotStartMessage(req *SendBotStartMessageRequest) (*Mes type SendInlineQueryResultMessageRequest struct { // Target chat ChatId int64 `json:"chat_id"` - // If not 0, a message thread identifier in which the message will be sent + // If not 0, the message thread identifier in which the message will be sent MessageThreadId int64 `json:"message_thread_id"` // Information about the message or story to be replied; pass null if none ReplyTo InputMessageReplyTo `json:"reply_to"` @@ -3638,7 +3622,7 @@ func (client *Client) SendInlineQueryResultMessage(req *SendInlineQueryResultMes type ForwardMessagesRequest struct { // Identifier of the chat to which to forward messages ChatId int64 `json:"chat_id"` - // If not 0, a message thread identifier in which the message will be sent; for forum threads only + // If not 0, the message thread identifier in which the message will be sent; for forum threads only MessageThreadId int64 `json:"message_thread_id"` // Identifier of the chat from which to forward messages FromChatId int64 `json:"from_chat_id"` @@ -4272,7 +4256,7 @@ type CreateForumTopicRequest struct { Icon *ForumTopicIcon `json:"icon"` } -// Creates a topic in a forum supergroup chat; requires can_manage_topics or can_create_topics rights in the supergroup +// Creates a topic in a forum supergroup chat; requires can_manage_topics administrator or can_create_topics member right in the supergroup func (client *Client) CreateForumTopic(req *CreateForumTopicRequest) (*ForumTopicInfo, error) { result, err := client.Send(Request{ meta: meta{ @@ -4880,13 +4864,20 @@ func (client *Client) SetDefaultReactionType(req *SetDefaultReactionTypeRequest) return UnmarshalOk(result.Data) } -// Returns tags used in Saved Messages; for Telegram Premium users only -func (client *Client) GetSavedMessagesTags() (*SavedMessagesTags, error) { +type GetSavedMessagesTagsRequest struct { + // Identifier of Saved Messages topic which tags will be returned; pass 0 to get all Saved Messages tags + SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` +} + +// Returns tags used in Saved Messages or a Saved Messages topic +func (client *Client) GetSavedMessagesTags(req *GetSavedMessagesTagsRequest) (*SavedMessagesTags, error) { result, err := client.Send(Request{ meta: meta{ Type: "getSavedMessagesTags", }, - Data: map[string]interface{}{}, + Data: map[string]interface{}{ + "saved_messages_topic_id": req.SavedMessagesTopicId, + }, }) if err != nil { return nil, err @@ -5892,7 +5883,7 @@ type OpenWebAppRequest struct { Theme *ThemeParameters `json:"theme"` // Short name of the application; 0-64 English letters, digits, and underscores ApplicationName string `json:"application_name"` - // If not 0, a message thread identifier in which the message will be sent + // If not 0, the message thread identifier in which the message will be sent MessageThreadId int64 `json:"message_thread_id"` // Information about the message or story to be replied in the message sent by the Web App; pass null if none ReplyTo InputMessageReplyTo `json:"reply_to"` @@ -6283,7 +6274,7 @@ func (client *Client) DeleteChatReplyMarkup(req *DeleteChatReplyMarkupRequest) ( type SendChatActionRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` - // If not 0, a message thread identifier in which the action was performed + // If not 0, the message thread identifier in which the action was performed MessageThreadId int64 `json:"message_thread_id"` // The action description; pass null to cancel the currently active action Action ChatAction `json:"action"` @@ -7038,7 +7029,7 @@ type UpgradeBasicGroupChatToSupergroupChatRequest struct { ChatId int64 `json:"chat_id"` } -// Creates a new supergroup from an existing basic group and sends a corresponding messageChatUpgradeTo and messageChatUpgradeFrom; requires creator privileges. Deactivates the original basic group +// Creates a new supergroup from an existing basic group and sends a corresponding messageChatUpgradeTo and messageChatUpgradeFrom; requires owner privileges. Deactivates the original basic group func (client *Client) UpgradeBasicGroupChatToSupergroupChat(req *UpgradeBasicGroupChatToSupergroupChatRequest) (*Chat, error) { result, err := client.Send(Request{ meta: meta{ @@ -7665,7 +7656,7 @@ type SetChatTitleRequest struct { Title string `json:"title"` } -// Changes the chat title. Supported only for basic groups, supergroups and channels. Requires can_change_info administrator right +// Changes the chat title. Supported only for basic groups, supergroups and channels. Requires can_change_info member right func (client *Client) SetChatTitle(req *SetChatTitleRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -7694,7 +7685,7 @@ type SetChatPhotoRequest struct { Photo InputChatPhoto `json:"photo"` } -// Changes the photo of a chat. Supported only for basic groups, supergroups and channels. Requires can_change_info administrator right +// Changes the photo of a chat. Supported only for basic groups, supergroups and channels. Requires can_change_info member right func (client *Client) SetChatPhoto(req *SetChatPhotoRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -7719,13 +7710,13 @@ func (client *Client) SetChatPhoto(req *SetChatPhotoRequest) (*Ok, error) { type SetChatAccentColorRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` - // Identifier of the accent color to use. The chat must have at least accentColor.min_chat_boost_level boost level to pass the corresponding color + // Identifier of the accent color to use. The chat must have at least accentColor.min_channel_chat_boost_level boost level to pass the corresponding color AccentColorId int32 `json:"accent_color_id"` // Identifier of a custom emoji to be shown on the reply header and link preview background; 0 if none. Use chatBoostLevelFeatures.can_set_background_custom_emoji to check whether a custom emoji can be set BackgroundCustomEmojiId JsonInt64 `json:"background_custom_emoji_id"` } -// Changes accent color and background custom emoji of a chat. Requires can_change_info administrator right +// Changes accent color and background custom emoji of a channel chat. Requires can_change_info administrator right func (client *Client) SetChatAccentColor(req *SetChatAccentColorRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -7751,13 +7742,13 @@ func (client *Client) SetChatAccentColor(req *SetChatAccentColorRequest) (*Ok, e type SetChatProfileAccentColorRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` - // Identifier of the accent color to use for profile; pass -1 if none. The chat must have at least profileAccentColor.min_chat_boost_level boost level to pass the corresponding color + // Identifier of the accent color to use for profile; pass -1 if none. The chat must have at least profileAccentColor.min_supergroup_chat_boost_level for supergroups or profileAccentColor.min_channel_chat_boost_level for channels boost level to pass the corresponding color ProfileAccentColorId int32 `json:"profile_accent_color_id"` // Identifier of a custom emoji to be shown on the chat's profile photo background; 0 if none. Use chatBoostLevelFeatures.can_set_profile_background_custom_emoji to check whether a custom emoji can be set ProfileBackgroundCustomEmojiId JsonInt64 `json:"profile_background_custom_emoji_id"` } -// Changes accent color and background custom emoji for profile of a chat. Requires can_change_info administrator right +// Changes accent color and background custom emoji for profile of a supergroup or channel chat. Requires can_change_info administrator right func (client *Client) SetChatProfileAccentColor(req *SetChatProfileAccentColorRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -7966,9 +7957,9 @@ func (client *Client) SetChatTheme(req *SetChatThemeRequest) (*Ok, error) { type SetChatDraftMessageRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` - // If not 0, a message thread identifier in which the draft was changed + // If not 0, the message thread identifier in which the draft was changed MessageThreadId int64 `json:"message_thread_id"` - // New draft message; pass null to remove the draft + // New draft message; pass null to remove the draft. All files in draft message content must be of the type inputFileLocal. Media thumbnails and captions are ignored DraftMessage *DraftMessage `json:"draft_message"` } @@ -8060,7 +8051,7 @@ type ToggleChatViewAsTopicsRequest struct { ViewAsTopics bool `json:"view_as_topics"` } -// Changes the view_as_topics setting of a forum chat +// Changes the view_as_topics setting of a forum chat or Saved Messages func (client *Client) ToggleChatViewAsTopics(req *ToggleChatViewAsTopicsRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -8172,11 +8163,11 @@ func (client *Client) ToggleChatDefaultDisableNotification(req *ToggleChatDefaul type SetChatAvailableReactionsRequest struct { // Identifier of the chat ChatId int64 `json:"chat_id"` - // Reactions available in the chat. All explicitly specified emoji reactions must be active. Up to the chat's boost level custom emoji reactions can be explicitly specified + // Reactions available in the chat. All explicitly specified emoji reactions must be active. In channel chats up to the chat's boost level custom emoji reactions can be explicitly specified AvailableReactions ChatAvailableReactions `json:"available_reactions"` } -// Changes reactions, available in a chat. Available for basic groups, supergroups, and channels. Requires can_change_info administrator right +// Changes reactions, available in a chat. Available for basic groups, supergroups, and channels. Requires can_change_info member right func (client *Client) SetChatAvailableReactions(req *SetChatAvailableReactionsRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -8234,7 +8225,7 @@ type SetChatDescriptionRequest struct { Description string `json:"description"` } -// Changes information about a chat. Available for basic groups, supergroups, and channels. Requires can_change_info administrator right +// Changes information about a chat. Available for basic groups, supergroups, and channels. Requires can_change_info member right func (client *Client) SetChatDescription(req *SetChatDescriptionRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -8257,7 +8248,7 @@ func (client *Client) SetChatDescription(req *SetChatDescriptionRequest) (*Ok, e } type SetChatDiscussionGroupRequest struct { - // Identifier of the channel chat. Pass 0 to remove a link from the supergroup passed in the second argument to a linked channel chat (requires can_pin_messages rights in the supergroup) + // Identifier of the channel chat. Pass 0 to remove a link from the supergroup passed in the second argument to a linked channel chat (requires can_pin_messages member right in the supergroup) ChatId int64 `json:"chat_id"` // Identifier of a new channel's discussion group. Use 0 to remove the discussion group. Use the method getSuitableDiscussionChats to find all suitable groups. Basic group chats must be first upgraded to supergroup chats. If new chat members don't have access to old messages in the supergroup, then toggleSupergroupIsAllHistoryAvailable must be used first to change that DiscussionChatId int64 `json:"discussion_chat_id"` @@ -8321,7 +8312,7 @@ type SetChatSlowModeDelayRequest struct { SlowModeDelay int32 `json:"slow_mode_delay"` } -// Changes the slow mode delay of a chat. Available only for supergroups; requires can_restrict_members rights +// Changes the slow mode delay of a chat. Available only for supergroups; requires can_restrict_members right func (client *Client) SetChatSlowModeDelay(req *SetChatSlowModeDelayRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -8354,7 +8345,7 @@ type PinChatMessageRequest struct { OnlyForSelf bool `json:"only_for_self"` } -// Pins a message in a chat; requires can_pin_messages rights or can_edit_messages rights in the channel +// Pins a message in a chat; requires can_pin_messages member right if the chat is a basic group or supergroup, or can_edit_messages administrator right if the chat is a channel func (client *Client) PinChatMessage(req *PinChatMessageRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -8385,7 +8376,7 @@ type UnpinChatMessageRequest struct { MessageId int64 `json:"message_id"` } -// Removes a pinned message from a chat; requires can_pin_messages rights in the group or can_edit_messages rights in the channel +// Removes a pinned message from a chat; requires can_pin_messages member right if the chat is a basic group or supergroup, or can_edit_messages administrator right if the chat is a channel func (client *Client) UnpinChatMessage(req *UnpinChatMessageRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -8412,7 +8403,7 @@ type UnpinAllChatMessagesRequest struct { ChatId int64 `json:"chat_id"` } -// Removes all pinned messages from a chat; requires can_pin_messages rights in the group or can_edit_messages rights in the channel +// Removes all pinned messages from a chat; requires can_pin_messages member right if the chat is a basic group or supergroup, or can_edit_messages administrator right if the chat is a channel func (client *Client) UnpinAllChatMessages(req *UnpinAllChatMessagesRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -8440,7 +8431,7 @@ type UnpinAllMessageThreadMessagesRequest struct { MessageThreadId int64 `json:"message_thread_id"` } -// Removes all pinned messages from a forum topic; requires can_pin_messages rights in the supergroup +// Removes all pinned messages from a forum topic; requires can_pin_messages member right in the supergroup func (client *Client) UnpinAllMessageThreadMessages(req *UnpinAllMessageThreadMessagesRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -8523,7 +8514,7 @@ type AddChatMemberRequest struct { ForwardLimit int32 `json:"forward_limit"` } -// Adds a new member to a chat. Members can't be added to private or secret chats +// Adds a new member to a chat; requires can_invite_users member right. Members can't be added to private or secret chats func (client *Client) AddChatMember(req *AddChatMemberRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -8553,7 +8544,7 @@ type AddChatMembersRequest struct { UserIds []int64 `json:"user_ids"` } -// Adds multiple new members to a chat. Currently, this method is only available for supergroups and channels. This method can't be used to join a chat. Members can't be added to a channel if it has more than 200 members +// Adds multiple new members to a chat; requires can_invite_users member right. Currently, this method is only available for supergroups and channels. This method can't be used to join a chat. Members can't be added to a channel if it has more than 200 members func (client *Client) AddChatMembers(req *AddChatMembersRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -8584,7 +8575,7 @@ type SetChatMemberStatusRequest struct { Status ChatMemberStatus `json:"status"` } -// Changes the status of a chat member, needs appropriate privileges. This function is currently not suitable for transferring chat ownership; use transferChatOwnership instead. Use addChatMember or banChatMember if some additional parameters needs to be passed +// Changes the status of a chat member; requires can_invite_users member right to add a chat member, can_promote_members administrator right to change administrator rights of the member, and can_restrict_members administrator right to change restrictions of a user. This function is currently not suitable for transferring chat ownership; use transferChatOwnership instead. Use addChatMember or banChatMember if some additional parameters needs to be passed func (client *Client) SetChatMemberStatus(req *SetChatMemberStatusRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -8618,7 +8609,7 @@ type BanChatMemberRequest struct { RevokeMessages bool `json:"revoke_messages"` } -// Bans a member in a chat. Members can't be banned in private or secret chats. In supergroups and channels, the user will not be able to return to the group on their own using invite links, etc., unless unbanned first +// Bans a member in a chat; requires can_restrict_members administrator right. Members can't be banned in private or secret chats. In supergroups and channels, the user will not be able to return to the group on their own using invite links, etc., unless unbanned first func (client *Client) BanChatMember(req *BanChatMemberRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -8685,7 +8676,7 @@ type TransferChatOwnershipRequest struct { Password string `json:"password"` } -// Changes the owner of a chat. The current user must be a current owner of the chat. Use the method canTransferOwnership to check whether the ownership can be transferred from the current session. Available only for supergroups and channel chats +// Changes the owner of a chat; requires owner privileges in the chat. Use the method canTransferOwnership to check whether the ownership can be transferred from the current session. Available only for supergroups and channel chats func (client *Client) TransferChatOwnership(req *TransferChatOwnershipRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -8748,7 +8739,7 @@ type SearchChatMembersRequest struct { Filter ChatMembersFilter `json:"filter"` } -// Searches for a specified query in the first name, last name and usernames of the members of a specified chat. Requires administrator rights in channels +// Searches for a specified query in the first name, last name and usernames of the members of a specified chat. Requires administrator rights if the chat is a channel func (client *Client) SearchChatMembers(req *SearchChatMembersRequest) (*ChatMembers, error) { result, err := client.Send(Request{ meta: meta{ @@ -9143,7 +9134,7 @@ func (client *Client) GetStory(req *GetStoryRequest) (*Story, error) { return UnmarshalStory(result.Data) } -// Returns channel chats in which the current user has the right to post stories. The chats must be rechecked with canSendStory before actually trying to post a story there +// Returns supergroup and channel chats in which the current user has the right to post stories. The chats must be rechecked with canSendStory before actually trying to post a story there func (client *Client) GetChatsToSendStories() (*Chats, error) { result, err := client.Send(Request{ meta: meta{ @@ -9167,7 +9158,7 @@ type CanSendStoryRequest struct { ChatId int64 `json:"chat_id"` } -// Checks whether the current user can send a story on behalf of a chat; requires can_post_stories rights for channel chats +// Checks whether the current user can send a story on behalf of a chat; requires can_post_stories right for supergroup and channel chats func (client *Client) CanSendStory(req *CanSendStoryRequest) (CanSendStoryResult, error) { result, err := client.Send(Request{ meta: meta{ @@ -9218,7 +9209,7 @@ type SendStoryRequest struct { Areas *InputStoryAreas `json:"areas"` // Story caption; pass null to use an empty caption; 0-getOption("story_caption_length_max") characters Caption *FormattedText `json:"caption"` - // The privacy settings for the story + // The privacy settings for the story; ignored for stories sent to supergroup and channel chats PrivacySettings StoryPrivacySettings `json:"privacy_settings"` // Period after which the story is moved to archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400 for Telegram Premium users, and 86400 otherwise ActivePeriod int32 `json:"active_period"` @@ -9230,7 +9221,7 @@ type SendStoryRequest struct { ProtectContent bool `json:"protect_content"` } -// Sends a new story to a chat; requires can_post_stories rights for channel chats. Returns a temporary story +// Sends a new story to a chat; requires can_post_stories right for supergroup and channel chats. Returns a temporary story func (client *Client) SendStory(req *SendStoryRequest) (*Story, error) { result, err := client.Send(Request{ meta: meta{ @@ -9298,22 +9289,19 @@ func (client *Client) EditStory(req *EditStoryRequest) (*Ok, error) { } type SetStoryPrivacySettingsRequest struct { - // Identifier of the chat that posted the story - StorySenderChatId int64 `json:"story_sender_chat_id"` // Identifier of the story StoryId int32 `json:"story_id"` // The new privacy settigs for the story PrivacySettings StoryPrivacySettings `json:"privacy_settings"` } -// Changes privacy settings of a story. Can be called only if story.can_be_edited == true +// Changes privacy settings of a story. The method can be called only for stories posted on behalf of the current user and if story.can_be_edited == true func (client *Client) SetStoryPrivacySettings(req *SetStoryPrivacySettingsRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ Type: "setStoryPrivacySettings", }, Data: map[string]interface{}{ - "story_sender_chat_id": req.StorySenderChatId, "story_id": req.StoryId, "privacy_settings": req.PrivacySettings, }, @@ -9531,7 +9519,7 @@ type GetChatArchivedStoriesRequest struct { Limit int32 `json:"limit"` } -// Returns the list of all stories posted by the given chat; requires can_edit_stories rights for channel chats. The stories are returned in a reverse chronological order (i.e., in order of decreasing story_id). For optimal performance, the number of returned stories is chosen by TDLib +// Returns the list of all stories posted by the given chat; requires can_edit_stories right in the chat. The stories are returned in a reverse chronological order (i.e., in order of decreasing story_id). For optimal performance, the number of returned stories is chosen by TDLib func (client *Client) GetChatArchivedStories(req *GetChatArchivedStoriesRequest) (*Stories, error) { result, err := client.Send(Request{ meta: meta{ @@ -9649,7 +9637,7 @@ type SetStoryReactionRequest struct { UpdateRecentReactions bool `json:"update_recent_reactions"` } -// Changes chosen reaction on a story +// Changes chosen reaction on a story that has already been sent func (client *Client) SetStoryReaction(req *SetStoryReactionRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -9848,6 +9836,8 @@ func (client *Client) GetStoryPublicForwards(req *GetStoryPublicForwardsRequest) } type GetChatBoostLevelFeaturesRequest struct { + // Pass true to get the list of features for channels; pass false to get the list of features for supergroups + IsChannel bool `json:"is_channel"` // Chat boost level Level int32 `json:"level"` } @@ -9859,6 +9849,7 @@ func (client *Client) GetChatBoostLevelFeatures(req *GetChatBoostLevelFeaturesRe Type: "getChatBoostLevelFeatures", }, Data: map[string]interface{}{ + "is_channel": req.IsChannel, "level": req.Level, }, }) @@ -9873,13 +9864,20 @@ func (client *Client) GetChatBoostLevelFeatures(req *GetChatBoostLevelFeaturesRe return UnmarshalChatBoostLevelFeatures(result.Data) } +type GetChatBoostFeaturesRequest struct { + // Pass true to get the list of features for channels; pass false to get the list of features for supergroups + IsChannel bool `json:"is_channel"` +} + // Returns list of features available on the first 10 chat boost levels; this is an offline request -func (client *Client) GetChatBoostFeatures() (*ChatBoostFeatures, error) { +func (client *Client) GetChatBoostFeatures(req *GetChatBoostFeaturesRequest) (*ChatBoostFeatures, error) { result, err := client.Send(Request{ meta: meta{ Type: "getChatBoostFeatures", }, - Data: map[string]interface{}{}, + Data: map[string]interface{}{ + "is_channel": req.IsChannel, + }, }) if err != nil { return nil, err @@ -9912,11 +9910,11 @@ func (client *Client) GetAvailableChatBoostSlots() (*ChatBoostSlots, error) { } type GetChatBoostStatusRequest struct { - // Identifier of the channel chat + // Identifier of the chat ChatId int64 `json:"chat_id"` } -// Returns the current boost status for a channel chat +// Returns the current boost status for a supergroup or a channel chat func (client *Client) GetChatBoostStatus(req *GetChatBoostStatusRequest) (*ChatBoostStatus, error) { result, err := client.Send(Request{ meta: meta{ @@ -9971,7 +9969,7 @@ type GetChatBoostLinkRequest struct { ChatId int64 `json:"chat_id"` } -// Returns an HTTPS link to boost the specified channel chat +// Returns an HTTPS link to boost the specified supergroup or channel chat func (client *Client) GetChatBoostLink(req *GetChatBoostLinkRequest) (*ChatBoostLink, error) { result, err := client.Send(Request{ meta: meta{ @@ -10029,7 +10027,7 @@ type GetChatBoostsRequest struct { Limit int32 `json:"limit"` } -// Returns list of boosts applied to a chat; requires administrator rights in the channel chat +// Returns list of boosts applied to a chat; requires administrator rights in the chat func (client *Client) GetChatBoosts(req *GetChatBoostsRequest) (*FoundChatBoosts, error) { result, err := client.Send(Request{ meta: meta{ @@ -10060,7 +10058,7 @@ type GetUserChatBoostsRequest struct { UserId int64 `json:"user_id"` } -// Returns list of boosts applied to a chat by a given user; requires administrator rights in the channel chat; for bots only +// Returns list of boosts applied to a chat by a given user; requires administrator rights in the chat; for bots only func (client *Client) GetUserChatBoosts(req *GetUserChatBoostsRequest) (*FoundChatBoosts, error) { result, err := client.Send(Request{ meta: meta{ @@ -10835,7 +10833,7 @@ func (client *Client) GetMessageFileType(req *GetMessageFileTypeRequest) (Messag } type GetMessageImportConfirmationTextRequest struct { - // Identifier of a chat to which the messages will be imported. It must be an identifier of a private chat with a mutual contact or an identifier of a supergroup chat with can_change_info administrator right + // Identifier of a chat to which the messages will be imported. It must be an identifier of a private chat with a mutual contact or an identifier of a supergroup chat with can_change_info member right ChatId int64 `json:"chat_id"` } @@ -10861,7 +10859,7 @@ func (client *Client) GetMessageImportConfirmationText(req *GetMessageImportConf } type ImportMessagesRequest struct { - // Identifier of a chat to which the messages will be imported. It must be an identifier of a private chat with a mutual contact or an identifier of a supergroup chat with can_change_info administrator right + // Identifier of a chat to which the messages will be imported. It must be an identifier of a private chat with a mutual contact or an identifier of a supergroup chat with can_change_info member right ChatId int64 `json:"chat_id"` // File with messages to import. Only inputFileLocal and inputFileGenerated are supported. The file must not be previously uploaded MessageFile InputFile `json:"message_file"` @@ -11652,11 +11650,11 @@ type CreateVideoChatRequest struct { Title string `json:"title"` // Point in time (Unix timestamp) when the group call is supposed to be started by an administrator; 0 to start the video chat immediately. The date must be at least 10 seconds and at most 8 days in the future StartDate int32 `json:"start_date"` - // Pass true to create an RTMP stream instead of an ordinary video chat; requires creator privileges + // Pass true to create an RTMP stream instead of an ordinary video chat; requires owner privileges IsRtmpStream bool `json:"is_rtmp_stream"` } -// Creates a video chat (a group call bound to a chat). Available only for basic groups, supergroups and channels; requires can_manage_video_chats rights +// Creates a video chat (a group call bound to a chat). Available only for basic groups, supergroups and channels; requires can_manage_video_chats administrator right func (client *Client) CreateVideoChat(req *CreateVideoChatRequest) (*GroupCallId, error) { result, err := client.Send(Request{ meta: meta{ @@ -11685,7 +11683,7 @@ type GetVideoChatRtmpUrlRequest struct { ChatId int64 `json:"chat_id"` } -// Returns RTMP URL for streaming to the chat; requires creator privileges +// Returns RTMP URL for streaming to the chat; requires owner privileges func (client *Client) GetVideoChatRtmpUrl(req *GetVideoChatRtmpUrlRequest) (*RtmpUrl, error) { result, err := client.Send(Request{ meta: meta{ @@ -11711,7 +11709,7 @@ type ReplaceVideoChatRtmpUrlRequest struct { ChatId int64 `json:"chat_id"` } -// Replaces the current RTMP URL for streaming to the chat; requires creator privileges +// Replaces the current RTMP URL for streaming to the chat; requires owner privileges func (client *Client) ReplaceVideoChatRtmpUrl(req *ReplaceVideoChatRtmpUrlRequest) (*RtmpUrl, error) { result, err := client.Send(Request{ meta: meta{ @@ -15384,6 +15382,64 @@ func (client *Client) SetSupergroupStickerSet(req *SetSupergroupStickerSetReques return UnmarshalOk(result.Data) } +type SetSupergroupCustomEmojiStickerSetRequest struct { + // Identifier of the supergroup + SupergroupId int64 `json:"supergroup_id"` + // New value of the custom emoji sticker set identifier for the supergroup. Use 0 to remove the custom emoji sticker set in the supergroup + CustomEmojiStickerSetId JsonInt64 `json:"custom_emoji_sticker_set_id"` +} + +// Changes the custom emoji sticker set of a supergroup; requires can_change_info administrator right. The chat must have at least chatBoostFeatures.min_custom_emoji_sticker_set_boost_level boost level to pass the corresponding color +func (client *Client) SetSupergroupCustomEmojiStickerSet(req *SetSupergroupCustomEmojiStickerSetRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setSupergroupCustomEmojiStickerSet", + }, + Data: map[string]interface{}{ + "supergroup_id": req.SupergroupId, + "custom_emoji_sticker_set_id": req.CustomEmojiStickerSetId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetSupergroupUnrestrictBoostCountRequest struct { + // Identifier of the supergroup + SupergroupId int64 `json:"supergroup_id"` + // New value of the unrestrict_boost_count supergroup setting; 0-8. Use 0 to remove the setting + UnrestrictBoostCount int32 `json:"unrestrict_boost_count"` +} + +// Changes the number of times the supergroup must be boosted by a user to ignore slow mode and chat permission restrictions; requires can_restrict_members administrator right +func (client *Client) SetSupergroupUnrestrictBoostCount(req *SetSupergroupUnrestrictBoostCountRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setSupergroupUnrestrictBoostCount", + }, + Data: map[string]interface{}{ + "supergroup_id": req.SupergroupId, + "unrestrict_boost_count": req.UnrestrictBoostCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type ToggleSupergroupSignMessagesRequest struct { // Identifier of the channel SupergroupId int64 `json:"supergroup_id"` @@ -15391,7 +15447,7 @@ type ToggleSupergroupSignMessagesRequest struct { SignMessages bool `json:"sign_messages"` } -// Toggles whether sender signature is added to sent messages in a channel; requires can_change_info administrator right +// Toggles whether sender signature is added to sent messages in a channel; requires can_change_info member right func (client *Client) ToggleSupergroupSignMessages(req *ToggleSupergroupSignMessagesRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -15478,7 +15534,7 @@ type ToggleSupergroupIsAllHistoryAvailableRequest struct { IsAllHistoryAvailable bool `json:"is_all_history_available"` } -// Toggles whether the message history of a supergroup is available to new members; requires can_change_info administrator right +// Toggles whether the message history of a supergroup is available to new members; requires can_change_info member right func (client *Client) ToggleSupergroupIsAllHistoryAvailable(req *ToggleSupergroupIsAllHistoryAvailableRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -18789,7 +18845,7 @@ func (client *Client) GetPremiumState() (*PremiumState, error) { } type GetPremiumGiftCodePaymentOptionsRequest struct { - // Identifier of the channel chat, which will be automatically boosted by receivers of the gift codes and which is administered by the user; 0 if none + // Identifier of the supergroup or channel chat, which will be automatically boosted by receivers of the gift codes and which is administered by the user; 0 if none BoostedChatId int64 `json:"boosted_chat_id"` } @@ -18873,7 +18929,7 @@ type LaunchPrepaidPremiumGiveawayRequest struct { Parameters *PremiumGiveawayParameters `json:"parameters"` } -// Launches a prepaid Telegram Premium giveaway for subscribers of channel chats; requires can_post_messages rights in the channels +// Launches a prepaid Telegram Premium giveaway func (client *Client) LaunchPrepaidPremiumGiveaway(req *LaunchPrepaidPremiumGiveawayRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -20351,8 +20407,11 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateChatOnlineMemberCount: return UnmarshalUpdateChatOnlineMemberCount(result.Data) - case TypeUpdatePinnedSavedMessagesTopics: - return UnmarshalUpdatePinnedSavedMessagesTopics(result.Data) + case TypeUpdateSavedMessagesTopic: + return UnmarshalUpdateSavedMessagesTopic(result.Data) + + case TypeUpdateSavedMessagesTopicCount: + return UnmarshalUpdateSavedMessagesTopicCount(result.Data) case TypeUpdateForumTopicInfo: return UnmarshalUpdateForumTopicInfo(result.Data) diff --git a/client/type.go b/client/type.go index f024b7e..a1728e4 100755 --- a/client/type.go +++ b/client/type.go @@ -48,7 +48,7 @@ const ( ClassInlineKeyboardButtonType = "InlineKeyboardButtonType" ClassReplyMarkup = "ReplyMarkup" ClassLoginUrlInfo = "LoginUrlInfo" - ClassSavedMessagesTopic = "SavedMessagesTopic" + ClassSavedMessagesTopicType = "SavedMessagesTopicType" ClassRichText = "RichText" ClassPageBlockHorizontalAlignment = "PageBlockHorizontalAlignment" ClassPageBlockVerticalAlignment = "PageBlockVerticalAlignment" @@ -282,8 +282,7 @@ const ( ClassFoundWebApp = "FoundWebApp" ClassWebAppInfo = "WebAppInfo" ClassMessageThreadInfo = "MessageThreadInfo" - ClassFoundSavedMessagesTopic = "FoundSavedMessagesTopic" - ClassFoundSavedMessagesTopics = "FoundSavedMessagesTopics" + ClassSavedMessagesTopic = "SavedMessagesTopic" ClassForumTopicIcon = "ForumTopicIcon" ClassForumTopicInfo = "ForumTopicInfo" ClassForumTopic = "ForumTopic" @@ -791,11 +790,10 @@ const ( TypeFoundWebApp = "foundWebApp" TypeWebAppInfo = "webAppInfo" TypeMessageThreadInfo = "messageThreadInfo" - TypeSavedMessagesTopicMyNotes = "savedMessagesTopicMyNotes" - TypeSavedMessagesTopicAuthorHidden = "savedMessagesTopicAuthorHidden" - TypeSavedMessagesTopicSavedFromChat = "savedMessagesTopicSavedFromChat" - TypeFoundSavedMessagesTopic = "foundSavedMessagesTopic" - TypeFoundSavedMessagesTopics = "foundSavedMessagesTopics" + TypeSavedMessagesTopicTypeMyNotes = "savedMessagesTopicTypeMyNotes" + TypeSavedMessagesTopicTypeAuthorHidden = "savedMessagesTopicTypeAuthorHidden" + TypeSavedMessagesTopicTypeSavedFromChat = "savedMessagesTopicTypeSavedFromChat" + TypeSavedMessagesTopic = "savedMessagesTopic" TypeForumTopicIcon = "forumTopicIcon" TypeForumTopicInfo = "forumTopicInfo" TypeForumTopic = "forumTopic" @@ -1007,6 +1005,7 @@ const ( TypeMessageChatSetBackground = "messageChatSetBackground" TypeMessageChatSetTheme = "messageChatSetTheme" TypeMessageChatSetMessageAutoDeleteTime = "messageChatSetMessageAutoDeleteTime" + TypeMessageChatBoost = "messageChatBoost" TypeMessageForumTopicCreated = "messageForumTopicCreated" TypeMessageForumTopicEdited = "messageForumTopicEdited" TypeMessageForumTopicIsClosedToggled = "messageForumTopicIsClosedToggled" @@ -1300,6 +1299,7 @@ const ( TypeChatEventPhotoChanged = "chatEventPhotoChanged" TypeChatEventSlowModeDelayChanged = "chatEventSlowModeDelayChanged" TypeChatEventStickerSetChanged = "chatEventStickerSetChanged" + TypeChatEventCustomEmojiStickerSetChanged = "chatEventCustomEmojiStickerSetChanged" TypeChatEventTitleChanged = "chatEventTitleChanged" TypeChatEventUsernameChanged = "chatEventUsernameChanged" TypeChatEventActiveUsernamesChanged = "chatEventActiveUsernamesChanged" @@ -1373,12 +1373,16 @@ const ( TypePremiumFeatureChatBoost = "premiumFeatureChatBoost" TypePremiumFeatureAccentColor = "premiumFeatureAccentColor" TypePremiumFeatureBackgroundForBoth = "premiumFeatureBackgroundForBoth" + TypePremiumFeatureSavedMessagesTags = "premiumFeatureSavedMessagesTags" + TypePremiumFeatureMessagePrivacy = "premiumFeatureMessagePrivacy" + TypePremiumFeatureLastSeenTimes = "premiumFeatureLastSeenTimes" TypePremiumStoryFeaturePriorityOrder = "premiumStoryFeaturePriorityOrder" TypePremiumStoryFeatureStealthMode = "premiumStoryFeatureStealthMode" TypePremiumStoryFeaturePermanentViewsHistory = "premiumStoryFeaturePermanentViewsHistory" TypePremiumStoryFeatureCustomExpirationDuration = "premiumStoryFeatureCustomExpirationDuration" TypePremiumStoryFeatureSaveStories = "premiumStoryFeatureSaveStories" TypePremiumStoryFeatureLinksAndFormatting = "premiumStoryFeatureLinksAndFormatting" + TypePremiumStoryFeatureVideoQuality = "premiumStoryFeatureVideoQuality" TypePremiumLimit = "premiumLimit" TypePremiumFeatures = "premiumFeatures" TypePremiumSourceLimitExceeded = "premiumSourceLimitExceeded" @@ -1771,7 +1775,8 @@ const ( TypeUpdateChatHasScheduledMessages = "updateChatHasScheduledMessages" TypeUpdateChatFolders = "updateChatFolders" TypeUpdateChatOnlineMemberCount = "updateChatOnlineMemberCount" - TypeUpdatePinnedSavedMessagesTopics = "updatePinnedSavedMessagesTopics" + TypeUpdateSavedMessagesTopic = "updateSavedMessagesTopic" + TypeUpdateSavedMessagesTopicCount = "updateSavedMessagesTopicCount" TypeUpdateForumTopicInfo = "updateForumTopicInfo" TypeUpdateScopeNotificationSettings = "updateScopeNotificationSettings" TypeUpdateNotification = "updateNotification" @@ -2075,9 +2080,9 @@ type LoginUrlInfo interface { LoginUrlInfoType() string } -// Contains information about a Saved Messages topic -type SavedMessagesTopic interface { - SavedMessagesTopicType() string +// Describes type of a Saved Messages topic +type SavedMessagesTopicType interface { + SavedMessagesTopicTypeType() string } // Describes a text object inside an instant-view web page @@ -6018,7 +6023,7 @@ func (*ChatPermissions) GetType() string { // Describes rights of the administrator type ChatAdministratorRights struct { meta - // True, if the administrator can get chat event log, get chat boosts in channels, get channel members, report supergroup spam messages, see anonymous administrators in supergroups and ignore slow mode. Implied by any other privilege; applicable to supergroups and channels only + // True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report supergroup spam messages and ignore slow mode. Implied by any other privilege; applicable to supergroups and channels only CanManageChat bool `json:"can_manage_chat"` // True, if the administrator can change the chat title, photo, and other settings CanChangeInfo bool `json:"can_change_info"` @@ -6040,11 +6045,11 @@ type ChatAdministratorRights struct { CanPromoteMembers bool `json:"can_promote_members"` // True, if the administrator can manage video chats CanManageVideoChats bool `json:"can_manage_video_chats"` - // True, if the administrator can create new channel stories, or edit and delete posted stories; applicable to channels only + // True, if the administrator can create new chat stories, or edit and delete posted stories; applicable to supergroups and channels only CanPostStories bool `json:"can_post_stories"` - // True, if the administrator can edit stories posted by other users, pin stories and access story archive; applicable to channels only + // True, if the administrator can edit stories posted by other users, pin stories and access story archive; applicable to supergroups and channels only CanEditStories bool `json:"can_edit_stories"` - // True, if the administrator can delete stories posted by other users; applicable to channels only + // True, if the administrator can delete stories posted by other users; applicable to supergroups and channels only CanDeleteStories bool `json:"can_delete_stories"` // True, if the administrator isn't shown in the chat member list and sends messages anonymously; applicable to supergroups only IsAnonymous bool `json:"is_anonymous"` @@ -6506,8 +6511,8 @@ type AccentColor struct { LightThemeColors []int32 `json:"light_theme_colors"` // The list of 1-3 colors in RGB format, describing the accent color, as expected to be shown in dark themes DarkThemeColors []int32 `json:"dark_theme_colors"` - // The minimum chat boost level required to use the color - MinChatBoostLevel int32 `json:"min_chat_boost_level"` + // The minimum chat boost level required to use the color in a channel chat + MinChannelChatBoostLevel int32 `json:"min_channel_chat_boost_level"` } func (entity *AccentColor) MarshalJSON() ([]byte, error) { @@ -6562,8 +6567,10 @@ type ProfileAccentColor struct { LightThemeColors *ProfileAccentColors `json:"light_theme_colors"` // Accent colors expected to be used in dark themes DarkThemeColors *ProfileAccentColors `json:"dark_theme_colors"` - // The minimum chat boost level required to use the color - MinChatBoostLevel int32 `json:"min_chat_boost_level"` + // The minimum chat boost level required to use the color in a supergroup chat + MinSupergroupChatBoostLevel int32 `json:"min_supergroup_chat_boost_level"` + // The minimum chat boost level required to use the color in a channel chat + MinChannelChatBoostLevel int32 `json:"min_channel_chat_boost_level"` } func (entity *ProfileAccentColor) MarshalJSON() ([]byte, error) { @@ -8272,9 +8279,9 @@ type Supergroup struct { IsScam bool `json:"is_scam"` // True, if many users reported this supergroup or channel as a fake account IsFake bool `json:"is_fake"` - // True, if the channel has non-expired stories available to the current user + // True, if the supergroup or channel has non-expired stories available to the current user HasActiveStories bool `json:"has_active_stories"` - // True, if the channel has unread non-expired stories available to the current user + // True, if the supergroup or channel has unread non-expired stories available to the current user HasUnreadActiveStories bool `json:"has_unread_active_stories"` } @@ -8392,10 +8399,16 @@ type SupergroupFullInfo struct { IsAllHistoryAvailable bool `json:"is_all_history_available"` // True, if aggressive anti-spam checks are enabled in the supergroup. The value of this field is only available to chat administrators HasAggressiveAntiSpamEnabled bool `json:"has_aggressive_anti_spam_enabled"` - // True, if the channel has pinned stories + // True, if the supergroup or channel has pinned stories HasPinnedStories bool `json:"has_pinned_stories"` - // Identifier of the supergroup sticker set; 0 if none + // Number of times the current user boosted the supergroup or channel + MyBoostCount int32 `json:"my_boost_count"` + // Number of times the supergroup must be boosted by a user to ignore slow mode and chat permission restrictions; 0 if unspecified + UnrestrictBoostCount int32 `json:"unrestrict_boost_count"` + // Identifier of the supergroup sticker set that must be shown before user sticker sets; 0 if none StickerSetId JsonInt64 `json:"sticker_set_id"` + // Identifier of the custom emoji sticker set that can be used in the supergroup without Telegram Premium subscription; 0 if none + CustomEmojiStickerSetId JsonInt64 `json:"custom_emoji_sticker_set_id"` // Location to which the supergroup is connected; may be null if none Location *ChatLocation `json:"location"` // Primary invite link for the chat; may be null. For chat administrators with can_invite_users right only @@ -9325,7 +9338,7 @@ type MessageReactions struct { meta // List of added reactions Reactions []*MessageReaction `json:"reactions"` - // True, if the reactions are tags and Telegram Premium users can filter messages by them; currently, always false + // True, if the reactions are tags and Telegram Premium users can filter messages by them AreTags bool `json:"are_tags"` } @@ -9669,7 +9682,7 @@ func (*InputMessageReplyToMessage) InputMessageReplyToType() string { // Describes a story to be replied type InputMessageReplyToStory struct { meta - // The identifier of the sender of the story. Currently, stories can be replied only in the sender's chat + // The identifier of the sender of the story. Currently, stories can be replied only in the sender's chat and channel stories can't be replied StorySenderChatId int64 `json:"story_sender_chat_id"` // The identifier of the story StoryId int32 `json:"story_id"` @@ -9762,8 +9775,8 @@ type Message struct { ReplyTo MessageReplyTo `json:"reply_to"` // If non-zero, the identifier of the message thread the message belongs to; unique within the chat to which the message belongs MessageThreadId int64 `json:"message_thread_id"` - // Information about topic of the message in the Saved Messages chat; may be null for messages not from Saved Messages - SavedMessagesTopic SavedMessagesTopic `json:"saved_messages_topic"` + // Identifier of the Saved Messages topic for the message; 0 for messages not from Saved Messages + SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` // The message's self-destruct type; may be null if none SelfDestructType MessageSelfDestructType `json:"self_destruct_type"` // Time left before the message self-destruct timer expires, in seconds; 0 if self-destruction isn't scheduled yet @@ -9772,6 +9785,8 @@ type Message struct { AutoDeleteIn float64 `json:"auto_delete_in"` // If non-zero, the user identifier of the bot through which this message was sent ViaBotUserId int64 `json:"via_bot_user_id"` + // Number of times the sender of the message boosted the supergroup at the time the message was sent; 0 if none or unknown. For messages sent by the current user, supergroupFullInfo.my_boost_count must be used instead + SenderBoostCount int32 `json:"sender_boost_count"` // For channel posts and anonymous group messages, optional author signature AuthorSignature string `json:"author_signature"` // Unique identifier of an album this message belongs to. Only audios, documents, photos and videos can be grouped together in albums @@ -9834,11 +9849,12 @@ func (message *Message) UnmarshalJSON(data []byte) error { UnreadReactions []*UnreadReaction `json:"unread_reactions"` ReplyTo json.RawMessage `json:"reply_to"` MessageThreadId int64 `json:"message_thread_id"` - SavedMessagesTopic json.RawMessage `json:"saved_messages_topic"` + SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` SelfDestructType json.RawMessage `json:"self_destruct_type"` SelfDestructIn float64 `json:"self_destruct_in"` AutoDeleteIn float64 `json:"auto_delete_in"` ViaBotUserId int64 `json:"via_bot_user_id"` + SenderBoostCount int32 `json:"sender_boost_count"` AuthorSignature string `json:"author_signature"` MediaAlbumId JsonInt64 `json:"media_album_id"` RestrictionReason string `json:"restriction_reason"` @@ -9879,9 +9895,11 @@ func (message *Message) UnmarshalJSON(data []byte) error { message.InteractionInfo = tmp.InteractionInfo message.UnreadReactions = tmp.UnreadReactions message.MessageThreadId = tmp.MessageThreadId + message.SavedMessagesTopicId = tmp.SavedMessagesTopicId message.SelfDestructIn = tmp.SelfDestructIn message.AutoDeleteIn = tmp.AutoDeleteIn message.ViaBotUserId = tmp.ViaBotUserId + message.SenderBoostCount = tmp.SenderBoostCount message.AuthorSignature = tmp.AuthorSignature message.MediaAlbumId = tmp.MediaAlbumId message.RestrictionReason = tmp.RestrictionReason @@ -9898,9 +9916,6 @@ func (message *Message) UnmarshalJSON(data []byte) error { fieldReplyTo, _ := UnmarshalMessageReplyTo(tmp.ReplyTo) message.ReplyTo = fieldReplyTo - fieldSavedMessagesTopic, _ := UnmarshalSavedMessagesTopic(tmp.SavedMessagesTopic) - message.SavedMessagesTopic = fieldSavedMessagesTopic - fieldSelfDestructType, _ := UnmarshalMessageSelfDestructType(tmp.SelfDestructType) message.SelfDestructType = fieldSelfDestructType @@ -10938,7 +10953,7 @@ type DraftMessage struct { ReplyTo InputMessageReplyTo `json:"reply_to"` // Point in time (Unix timestamp) when the draft was created Date int32 `json:"date"` - // Content of the message draft; must be of the type inputMessageText + // Content of the message draft; must be of the type inputMessageText, inputMessageVideoNote, or inputMessageVoiceNote InputMessageText InputMessageContent `json:"input_message_text"` } @@ -11640,12 +11655,12 @@ func (chatAvailableReactionsSome *ChatAvailableReactionsSome) UnmarshalJSON(data return nil } -// Represents a tag used in Saved Messages +// Represents a tag used in Saved Messages or a Saved Messages topic type SavedMessagesTag struct { meta // The tag Tag ReactionType `json:"tag"` - // Label of the tag; 0-12 characters + // Label of the tag; 0-12 characters. Always empty if the tag is returned for a Saved Messages topic Label string `json:"label"` // Number of times the tag was used; may be 0 if the tag has non-empty label Count int32 `json:"count"` @@ -11794,7 +11809,7 @@ type Chat struct { IsTranslatable bool `json:"is_translatable"` // True, if the chat is marked as unread IsMarkedAsUnread bool `json:"is_marked_as_unread"` - // True, if the chat is a forum supergroup that must be shown in the "View as topics" mode + // 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 `json:"view_as_topics"` // True, if the chat has scheduled messages HasScheduledMessages bool `json:"has_scheduled_messages"` @@ -13104,111 +13119,123 @@ func (*MessageThreadInfo) GetType() string { } // Topic containing messages sent by the current user of forwarded from an unknown chat -type SavedMessagesTopicMyNotes struct{ +type SavedMessagesTopicTypeMyNotes struct{ meta } -func (entity *SavedMessagesTopicMyNotes) MarshalJSON() ([]byte, error) { +func (entity *SavedMessagesTopicTypeMyNotes) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub SavedMessagesTopicMyNotes + type stub SavedMessagesTopicTypeMyNotes return json.Marshal((*stub)(entity)) } -func (*SavedMessagesTopicMyNotes) GetClass() string { - return ClassSavedMessagesTopic +func (*SavedMessagesTopicTypeMyNotes) GetClass() string { + return ClassSavedMessagesTopicType } -func (*SavedMessagesTopicMyNotes) GetType() string { - return TypeSavedMessagesTopicMyNotes +func (*SavedMessagesTopicTypeMyNotes) GetType() string { + return TypeSavedMessagesTopicTypeMyNotes } -func (*SavedMessagesTopicMyNotes) SavedMessagesTopicType() string { - return TypeSavedMessagesTopicMyNotes +func (*SavedMessagesTopicTypeMyNotes) SavedMessagesTopicTypeType() string { + return TypeSavedMessagesTopicTypeMyNotes } // Topic containing messages forwarded from a user with hidden privacy -type SavedMessagesTopicAuthorHidden struct{ +type SavedMessagesTopicTypeAuthorHidden struct{ meta } -func (entity *SavedMessagesTopicAuthorHidden) MarshalJSON() ([]byte, error) { +func (entity *SavedMessagesTopicTypeAuthorHidden) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub SavedMessagesTopicAuthorHidden + type stub SavedMessagesTopicTypeAuthorHidden return json.Marshal((*stub)(entity)) } -func (*SavedMessagesTopicAuthorHidden) GetClass() string { - return ClassSavedMessagesTopic +func (*SavedMessagesTopicTypeAuthorHidden) GetClass() string { + return ClassSavedMessagesTopicType } -func (*SavedMessagesTopicAuthorHidden) GetType() string { - return TypeSavedMessagesTopicAuthorHidden +func (*SavedMessagesTopicTypeAuthorHidden) GetType() string { + return TypeSavedMessagesTopicTypeAuthorHidden } -func (*SavedMessagesTopicAuthorHidden) SavedMessagesTopicType() string { - return TypeSavedMessagesTopicAuthorHidden +func (*SavedMessagesTopicTypeAuthorHidden) SavedMessagesTopicTypeType() string { + return TypeSavedMessagesTopicTypeAuthorHidden } // Topic containing messages forwarded from a specific chat -type SavedMessagesTopicSavedFromChat struct { +type SavedMessagesTopicTypeSavedFromChat struct { meta // Identifier of the chat ChatId int64 `json:"chat_id"` } -func (entity *SavedMessagesTopicSavedFromChat) MarshalJSON() ([]byte, error) { +func (entity *SavedMessagesTopicTypeSavedFromChat) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub SavedMessagesTopicSavedFromChat + type stub SavedMessagesTopicTypeSavedFromChat return json.Marshal((*stub)(entity)) } -func (*SavedMessagesTopicSavedFromChat) GetClass() string { +func (*SavedMessagesTopicTypeSavedFromChat) GetClass() string { + return ClassSavedMessagesTopicType +} + +func (*SavedMessagesTopicTypeSavedFromChat) GetType() string { + return TypeSavedMessagesTopicTypeSavedFromChat +} + +func (*SavedMessagesTopicTypeSavedFromChat) SavedMessagesTopicTypeType() string { + return TypeSavedMessagesTopicTypeSavedFromChat +} + +// Contains information about a Saved Messages topic +type SavedMessagesTopic struct { + meta + // Unique topic identifier + Id int64 `json:"id"` + // Type of the topic + Type SavedMessagesTopicType `json:"type"` + // True, if the topic is pinned + IsPinned bool `json:"is_pinned"` + // A parameter used to determine order of the topic in the topic list. Topics must be sorted by the order in descending order + Order JsonInt64 `json:"order"` + // Last message in the topic; may be null if none or unknown + LastMessage *Message `json:"last_message"` + // A draft of a message in the topic; may be null if none + DraftMessage *DraftMessage `json:"draft_message"` +} + +func (entity *SavedMessagesTopic) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SavedMessagesTopic + + return json.Marshal((*stub)(entity)) +} + +func (*SavedMessagesTopic) GetClass() string { return ClassSavedMessagesTopic } -func (*SavedMessagesTopicSavedFromChat) GetType() string { - return TypeSavedMessagesTopicSavedFromChat +func (*SavedMessagesTopic) GetType() string { + return TypeSavedMessagesTopic } -func (*SavedMessagesTopicSavedFromChat) SavedMessagesTopicType() string { - return TypeSavedMessagesTopicSavedFromChat -} - -// Contains information about a found Saved Messages topic -type FoundSavedMessagesTopic struct { - meta - // The topic - Topic SavedMessagesTopic `json:"topic"` - // Last message in the topic; may be null if none or unknown - LastMessage *Message `json:"last_message"` -} - -func (entity *FoundSavedMessagesTopic) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub FoundSavedMessagesTopic - - return json.Marshal((*stub)(entity)) -} - -func (*FoundSavedMessagesTopic) GetClass() string { - return ClassFoundSavedMessagesTopic -} - -func (*FoundSavedMessagesTopic) GetType() string { - return TypeFoundSavedMessagesTopic -} - -func (foundSavedMessagesTopic *FoundSavedMessagesTopic) UnmarshalJSON(data []byte) error { +func (savedMessagesTopic *SavedMessagesTopic) UnmarshalJSON(data []byte) error { var tmp struct { - Topic json.RawMessage `json:"topic"` + Id int64 `json:"id"` + Type json.RawMessage `json:"type"` + IsPinned bool `json:"is_pinned"` + Order JsonInt64 `json:"order"` LastMessage *Message `json:"last_message"` + DraftMessage *DraftMessage `json:"draft_message"` } err := json.Unmarshal(data, &tmp) @@ -13216,41 +13243,18 @@ func (foundSavedMessagesTopic *FoundSavedMessagesTopic) UnmarshalJSON(data []byt return err } - foundSavedMessagesTopic.LastMessage = tmp.LastMessage + savedMessagesTopic.Id = tmp.Id + savedMessagesTopic.IsPinned = tmp.IsPinned + savedMessagesTopic.Order = tmp.Order + savedMessagesTopic.LastMessage = tmp.LastMessage + savedMessagesTopic.DraftMessage = tmp.DraftMessage - fieldTopic, _ := UnmarshalSavedMessagesTopic(tmp.Topic) - foundSavedMessagesTopic.Topic = fieldTopic + fieldType, _ := UnmarshalSavedMessagesTopicType(tmp.Type) + savedMessagesTopic.Type = fieldType return nil } -// Contains a list of Saved Messages topics -type FoundSavedMessagesTopics struct { - meta - // Total number of Saved Messages topics found - TotalCount int32 `json:"total_count"` - // List of Saved Messages topics - Topics []*FoundSavedMessagesTopic `json:"topics"` - // The offset for the next request. If empty, then there are no more results - NextOffset string `json:"next_offset"` -} - -func (entity *FoundSavedMessagesTopics) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub FoundSavedMessagesTopics - - return json.Marshal((*stub)(entity)) -} - -func (*FoundSavedMessagesTopics) GetClass() string { - return ClassFoundSavedMessagesTopics -} - -func (*FoundSavedMessagesTopics) GetType() string { - return TypeFoundSavedMessagesTopics -} - // Describes a forum topic icon type ForumTopicIcon struct { meta @@ -16840,9 +16844,9 @@ func (*MessageExtendedMediaUnsupported) MessageExtendedMediaType() string { // Describes parameters of a Telegram Premium giveaway type PremiumGiveawayParameters struct { meta - // Identifier of the channel chat, which will be automatically boosted by the winners of the giveaway for duration of the Premium subscription + // Identifier of the supergroup or channel chat, which will be automatically boosted by the winners of the giveaway for duration of the Premium subscription. If the chat is a channel, then can_post_messages right is required in the channel, otherwise, the user must be an administrator in the supergroup BoostedChatId int64 `json:"boosted_chat_id"` - // Identifiers of other channel chats that must be subscribed by the users to be eligible for the giveaway. There can be up to getOption("giveaway_additional_chat_count_max") additional chats + // Identifiers of other supergroup or channel chats that must be subscribed by the users to be eligible for the giveaway. There can be up to getOption("giveaway_additional_chat_count_max") additional chats AdditionalChatIds []int64 `json:"additional_chat_ids"` // Point in time (Unix timestamp) when the giveaway is expected to be performed; must be 60-getOption("giveaway_duration_max") seconds in the future in scheduled giveaways WinnersSelectionDate int32 `json:"winners_selection_date"` @@ -20343,6 +20347,33 @@ func (*MessageChatSetMessageAutoDeleteTime) MessageContentType() string { return TypeMessageChatSetMessageAutoDeleteTime } +// The chat was boosted by the sender of the message +type MessageChatBoost struct { + meta + // Number of times the chat was boosted + BoostCount int32 `json:"boost_count"` +} + +func (entity *MessageChatBoost) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageChatBoost + + return json.Marshal((*stub)(entity)) +} + +func (*MessageChatBoost) GetClass() string { + return ClassMessageContent +} + +func (*MessageChatBoost) GetType() string { + return TypeMessageChatBoost +} + +func (*MessageChatBoost) MessageContentType() string { + return TypeMessageChatBoost +} + // A forum topic has been created type MessageForumTopicCreated struct { meta @@ -21995,7 +22026,7 @@ type InputMessageText struct { meta // Formatted text to be sent; 0-getOption("message_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, BlockQuote, Code, Pre, PreCode, TextUrl and MentionName entities are allowed to be specified manually Text *FormattedText `json:"text"` - // Options to be used for generation of a link preview; pass null to use default link preview options + // Options to be used for generation of a link preview; may be null if none; pass null to use default link preview options LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options"` // True, if a chat message draft must be deleted ClearDraft bool `json:"clear_draft"` @@ -22434,13 +22465,13 @@ type InputMessageVideoNote struct { meta // Video note to be sent VideoNote InputFile `json:"video_note"` - // Video thumbnail; pass null to skip thumbnail uploading + // Video thumbnail; may be null if empty; pass null to skip thumbnail uploading Thumbnail *InputThumbnail `json:"thumbnail"` // Duration of the video, in seconds Duration int32 `json:"duration"` // Video width and height; must be positive and not greater than 640 Length int32 `json:"length"` - // Video note self-destruct type; pass null if none; private chats only + // Video note self-destruct type; may be null if none; pass null if none; private chats only SelfDestructType MessageSelfDestructType `json:"self_destruct_type"` } @@ -22500,9 +22531,9 @@ type InputMessageVoiceNote struct { Duration int32 `json:"duration"` // Waveform representation of the voice note in 5-bit format Waveform []byte `json:"waveform"` - // Voice note caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters + // Voice note caption; may be null if empty; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters Caption *FormattedText `json:"caption"` - // Voice note self-destruct type; pass null if none; private chats only + // Voice note self-destruct type; may be null if none; pass null if none; private chats only SelfDestructType MessageSelfDestructType `json:"self_destruct_type"` } @@ -25212,6 +25243,8 @@ type Story struct { Id int32 `json:"id"` // Identifier of the chat that posted the story SenderChatId int64 `json:"sender_chat_id"` + // Identifier of the sender of the story; may be null if the story is posted on behalf of the sender_chat_id + SenderId MessageSender `json:"sender_id"` // Point in time (Unix timestamp) when the story was published Date int32 `json:"date"` // True, if the story is being sent by the current user @@ -25276,6 +25309,7 @@ func (story *Story) UnmarshalJSON(data []byte) error { var tmp struct { Id int32 `json:"id"` SenderChatId int64 `json:"sender_chat_id"` + SenderId json.RawMessage `json:"sender_id"` Date int32 `json:"date"` IsBeingSent bool `json:"is_being_sent"` IsBeingEdited bool `json:"is_being_edited"` @@ -25325,6 +25359,9 @@ func (story *Story) UnmarshalJSON(data []byte) error { story.Areas = tmp.Areas story.Caption = tmp.Caption + fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) + story.SenderId = fieldSenderId + fieldChosenReactionType, _ := UnmarshalReactionType(tmp.ChosenReactionType) story.ChosenReactionType = fieldChosenReactionType @@ -25781,6 +25818,10 @@ type ChatBoostLevelFeatures struct { ChatThemeBackgroundCount int32 `json:"chat_theme_background_count"` // True, if custom background can be set in the chat for all users CanSetCustomBackground bool `json:"can_set_custom_background"` + // True, if custom emoji sticker set can be set for the chat + CanSetCustomEmojiStickerSet bool `json:"can_set_custom_emoji_sticker_set"` + // True, if speech recognition can be used for video note and voice note messages by all users + CanRecognizeSpeech bool `json:"can_recognize_speech"` } func (entity *ChatBoostLevelFeatures) MarshalJSON() ([]byte, error) { @@ -25806,7 +25847,7 @@ type ChatBoostFeatures struct { Features []*ChatBoostLevelFeatures `json:"features"` // The minimum boost level required to set custom emoji for profile background MinProfileBackgroundCustomEmojiBoostLevel int32 `json:"min_profile_background_custom_emoji_boost_level"` - // The minimum boost level required to set custom emoji for reply header and link preview background + // The minimum boost level required to set custom emoji for reply header and link preview background; for channel chats only MinBackgroundCustomEmojiBoostLevel int32 `json:"min_background_custom_emoji_boost_level"` // The minimum boost level required to set emoji status MinEmojiStatusBoostLevel int32 `json:"min_emoji_status_boost_level"` @@ -25814,6 +25855,10 @@ type ChatBoostFeatures struct { MinChatThemeBackgroundBoostLevel int32 `json:"min_chat_theme_background_boost_level"` // The minimum boost level required to set custom chat background MinCustomBackgroundBoostLevel int32 `json:"min_custom_background_boost_level"` + // The minimum boost level required to set custom emoji sticker set for the chat; for supergroup chats only + MinCustomEmojiStickerSetBoostLevel int32 `json:"min_custom_emoji_sticker_set_boost_level"` + // The minimum boost level allowing to recognize speech in video note and voice note messages for non-Premium users; for supergroup chats only + MinSpeechRecognitionBoostLevel int32 `json:"min_speech_recognition_boost_level"` } func (entity *ChatBoostFeatures) MarshalJSON() ([]byte, error) { @@ -27595,7 +27640,7 @@ type AvailableReactions struct { PopularReactions []*AvailableReaction `json:"popular_reactions"` // True, if any custom emoji reaction can be added by Telegram Premium subscribers AllowCustomEmoji bool `json:"allow_custom_emoji"` - // True, if the reactions will be tags and the message can be found by them; currently, always false + // True, if the reactions will be tags and the message can be found by them AreTags bool `json:"are_tags"` // The reason why the current user can't add reactions to the message, despite some other users can; may be null if none UnavailabilityReason ReactionUnavailabilityReason `json:"unavailability_reason"` @@ -30539,6 +30584,35 @@ func (*ChatEventStickerSetChanged) ChatEventActionType() string { return TypeChatEventStickerSetChanged } +// The supergroup sticker set with allowed custom emoji was changed +type ChatEventCustomEmojiStickerSetChanged struct { + meta + // Previous identifier of the chat sticker set; 0 if none + OldStickerSetId JsonInt64 `json:"old_sticker_set_id"` + // New identifier of the chat sticker set; 0 if none + NewStickerSetId JsonInt64 `json:"new_sticker_set_id"` +} + +func (entity *ChatEventCustomEmojiStickerSetChanged) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventCustomEmojiStickerSetChanged + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventCustomEmojiStickerSetChanged) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventCustomEmojiStickerSetChanged) GetType() string { + return TypeChatEventCustomEmojiStickerSetChanged +} + +func (*ChatEventCustomEmojiStickerSetChanged) ChatEventActionType() string { + return TypeChatEventCustomEmojiStickerSetChanged +} + // The chat title was changed type ChatEventTitleChanged struct { meta @@ -32580,7 +32654,82 @@ func (*PremiumFeatureBackgroundForBoth) PremiumFeatureType() string { return TypePremiumFeatureBackgroundForBoth } -// User stories are displayed before stories of non-premium contacts and channels +// The ability to use tags in Saved Messages +type PremiumFeatureSavedMessagesTags struct{ + meta +} + +func (entity *PremiumFeatureSavedMessagesTags) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumFeatureSavedMessagesTags + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumFeatureSavedMessagesTags) GetClass() string { + return ClassPremiumFeature +} + +func (*PremiumFeatureSavedMessagesTags) GetType() string { + return TypePremiumFeatureSavedMessagesTags +} + +func (*PremiumFeatureSavedMessagesTags) PremiumFeatureType() string { + return TypePremiumFeatureSavedMessagesTags +} + +// The ability to disallow incoming voice and video note messages in private chats using setUserPrivacySettingRules with userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages and to restrict incoming messages from non-contacts using setNewChatPrivacySettings +type PremiumFeatureMessagePrivacy struct{ + meta +} + +func (entity *PremiumFeatureMessagePrivacy) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumFeatureMessagePrivacy + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumFeatureMessagePrivacy) GetClass() string { + return ClassPremiumFeature +} + +func (*PremiumFeatureMessagePrivacy) GetType() string { + return TypePremiumFeatureMessagePrivacy +} + +func (*PremiumFeatureMessagePrivacy) PremiumFeatureType() string { + return TypePremiumFeatureMessagePrivacy +} + +// The ability to view last seen and read times of other users even they can't view last seen or read time for the current user +type PremiumFeatureLastSeenTimes struct{ + meta +} + +func (entity *PremiumFeatureLastSeenTimes) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumFeatureLastSeenTimes + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumFeatureLastSeenTimes) GetClass() string { + return ClassPremiumFeature +} + +func (*PremiumFeatureLastSeenTimes) GetType() string { + return TypePremiumFeatureLastSeenTimes +} + +func (*PremiumFeatureLastSeenTimes) PremiumFeatureType() string { + return TypePremiumFeatureLastSeenTimes +} + +// Stories of the current user are displayed before stories of non-Premium contacts, supergroups, and channels type PremiumStoryFeaturePriorityOrder struct{ meta } @@ -32730,6 +32879,31 @@ func (*PremiumStoryFeatureLinksAndFormatting) PremiumStoryFeatureType() string { return TypePremiumStoryFeatureLinksAndFormatting } +// The ability to choose better quality for viewed stories +type PremiumStoryFeatureVideoQuality struct{ + meta +} + +func (entity *PremiumStoryFeatureVideoQuality) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumStoryFeatureVideoQuality + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumStoryFeatureVideoQuality) GetClass() string { + return ClassPremiumStoryFeature +} + +func (*PremiumStoryFeatureVideoQuality) GetType() string { + return TypePremiumStoryFeatureVideoQuality +} + +func (*PremiumStoryFeatureVideoQuality) PremiumStoryFeatureType() string { + return TypePremiumStoryFeatureVideoQuality +} + // Contains information about a limit, increased for Premium users type PremiumLimit struct { meta @@ -33143,7 +33317,7 @@ func (*StorePaymentPurposeGiftedPremium) StorePaymentPurposeType() string { // The user creating Telegram Premium gift codes for other users type StorePaymentPurposePremiumGiftCodes struct { meta - // Identifier of the channel chat, which will be automatically boosted by the users for duration of the Premium subscription and which is administered by the user; 0 if none + // Identifier of the supergroup or channel chat, which will be automatically boosted by the users for duration of the Premium subscription and which is administered by the user; 0 if none BoostedChatId int64 `json:"boosted_chat_id"` // ISO 4217 currency code of the payment currency Currency string `json:"currency"` @@ -33173,7 +33347,7 @@ func (*StorePaymentPurposePremiumGiftCodes) StorePaymentPurposeType() string { return TypeStorePaymentPurposePremiumGiftCodes } -// The user creating a Telegram Premium giveaway for subscribers of channel chats; requires can_post_messages rights in the channels +// The user creating a Telegram Premium giveaway type StorePaymentPurposePremiumGiveaway struct { meta // Giveaway parameters @@ -33207,7 +33381,7 @@ func (*StorePaymentPurposePremiumGiveaway) StorePaymentPurposeType() string { // The user creating Telegram Premium gift codes for other users type TelegramPaymentPurposePremiumGiftCodes struct { meta - // Identifier of the channel chat, which will be automatically boosted by the users for duration of the Premium subscription and which is administered by the user; 0 if none + // Identifier of the supergroup or channel chat, which will be automatically boosted by the users for duration of the Premium subscription and which is administered by the user; 0 if none BoostedChatId int64 `json:"boosted_chat_id"` // ISO 4217 currency code of the payment currency Currency string `json:"currency"` @@ -33239,7 +33413,7 @@ func (*TelegramPaymentPurposePremiumGiftCodes) TelegramPaymentPurposeType() stri return TypeTelegramPaymentPurposePremiumGiftCodes } -// The user creating a Telegram Premium giveaway for subscribers of channel chats; requires can_post_messages rights in the channels +// The user creating a Telegram Premium giveaway type TelegramPaymentPurposePremiumGiveaway struct { meta // Giveaway parameters @@ -34128,7 +34302,7 @@ func (*CanSendStoryResultPremiumNeeded) CanSendStoryResultType() string { return TypeCanSendStoryResultPremiumNeeded } -// The channel chat must be boosted first by Telegram Premium subscribers to post more stories. Call getChatBoostStatus to get current boost status of the chat +// The chat must be boosted first by Telegram Premium subscribers to post more stories. Call getChatBoostStatus to get current boost status of the chat type CanSendStoryResultBoostNeeded struct{ meta } @@ -37000,7 +37174,7 @@ func (*UserPrivacySettingAllowFindingByPhoneNumber) UserPrivacySettingType() str return TypeUserPrivacySettingAllowFindingByPhoneNumber } -// A privacy setting for managing whether the user can receive voice and video messages in private chats +// A privacy setting for managing whether the user can receive voice and video messages in private chats; for Telegram Premium users only type UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages struct{ meta } @@ -43700,7 +43874,7 @@ type UpdateChatDraftMessage struct { meta // Chat identifier ChatId int64 `json:"chat_id"` - // The new draft message; may be null + // The new draft message; may be null if none DraftMessage *DraftMessage `json:"draft_message"` // The new chat positions in the chat lists Positions []*ChatPosition `json:"positions"` @@ -44344,29 +44518,58 @@ func (*UpdateChatOnlineMemberCount) UpdateType() string { return TypeUpdateChatOnlineMemberCount } -// The list of pinned Saved Messages topics has changed. The app can call getPinnedSavedMessagesTopics to get the new list -type UpdatePinnedSavedMessagesTopics struct{ +// Basic information about a Saved Messages topic has changed. This update is guaranteed to come before the topic identifier is returned to the application +type UpdateSavedMessagesTopic struct { meta + // New data about the topic + Topic *SavedMessagesTopic `json:"topic"` } -func (entity *UpdatePinnedSavedMessagesTopics) MarshalJSON() ([]byte, error) { +func (entity *UpdateSavedMessagesTopic) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub UpdatePinnedSavedMessagesTopics + type stub UpdateSavedMessagesTopic return json.Marshal((*stub)(entity)) } -func (*UpdatePinnedSavedMessagesTopics) GetClass() string { +func (*UpdateSavedMessagesTopic) GetClass() string { return ClassUpdate } -func (*UpdatePinnedSavedMessagesTopics) GetType() string { - return TypeUpdatePinnedSavedMessagesTopics +func (*UpdateSavedMessagesTopic) GetType() string { + return TypeUpdateSavedMessagesTopic } -func (*UpdatePinnedSavedMessagesTopics) UpdateType() string { - return TypeUpdatePinnedSavedMessagesTopics +func (*UpdateSavedMessagesTopic) UpdateType() string { + return TypeUpdateSavedMessagesTopic +} + +// Number of Saved Messages topics has changed +type UpdateSavedMessagesTopicCount struct { + meta + // Approximate total number of Saved Messages topics + TopicCount int32 `json:"topic_count"` +} + +func (entity *UpdateSavedMessagesTopicCount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateSavedMessagesTopicCount + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateSavedMessagesTopicCount) GetClass() string { + return ClassUpdate +} + +func (*UpdateSavedMessagesTopicCount) GetType() string { + return TypeUpdateSavedMessagesTopicCount +} + +func (*UpdateSavedMessagesTopicCount) UpdateType() string { + return TypeUpdateSavedMessagesTopicCount } // Basic information about a topic in a forum chat was changed @@ -44641,7 +44844,7 @@ type UpdateChatAction struct { meta // Chat identifier ChatId int64 `json:"chat_id"` - // If not 0, a message thread identifier in which the action was performed + // If not 0, the message thread identifier in which the action was performed MessageThreadId int64 `json:"message_thread_id"` // Identifier of a message sender performing the action SenderId MessageSender `json:"sender_id"` @@ -46387,10 +46590,12 @@ func (updateDefaultReactionType *UpdateDefaultReactionType) UnmarshalJSON(data [ return nil } -// Used Saved Messages tags have changed +// Tags used in Saved Messages or a Saved Messages topic have changed type UpdateSavedMessagesTags struct { meta - // The new used tags + // Identifier of Saved Messages topic which tags were changed; 0 if tags for the whole chat has changed + SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` + // The new tags Tags *SavedMessagesTags `json:"tags"` } diff --git a/client/unmarshaler.go b/client/unmarshaler.go index b9ac0e7..7e00275 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -1677,7 +1677,7 @@ func UnmarshalListOfLoginUrlInfo(dataList []json.RawMessage) ([]LoginUrlInfo, er return list, nil } -func UnmarshalSavedMessagesTopic(data json.RawMessage) (SavedMessagesTopic, error) { +func UnmarshalSavedMessagesTopicType(data json.RawMessage) (SavedMessagesTopicType, error) { var meta meta err := json.Unmarshal(data, &meta) @@ -1686,25 +1686,25 @@ func UnmarshalSavedMessagesTopic(data json.RawMessage) (SavedMessagesTopic, erro } switch meta.Type { - case TypeSavedMessagesTopicMyNotes: - return UnmarshalSavedMessagesTopicMyNotes(data) + case TypeSavedMessagesTopicTypeMyNotes: + return UnmarshalSavedMessagesTopicTypeMyNotes(data) - case TypeSavedMessagesTopicAuthorHidden: - return UnmarshalSavedMessagesTopicAuthorHidden(data) + case TypeSavedMessagesTopicTypeAuthorHidden: + return UnmarshalSavedMessagesTopicTypeAuthorHidden(data) - case TypeSavedMessagesTopicSavedFromChat: - return UnmarshalSavedMessagesTopicSavedFromChat(data) + case TypeSavedMessagesTopicTypeSavedFromChat: + return UnmarshalSavedMessagesTopicTypeSavedFromChat(data) default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } } -func UnmarshalListOfSavedMessagesTopic(dataList []json.RawMessage) ([]SavedMessagesTopic, error) { - list := []SavedMessagesTopic{} +func UnmarshalListOfSavedMessagesTopicType(dataList []json.RawMessage) ([]SavedMessagesTopicType, error) { + list := []SavedMessagesTopicType{} for _, data := range dataList { - entity, err := UnmarshalSavedMessagesTopic(data) + entity, err := UnmarshalSavedMessagesTopicType(data) if err != nil { return nil, err } @@ -2585,6 +2585,9 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessageChatSetMessageAutoDeleteTime: return UnmarshalMessageChatSetMessageAutoDeleteTime(data) + case TypeMessageChatBoost: + return UnmarshalMessageChatBoost(data) + case TypeMessageForumTopicCreated: return UnmarshalMessageForumTopicCreated(data) @@ -4156,6 +4159,9 @@ func UnmarshalChatEventAction(data json.RawMessage) (ChatEventAction, error) { case TypeChatEventStickerSetChanged: return UnmarshalChatEventStickerSetChanged(data) + case TypeChatEventCustomEmojiStickerSetChanged: + return UnmarshalChatEventCustomEmojiStickerSetChanged(data) + case TypeChatEventTitleChanged: return UnmarshalChatEventTitleChanged(data) @@ -4438,6 +4444,15 @@ func UnmarshalPremiumFeature(data json.RawMessage) (PremiumFeature, error) { case TypePremiumFeatureBackgroundForBoth: return UnmarshalPremiumFeatureBackgroundForBoth(data) + case TypePremiumFeatureSavedMessagesTags: + return UnmarshalPremiumFeatureSavedMessagesTags(data) + + case TypePremiumFeatureMessagePrivacy: + return UnmarshalPremiumFeatureMessagePrivacy(data) + + case TypePremiumFeatureLastSeenTimes: + return UnmarshalPremiumFeatureLastSeenTimes(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -4484,6 +4499,9 @@ func UnmarshalPremiumStoryFeature(data json.RawMessage) (PremiumStoryFeature, er case TypePremiumStoryFeatureLinksAndFormatting: return UnmarshalPremiumStoryFeatureLinksAndFormatting(data) + case TypePremiumStoryFeatureVideoQuality: + return UnmarshalPremiumStoryFeatureVideoQuality(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -6684,8 +6702,11 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateChatOnlineMemberCount: return UnmarshalUpdateChatOnlineMemberCount(data) - case TypeUpdatePinnedSavedMessagesTopics: - return UnmarshalUpdatePinnedSavedMessagesTopics(data) + case TypeUpdateSavedMessagesTopic: + return UnmarshalUpdateSavedMessagesTopic(data) + + case TypeUpdateSavedMessagesTopicCount: + return UnmarshalUpdateSavedMessagesTopicCount(data) case TypeUpdateForumTopicInfo: return UnmarshalUpdateForumTopicInfo(data) @@ -9493,40 +9514,32 @@ func UnmarshalMessageThreadInfo(data json.RawMessage) (*MessageThreadInfo, error return &resp, err } -func UnmarshalSavedMessagesTopicMyNotes(data json.RawMessage) (*SavedMessagesTopicMyNotes, error) { - var resp SavedMessagesTopicMyNotes +func UnmarshalSavedMessagesTopicTypeMyNotes(data json.RawMessage) (*SavedMessagesTopicTypeMyNotes, error) { + var resp SavedMessagesTopicTypeMyNotes err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalSavedMessagesTopicAuthorHidden(data json.RawMessage) (*SavedMessagesTopicAuthorHidden, error) { - var resp SavedMessagesTopicAuthorHidden +func UnmarshalSavedMessagesTopicTypeAuthorHidden(data json.RawMessage) (*SavedMessagesTopicTypeAuthorHidden, error) { + var resp SavedMessagesTopicTypeAuthorHidden err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalSavedMessagesTopicSavedFromChat(data json.RawMessage) (*SavedMessagesTopicSavedFromChat, error) { - var resp SavedMessagesTopicSavedFromChat +func UnmarshalSavedMessagesTopicTypeSavedFromChat(data json.RawMessage) (*SavedMessagesTopicTypeSavedFromChat, error) { + var resp SavedMessagesTopicTypeSavedFromChat err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalFoundSavedMessagesTopic(data json.RawMessage) (*FoundSavedMessagesTopic, error) { - var resp FoundSavedMessagesTopic - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalFoundSavedMessagesTopics(data json.RawMessage) (*FoundSavedMessagesTopics, error) { - var resp FoundSavedMessagesTopics +func UnmarshalSavedMessagesTopic(data json.RawMessage) (*SavedMessagesTopic, error) { + var resp SavedMessagesTopic err := json.Unmarshal(data, &resp) @@ -11221,6 +11234,14 @@ func UnmarshalMessageChatSetMessageAutoDeleteTime(data json.RawMessage) (*Messag return &resp, err } +func UnmarshalMessageChatBoost(data json.RawMessage) (*MessageChatBoost, error) { + var resp MessageChatBoost + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageForumTopicCreated(data json.RawMessage) (*MessageForumTopicCreated, error) { var resp MessageForumTopicCreated @@ -13565,6 +13586,14 @@ func UnmarshalChatEventStickerSetChanged(data json.RawMessage) (*ChatEventSticke return &resp, err } +func UnmarshalChatEventCustomEmojiStickerSetChanged(data json.RawMessage) (*ChatEventCustomEmojiStickerSetChanged, error) { + var resp ChatEventCustomEmojiStickerSetChanged + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatEventTitleChanged(data json.RawMessage) (*ChatEventTitleChanged, error) { var resp ChatEventTitleChanged @@ -14149,6 +14178,30 @@ func UnmarshalPremiumFeatureBackgroundForBoth(data json.RawMessage) (*PremiumFea return &resp, err } +func UnmarshalPremiumFeatureSavedMessagesTags(data json.RawMessage) (*PremiumFeatureSavedMessagesTags, error) { + var resp PremiumFeatureSavedMessagesTags + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPremiumFeatureMessagePrivacy(data json.RawMessage) (*PremiumFeatureMessagePrivacy, error) { + var resp PremiumFeatureMessagePrivacy + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPremiumFeatureLastSeenTimes(data json.RawMessage) (*PremiumFeatureLastSeenTimes, error) { + var resp PremiumFeatureLastSeenTimes + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPremiumStoryFeaturePriorityOrder(data json.RawMessage) (*PremiumStoryFeaturePriorityOrder, error) { var resp PremiumStoryFeaturePriorityOrder @@ -14197,6 +14250,14 @@ func UnmarshalPremiumStoryFeatureLinksAndFormatting(data json.RawMessage) (*Prem return &resp, err } +func UnmarshalPremiumStoryFeatureVideoQuality(data json.RawMessage) (*PremiumStoryFeatureVideoQuality, error) { + var resp PremiumStoryFeatureVideoQuality + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPremiumLimit(data json.RawMessage) (*PremiumLimit, error) { var resp PremiumLimit @@ -17333,8 +17394,16 @@ func UnmarshalUpdateChatOnlineMemberCount(data json.RawMessage) (*UpdateChatOnli return &resp, err } -func UnmarshalUpdatePinnedSavedMessagesTopics(data json.RawMessage) (*UpdatePinnedSavedMessagesTopics, error) { - var resp UpdatePinnedSavedMessagesTopics +func UnmarshalUpdateSavedMessagesTopic(data json.RawMessage) (*UpdateSavedMessagesTopic, error) { + var resp UpdateSavedMessagesTopic + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateSavedMessagesTopicCount(data json.RawMessage) (*UpdateSavedMessagesTopicCount, error) { + var resp UpdateSavedMessagesTopicCount err := json.Unmarshal(data, &resp) @@ -19057,20 +19126,17 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageThreadInfo: return UnmarshalMessageThreadInfo(data) - case TypeSavedMessagesTopicMyNotes: - return UnmarshalSavedMessagesTopicMyNotes(data) + case TypeSavedMessagesTopicTypeMyNotes: + return UnmarshalSavedMessagesTopicTypeMyNotes(data) - case TypeSavedMessagesTopicAuthorHidden: - return UnmarshalSavedMessagesTopicAuthorHidden(data) + case TypeSavedMessagesTopicTypeAuthorHidden: + return UnmarshalSavedMessagesTopicTypeAuthorHidden(data) - case TypeSavedMessagesTopicSavedFromChat: - return UnmarshalSavedMessagesTopicSavedFromChat(data) + case TypeSavedMessagesTopicTypeSavedFromChat: + return UnmarshalSavedMessagesTopicTypeSavedFromChat(data) - case TypeFoundSavedMessagesTopic: - return UnmarshalFoundSavedMessagesTopic(data) - - case TypeFoundSavedMessagesTopics: - return UnmarshalFoundSavedMessagesTopics(data) + case TypeSavedMessagesTopic: + return UnmarshalSavedMessagesTopic(data) case TypeForumTopicIcon: return UnmarshalForumTopicIcon(data) @@ -19705,6 +19771,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageChatSetMessageAutoDeleteTime: return UnmarshalMessageChatSetMessageAutoDeleteTime(data) + case TypeMessageChatBoost: + return UnmarshalMessageChatBoost(data) + case TypeMessageForumTopicCreated: return UnmarshalMessageForumTopicCreated(data) @@ -20584,6 +20653,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatEventStickerSetChanged: return UnmarshalChatEventStickerSetChanged(data) + case TypeChatEventCustomEmojiStickerSetChanged: + return UnmarshalChatEventCustomEmojiStickerSetChanged(data) + case TypeChatEventTitleChanged: return UnmarshalChatEventTitleChanged(data) @@ -20803,6 +20875,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePremiumFeatureBackgroundForBoth: return UnmarshalPremiumFeatureBackgroundForBoth(data) + case TypePremiumFeatureSavedMessagesTags: + return UnmarshalPremiumFeatureSavedMessagesTags(data) + + case TypePremiumFeatureMessagePrivacy: + return UnmarshalPremiumFeatureMessagePrivacy(data) + + case TypePremiumFeatureLastSeenTimes: + return UnmarshalPremiumFeatureLastSeenTimes(data) + case TypePremiumStoryFeaturePriorityOrder: return UnmarshalPremiumStoryFeaturePriorityOrder(data) @@ -20821,6 +20902,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePremiumStoryFeatureLinksAndFormatting: return UnmarshalPremiumStoryFeatureLinksAndFormatting(data) + case TypePremiumStoryFeatureVideoQuality: + return UnmarshalPremiumStoryFeatureVideoQuality(data) + case TypePremiumLimit: return UnmarshalPremiumLimit(data) @@ -21997,8 +22081,11 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateChatOnlineMemberCount: return UnmarshalUpdateChatOnlineMemberCount(data) - case TypeUpdatePinnedSavedMessagesTopics: - return UnmarshalUpdatePinnedSavedMessagesTopics(data) + case TypeUpdateSavedMessagesTopic: + return UnmarshalUpdateSavedMessagesTopic(data) + + case TypeUpdateSavedMessagesTopicCount: + return UnmarshalUpdateSavedMessagesTopicCount(data) case TypeUpdateForumTopicInfo: return UnmarshalUpdateForumTopicInfo(data) diff --git a/data/td_api.tl b/data/td_api.tl index 3f56509..9653ed9 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -653,7 +653,7 @@ inputChatPhotoSticker sticker:chatPhotoSticker = InputChatPhoto; chatPermissions can_send_basic_messages:Bool can_send_audios:Bool can_send_documents:Bool can_send_photos:Bool can_send_videos:Bool can_send_video_notes:Bool can_send_voice_notes:Bool can_send_polls:Bool can_send_stickers:Bool can_send_animations:Bool can_send_games:Bool can_use_inline_bots:Bool can_add_web_page_previews:Bool can_change_info:Bool can_invite_users:Bool can_pin_messages:Bool can_create_topics:Bool = ChatPermissions; //@description Describes rights of the administrator -//@can_manage_chat True, if the administrator can get chat event log, get chat boosts in channels, get channel members, report supergroup spam messages, see anonymous administrators in supergroups and ignore slow mode. Implied by any other privilege; applicable to supergroups and channels only +//@can_manage_chat True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report supergroup spam messages and ignore slow mode. Implied by any other privilege; applicable to supergroups and channels only //@can_change_info True, if the administrator can change the chat title, photo, and other settings //@can_post_messages True, if the administrator can create channel posts or view channel statistics; applicable to channels only //@can_edit_messages True, if the administrator can edit messages of other users and pin messages; applicable to channels only @@ -664,9 +664,9 @@ chatPermissions can_send_basic_messages:Bool can_send_audios:Bool can_send_docum //@can_manage_topics True, if the administrator can create, rename, close, reopen, hide, and unhide forum topics; applicable to forum supergroups only //@can_promote_members True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that were directly or indirectly promoted by them //@can_manage_video_chats True, if the administrator can manage video chats -//@can_post_stories True, if the administrator can create new channel stories, or edit and delete posted stories; applicable to channels only -//@can_edit_stories True, if the administrator can edit stories posted by other users, pin stories and access story archive; applicable to channels only -//@can_delete_stories True, if the administrator can delete stories posted by other users; applicable to channels only +//@can_post_stories True, if the administrator can create new chat stories, or edit and delete posted stories; applicable to supergroups and channels only +//@can_edit_stories True, if the administrator can edit stories posted by other users, pin stories and access story archive; applicable to supergroups and channels only +//@can_delete_stories True, if the administrator can delete stories posted by other users; applicable to supergroups and channels only //@is_anonymous True, if the administrator isn't shown in the chat member list and sends messages anonymously; applicable to supergroups only chatAdministratorRights can_manage_chat:Bool can_change_info:Bool can_post_messages:Bool can_edit_messages:Bool can_delete_messages:Bool can_invite_users:Bool can_restrict_members:Bool can_pin_messages:Bool can_manage_topics:Bool can_promote_members:Bool can_manage_video_chats:Bool can_post_stories:Bool can_edit_stories:Bool can_delete_stories:Bool is_anonymous:Bool = ChatAdministratorRights; @@ -752,8 +752,8 @@ premiumGiveawayInfoCompleted creation_date:int32 actual_winners_selection_date:i //@built_in_accent_color_id Identifier of a built-in color to use in places, where only one color is needed; 0-6 //@light_theme_colors The list of 1-3 colors in RGB format, describing the accent color, as expected to be shown in light themes //@dark_theme_colors The list of 1-3 colors in RGB format, describing the accent color, as expected to be shown in dark themes -//@min_chat_boost_level The minimum chat boost level required to use the color -accentColor id:int32 built_in_accent_color_id:int32 light_theme_colors:vector dark_theme_colors:vector min_chat_boost_level:int32 = AccentColor; +//@min_channel_chat_boost_level The minimum chat boost level required to use the color in a channel chat +accentColor id:int32 built_in_accent_color_id:int32 light_theme_colors:vector dark_theme_colors:vector min_channel_chat_boost_level:int32 = AccentColor; //@description Contains information about supported accent colors for user profile photo background in RGB format //@palette_colors The list of 1-2 colors in RGB format, describing the colors, as expected to be shown in the color palette settings @@ -765,8 +765,9 @@ profileAccentColors palette_colors:vector background_colors:vector //@id Profile accent color identifier //@light_theme_colors Accent colors expected to be used in light themes //@dark_theme_colors Accent colors expected to be used in dark themes -//@min_chat_boost_level The minimum chat boost level required to use the color -profileAccentColor id:int32 light_theme_colors:profileAccentColors dark_theme_colors:profileAccentColors min_chat_boost_level:int32 = ProfileAccentColor; +//@min_supergroup_chat_boost_level The minimum chat boost level required to use the color in a supergroup chat +//@min_channel_chat_boost_level The minimum chat boost level required to use the color in a channel chat +profileAccentColor id:int32 light_theme_colors:profileAccentColors dark_theme_colors:profileAccentColors min_supergroup_chat_boost_level:int32 min_channel_chat_boost_level:int32 = ProfileAccentColor; //@description Describes a custom emoji to be shown instead of the Telegram Premium badge //@custom_emoji_id Identifier of the custom emoji in stickerFormatTgs format @@ -1084,8 +1085,8 @@ basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int53 memb //@restriction_reason If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted //@is_scam True, if many users reported this supergroup or channel as a scam //@is_fake True, if many users reported this supergroup or channel as a fake account -//@has_active_stories True, if the channel has non-expired stories available to the current user -//@has_unread_active_stories True, if the channel has unread non-expired stories available to the current user +//@has_active_stories True, if the supergroup or channel has non-expired stories available to the current user +//@has_unread_active_stories True, if the supergroup or channel has unread non-expired stories available to the current user supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 boost_level:int32 has_linked_chat:Bool has_location:Bool sign_messages:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool is_verified:Bool restriction_reason:string is_scam:Bool is_fake:Bool has_active_stories:Bool has_unread_active_stories:Bool = Supergroup; //@description Contains full information about a supergroup or channel @@ -1108,14 +1109,17 @@ supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:Chat //@is_all_history_available 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, //-so this option affects only private non-forum supergroups without a linked chat. The value of this field is only available to chat administrators //@has_aggressive_anti_spam_enabled True, if aggressive anti-spam checks are enabled in the supergroup. The value of this field is only available to chat administrators -//@has_pinned_stories True, if the channel has pinned stories -//@sticker_set_id Identifier of the supergroup sticker set; 0 if none +//@has_pinned_stories True, if the supergroup or channel has pinned stories +//@my_boost_count Number of times the current user boosted the supergroup or channel +//@unrestrict_boost_count Number of times the supergroup must be boosted by a user to ignore slow mode and chat permission restrictions; 0 if unspecified +//@sticker_set_id Identifier of the supergroup sticker set that must be shown before user sticker sets; 0 if none +//@custom_emoji_sticker_set_id Identifier of the custom emoji sticker set that can be used in the supergroup without Telegram Premium subscription; 0 if none //@location Location to which the supergroup is connected; may be null if none //@invite_link Primary invite link for the chat; may be null. For chat administrators with can_invite_users right only //@bot_commands List of commands of bots in the group //@upgraded_from_basic_group_id Identifier of the basic group from which supergroup was upgraded; 0 if none //@upgraded_from_max_message_id Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none -supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool has_aggressive_anti_spam_enabled:Bool has_pinned_stories:Bool sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; +supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool has_aggressive_anti_spam_enabled:Bool has_pinned_stories:Bool my_boost_count:int32 unrestrict_boost_count:int32 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; //@class SecretChatState @description Describes the current secret chat state @@ -1254,7 +1258,7 @@ messageReplyInfo reply_count:int32 recent_replier_ids:vector last //@recent_sender_ids Identifiers of at most 3 recent message senders, added the reaction; available in private, basic group and supergroup chats messageReaction type:ReactionType total_count:int32 is_chosen:Bool used_sender_id:MessageSender recent_sender_ids:vector = MessageReaction; -//@description Contains a list of reactions added to a message @reactions List of added reactions @are_tags True, if the reactions are tags and Telegram Premium users can filter messages by them; currently, always false +//@description Contains a list of reactions added to a message @reactions List of added reactions @are_tags True, if the reactions are tags and Telegram Premium users can filter messages by them messageReactions reactions:vector are_tags:Bool = MessageReactions; @@ -1325,7 +1329,9 @@ messageReplyToStory story_sender_chat_id:int53 story_id:int32 = MessageReplyTo; //@quote Quote from the message to be replied; pass null if none. Must always be null for replies in secret chats inputMessageReplyToMessage chat_id:int53 message_id:int53 quote:inputTextQuote = InputMessageReplyTo; -//@description Describes a story to be replied @story_sender_chat_id The identifier of the sender of the story. Currently, stories can be replied only in the sender's chat @story_id The identifier of the story +//@description Describes a story to be replied +//@story_sender_chat_id The identifier of the sender of the story. Currently, stories can be replied only in the sender's chat and channel stories can't be replied +//@story_id The identifier of the story inputMessageReplyToStory story_sender_chat_id:int53 story_id:int32 = InputMessageReplyTo; @@ -1362,17 +1368,18 @@ inputMessageReplyToStory story_sender_chat_id:int53 story_id:int32 = InputMessag //@unread_reactions Information about unread reactions added to the message //@reply_to Information about the message or the story this message is replying to; may be null if none //@message_thread_id If non-zero, the identifier of the message thread the message belongs to; unique within the chat to which the message belongs -//@saved_messages_topic Information about topic of the message in the Saved Messages chat; may be null for messages not from Saved Messages +//@saved_messages_topic_id Identifier of the Saved Messages topic for the message; 0 for messages not from Saved Messages //@self_destruct_type The message's self-destruct type; may be null if none //@self_destruct_in Time left before the message self-destruct timer expires, in seconds; 0 if self-destruction isn't scheduled yet //@auto_delete_in Time left before the message will be automatically deleted by message_auto_delete_time setting of the chat, in seconds; 0 if never //@via_bot_user_id If non-zero, the user identifier of the bot through which this message was sent +//@sender_boost_count Number of times the sender of the message boosted the supergroup at the time the message was sent; 0 if none or unknown. For messages sent by the current user, supergroupFullInfo.my_boost_count must be used instead //@author_signature For channel posts and anonymous group messages, optional author signature //@media_album_id Unique identifier of an album this message belongs to. Only audios, documents, photos and videos can be grouped together in albums //@restriction_reason If non-empty, contains a human-readable description of the reason why access to this message must be restricted //@content Content of the message //@reply_markup Reply markup for the message; may be null if none -message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_get_added_reactions:Bool can_get_statistics:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_viewers:Bool can_get_media_timestamp_links:Bool can_report_reactions:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector reply_to:MessageReplyTo message_thread_id:int53 saved_messages_topic:SavedMessagesTopic self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 author_signature:string media_album_id:int64 restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; +message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_get_added_reactions:Bool can_get_statistics:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_viewers:Bool can_get_media_timestamp_links:Bool can_report_reactions:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector reply_to:MessageReplyTo message_thread_id:int53 saved_messages_topic_id:int53 self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 sender_boost_count:int32 author_signature:string media_album_id:int64 restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; //@description Contains a list of messages @total_count Approximate total number of messages found @messages List of messages; messages may be null messages total_count:int32 messages:vector = Messages; @@ -1534,7 +1541,7 @@ scopeNotificationSettings mute_for:int32 sound_id:int64 show_preview:Bool use_de //@description Contains information about a message draft //@reply_to Information about the message to be replied; must be of the type inputMessageReplyToMessage; may be null if none //@date Point in time (Unix timestamp) when the draft was created -//@input_message_text Content of the message draft; must be of the type inputMessageText +//@input_message_text Content of the message draft; must be of the type inputMessageText, inputMessageVideoNote, or inputMessageVoiceNote draftMessage reply_to:InputMessageReplyTo date:int32 input_message_text:InputMessageContent = DraftMessage; @@ -1651,7 +1658,10 @@ chatAvailableReactionsAll = ChatAvailableReactions; chatAvailableReactionsSome reactions:vector = ChatAvailableReactions; -//@description Represents a tag used in Saved Messages @tag The tag @label Label of the tag; 0-12 characters @count Number of times the tag was used; may be 0 if the tag has non-empty label +//@description Represents a tag used in Saved Messages or a Saved Messages topic +//@tag The tag +//@label Label of the tag; 0-12 characters. Always empty if the tag is returned for a Saved Messages topic +//@count Number of times the tag was used; may be 0 if the tag has non-empty label savedMessagesTag tag:ReactionType label:string count:int32 = SavedMessagesTag; //@description Contains a list of tags used in Saved Messages @tags List of tags @@ -1682,7 +1692,7 @@ videoChat group_call_id:int32 has_participants:Bool default_participant_id:Messa //@has_protected_content True, if chat content can't be saved locally, forwarded, or copied //@is_translatable True, if translation of all messages in the chat must be suggested to the user //@is_marked_as_unread True, if the chat is marked as unread -//@view_as_topics True, if the chat is a forum supergroup that must be shown in the "View as topics" mode +//@view_as_topics 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" //@has_scheduled_messages True, if the chat has scheduled messages //@can_be_deleted_only_for_self True, if the chat messages can be deleted only for the current user while other users will continue to see the messages //@can_be_deleted_for_all_users True, if the chat messages can be deleted for all users @@ -1894,26 +1904,26 @@ webAppInfo launch_id:int64 url:string = WebAppInfo; messageThreadInfo chat_id:int53 message_thread_id:int53 reply_info:messageReplyInfo unread_message_count:int32 messages:vector draft_message:draftMessage = MessageThreadInfo; -//@class SavedMessagesTopic @description Contains information about a Saved Messages topic +//@class SavedMessagesTopicType @description Describes type of a Saved Messages topic //@description Topic containing messages sent by the current user of forwarded from an unknown chat -savedMessagesTopicMyNotes = SavedMessagesTopic; +savedMessagesTopicTypeMyNotes = SavedMessagesTopicType; //@description Topic containing messages forwarded from a user with hidden privacy -savedMessagesTopicAuthorHidden = SavedMessagesTopic; +savedMessagesTopicTypeAuthorHidden = SavedMessagesTopicType; //@description Topic containing messages forwarded from a specific chat @chat_id Identifier of the chat -savedMessagesTopicSavedFromChat chat_id:int53 = SavedMessagesTopic; +savedMessagesTopicTypeSavedFromChat chat_id:int53 = SavedMessagesTopicType; -//@description Contains information about a found Saved Messages topic @topic The topic @last_message Last message in the topic; may be null if none or unknown -foundSavedMessagesTopic topic:SavedMessagesTopic last_message:message = FoundSavedMessagesTopic; - -//@description Contains a list of Saved Messages topics -//@total_count Total number of Saved Messages topics found -//@topics List of Saved Messages topics -//@next_offset The offset for the next request. If empty, then there are no more results -foundSavedMessagesTopics total_count:int32 topics:vector next_offset:string = FoundSavedMessagesTopics; +//@description Contains information about a Saved Messages topic +//@id Unique topic identifier +//@type Type of the topic +//@is_pinned True, if the topic is pinned +//@order A parameter used to determine order of the topic in the topic list. Topics must be sorted by the order in descending order +//@last_message Last message in the topic; may be null if none or unknown +//@draft_message A draft of a message in the topic; may be null if none +savedMessagesTopic id:int53 type:SavedMessagesTopicType is_pinned:Bool order:int64 last_message:message draft_message:draftMessage = SavedMessagesTopic; //@description Describes a forum topic icon @color Color of the topic icon in RGB format @custom_emoji_id Unique identifier of the custom emoji shown on the topic icon; 0 if none @@ -2447,8 +2457,9 @@ messageExtendedMediaUnsupported caption:formattedText = MessageExtendedMedia; //@description Describes parameters of a Telegram Premium giveaway -//@boosted_chat_id Identifier of the channel chat, which will be automatically boosted by the winners of the giveaway for duration of the Premium subscription -//@additional_chat_ids Identifiers of other channel chats that must be subscribed by the users to be eligible for the giveaway. There can be up to getOption("giveaway_additional_chat_count_max") additional chats +//@boosted_chat_id Identifier of the supergroup or channel chat, which will be automatically boosted by the winners of the giveaway for duration of the Premium subscription. +//-If the chat is a channel, then can_post_messages right is required in the channel, otherwise, the user must be an administrator in the supergroup +//@additional_chat_ids Identifiers of other supergroup or channel chats that must be subscribed by the users to be eligible for the giveaway. There can be up to getOption("giveaway_additional_chat_count_max") additional chats //@winners_selection_date Point in time (Unix timestamp) when the giveaway is expected to be performed; must be 60-getOption("giveaway_duration_max") seconds in the future in scheduled giveaways //@only_new_members True, if only new members of the chats will be eligible for the giveaway //@has_public_winners True, if the list of winners of the giveaway will be available to everyone @@ -2910,6 +2921,9 @@ messageChatSetTheme theme_name:string = MessageContent; //@description The auto-delete or self-destruct timer for messages in the chat has been changed @message_auto_delete_time New value auto-delete or self-destruct time, in seconds; 0 if disabled @from_user_id If not 0, a user identifier, which default setting was automatically applied messageChatSetMessageAutoDeleteTime message_auto_delete_time:int32 from_user_id:int53 = MessageContent; +//@description The chat was boosted by the sender of the message @boost_count Number of times the chat was boosted +messageChatBoost boost_count:int32 = MessageContent; + //@description A forum topic has been created @name Name of the topic @icon Icon of the topic messageForumTopicCreated name:string icon:forumTopicIcon = MessageContent; @@ -3152,7 +3166,7 @@ messageCopyOptions send_copy:Bool replace_caption:Bool new_caption:formattedText //@description A text message //@text Formatted text to be sent; 0-getOption("message_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, BlockQuote, Code, Pre, PreCode, TextUrl and MentionName entities are allowed to be specified manually -//@link_preview_options Options to be used for generation of a link preview; pass null to use default link preview options +//@link_preview_options Options to be used for generation of a link preview; may be null if none; pass null to use default link preview options //@clear_draft True, if a chat message draft must be deleted inputMessageText text:formattedText link_preview_options:linkPreviewOptions clear_draft:Bool = InputMessageContent; @@ -3217,18 +3231,18 @@ inputMessageVideo video:InputFile thumbnail:inputThumbnail added_sticker_file_id //@description A video note message //@video_note Video note to be sent -//@thumbnail Video thumbnail; pass null to skip thumbnail uploading +//@thumbnail Video thumbnail; may be null if empty; pass null to skip thumbnail uploading //@duration Duration of the video, in seconds //@length Video width and height; must be positive and not greater than 640 -//@self_destruct_type Video note self-destruct type; pass null if none; private chats only +//@self_destruct_type Video note self-destruct type; may be null if none; pass null if none; private chats only inputMessageVideoNote video_note:InputFile thumbnail:inputThumbnail duration:int32 length:int32 self_destruct_type:MessageSelfDestructType = InputMessageContent; //@description A voice note message //@voice_note Voice note to be sent //@duration Duration of the voice note, in seconds //@waveform Waveform representation of the voice note in 5-bit format -//@caption Voice note caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters -//@self_destruct_type Voice note self-destruct type; pass null if none; private chats only +//@caption Voice note caption; may be null if empty; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters +//@self_destruct_type Voice note self-destruct type; may be null if none; pass null if none; private chats only inputMessageVoiceNote voice_note:InputFile duration:int32 waveform:bytes caption:formattedText self_destruct_type:MessageSelfDestructType = InputMessageContent; //@description A message with a location @@ -3629,6 +3643,7 @@ storyInteractionInfo view_count:int32 forward_count:int32 reaction_count:int32 r //@description Represents a story //@id Unique story identifier among stories of the given sender //@sender_chat_id Identifier of the chat that posted the story +//@sender_id Identifier of the sender of the story; may be null if the story is posted on behalf of the sender_chat_id //@date Point in time (Unix timestamp) when the story was published //@is_being_sent True, if the story is being sent by the current user //@is_being_edited True, if the story is being edited by the current user @@ -3650,7 +3665,7 @@ storyInteractionInfo view_count:int32 forward_count:int32 reaction_count:int32 r //@content Content of the story //@areas Clickable areas to be shown on the story content //@caption Caption of the story -story id:int32 sender_chat_id:int53 date:int32 is_being_sent:Bool is_being_edited:Bool is_edited:Bool is_pinned:Bool is_visible_only_for_self:Bool can_be_deleted:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied:Bool can_toggle_is_pinned:Bool can_get_statistics:Bool can_get_interactions:Bool has_expired_viewers:Bool repost_info:storyRepostInfo interaction_info:storyInteractionInfo chosen_reaction_type:ReactionType privacy_settings:StoryPrivacySettings content:StoryContent areas:vector caption:formattedText = Story; +story id:int32 sender_chat_id:int53 sender_id:MessageSender date:int32 is_being_sent:Bool is_being_edited:Bool is_edited:Bool is_pinned:Bool is_visible_only_for_self:Bool can_be_deleted:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied:Bool can_toggle_is_pinned:Bool can_get_statistics:Bool can_get_interactions:Bool has_expired_viewers:Bool repost_info:storyRepostInfo interaction_info:storyInteractionInfo chosen_reaction_type:ReactionType privacy_settings:StoryPrivacySettings content:StoryContent areas:vector caption:formattedText = Story; //@description Represents a list of stories @total_count Approximate total number of stories found @stories The list of stories stories total_count:int32 stories:vector = Stories; @@ -3731,16 +3746,20 @@ publicForwards total_count:int32 forwards:vector next_offset:stri //@can_set_emoji_status True, if emoji status can be set //@chat_theme_background_count Number of chat theme backgrounds that can be set as chat background //@can_set_custom_background True, if custom background can be set in the chat for all users -chatBoostLevelFeatures level:int32 story_per_day_count:int32 custom_emoji_reaction_count:int32 title_color_count:int32 profile_accent_color_count:int32 can_set_profile_background_custom_emoji:Bool accent_color_count:int32 can_set_background_custom_emoji:Bool can_set_emoji_status:Bool chat_theme_background_count:int32 can_set_custom_background:Bool = ChatBoostLevelFeatures; +//@can_set_custom_emoji_sticker_set True, if custom emoji sticker set can be set for the chat +//@can_recognize_speech True, if speech recognition can be used for video note and voice note messages by all users +chatBoostLevelFeatures level:int32 story_per_day_count:int32 custom_emoji_reaction_count:int32 title_color_count:int32 profile_accent_color_count:int32 can_set_profile_background_custom_emoji:Bool accent_color_count:int32 can_set_background_custom_emoji:Bool can_set_emoji_status:Bool chat_theme_background_count:int32 can_set_custom_background:Bool can_set_custom_emoji_sticker_set:Bool can_recognize_speech:Bool = ChatBoostLevelFeatures; //@description Contains a list of features available on the first chat boost levels //@features The list of features //@min_profile_background_custom_emoji_boost_level The minimum boost level required to set custom emoji for profile background -//@min_background_custom_emoji_boost_level The minimum boost level required to set custom emoji for reply header and link preview background +//@min_background_custom_emoji_boost_level The minimum boost level required to set custom emoji for reply header and link preview background; for channel chats only //@min_emoji_status_boost_level The minimum boost level required to set emoji status //@min_chat_theme_background_boost_level The minimum boost level required to set a chat theme background as chat background //@min_custom_background_boost_level The minimum boost level required to set custom chat background -chatBoostFeatures features:vector min_profile_background_custom_emoji_boost_level:int32 min_background_custom_emoji_boost_level:int32 min_emoji_status_boost_level:int32 min_chat_theme_background_boost_level:int32 min_custom_background_boost_level:int32 = ChatBoostFeatures; +//@min_custom_emoji_sticker_set_boost_level The minimum boost level required to set custom emoji sticker set for the chat; for supergroup chats only +//@min_speech_recognition_boost_level The minimum boost level allowing to recognize speech in video note and voice note messages for non-Premium users; for supergroup chats only +chatBoostFeatures features:vector min_profile_background_custom_emoji_boost_level:int32 min_background_custom_emoji_boost_level:int32 min_emoji_status_boost_level:int32 min_chat_theme_background_boost_level:int32 min_custom_background_boost_level:int32 min_custom_emoji_sticker_set_boost_level:int32 min_speech_recognition_boost_level:int32 = ChatBoostFeatures; //@class ChatBoostSource @description Describes source of a chat boost @@ -3790,7 +3809,10 @@ chatBoostStatus boost_url:string applied_slot_ids:vector level:int32 gift //@expiration_date Point in time (Unix timestamp) when the boost will expire chatBoost id:string count:int32 source:ChatBoostSource start_date:int32 expiration_date:int32 = ChatBoost; -//@description Contains a list of boosts applied to a chat @total_count Total number of boosts applied to the chat @boosts List of boosts @next_offset The offset for the next request. If empty, then there are no more results +//@description Contains a list of boosts applied to a chat +//@total_count Total number of boosts applied to the chat +//@boosts List of boosts +//@next_offset The offset for the next request. If empty, then there are no more results foundChatBoosts total_count:int32 boosts:vector next_offset:string = FoundChatBoosts; //@description Describes a slot for chat boost @@ -4051,7 +4073,7 @@ availableReaction type:ReactionType needs_premium:Bool = AvailableReaction; //@recent_reactions List of recently used reactions //@popular_reactions List of popular reactions //@allow_custom_emoji True, if any custom emoji reaction can be added by Telegram Premium subscribers -//@are_tags True, if the reactions will be tags and the message can be found by them; currently, always false +//@are_tags True, if the reactions will be tags and the message can be found by them //@unavailability_reason The reason why the current user can't add reactions to the message, despite some other users can; may be null if none availableReactions top_reactions:vector recent_reactions:vector popular_reactions:vector allow_custom_emoji:Bool are_tags:Bool unavailability_reason:ReactionUnavailabilityReason = AvailableReactions; @@ -4504,6 +4526,9 @@ chatEventSlowModeDelayChanged old_slow_mode_delay:int32 new_slow_mode_delay:int3 //@description The supergroup sticker set was changed @old_sticker_set_id Previous identifier of the chat sticker set; 0 if none @new_sticker_set_id New identifier of the chat sticker set; 0 if none chatEventStickerSetChanged old_sticker_set_id:int64 new_sticker_set_id:int64 = ChatEventAction; +//@description The supergroup sticker set with allowed custom emoji was changed @old_sticker_set_id Previous identifier of the chat sticker set; 0 if none @new_sticker_set_id New identifier of the chat sticker set; 0 if none +chatEventCustomEmojiStickerSetChanged old_sticker_set_id:int64 new_sticker_set_id:int64 = ChatEventAction; + //@description The chat title was changed @old_title Previous chat title @new_title New chat title chatEventTitleChanged old_title:string new_title:string = ChatEventAction; @@ -4777,10 +4802,20 @@ premiumFeatureAccentColor = PremiumFeature; //@description The ability to set private chat background for both users premiumFeatureBackgroundForBoth = PremiumFeature; +//@description The ability to use tags in Saved Messages +premiumFeatureSavedMessagesTags = PremiumFeature; + +//@description The ability to disallow incoming voice and video note messages in private chats using setUserPrivacySettingRules with userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages +//-and to restrict incoming messages from non-contacts using setNewChatPrivacySettings +premiumFeatureMessagePrivacy = PremiumFeature; + +//@description The ability to view last seen and read times of other users even they can't view last seen or read time for the current user +premiumFeatureLastSeenTimes = PremiumFeature; + //@class PremiumStoryFeature @description Describes a story feature available to Premium users -//@description User stories are displayed before stories of non-premium contacts and channels +//@description Stories of the current user are displayed before stories of non-Premium contacts, supergroups, and channels premiumStoryFeaturePriorityOrder = PremiumStoryFeature; //@description The ability to hide the fact that the user viewed other's stories @@ -4798,6 +4833,9 @@ premiumStoryFeatureSaveStories = PremiumStoryFeature; //@description The ability to use links and formatting in story caption premiumStoryFeatureLinksAndFormatting = PremiumStoryFeature; +//@description The ability to choose better quality for viewed stories +premiumStoryFeatureVideoQuality = PremiumStoryFeature; + //@description Contains information about a limit, increased for Premium users @type The type of the limit @default_value Default value of the limit @premium_value Value of the limit for Premium users premiumLimit type:PremiumLimitType default_value:int32 premium_value:int32 = PremiumLimit; @@ -4846,13 +4884,13 @@ storePaymentPurposePremiumSubscription is_restore:Bool is_upgrade:Bool = StorePa storePaymentPurposeGiftedPremium user_id:int53 currency:string amount:int53 = StorePaymentPurpose; //@description The user creating Telegram Premium gift codes for other users -//@boosted_chat_id Identifier of the channel chat, which will be automatically boosted by the users for duration of the Premium subscription and which is administered by the user; 0 if none +//@boosted_chat_id Identifier of the supergroup or channel chat, which will be automatically boosted by the users for duration of the Premium subscription and which is administered by the user; 0 if none //@currency ISO 4217 currency code of the payment currency //@amount Paid amount, in the smallest units of the currency //@user_ids Identifiers of the users which can activate the gift codes storePaymentPurposePremiumGiftCodes boosted_chat_id:int53 currency:string amount:int53 user_ids:vector = StorePaymentPurpose; -//@description The user creating a Telegram Premium giveaway for subscribers of channel chats; requires can_post_messages rights in the channels +//@description The user creating a Telegram Premium giveaway //@parameters Giveaway parameters //@currency ISO 4217 currency code of the payment currency //@amount Paid amount, in the smallest units of the currency @@ -4862,14 +4900,14 @@ storePaymentPurposePremiumGiveaway parameters:premiumGiveawayParameters currency //@class TelegramPaymentPurpose @description Describes a purpose of a payment toward Telegram //@description The user creating Telegram Premium gift codes for other users -//@boosted_chat_id Identifier of the channel chat, which will be automatically boosted by the users for duration of the Premium subscription and which is administered by the user; 0 if none +//@boosted_chat_id Identifier of the supergroup or channel chat, which will be automatically boosted by the users for duration of the Premium subscription and which is administered by the user; 0 if none //@currency ISO 4217 currency code of the payment currency //@amount Paid amount, in the smallest units of the currency //@user_ids Identifiers of the users which can activate the gift codes //@month_count Number of months the Telegram Premium subscription will be active for the users telegramPaymentPurposePremiumGiftCodes boosted_chat_id:int53 currency:string amount:int53 user_ids:vector month_count:int32 = TelegramPaymentPurpose; -//@description The user creating a Telegram Premium giveaway for subscribers of channel chats; requires can_post_messages rights in the channels +//@description The user creating a Telegram Premium giveaway //@parameters Giveaway parameters //@currency ISO 4217 currency code of the payment currency //@amount Paid amount, in the smallest units of the currency @@ -5001,7 +5039,7 @@ canSendStoryResultOk = CanSendStoryResult; //@description The user must subscribe to Telegram Premium to be able to post stories canSendStoryResultPremiumNeeded = CanSendStoryResult; -//@description The channel chat must be boosted first by Telegram Premium subscribers to post more stories. Call getChatBoostStatus to get current boost status of the chat +//@description The chat must be boosted first by Telegram Premium subscribers to post more stories. Call getChatBoostStatus to get current boost status of the chat canSendStoryResultBoostNeeded = CanSendStoryResult; //@description The limit for the number of active stories exceeded. The user can buy Telegram Premium, delete an active story, or wait for the oldest story to expire @@ -5396,7 +5434,7 @@ userPrivacySettingAllowPeerToPeerCalls = UserPrivacySetting; //@description A privacy setting for managing whether the user can be found by their phone number. Checked only if the phone number is not known to the other user. Can be set only to "Allow contacts" or "Allow all" userPrivacySettingAllowFindingByPhoneNumber = UserPrivacySetting; -//@description A privacy setting for managing whether the user can receive voice and video messages in private chats +//@description A privacy setting for managing whether the user can receive voice and video messages in private chats; for Telegram Premium users only userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages = UserPrivacySetting; @@ -6432,7 +6470,7 @@ updateChatAvailableReactions chat_id:int53 available_reactions:ChatAvailableReac //@description A chat draft has changed. Be aware that the update may come in the currently opened chat but with old content of the draft. If the user has changed the content of the draft, this update mustn't be applied //@chat_id Chat identifier -//@draft_message The new draft message; may be null +//@draft_message The new draft message; may be null if none //@positions The new chat positions in the chat lists updateChatDraftMessage chat_id:int53 draft_message:draftMessage positions:vector = Update; @@ -6503,8 +6541,12 @@ updateChatFolders chat_folders:vector main_chat_list_position:in //@online_member_count New number of online members in the chat, or 0 if unknown updateChatOnlineMemberCount chat_id:int53 online_member_count:int32 = Update; -//@description The list of pinned Saved Messages topics has changed. The app can call getPinnedSavedMessagesTopics to get the new list -updatePinnedSavedMessagesTopics = Update; +//@description Basic information about a Saved Messages topic has changed. This update is guaranteed to come before the topic identifier is returned to the application +//@topic New data about the topic +updateSavedMessagesTopic topic:savedMessagesTopic = Update; + +//@description Number of Saved Messages topics has changed @topic_count Approximate total number of Saved Messages topics +updateSavedMessagesTopicCount topic_count:int32 = Update; //@description Basic information about a topic in a forum chat was changed @chat_id Chat identifier @info New information about the topic updateForumTopicInfo chat_id:int53 info:forumTopicInfo = Update; @@ -6543,7 +6585,7 @@ updateDeleteMessages chat_id:int53 message_ids:vector is_permanent:Bool f //@description A message sender activity in the chat has changed //@chat_id Chat identifier -//@message_thread_id If not 0, a message thread identifier in which the action was performed +//@message_thread_id If not 0, the message thread identifier in which the action was performed //@sender_id Identifier of a message sender performing the action //@action The action updateChatAction chat_id:int53 message_thread_id:int53 sender_id:MessageSender action:ChatAction = Update; @@ -6736,8 +6778,10 @@ updateActiveEmojiReactions emojis:vector = Update; //@description The type of default reaction has changed @reaction_type The new type of the default reaction updateDefaultReactionType reaction_type:ReactionType = Update; -//@description Used Saved Messages tags have changed @tags The new used tags -updateSavedMessagesTags tags:savedMessagesTags = Update; +//@description Tags used in Saved Messages or a Saved Messages topic have changed +//@saved_messages_topic_id Identifier of Saved Messages topic which tags were changed; 0 if tags for the whole chat has changed +//@tags The new tags +updateSavedMessagesTags saved_messages_topic_id:int53 tags:savedMessagesTags = Update; //@description The parameters of speech recognition without Telegram Premium subscription has changed //@max_media_duration The maximum allowed duration of media for speech recognition without Telegram Premium subscription @@ -6967,7 +7011,8 @@ requestQrCodeAuthentication other_user_ids:vector = Ok; //@description Finishes user registration. Works only when the current authorization state is authorizationStateWaitRegistration //@first_name The first name of the user; 1-64 characters //@last_name The last name of the user; 0-64 characters -registerUser first_name:string last_name:string = Ok; +//@disable_notification Pass true to disable notification about the current user joining Telegram for other users that added them to contact list +registerUser first_name:string last_name:string disable_notification:Bool = Ok; //@description Resets the login email address. May return an error with a message "TASK_ALREADY_EXISTS" if reset is still pending. //-Works only when the current authorization state is authorizationStateWaitEmailCode and authorization_state.can_reset_email_address == true @@ -7238,43 +7283,39 @@ getSuitableDiscussionChats = Chats; getInactiveSupergroupChats = Chats; -//@description Returns list of all pinned Saved Messages topics -getPinnedSavedMessagesTopics = FoundSavedMessagesTopics; - -//@description Returns list of non-pinned Saved Messages topics from the specified offset -//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results -//@limit The maximum number of Saved Messages topics to be returned; up to 100 -getSavedMessagesTopics offset:string limit:int32 = FoundSavedMessagesTopics; +//@description Loads more Saved Messages topics. The loaded topics will be sent through updateSavedMessagesTopic. Topics are sorted by their topic.order in descending order. Returns a 404 error if all topics have been loaded +//@limit The maximum number of topics to be loaded. For optimal performance, the number of loaded topics is chosen by TDLib and can be smaller than the specified limit, even if the end of the list is not reached +loadSavedMessagesTopics limit:int32 = Ok; //@description Returns messages in a Saved Messages topic. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id) -//@saved_messages_topic Saved Messages topic which messages will be fetched +//@saved_messages_topic_id Identifier of Saved Messages topic which messages will be fetched //@from_message_id Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message //@offset Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages //@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit -getSavedMessagesTopicHistory saved_messages_topic:SavedMessagesTopic from_message_id:int53 offset:int32 limit:int32 = Messages; +getSavedMessagesTopicHistory saved_messages_topic_id:int53 from_message_id:int53 offset:int32 limit:int32 = Messages; //@description Returns the last message sent in a Saved Messages topic no later than the specified date -//@saved_messages_topic Saved Messages topic which message will be returned +//@saved_messages_topic_id Identifier of Saved Messages topic which message will be returned //@date Point in time (Unix timestamp) relative to which to search for messages -getSavedMessagesTopicMessageByDate saved_messages_topic:SavedMessagesTopic date:int32 = Message; +getSavedMessagesTopicMessageByDate saved_messages_topic_id:int53 date:int32 = Message; -//@description Deletes all messages in a Saved Messages topic @saved_messages_topic Saved Messages topic which messages will be deleted -deleteSavedMessagesTopicHistory saved_messages_topic:SavedMessagesTopic = Ok; +//@description Deletes all messages in a Saved Messages topic @saved_messages_topic_id Identifier of Saved Messages topic which messages will be deleted +deleteSavedMessagesTopicHistory saved_messages_topic_id:int53 = Ok; //@description Deletes all messages between the specified dates in a Saved Messages topic. Messages sent in the last 30 seconds will not be deleted -//@saved_messages_topic Saved Messages topic which messages will be deleted +//@saved_messages_topic_id Identifier of Saved Messages topic which messages will be deleted //@min_date The minimum date of the messages to delete //@max_date The maximum date of the messages to delete -deleteSavedMessagesTopicMessagesByDate saved_messages_topic:SavedMessagesTopic min_date:int32 max_date:int32 = Ok; +deleteSavedMessagesTopicMessagesByDate saved_messages_topic_id:int53 min_date:int32 max_date:int32 = Ok; //@description Changes the pinned state of a Saved Messages topic. There can be up to getOption("pinned_saved_messages_topic_count_max") pinned topics. The limit can be increased with Telegram Premium -//@saved_messages_topic Saved Messages topic to pin or unpin +//@saved_messages_topic_id Identifier of Saved Messages topic to pin or unpin //@is_pinned Pass true to pin the topic; pass false to unpin it -toggleSavedMessagesTopicIsPinned saved_messages_topic:SavedMessagesTopic is_pinned:Bool = Ok; +toggleSavedMessagesTopicIsPinned saved_messages_topic_id:int53 is_pinned:Bool = Ok; -//@description Changes the order of pinned Saved Messages topics @saved_messages_topics The new list of pinned Saved Messages topics -setPinnedSavedMessagesTopics saved_messages_topics:vector = Ok; +//@description Changes the order of pinned Saved Messages topics @saved_messages_topic_ids Identifiers of the new pinned Saved Messages topics +setPinnedSavedMessagesTopics saved_messages_topic_ids:vector = Ok; //@description Returns a list of common group chats with a given user. Chats are sorted by their type and creation date @@ -7327,8 +7368,8 @@ deleteChat chat_id:int53 = Ok; //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit //@filter Additional filter for messages to search; pass null to search for all messages //@message_thread_id If not 0, only messages in the specified thread will be returned; supergroups only -//@saved_messages_topic If not null, only messages in the specified Saved Messages topic will be returned; pass null to return all messages, or for chats other than Saved Messages -searchChatMessages chat_id:int53 query:string sender_id:MessageSender from_message_id:int53 offset:int32 limit:int32 filter:SearchMessagesFilter message_thread_id:int53 saved_messages_topic:SavedMessagesTopic = FoundChatMessages; +//@saved_messages_topic_id If not 0, only messages in the specified Saved Messages topic will be returned; pass 0 to return all messages, or for chats other than Saved Messages +searchChatMessages chat_id:int53 query:string sender_id:MessageSender from_message_id:int53 offset:int32 limit:int32 filter:SearchMessagesFilter message_thread_id:int53 saved_messages_topic_id:int53 = FoundChatMessages; //@description Searches for messages in all chats except secret chats. Returns the results in reverse chronological order (i.e., in order of decreasing (date, chat_id, message_id)). //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit @@ -7352,13 +7393,14 @@ searchSecretMessages chat_id:int53 query:string offset:string limit:int32 filter //@description Searches for messages tagged by the given reaction and with the given words in the Saved Messages chat; for Telegram Premium users only. //-Returns the results in reverse chronological order, i.e. in order of decreasing message_id //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit +//@saved_messages_topic_id If not 0, only messages in the specified Saved Messages topic will be considered; pass 0 to consider all messages //@tag Tag to search for; pass null to return all suitable messages //@query Query to search for //@from_message_id Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message //@offset Specify 0 to get results from exactly the message from_message_id or a negative offset to get the specified message and some newer messages //@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than -offset. //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit -searchSavedMessages tag:ReactionType query:string from_message_id:int53 offset:int32 limit:int32 = FoundChatMessages; +searchSavedMessages saved_messages_topic_id:int53 tag:ReactionType query:string from_message_id:int53 offset:int32 limit:int32 = FoundChatMessages; //@description Searches for call messages. Returns the results in reverse chronological order (i.e., in order of decreasing message_id). For optimal performance, the number of returned messages is chosen by TDLib //@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results @@ -7389,30 +7431,30 @@ getChatMessageByDate chat_id:int53 date:int32 = Message; //@filter Filter for message content. Filters searchMessagesFilterEmpty, searchMessagesFilterMention, searchMessagesFilterUnreadMention, and searchMessagesFilterUnreadReaction are unsupported in this function //@from_message_id The message identifier from which to return information about message positions //@limit The expected number of message positions to be returned; 50-2000. A smaller number of positions can be returned, if there are not enough appropriate messages -//@saved_messages_topic If not null, only messages in the specified Saved Messages topic will be considered; pass null to consider all messages, or for chats other than Saved Messages -getChatSparseMessagePositions chat_id:int53 filter:SearchMessagesFilter from_message_id:int53 limit:int32 saved_messages_topic:SavedMessagesTopic = MessagePositions; +//@saved_messages_topic_id If not 0, only messages in the specified Saved Messages topic will be considered; pass 0 to consider all messages, or for chats other than Saved Messages +getChatSparseMessagePositions chat_id:int53 filter:SearchMessagesFilter from_message_id:int53 limit:int32 saved_messages_topic_id:int53 = MessagePositions; //@description Returns information about the next messages of the specified type in the chat split by days. Returns the results in reverse chronological order. Can return partial result for the last returned day. Behavior of this method depends on the value of the option "utc_time_offset" //@chat_id Identifier of the chat in which to return information about messages //@filter Filter for message content. Filters searchMessagesFilterEmpty, searchMessagesFilterMention, searchMessagesFilterUnreadMention, and searchMessagesFilterUnreadReaction are unsupported in this function //@from_message_id The message identifier from which to return information about messages; use 0 to get results from the last message -//@saved_messages_topic If not null, only messages in the specified Saved Messages topic will be considered; pass null to consider all messages, or for chats other than Saved Messages -getChatMessageCalendar chat_id:int53 filter:SearchMessagesFilter from_message_id:int53 saved_messages_topic:SavedMessagesTopic = MessageCalendar; +//@saved_messages_topic_id If not0, only messages in the specified Saved Messages topic will be considered; pass 0 to consider all messages, or for chats other than Saved Messages +getChatMessageCalendar chat_id:int53 filter:SearchMessagesFilter from_message_id:int53 saved_messages_topic_id:int53 = MessageCalendar; //@description Returns approximate number of messages of the specified type in the chat //@chat_id Identifier of the chat in which to count messages //@filter Filter for message content; searchMessagesFilterEmpty is unsupported in this function -//@saved_messages_topic If not null, only messages in the specified Saved Messages topic will be counted; pass null to count all messages, or for chats other than Saved Messages +//@saved_messages_topic_id If not 0, only messages in the specified Saved Messages topic will be counted; pass 0 to count all messages, or for chats other than Saved Messages //@return_local Pass true to get the number of messages without sending network requests, or -1 if the number of messages is unknown locally -getChatMessageCount chat_id:int53 filter:SearchMessagesFilter saved_messages_topic:SavedMessagesTopic return_local:Bool = Count; +getChatMessageCount chat_id:int53 filter:SearchMessagesFilter saved_messages_topic_id:int53 return_local:Bool = Count; //@description Returns approximate 1-based position of a message among messages, which can be found by the specified filter in the chat. Cannot be used in secret chats //@chat_id Identifier of the chat in which to find message position //@message_id Message identifier //@filter Filter for message content; searchMessagesFilterEmpty, searchMessagesFilterUnreadMention, searchMessagesFilterUnreadReaction, and searchMessagesFilterFailedToSend are unsupported in this function //@message_thread_id If not 0, only messages in the specified thread will be considered; supergroups only -//@saved_messages_topic If not null, only messages in the specified Saved Messages topic will be considered; pass null to consider all relevant messages, or for chats other than Saved Messages -getChatMessagePosition chat_id:int53 message_id:int53 filter:SearchMessagesFilter message_thread_id:int53 saved_messages_topic:SavedMessagesTopic = Count; +//@saved_messages_topic_id If not 0, only messages in the specified Saved Messages topic will be considered; pass 0 to consider all relevant messages, or for chats other than Saved Messages +getChatMessagePosition chat_id:int53 message_id:int53 filter:SearchMessagesFilter message_thread_id:int53 saved_messages_topic_id:int53 = Count; //@description Returns all scheduled messages in a chat. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id) @chat_id Chat identifier getChatScheduledMessages chat_id:int53 = Messages; @@ -7487,7 +7529,7 @@ setChatMessageSender chat_id:int53 message_sender_id:MessageSender = Ok; //@description Sends a message. Returns the sent message //@chat_id Target chat -//@message_thread_id If not 0, a message thread identifier in which the message will be sent +//@message_thread_id If not 0, the message thread identifier in which the message will be sent //@reply_to Information about the message or story to be replied; pass null if none //@options Options to be used to send the message; pass null to use default options //@reply_markup Markup for replying to the message; pass null if none; for bots only @@ -7496,13 +7538,14 @@ sendMessage chat_id:int53 message_thread_id:int53 reply_to:InputMessageReplyTo o //@description Sends 2-10 messages grouped together into an album. Currently, only audio, document, photo and video messages can be grouped into an album. Documents and audio files can be only grouped in an album with messages of the same type. Returns sent messages //@chat_id Target chat -//@message_thread_id If not 0, a message thread identifier in which the messages will be sent +//@message_thread_id If not 0, the message thread identifier in which the messages will be sent //@reply_to Information about the message or story to be replied; pass null if none //@options Options to be used to send the messages; pass null to use default options //@input_message_contents Contents of messages to be sent. At most 10 messages can be added to an album sendMessageAlbum chat_id:int53 message_thread_id:int53 reply_to:InputMessageReplyTo options:messageSendOptions input_message_contents:vector = Messages; -//@description Invites a bot to a chat (if it is not yet a member) and sends it the /start command. Bots can't be invited to a private chat other than the chat with the bot. Bots can't be invited to channels (although they can be added as admins) and secret chats. Returns the sent message +//@description Invites a bot to a chat (if it is not yet a member) and sends it the /start command; requires can_invite_users member right. Bots can't be invited to a private chat other than the chat with the bot. +//-Bots can't be invited to channels (although they can be added as admins) and secret chats. Returns the sent message //@bot_user_id Identifier of the bot //@chat_id Identifier of the target chat //@parameter A hidden parameter sent to the bot for deep linking purposes (https://core.telegram.org/bots#deep-linking) @@ -7510,7 +7553,7 @@ sendBotStartMessage bot_user_id:int53 chat_id:int53 parameter:string = Message; //@description Sends the result of an inline query as a message. Returns the sent message. Always clears a chat draft message //@chat_id Target chat -//@message_thread_id If not 0, a message thread identifier in which the message will be sent +//@message_thread_id If not 0, the message thread identifier in which the message will be sent //@reply_to Information about the message or story to be replied; pass null if none //@options Options to be used to send the message; pass null to use default options //@query_id Identifier of the inline query @@ -7520,7 +7563,7 @@ sendInlineQueryResultMessage chat_id:int53 message_thread_id:int53 reply_to:Inpu //@description Forwards previously sent messages. Returns the forwarded messages in the same order as the message identifiers passed in message_ids. If a message can't be forwarded, null will be returned instead of the message //@chat_id Identifier of the chat to which to forward messages -//@message_thread_id If not 0, a message thread identifier in which the message will be sent; for forum threads only +//@message_thread_id If not 0, the message thread identifier in which the message will be sent; for forum threads only //@from_chat_id Identifier of the chat from which to forward messages //@message_ids Identifiers of the messages to forward. Message identifiers must be in a strictly increasing order. At most 100 messages can be forwarded simultaneously. A message can be forwarded only if message.can_be_forwarded //@options Options to be used to send the messages; pass null to use default options @@ -7638,7 +7681,7 @@ editMessageSchedulingState chat_id:int53 message_id:int53 scheduling_state:Messa //@description Returns list of custom emojis, which can be used as forum topic icon by all users getForumTopicDefaultIcons = Stickers; -//@description Creates a topic in a forum supergroup chat; requires can_manage_topics or can_create_topics rights in the supergroup +//@description Creates a topic in a forum supergroup chat; requires can_manage_topics administrator or can_create_topics member right in the supergroup //@chat_id Identifier of the chat //@name Name of the topic; 1-128 characters //@icon Icon of the topic. Icon color must be one of 0x6FB9F0, 0xFFD67E, 0xCB86DB, 0x8EEE98, 0xFF93B2, or 0xFB6F5F. Telegram Premium users can use any custom emoji as topic icon, other users can use only a custom emoji returned by getForumTopicDefaultIcons @@ -7746,8 +7789,9 @@ getMessageAddedReactions chat_id:int53 message_id:int53 reaction_type:ReactionTy //@description Changes type of default reaction for the current user @reaction_type New type of the default reaction setDefaultReactionType reaction_type:ReactionType = Ok; -//@description Returns tags used in Saved Messages; for Telegram Premium users only -getSavedMessagesTags = SavedMessagesTags; +//@description Returns tags used in Saved Messages or a Saved Messages topic +//@saved_messages_topic_id Identifier of Saved Messages topic which tags will be returned; pass 0 to get all Saved Messages tags +getSavedMessagesTags saved_messages_topic_id:int53 = SavedMessagesTags; //@description Changes label of a Saved Messages tag; for Telegram Premium users only @tag The tag which label will be changed @label New label for the tag; 0-12 characters setSavedMessagesTagLabel tag:ReactionType label:string = Ok; @@ -7913,7 +7957,7 @@ sendWebAppData bot_user_id:int53 button_text:string data:string = Ok; //@url The URL from an inlineKeyboardButtonTypeWebApp button, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an empty string otherwise //@theme Preferred Web App theme; pass null to use the default theme //@application_name Short name of the application; 0-64 English letters, digits, and underscores -//@message_thread_id If not 0, a message thread identifier in which the message will be sent +//@message_thread_id If not 0, the message thread identifier in which the message will be sent //@reply_to Information about the message or story to be replied in the message sent by the Web App; pass null if none openWebApp chat_id:int53 bot_user_id:int53 url:string theme:themeParameters application_name:string message_thread_id:int53 reply_to:InputMessageReplyTo = WebAppInfo; @@ -7978,7 +8022,7 @@ getInlineGameHighScores inline_message_id:string user_id:int53 = GameHighScores; deleteChatReplyMarkup chat_id:int53 message_id:int53 = Ok; -//@description Sends a notification about user activity in a chat @chat_id Chat identifier @message_thread_id If not 0, a message thread identifier in which the action was performed @action The action description; pass null to cancel the currently active action +//@description Sends a notification about user activity in a chat @chat_id Chat identifier @message_thread_id If not 0, the message thread identifier in which the action was performed @action The action description; pass null to cancel the currently active action sendChatAction chat_id:int53 message_thread_id:int53 action:ChatAction = Ok; @@ -8064,7 +8108,7 @@ createNewSupergroupChat title:string is_forum:Bool is_channel:Bool description:s //@description Creates a new secret chat. Returns the newly created chat @user_id Identifier of the target user createNewSecretChat user_id:int53 = Chat; -//@description Creates a new supergroup from an existing basic group and sends a corresponding messageChatUpgradeTo and messageChatUpgradeFrom; requires creator privileges. Deactivates the original basic group @chat_id Identifier of the chat to upgrade +//@description Creates a new supergroup from an existing basic group and sends a corresponding messageChatUpgradeTo and messageChatUpgradeFrom; requires owner privileges. Deactivates the original basic group @chat_id Identifier of the chat to upgrade upgradeBasicGroupChatToSupergroupChat chat_id:int53 = Chat; @@ -8146,25 +8190,26 @@ getArchiveChatListSettings = ArchiveChatListSettings; setArchiveChatListSettings settings:archiveChatListSettings = Ok; -//@description Changes the chat title. Supported only for basic groups, supergroups and channels. Requires can_change_info administrator right +//@description Changes the chat title. Supported only for basic groups, supergroups and channels. Requires can_change_info member right //@chat_id Chat identifier //@title New title of the chat; 1-128 characters setChatTitle chat_id:int53 title:string = Ok; -//@description Changes the photo of a chat. Supported only for basic groups, supergroups and channels. Requires can_change_info administrator right +//@description Changes the photo of a chat. Supported only for basic groups, supergroups and channels. Requires can_change_info member right //@chat_id Chat identifier //@photo New chat photo; pass null to delete the chat photo setChatPhoto chat_id:int53 photo:InputChatPhoto = Ok; -//@description Changes accent color and background custom emoji of a chat. Requires can_change_info administrator right +//@description Changes accent color and background custom emoji of a channel chat. Requires can_change_info administrator right //@chat_id Chat identifier -//@accent_color_id Identifier of the accent color to use. The chat must have at least accentColor.min_chat_boost_level boost level to pass the corresponding color +//@accent_color_id Identifier of the accent color to use. The chat must have at least accentColor.min_channel_chat_boost_level boost level to pass the corresponding color //@background_custom_emoji_id Identifier of a custom emoji to be shown on the reply header and link preview background; 0 if none. Use chatBoostLevelFeatures.can_set_background_custom_emoji to check whether a custom emoji can be set setChatAccentColor chat_id:int53 accent_color_id:int32 background_custom_emoji_id:int64 = Ok; -//@description Changes accent color and background custom emoji for profile of a chat. Requires can_change_info administrator right +//@description Changes accent color and background custom emoji for profile of a supergroup or channel chat. Requires can_change_info administrator right //@chat_id Chat identifier -//@profile_accent_color_id Identifier of the accent color to use for profile; pass -1 if none. The chat must have at least profileAccentColor.min_chat_boost_level boost level to pass the corresponding color +//@profile_accent_color_id Identifier of the accent color to use for profile; pass -1 if none. The chat must have at least profileAccentColor.min_supergroup_chat_boost_level for supergroups +//-or profileAccentColor.min_channel_chat_boost_level for channels boost level to pass the corresponding color //@profile_background_custom_emoji_id Identifier of a custom emoji to be shown on the chat's profile photo background; 0 if none. Use chatBoostLevelFeatures.can_set_profile_background_custom_emoji to check whether a custom emoji can be set setChatProfileAccentColor chat_id:int53 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 = Ok; @@ -8202,7 +8247,10 @@ deleteChatBackground chat_id:int53 restore_previous:Bool = Ok; //@description Changes the chat theme. Supported only in private and secret chats @chat_id Chat identifier @theme_name Name of the new chat theme; pass an empty string to return the default theme setChatTheme chat_id:int53 theme_name:string = Ok; -//@description Changes the draft message in a chat @chat_id Chat identifier @message_thread_id If not 0, a message thread identifier in which the draft was changed @draft_message New draft message; pass null to remove the draft +//@description Changes the draft message in a chat +//@chat_id Chat identifier +//@message_thread_id If not 0, the message thread identifier in which the draft was changed +//@draft_message New draft message; pass null to remove the draft. All files in draft message content must be of the type inputFileLocal. Media thumbnails and captions are ignored setChatDraftMessage chat_id:int53 message_thread_id:int53 draft_message:draftMessage = Ok; //@description Changes the notification settings of a chat. Notification settings of a chat with the current user (Saved Messages) can't be changed @@ -8215,7 +8263,7 @@ setChatNotificationSettings chat_id:int53 notification_settings:chatNotification //@has_protected_content New value of has_protected_content toggleChatHasProtectedContent chat_id:int53 has_protected_content:Bool = Ok; -//@description Changes the view_as_topics setting of a forum chat @chat_id Chat identifier @view_as_topics New value of view_as_topics +//@description Changes the view_as_topics setting of a forum chat or Saved Messages @chat_id Chat identifier @view_as_topics New value of view_as_topics toggleChatViewAsTopics chat_id:int53 view_as_topics:Bool = Ok; //@description Changes the translatable state of a chat @chat_id Chat identifier @is_translatable New value of is_translatable @@ -8227,19 +8275,19 @@ toggleChatIsMarkedAsUnread chat_id:int53 is_marked_as_unread:Bool = Ok; //@description Changes the value of the default disable_notification parameter, used when a message is sent to a chat @chat_id Chat identifier @default_disable_notification New value of default_disable_notification toggleChatDefaultDisableNotification chat_id:int53 default_disable_notification:Bool = Ok; -//@description Changes reactions, available in a chat. Available for basic groups, supergroups, and channels. Requires can_change_info administrator right +//@description Changes reactions, available in a chat. Available for basic groups, supergroups, and channels. Requires can_change_info member right //@chat_id Identifier of the chat -//@available_reactions Reactions available in the chat. All explicitly specified emoji reactions must be active. Up to the chat's boost level custom emoji reactions can be explicitly specified +//@available_reactions Reactions available in the chat. All explicitly specified emoji reactions must be active. In channel chats up to the chat's boost level custom emoji reactions can be explicitly specified setChatAvailableReactions chat_id:int53 available_reactions:ChatAvailableReactions = Ok; //@description Changes application-specific data associated with a chat @chat_id Chat identifier @client_data New value of client_data setChatClientData chat_id:int53 client_data:string = Ok; -//@description Changes information about a chat. Available for basic groups, supergroups, and channels. Requires can_change_info administrator right @chat_id Identifier of the chat @param_description New chat description; 0-255 characters +//@description Changes information about a chat. Available for basic groups, supergroups, and channels. Requires can_change_info member right @chat_id Identifier of the chat @param_description New chat description; 0-255 characters setChatDescription chat_id:int53 description:string = Ok; //@description Changes the discussion group of a channel chat; requires can_change_info administrator right in the channel if it is specified -//@chat_id Identifier of the channel chat. Pass 0 to remove a link from the supergroup passed in the second argument to a linked channel chat (requires can_pin_messages rights in the supergroup) +//@chat_id Identifier of the channel chat. Pass 0 to remove a link from the supergroup passed in the second argument to a linked channel chat (requires can_pin_messages member right in the supergroup) //@discussion_chat_id Identifier of a new channel's discussion group. Use 0 to remove the discussion group. Use the method getSuitableDiscussionChats to find all suitable groups. //-Basic group chats must be first upgraded to supergroup chats. If new chat members don't have access to old messages in the supergroup, then toggleSupergroupIsAllHistoryAvailable must be used first to change that setChatDiscussionGroup chat_id:int53 discussion_chat_id:int53 = Ok; @@ -8247,23 +8295,23 @@ setChatDiscussionGroup chat_id:int53 discussion_chat_id:int53 = Ok; //@description Changes the location of a chat. Available only for some location-based supergroups, use supergroupFullInfo.can_set_location to check whether the method is allowed to use @chat_id Chat identifier @location New location for the chat; must be valid and not null setChatLocation chat_id:int53 location:chatLocation = Ok; -//@description Changes the slow mode delay of a chat. Available only for supergroups; requires can_restrict_members rights @chat_id Chat identifier @slow_mode_delay New slow mode delay for the chat, in seconds; must be one of 0, 10, 30, 60, 300, 900, 3600 +//@description Changes the slow mode delay of a chat. Available only for supergroups; requires can_restrict_members right @chat_id Chat identifier @slow_mode_delay New slow mode delay for the chat, in seconds; must be one of 0, 10, 30, 60, 300, 900, 3600 setChatSlowModeDelay chat_id:int53 slow_mode_delay:int32 = Ok; -//@description Pins a message in a chat; requires can_pin_messages rights or can_edit_messages rights in the channel +//@description Pins a message in a chat; requires can_pin_messages member right if the chat is a basic group or supergroup, or can_edit_messages administrator right if the chat is a channel //@chat_id Identifier of the chat //@message_id Identifier of the new pinned message //@disable_notification Pass true to disable notification about the pinned message. Notifications are always disabled in channels and private chats //@only_for_self Pass true to pin the message only for self; private chats only pinChatMessage chat_id:int53 message_id:int53 disable_notification:Bool only_for_self:Bool = Ok; -//@description Removes a pinned message from a chat; requires can_pin_messages rights in the group or can_edit_messages rights in the channel @chat_id Identifier of the chat @message_id Identifier of the removed pinned message +//@description Removes a pinned message from a chat; requires can_pin_messages member right if the chat is a basic group or supergroup, or can_edit_messages administrator right if the chat is a channel @chat_id Identifier of the chat @message_id Identifier of the removed pinned message unpinChatMessage chat_id:int53 message_id:int53 = Ok; -//@description Removes all pinned messages from a chat; requires can_pin_messages rights in the group or can_edit_messages rights in the channel @chat_id Identifier of the chat +//@description Removes all pinned messages from a chat; requires can_pin_messages member right if the chat is a basic group or supergroup, or can_edit_messages administrator right if the chat is a channel @chat_id Identifier of the chat unpinAllChatMessages chat_id:int53 = Ok; -//@description Removes all pinned messages from a forum topic; requires can_pin_messages rights in the supergroup +//@description Removes all pinned messages from a forum topic; requires can_pin_messages member right in the supergroup //@chat_id Identifier of the chat //@message_thread_id Message thread identifier in which messages will be unpinned unpinAllMessageThreadMessages chat_id:int53 message_thread_id:int53 = Ok; @@ -8275,24 +8323,26 @@ joinChat chat_id:int53 = Ok; //@description Removes the current user from chat members. Private and secret chats can't be left using this method @chat_id Chat identifier leaveChat chat_id:int53 = Ok; -//@description Adds a new member to a chat. Members can't be added to private or secret chats +//@description Adds a new member to a chat; requires can_invite_users member right. Members can't be added to private or secret chats //@chat_id Chat identifier //@user_id Identifier of the user //@forward_limit The number of earlier messages from the chat to be forwarded to the new member; up to 100. Ignored for supergroups and channels, or if the added user is a bot addChatMember chat_id:int53 user_id:int53 forward_limit:int32 = Ok; -//@description Adds multiple new members to a chat. Currently, this method is only available for supergroups and channels. This method can't be used to join a chat. Members can't be added to a channel if it has more than 200 members +//@description Adds multiple new members to a chat; requires can_invite_users member right. Currently, this method is only available for supergroups and channels. This method can't be used to join a chat. Members can't be added to a channel if it has more than 200 members //@chat_id Chat identifier //@user_ids Identifiers of the users to be added to the chat. The maximum number of added users is 20 for supergroups and 100 for channels addChatMembers chat_id:int53 user_ids:vector = Ok; -//@description Changes the status of a chat member, needs appropriate privileges. This function is currently not suitable for transferring chat ownership; use transferChatOwnership instead. Use addChatMember or banChatMember if some additional parameters needs to be passed +//@description Changes the status of a chat member; requires can_invite_users member right to add a chat member, can_promote_members administrator right to change administrator rights of the member, +//-and can_restrict_members administrator right to change restrictions of a user. This function is currently not suitable for transferring chat ownership; use transferChatOwnership instead. +//-Use addChatMember or banChatMember if some additional parameters needs to be passed //@chat_id Chat identifier //@member_id Member identifier. Chats can be only banned and unbanned in supergroups and channels //@status The new status of the member in the chat setChatMemberStatus chat_id:int53 member_id:MessageSender status:ChatMemberStatus = Ok; -//@description Bans a member in a chat. Members can't be banned in private or secret chats. In supergroups and channels, the user will not be able to return to the group on their own using invite links, etc., unless unbanned first +//@description Bans a member in a chat; requires can_restrict_members administrator right. Members can't be banned in private or secret chats. In supergroups and channels, the user will not be able to return to the group on their own using invite links, etc., unless unbanned first //@chat_id Chat identifier //@member_id Member identifier //@banned_until_date Point in time (Unix timestamp) when the user will be unbanned; 0 if never. If the user is banned for more than 366 days or for less than 30 seconds from the current time, the user is considered to be banned forever. Ignored in basic groups and if a chat is banned @@ -8302,7 +8352,7 @@ banChatMember chat_id:int53 member_id:MessageSender banned_until_date:int32 revo //@description Checks whether the current session can be used to transfer a chat ownership to another user canTransferOwnership = CanTransferOwnershipResult; -//@description Changes the owner of a chat. The current user must be a current owner of the chat. Use the method canTransferOwnership to check whether the ownership can be transferred from the current session. Available only for supergroups and channel chats +//@description Changes the owner of a chat; requires owner privileges in the chat. Use the method canTransferOwnership to check whether the ownership can be transferred from the current session. Available only for supergroups and channel chats //@chat_id Chat identifier //@user_id Identifier of the user to which transfer the ownership. The ownership can't be transferred to a bot or to a deleted user //@password The 2-step verification password of the current user @@ -8311,7 +8361,7 @@ transferChatOwnership chat_id:int53 user_id:int53 password:string = Ok; //@description Returns information about a single member of a chat @chat_id Chat identifier @member_id Member identifier getChatMember chat_id:int53 member_id:MessageSender = ChatMember; -//@description Searches for a specified query in the first name, last name and usernames of the members of a specified chat. Requires administrator rights in channels +//@description Searches for a specified query in the first name, last name and usernames of the members of a specified chat. Requires administrator rights if the chat is a channel //@chat_id Chat identifier //@query Query to search for //@limit The maximum number of users to be returned; up to 200 @@ -8373,18 +8423,18 @@ readChatList chat_list:ChatList = Ok; //@only_local Pass true to get only locally available information without sending network requests getStory story_sender_chat_id:int53 story_id:int32 only_local:Bool = Story; -//@description Returns channel chats in which the current user has the right to post stories. The chats must be rechecked with canSendStory before actually trying to post a story there +//@description Returns supergroup and channel chats in which the current user has the right to post stories. The chats must be rechecked with canSendStory before actually trying to post a story there getChatsToSendStories = Chats; -//@description Checks whether the current user can send a story on behalf of a chat; requires can_post_stories rights for channel chats @chat_id Chat identifier +//@description Checks whether the current user can send a story on behalf of a chat; requires can_post_stories right for supergroup and channel chats @chat_id Chat identifier canSendStory chat_id:int53 = CanSendStoryResult; -//@description Sends a new story to a chat; requires can_post_stories rights for channel chats. Returns a temporary story +//@description Sends a new story to a chat; requires can_post_stories right for supergroup and channel chats. Returns a temporary story //@chat_id Identifier of the chat that will post the story //@content Content of the story //@areas Clickable rectangle areas to be shown on the story media; pass null if none //@caption Story caption; pass null to use an empty caption; 0-getOption("story_caption_length_max") characters -//@privacy_settings The privacy settings for the story +//@privacy_settings The privacy settings for the story; ignored for stories sent to supergroup and channel chats //@active_period Period after which the story is moved to archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400 for Telegram Premium users, and 86400 otherwise //@from_story_full_id Full identifier of the original story, which content was used to create the story //@is_pinned Pass true to keep the story accessible after expiration @@ -8399,11 +8449,10 @@ sendStory chat_id:int53 content:InputStoryContent areas:inputStoryAreas caption: //@caption New story caption; pass null to keep the current caption editStory story_sender_chat_id:int53 story_id:int32 content:InputStoryContent areas:inputStoryAreas caption:formattedText = Ok; -//@description Changes privacy settings of a story. Can be called only if story.can_be_edited == true -//@story_sender_chat_id Identifier of the chat that posted the story +//@description Changes privacy settings of a story. The method can be called only for stories posted on behalf of the current user and if story.can_be_edited == true //@story_id Identifier of the story //@privacy_settings The new privacy settigs for the story -setStoryPrivacySettings story_sender_chat_id:int53 story_id:int32 privacy_settings:StoryPrivacySettings = Ok; +setStoryPrivacySettings story_id:int32 privacy_settings:StoryPrivacySettings = Ok; //@description Toggles whether a story is accessible after expiration. Can be called only if story.can_toggle_is_pinned == true //@story_sender_chat_id Identifier of the chat that posted the story @@ -8438,7 +8487,7 @@ getChatActiveStories chat_id:int53 = ChatActiveStories; //-For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit getChatPinnedStories chat_id:int53 from_story_id:int32 limit:int32 = Stories; -//@description Returns the list of all stories posted by the given chat; requires can_edit_stories rights for channel chats. +//@description Returns the list of all stories posted by the given chat; requires can_edit_stories right in the chat. //-The stories are returned in a reverse chronological order (i.e., in order of decreasing story_id). For optimal performance, the number of returned stories is chosen by TDLib //@chat_id Chat identifier //@from_story_id Identifier of the story starting from which stories must be returned; use 0 to get results from the last story @@ -8459,7 +8508,7 @@ closeStory story_sender_chat_id:int53 story_id:int32 = Ok; //@description Returns reactions, which can be chosen for a story @row_size Number of reaction per row, 5-25 getStoryAvailableReactions row_size:int32 = AvailableReactions; -//@description Changes chosen reaction on a story +//@description Changes chosen reaction on a story that has already been sent //@story_sender_chat_id The identifier of the sender of the story //@story_id The identifier of the story //@reaction_type Type of the reaction to set; pass null to remove the reaction. `reactionTypeCustomEmoji` reactions can be used only by Telegram Premium users @@ -8505,35 +8554,40 @@ activateStoryStealthMode = Ok; getStoryPublicForwards story_sender_chat_id:int53 story_id:int32 offset:string limit:int32 = PublicForwards; -//@description Returns list of features available on the specific chat boost level; this is an offline request @level Chat boost level -getChatBoostLevelFeatures level:int32 = ChatBoostLevelFeatures; +//@description Returns list of features available on the specific chat boost level; this is an offline request +//@is_channel Pass true to get the list of features for channels; pass false to get the list of features for supergroups +//@level Chat boost level +getChatBoostLevelFeatures is_channel:Bool level:int32 = ChatBoostLevelFeatures; //@description Returns list of features available on the first 10 chat boost levels; this is an offline request -getChatBoostFeatures = ChatBoostFeatures; +//@is_channel Pass true to get the list of features for channels; pass false to get the list of features for supergroups +getChatBoostFeatures is_channel:Bool = ChatBoostFeatures; //@description Returns the list of available chat boost slots for the current user getAvailableChatBoostSlots = ChatBoostSlots; -//@description Returns the current boost status for a channel chat @chat_id Identifier of the channel chat +//@description Returns the current boost status for a supergroup or a channel chat @chat_id Identifier of the chat getChatBoostStatus chat_id:int53 = ChatBoostStatus; -//@description Boosts a chat and returns the list of available chat boost slots for the current user after the boost @chat_id Identifier of the chat @slot_ids Identifiers of boost slots of the current user from which to apply boosts to the chat +//@description Boosts a chat and returns the list of available chat boost slots for the current user after the boost +//@chat_id Identifier of the chat +//@slot_ids Identifiers of boost slots of the current user from which to apply boosts to the chat boostChat chat_id:int53 slot_ids:vector = ChatBoostSlots; -//@description Returns an HTTPS link to boost the specified channel chat @chat_id Identifier of the chat +//@description Returns an HTTPS link to boost the specified supergroup or channel chat @chat_id Identifier of the chat getChatBoostLink chat_id:int53 = ChatBoostLink; //@description Returns information about a link to boost a chat. Can be called for any internal link of the type internalLinkTypeChatBoost @url The link to boost a chat getChatBoostLinkInfo url:string = ChatBoostLinkInfo; -//@description Returns list of boosts applied to a chat; requires administrator rights in the channel chat +//@description Returns list of boosts applied to a chat; requires administrator rights in the chat //@chat_id Identifier of the chat //@only_gift_codes Pass true to receive only boosts received from gift codes and giveaways created by the chat //@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results //@limit The maximum number of boosts to be returned; up to 100. For optimal performance, the number of returned boosts can be smaller than the specified limit getChatBoosts chat_id:int53 only_gift_codes:Bool offset:string limit:int32 = FoundChatBoosts; -//@description Returns list of boosts applied to a chat by a given user; requires administrator rights in the channel chat; for bots only +//@description Returns list of boosts applied to a chat by a given user; requires administrator rights in the chat; for bots only //@chat_id Identifier of the chat //@user_id Identifier of the user getUserChatBoosts chat_id:int53 user_id:int53 = FoundChatBoosts; @@ -8663,11 +8717,11 @@ searchFileDownloads query:string only_active:Bool only_completed:Bool offset:str getMessageFileType message_file_head:string = MessageFileType; //@description Returns a confirmation text to be shown to the user before starting message import -//@chat_id Identifier of a chat to which the messages will be imported. It must be an identifier of a private chat with a mutual contact or an identifier of a supergroup chat with can_change_info administrator right +//@chat_id Identifier of a chat to which the messages will be imported. It must be an identifier of a private chat with a mutual contact or an identifier of a supergroup chat with can_change_info member right getMessageImportConfirmationText chat_id:int53 = Text; //@description Imports messages exported from another app -//@chat_id Identifier of a chat to which the messages will be imported. It must be an identifier of a private chat with a mutual contact or an identifier of a supergroup chat with can_change_info administrator right +//@chat_id Identifier of a chat to which the messages will be imported. It must be an identifier of a private chat with a mutual contact or an identifier of a supergroup chat with can_change_info member right //@message_file File with messages to import. Only inputFileLocal and inputFileGenerated are supported. The file must not be previously uploaded //@attached_files Files used in the imported messages. Only inputFileLocal and inputFileGenerated are supported. The files must not be previously uploaded importMessages chat_id:int53 message_file:InputFile attached_files:vector = Ok; @@ -8792,17 +8846,17 @@ getVideoChatAvailableParticipants chat_id:int53 = MessageSenders; //@description Changes default participant identifier, on whose behalf a video chat in the chat will be joined @chat_id Chat identifier @default_participant_id Default group call participant identifier to join the video chats setVideoChatDefaultParticipant chat_id:int53 default_participant_id:MessageSender = Ok; -//@description Creates a video chat (a group call bound to a chat). Available only for basic groups, supergroups and channels; requires can_manage_video_chats rights +//@description Creates a video chat (a group call bound to a chat). Available only for basic groups, supergroups and channels; requires can_manage_video_chats administrator right //@chat_id Identifier of a chat in which the video chat will be created //@title Group call title; if empty, chat title will be used //@start_date Point in time (Unix timestamp) when the group call is supposed to be started by an administrator; 0 to start the video chat immediately. The date must be at least 10 seconds and at most 8 days in the future -//@is_rtmp_stream Pass true to create an RTMP stream instead of an ordinary video chat; requires creator privileges +//@is_rtmp_stream Pass true to create an RTMP stream instead of an ordinary video chat; requires owner privileges createVideoChat chat_id:int53 title:string start_date:int32 is_rtmp_stream:Bool = GroupCallId; -//@description Returns RTMP URL for streaming to the chat; requires creator privileges @chat_id Chat identifier +//@description Returns RTMP URL for streaming to the chat; requires owner privileges @chat_id Chat identifier getVideoChatRtmpUrl chat_id:int53 = RtmpUrl; -//@description Replaces the current RTMP URL for streaming to the chat; requires creator privileges @chat_id Chat identifier +//@description Replaces the current RTMP URL for streaming to the chat; requires owner privileges @chat_id Chat identifier replaceVideoChatRtmpUrl chat_id:int53 = RtmpUrl; //@description Returns information about a group call @group_call_id Group call identifier @@ -9347,13 +9401,25 @@ toggleSupergroupUsernameIsActive supergroup_id:int53 username:string is_active:B //@description Disables all active non-editable usernames of a supergroup or channel, requires owner privileges in the supergroup or channel @supergroup_id Identifier of the supergroup or channel disableAllSupergroupUsernames supergroup_id:int53 = Ok; -//@description Changes order of active usernames of a supergroup or channel, requires owner privileges in the supergroup or channel @supergroup_id Identifier of the supergroup or channel @usernames The new order of active usernames. All currently active usernames must be specified +//@description Changes order of active usernames of a supergroup or channel, requires owner privileges in the supergroup or channel +//@supergroup_id Identifier of the supergroup or channel +//@usernames The new order of active usernames. All currently active usernames must be specified reorderSupergroupActiveUsernames supergroup_id:int53 usernames:vector = Ok; //@description Changes the sticker set of a supergroup; requires can_change_info administrator right @supergroup_id Identifier of the supergroup @sticker_set_id New value of the supergroup sticker set identifier. Use 0 to remove the supergroup sticker set setSupergroupStickerSet supergroup_id:int53 sticker_set_id:int64 = Ok; -//@description Toggles whether sender signature is added to sent messages in a channel; requires can_change_info administrator right @supergroup_id Identifier of the channel @sign_messages New value of sign_messages +//@description Changes the custom emoji sticker set of a supergroup; requires can_change_info administrator right. The chat must have at least chatBoostFeatures.min_custom_emoji_sticker_set_boost_level boost level to pass the corresponding color +//@supergroup_id Identifier of the supergroup +//@custom_emoji_sticker_set_id New value of the custom emoji sticker set identifier for the supergroup. Use 0 to remove the custom emoji sticker set in the supergroup +setSupergroupCustomEmojiStickerSet supergroup_id:int53 custom_emoji_sticker_set_id:int64 = Ok; + +//@description Changes the number of times the supergroup must be boosted by a user to ignore slow mode and chat permission restrictions; requires can_restrict_members administrator right +//@supergroup_id Identifier of the supergroup +//@unrestrict_boost_count New value of the unrestrict_boost_count supergroup setting; 0-8. Use 0 to remove the setting +setSupergroupUnrestrictBoostCount supergroup_id:int53 unrestrict_boost_count:int32 = Ok; + +//@description Toggles whether sender signature is added to sent messages in a channel; requires can_change_info member right @supergroup_id Identifier of the channel @sign_messages New value of sign_messages toggleSupergroupSignMessages supergroup_id:int53 sign_messages:Bool = Ok; //@description Toggles whether joining is mandatory to send messages to a discussion supergroup; requires can_restrict_members administrator right @supergroup_id Identifier of the supergroup @join_to_send_messages New value of join_to_send_messages @@ -9362,7 +9428,7 @@ toggleSupergroupJoinToSendMessages supergroup_id:int53 join_to_send_messages:Boo //@description Toggles whether all users directly joining the supergroup need to be approved by supergroup administrators; requires can_restrict_members administrator right @supergroup_id Identifier of the channel @join_by_request New value of join_by_request toggleSupergroupJoinByRequest supergroup_id:int53 join_by_request:Bool = Ok; -//@description Toggles whether the message history of a supergroup is available to new members; requires can_change_info administrator right @supergroup_id The identifier of the supergroup @is_all_history_available The new value of is_all_history_available +//@description Toggles whether the message history of a supergroup is available to new members; requires can_change_info member right @supergroup_id The identifier of the supergroup @is_all_history_available The new value of is_all_history_available toggleSupergroupIsAllHistoryAvailable supergroup_id:int53 is_all_history_available:Bool = Ok; //@description Toggles whether non-administrators can receive only administrators and bots using getSupergroupMembers or searchChatMembers. Can be called only if supergroupFullInfo.can_hide_members == true @@ -9864,7 +9930,7 @@ clickPremiumSubscriptionButton = Ok; getPremiumState = PremiumState; //@description Returns available options for Telegram Premium gift code or giveaway creation -//@boosted_chat_id Identifier of the channel chat, which will be automatically boosted by receivers of the gift codes and which is administered by the user; 0 if none +//@boosted_chat_id Identifier of the supergroup or channel chat, which will be automatically boosted by receivers of the gift codes and which is administered by the user; 0 if none getPremiumGiftCodePaymentOptions boosted_chat_id:int53 = PremiumGiftCodePaymentOptions; //@description Return information about a Telegram Premium gift code @code The code to check @@ -9873,7 +9939,7 @@ checkPremiumGiftCode code:string = PremiumGiftCodeInfo; //@description Applies a Telegram Premium gift code @code The code to apply applyPremiumGiftCode code:string = Ok; -//@description Launches a prepaid Telegram Premium giveaway for subscribers of channel chats; requires can_post_messages rights in the channels +//@description Launches a prepaid Telegram Premium giveaway //@giveaway_id Unique identifier of the prepaid giveaway //@parameters Giveaway parameters launchPrepaidPremiumGiveaway giveaway_id:int64 parameters:premiumGiveawayParameters = Ok; From 7005072ba429127bb1c1097b18a5d05d5ce6ca4d Mon Sep 17 00:00:00 2001 From: c0re100 Date: Sun, 10 Mar 2024 23:09:37 +0800 Subject: [PATCH 14/54] Update to TDLib 1.8.26 --- client/function.go | 462 +++++++++++++++++++++++++- client/type.go | 734 ++++++++++++++++++++++++++++++++++++++++++ client/unmarshaler.go | 286 ++++++++++++++++ data/td_api.tl | 196 ++++++++++- 4 files changed, 1666 insertions(+), 12 deletions(-) diff --git a/client/function.go b/client/function.go index 021b491..27f7285 100755 --- a/client/function.go +++ b/client/function.go @@ -3663,6 +3663,38 @@ func (client *Client) ForwardMessages(req *ForwardMessagesRequest) (*Messages, e return UnmarshalMessages(result.Data) } +type SendQuickReplyShortcutMessagesRequest struct { + // Identifier of the chat to which to send messages. The chat must be a private chat with a regular user + ChatId int64 `json:"chat_id"` + // Unique identifier of the quick reply shortcut + ShortcutId int32 `json:"shortcut_id"` + // Non-persistent identifier, which will be returned back in messageSendingStatePending object and can be used to match sent messages and corresponding updateNewMessage updates + SendingId int32 `json:"sending_id"` +} + +// Sends messages from a quick reply shortcut. Requires Telegram Business subscription +func (client *Client) SendQuickReplyShortcutMessages(req *SendQuickReplyShortcutMessagesRequest) (*Messages, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendQuickReplyShortcutMessages", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "shortcut_id": req.ShortcutId, + "sending_id": req.SendingId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessages(result.Data) +} + type ResendMessagesRequest struct { // Identifier of the chat to send messages ChatId int64 `json:"chat_id"` @@ -4228,6 +4260,192 @@ func (client *Client) EditMessageSchedulingState(req *EditMessageSchedulingState return UnmarshalOk(result.Data) } +type CheckQuickReplyShortcutNameRequest struct { + // The name of the shortcut; 1-32 characters + Name string `json:"name"` +} + +// Checks validness of a name for a quick reply shortcut. Can be called synchronously +func CheckQuickReplyShortcutName(req *CheckQuickReplyShortcutNameRequest) (*Ok, error) { + result, err := Execute(Request{ + meta: meta{ + Type: "checkQuickReplyShortcutName", + }, + Data: map[string]interface{}{ + "name": req.Name, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// deprecated +// Checks validness of a name for a quick reply shortcut. Can be called synchronously +func (client *Client) CheckQuickReplyShortcutName(req *CheckQuickReplyShortcutNameRequest) (*Ok, error) { + return CheckQuickReplyShortcutName(req)} + +// Loads quick reply shortcuts created by the current user. The loaded topics will be sent through updateQuickReplyShortcuts +func (client *Client) LoadQuickReplyShortcuts() (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "loadQuickReplyShortcuts", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetQuickReplyShortcutNameRequest struct { + // Unique identifier of the quick reply shortcut + ShortcutId int32 `json:"shortcut_id"` + // New name for the shortcut. Use checkQuickReplyShortcutName to check its validness + Name string `json:"name"` +} + +// Changes name of a quick reply shortcut +func (client *Client) SetQuickReplyShortcutName(req *SetQuickReplyShortcutNameRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setQuickReplyShortcutName", + }, + Data: map[string]interface{}{ + "shortcut_id": req.ShortcutId, + "name": req.Name, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DeleteQuickReplyShortcutRequest struct { + // Unique identifier of the quick reply shortcut + ShortcutId int32 `json:"shortcut_id"` +} + +// Deletes a quick reply shortcut +func (client *Client) DeleteQuickReplyShortcut(req *DeleteQuickReplyShortcutRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteQuickReplyShortcut", + }, + Data: map[string]interface{}{ + "shortcut_id": req.ShortcutId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ReorderQuickReplyShortcutsRequest struct { + // The new order of quick reply shortcuts + ShortcutIds []int32 `json:"shortcut_ids"` +} + +// Changes the order of quick reply shortcuts +func (client *Client) ReorderQuickReplyShortcuts(req *ReorderQuickReplyShortcutsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reorderQuickReplyShortcuts", + }, + Data: map[string]interface{}{ + "shortcut_ids": req.ShortcutIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type LoadQuickReplyShortcutMessagesRequest struct { + // Unique identifier of the quick reply shortcut + ShortcutId int32 `json:"shortcut_id"` +} + +// Loads quick reply messages that can be sent by a given quick reply shortcut. The loaded messages will be sent through updateQuickReplyShortcutMessages +func (client *Client) LoadQuickReplyShortcutMessages(req *LoadQuickReplyShortcutMessagesRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "loadQuickReplyShortcutMessages", + }, + Data: map[string]interface{}{ + "shortcut_id": req.ShortcutId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DeleteQuickReplyShortcutMessagesRequest struct { + // Unique identifier of the quick reply shortcut to which the messages belong + ShortcutId int32 `json:"shortcut_id"` + // Unique identifiers of the messages + MessageIds []int64 `json:"message_ids"` +} + +// Deletes specified quick reply messages +func (client *Client) DeleteQuickReplyShortcutMessages(req *DeleteQuickReplyShortcutMessagesRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteQuickReplyShortcutMessages", + }, + Data: map[string]interface{}{ + "shortcut_id": req.ShortcutId, + "message_ids": req.MessageIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + // Returns list of custom emojis, which can be used as forum topic icon by all users func (client *Client) GetForumTopicDefaultIcons() (*Stickers, error) { result, err := client.Send(Request{ @@ -7296,6 +7514,32 @@ func (client *Client) ReorderChatFolders(req *ReorderChatFoldersRequest) (*Ok, e return UnmarshalOk(result.Data) } +type ToggleChatFolderTagsRequest struct { + // Pass true to enable folder tags; pass false to disable them + AreTagsEnabled bool `json:"are_tags_enabled"` +} + +// Toggles whether chat folder tags are enabled +func (client *Client) ToggleChatFolderTags(req *ToggleChatFolderTagsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleChatFolderTags", + }, + Data: map[string]interface{}{ + "are_tags_enabled": req.AreTagsEnabled, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + // Returns recommended chat folders for the current user func (client *Client) GetRecommendedChatFolders() (*RecommendedChatFolders, error) { result, err := client.Send(Request{ @@ -13429,7 +13673,7 @@ type AddRecentStickerRequest struct { Sticker InputFile `json:"sticker"` } -// Manually adds a new sticker to the list of recently used stickers. The new sticker is added to the top of the list. If the sticker was already in the list, it is removed from the list first. Only stickers belonging to a sticker set can be added to this list. Emoji stickers can't be added to recent stickers +// Manually adds a new sticker to the list of recently used stickers. The new sticker is added to the top of the list. If the sticker was already in the list, it is removed from the list first. Only stickers belonging to a sticker set or in WEBP format can be added to this list. Emoji stickers can't be added to recent stickers func (client *Client) AddRecentSticker(req *AddRecentStickerRequest) (*Stickers, error) { result, err := client.Send(Request{ meta: meta{ @@ -13530,7 +13774,7 @@ type AddFavoriteStickerRequest struct { Sticker InputFile `json:"sticker"` } -// Adds a new sticker to the list of favorite stickers. The new sticker is added to the top of the list. If the sticker was already in the list, it is removed from the list first. Only stickers belonging to a sticker set can be added to this list. Emoji stickers can't be added to favorite stickers +// Adds a new sticker to the list of favorite stickers. The new sticker is added to the top of the list. If the sticker was already in the list, it is removed from the list first. Only stickers belonging to a sticker set or in WEBP format can be added to this list. Emoji stickers can't be added to favorite stickers func (client *Client) AddFavoriteSticker(req *AddFavoriteStickerRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -14305,7 +14549,7 @@ type SetLocationRequest struct { Location *Location `json:"location"` } -// Changes the location of the current user. Needs to be called if getOption("is_location_visible") is true and location changes for more than 1 kilometer +// Changes the location of the current user. Needs to be called if getOption("is_location_visible") is true and location changes for more than 1 kilometer. Must not be called if the user has a business location func (client *Client) SetLocation(req *SetLocationRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -14326,6 +14570,110 @@ func (client *Client) SetLocation(req *SetLocationRequest) (*Ok, error) { return UnmarshalOk(result.Data) } +type SetBusinessLocationRequest struct { + // The new location of the business; pass null to remove the location + Location *BusinessLocation `json:"location"` +} + +// Changes the business location of the current user. Requires Telegram Business subscription +func (client *Client) SetBusinessLocation(req *SetBusinessLocationRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBusinessLocation", + }, + Data: map[string]interface{}{ + "location": req.Location, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetBusinessOpeningHoursRequest struct { + // The new opening hours of the business; pass null to remove the opening hours + OpeningHours *BusinessOpeningHours `json:"opening_hours"` +} + +// Changes the business opening hours of the current user. Requires Telegram Business subscription +func (client *Client) SetBusinessOpeningHours(req *SetBusinessOpeningHoursRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBusinessOpeningHours", + }, + Data: map[string]interface{}{ + "opening_hours": req.OpeningHours, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetBusinessGreetingMessageSettingsRequest struct { + // The new settings for the greeting message of the business; pass null to disable the greeting message + GreetingMessageSettings *BusinessGreetingMessageSettings `json:"greeting_message_settings"` +} + +// Changes the business greeting message settings of the current user. Requires Telegram Business subscription +func (client *Client) SetBusinessGreetingMessageSettings(req *SetBusinessGreetingMessageSettingsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBusinessGreetingMessageSettings", + }, + Data: map[string]interface{}{ + "greeting_message_settings": req.GreetingMessageSettings, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetBusinessAwayMessageSettingsRequest struct { + // The new settings for the away message of the business; pass null to disable the away message + AwayMessageSettings *BusinessAwayMessageSettings `json:"away_message_settings"` +} + +// Changes the business away message settings of the current user. Requires Telegram Business subscription +func (client *Client) SetBusinessAwayMessageSettings(req *SetBusinessAwayMessageSettingsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBusinessAwayMessageSettings", + }, + Data: map[string]interface{}{ + "away_message_settings": req.AwayMessageSettings, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type ChangePhoneNumberRequest struct { // The new phone number of the user in international format PhoneNumber string `json:"phone_number"` @@ -14400,6 +14748,77 @@ func (client *Client) CheckChangePhoneNumberCode(req *CheckChangePhoneNumberCode return UnmarshalOk(result.Data) } +// Returns the business bot that is connected to the current user account. Returns a 404 error if there is no connected bot +func (client *Client) GetBusinessConnectedBot() (*BusinessConnectedBot, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getBusinessConnectedBot", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBusinessConnectedBot(result.Data) +} + +type SetBusinessConnectedBotRequest struct { + // Connection settings for the bot + Bot *BusinessConnectedBot `json:"bot"` +} + +// Adds or changes business bot that is connected to the current user account +func (client *Client) SetBusinessConnectedBot(req *SetBusinessConnectedBotRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBusinessConnectedBot", + }, + Data: map[string]interface{}{ + "bot": req.Bot, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DeleteBusinessConnectedBotRequest struct { + // Unique user identifier for the bot + BotUserId int64 `json:"bot_user_id"` +} + +// Deletes the business bot that is connected to the current user account +func (client *Client) DeleteBusinessConnectedBot(req *DeleteBusinessConnectedBotRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteBusinessConnectedBot", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + // Returns an HTTPS link, which can be used to get information about the current user func (client *Client) GetUserLink() (*UserLink, error) { result, err := client.Send(Request{ @@ -15829,6 +16248,25 @@ func (client *Client) GetChatEventLog(req *GetChatEventLogRequest) (*ChatEvents, return UnmarshalChatEvents(result.Data) } +// Returns the list of supported time zones +func (client *Client) GetTimeZones() (*TimeZones, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getTimeZones", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalTimeZones(result.Data) +} + type GetPaymentFormRequest struct { // The invoice InputInvoice InputInvoice `json:"input_invoice"` @@ -20332,6 +20770,12 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateChatPosition: return UnmarshalUpdateChatPosition(result.Data) + case TypeUpdateChatAddedToList: + return UnmarshalUpdateChatAddedToList(result.Data) + + case TypeUpdateChatRemovedFromList: + return UnmarshalUpdateChatRemovedFromList(result.Data) + case TypeUpdateChatReadInbox: return UnmarshalUpdateChatReadInbox(result.Data) @@ -20413,6 +20857,18 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateSavedMessagesTopicCount: return UnmarshalUpdateSavedMessagesTopicCount(result.Data) + case TypeUpdateQuickReplyShortcut: + return UnmarshalUpdateQuickReplyShortcut(result.Data) + + case TypeUpdateQuickReplyShortcutDeleted: + return UnmarshalUpdateQuickReplyShortcutDeleted(result.Data) + + case TypeUpdateQuickReplyShortcuts: + return UnmarshalUpdateQuickReplyShortcuts(result.Data) + + case TypeUpdateQuickReplyShortcutMessages: + return UnmarshalUpdateQuickReplyShortcutMessages(result.Data) + case TypeUpdateForumTopicInfo: return UnmarshalUpdateForumTopicInfo(result.Data) diff --git a/client/type.go b/client/type.go index a1728e4..036f037 100755 --- a/client/type.go +++ b/client/type.go @@ -19,6 +19,7 @@ const ( ClassStickerFullType = "StickerFullType" ClassPollType = "PollType" ClassUserType = "UserType" + ClassBusinessAwayMessageSchedule = "BusinessAwayMessageSchedule" ClassChatPhotoStickerType = "ChatPhotoStickerType" ClassInputChatPhoto = "InputChatPhoto" ClassPremiumGiveawayParticipantStatus = "PremiumGiveawayParticipantStatus" @@ -187,6 +188,14 @@ const ( ClassBotCommands = "BotCommands" ClassBotMenuButton = "BotMenuButton" ClassChatLocation = "ChatLocation" + ClassBusinessLocation = "BusinessLocation" + ClassBusinessRecipients = "BusinessRecipients" + ClassBusinessAwayMessageSettings = "BusinessAwayMessageSettings" + ClassBusinessGreetingMessageSettings = "BusinessGreetingMessageSettings" + ClassBusinessConnectedBot = "BusinessConnectedBot" + ClassBusinessOpeningHoursInterval = "BusinessOpeningHoursInterval" + ClassBusinessOpeningHours = "BusinessOpeningHours" + ClassBusinessInfo = "BusinessInfo" ClassChatPhotoSticker = "ChatPhotoSticker" ClassAnimatedChatPhoto = "AnimatedChatPhoto" ClassChatPhoto = "ChatPhoto" @@ -355,6 +364,8 @@ const ( ClassChatActiveStories = "ChatActiveStories" ClassStoryInteraction = "StoryInteraction" ClassStoryInteractions = "StoryInteractions" + ClassQuickReplyMessage = "QuickReplyMessage" + ClassQuickReplyShortcut = "QuickReplyShortcut" ClassPublicForwards = "PublicForwards" ClassChatBoostLevelFeatures = "ChatBoostLevelFeatures" ClassChatBoostFeatures = "ChatBoostFeatures" @@ -410,6 +421,8 @@ const ( ClassPushReceiverId = "PushReceiverId" ClassThemeSettings = "ThemeSettings" ClassChatTheme = "ChatTheme" + ClassTimeZone = "TimeZone" + ClassTimeZones = "TimeZones" ClassHashtags = "Hashtags" ClassNotificationSound = "NotificationSound" ClassNotificationSounds = "NotificationSounds" @@ -576,6 +589,17 @@ const ( TypeBotCommands = "botCommands" TypeBotMenuButton = "botMenuButton" TypeChatLocation = "chatLocation" + TypeBusinessAwayMessageScheduleAlways = "businessAwayMessageScheduleAlways" + TypeBusinessAwayMessageScheduleOutsideOfOpeningHours = "businessAwayMessageScheduleOutsideOfOpeningHours" + TypeBusinessAwayMessageScheduleCustom = "businessAwayMessageScheduleCustom" + TypeBusinessLocation = "businessLocation" + TypeBusinessRecipients = "businessRecipients" + TypeBusinessAwayMessageSettings = "businessAwayMessageSettings" + TypeBusinessGreetingMessageSettings = "businessGreetingMessageSettings" + TypeBusinessConnectedBot = "businessConnectedBot" + TypeBusinessOpeningHoursInterval = "businessOpeningHoursInterval" + TypeBusinessOpeningHours = "businessOpeningHours" + TypeBusinessInfo = "businessInfo" TypeChatPhotoStickerTypeRegularOrMask = "chatPhotoStickerTypeRegularOrMask" TypeChatPhotoStickerTypeCustomEmoji = "chatPhotoStickerTypeCustomEmoji" TypeChatPhotoSticker = "chatPhotoSticker" @@ -1163,6 +1187,8 @@ const ( TypeStoryInteractionTypeRepost = "storyInteractionTypeRepost" TypeStoryInteraction = "storyInteraction" TypeStoryInteractions = "storyInteractions" + TypeQuickReplyMessage = "quickReplyMessage" + TypeQuickReplyShortcut = "quickReplyShortcut" TypePublicForwardMessage = "publicForwardMessage" TypePublicForwardStory = "publicForwardStory" TypePublicForwards = "publicForwards" @@ -1423,6 +1449,8 @@ const ( TypeInputBackgroundPrevious = "inputBackgroundPrevious" TypeThemeSettings = "themeSettings" TypeChatTheme = "chatTheme" + TypeTimeZone = "timeZone" + TypeTimeZones = "timeZones" TypeHashtags = "hashtags" TypeCanSendStoryResultOk = "canSendStoryResultOk" TypeCanSendStoryResultPremiumNeeded = "canSendStoryResultPremiumNeeded" @@ -1750,6 +1778,8 @@ const ( TypeUpdateChatPermissions = "updateChatPermissions" TypeUpdateChatLastMessage = "updateChatLastMessage" TypeUpdateChatPosition = "updateChatPosition" + TypeUpdateChatAddedToList = "updateChatAddedToList" + TypeUpdateChatRemovedFromList = "updateChatRemovedFromList" TypeUpdateChatReadInbox = "updateChatReadInbox" TypeUpdateChatReadOutbox = "updateChatReadOutbox" TypeUpdateChatActionBar = "updateChatActionBar" @@ -1777,6 +1807,10 @@ const ( TypeUpdateChatOnlineMemberCount = "updateChatOnlineMemberCount" TypeUpdateSavedMessagesTopic = "updateSavedMessagesTopic" TypeUpdateSavedMessagesTopicCount = "updateSavedMessagesTopicCount" + TypeUpdateQuickReplyShortcut = "updateQuickReplyShortcut" + TypeUpdateQuickReplyShortcutDeleted = "updateQuickReplyShortcutDeleted" + TypeUpdateQuickReplyShortcuts = "updateQuickReplyShortcuts" + TypeUpdateQuickReplyShortcutMessages = "updateQuickReplyShortcutMessages" TypeUpdateForumTopicInfo = "updateForumTopicInfo" TypeUpdateScopeNotificationSettings = "updateScopeNotificationSettings" TypeUpdateNotification = "updateNotification" @@ -1935,6 +1969,11 @@ type UserType interface { UserTypeType() string } +// Describes conditions for sending of away messages by a Telegram Business account +type BusinessAwayMessageSchedule interface { + BusinessAwayMessageScheduleType() string +} + // Describes type of a sticker, which was used to create a chat photo type ChatPhotoStickerType interface { ChatPhotoStickerTypeType() string @@ -5632,6 +5671,328 @@ func (*ChatLocation) GetType() string { return TypeChatLocation } +// Send away messages always +type BusinessAwayMessageScheduleAlways struct{ + meta +} + +func (entity *BusinessAwayMessageScheduleAlways) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessAwayMessageScheduleAlways + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessAwayMessageScheduleAlways) GetClass() string { + return ClassBusinessAwayMessageSchedule +} + +func (*BusinessAwayMessageScheduleAlways) GetType() string { + return TypeBusinessAwayMessageScheduleAlways +} + +func (*BusinessAwayMessageScheduleAlways) BusinessAwayMessageScheduleType() string { + return TypeBusinessAwayMessageScheduleAlways +} + +// Send away messages outside of the business opening hours +type BusinessAwayMessageScheduleOutsideOfOpeningHours struct{ + meta +} + +func (entity *BusinessAwayMessageScheduleOutsideOfOpeningHours) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessAwayMessageScheduleOutsideOfOpeningHours + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessAwayMessageScheduleOutsideOfOpeningHours) GetClass() string { + return ClassBusinessAwayMessageSchedule +} + +func (*BusinessAwayMessageScheduleOutsideOfOpeningHours) GetType() string { + return TypeBusinessAwayMessageScheduleOutsideOfOpeningHours +} + +func (*BusinessAwayMessageScheduleOutsideOfOpeningHours) BusinessAwayMessageScheduleType() string { + return TypeBusinessAwayMessageScheduleOutsideOfOpeningHours +} + +// Send away messages only in the specified time span +type BusinessAwayMessageScheduleCustom struct { + meta + // Point in time (Unix timestamp) when the away messages will start to be sent + StartDate int32 `json:"start_date"` + // Point in time (Unix timestamp) when the away messages will stop to be sent + EndDate int32 `json:"end_date"` +} + +func (entity *BusinessAwayMessageScheduleCustom) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessAwayMessageScheduleCustom + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessAwayMessageScheduleCustom) GetClass() string { + return ClassBusinessAwayMessageSchedule +} + +func (*BusinessAwayMessageScheduleCustom) GetType() string { + return TypeBusinessAwayMessageScheduleCustom +} + +func (*BusinessAwayMessageScheduleCustom) BusinessAwayMessageScheduleType() string { + return TypeBusinessAwayMessageScheduleCustom +} + +// Represents a location of a business +type BusinessLocation struct { + meta + // The location; may be null if not specified + Location *Location `json:"location"` + // Location address; 1-96 characters + Address string `json:"address"` +} + +func (entity *BusinessLocation) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessLocation + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessLocation) GetClass() string { + return ClassBusinessLocation +} + +func (*BusinessLocation) GetType() string { + return TypeBusinessLocation +} + +// Describes private chats chosen for automatic interaction with a business +type BusinessRecipients struct { + meta + // Identifiers of selected private chats + ChatIds []int64 `json:"chat_ids"` + // True, if all existing private chats are selected + SelectExistingChats bool `json:"select_existing_chats"` + // True, if all new private chats are selected + SelectNewChats bool `json:"select_new_chats"` + // True, if all private chats with contacts are selected + SelectContacts bool `json:"select_contacts"` + // True, if all private chats with non-contacts are selected + SelectNonContacts bool `json:"select_non_contacts"` + // If true, then all private chats except the selected are chosen. Otherwise, only the selected chats are chosen + ExcludeSelected bool `json:"exclude_selected"` +} + +func (entity *BusinessRecipients) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessRecipients + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessRecipients) GetClass() string { + return ClassBusinessRecipients +} + +func (*BusinessRecipients) GetType() string { + return TypeBusinessRecipients +} + +// Describes settings for messages that are automatically sent by a Telegram Business account when it is away +type BusinessAwayMessageSettings struct { + meta + // Unique quick reply shortcut identifier for the away messages + ShortcutId int32 `json:"shortcut_id"` + // Chosen recipients of the away messages + Recipients *BusinessRecipients `json:"recipients"` + // Settings used to check whether the current user is away + Schedule BusinessAwayMessageSchedule `json:"schedule"` + // True, if the messages must not be sent if the account was online in the last 10 minutes + OfflineOnly bool `json:"offline_only"` +} + +func (entity *BusinessAwayMessageSettings) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessAwayMessageSettings + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessAwayMessageSettings) GetClass() string { + return ClassBusinessAwayMessageSettings +} + +func (*BusinessAwayMessageSettings) GetType() string { + return TypeBusinessAwayMessageSettings +} + +func (businessAwayMessageSettings *BusinessAwayMessageSettings) UnmarshalJSON(data []byte) error { + var tmp struct { + ShortcutId int32 `json:"shortcut_id"` + Recipients *BusinessRecipients `json:"recipients"` + Schedule json.RawMessage `json:"schedule"` + OfflineOnly bool `json:"offline_only"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + businessAwayMessageSettings.ShortcutId = tmp.ShortcutId + businessAwayMessageSettings.Recipients = tmp.Recipients + businessAwayMessageSettings.OfflineOnly = tmp.OfflineOnly + + fieldSchedule, _ := UnmarshalBusinessAwayMessageSchedule(tmp.Schedule) + businessAwayMessageSettings.Schedule = fieldSchedule + + return nil +} + +// Describes settings for greeting messages that are automatically sent by a Telegram Business account as response to incoming messages in an inactive private chat +type BusinessGreetingMessageSettings struct { + meta + // Unique quick reply shortcut identifier for the greeting messages + ShortcutId int32 `json:"shortcut_id"` + // Chosen recipients of the greeting messages + Recipients *BusinessRecipients `json:"recipients"` + // The number of days after which a chat will be considered as inactive; currently, must be on of 7, 14, 21, or 28 + InactivityDays int32 `json:"inactivity_days"` +} + +func (entity *BusinessGreetingMessageSettings) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessGreetingMessageSettings + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessGreetingMessageSettings) GetClass() string { + return ClassBusinessGreetingMessageSettings +} + +func (*BusinessGreetingMessageSettings) GetType() string { + return TypeBusinessGreetingMessageSettings +} + +// Describes a bot connected to a business account +type BusinessConnectedBot struct { + meta + // User identifier of the bot + BotUserId int64 `json:"bot_user_id"` + // Private chats that will be accessible to the bot + Recipients *BusinessRecipients `json:"recipients"` + // True, if the bot can send messages to the private chats; false otherwise + CanReply bool `json:"can_reply"` +} + +func (entity *BusinessConnectedBot) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessConnectedBot + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessConnectedBot) GetClass() string { + return ClassBusinessConnectedBot +} + +func (*BusinessConnectedBot) GetType() string { + return TypeBusinessConnectedBot +} + +// Describes an interval of time when the business is open +type BusinessOpeningHoursInterval struct { + meta + // The first minute of the interval since start of the week; 0-7*24*60 + StartMinute int32 `json:"start_minute"` + // The first minute after the end of the interval since start of the week; 1-8*24*60 + EndMinute int32 `json:"end_minute"` +} + +func (entity *BusinessOpeningHoursInterval) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessOpeningHoursInterval + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessOpeningHoursInterval) GetClass() string { + return ClassBusinessOpeningHoursInterval +} + +func (*BusinessOpeningHoursInterval) GetType() string { + return TypeBusinessOpeningHoursInterval +} + +// Describes opening hours of a business +type BusinessOpeningHours struct { + meta + // Unique time zone identifier + TimeZoneId string `json:"time_zone_id"` + // Intervals of the time when the business is open + OpeningHours []*BusinessOpeningHoursInterval `json:"opening_hours"` +} + +func (entity *BusinessOpeningHours) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessOpeningHours + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessOpeningHours) GetClass() string { + return ClassBusinessOpeningHours +} + +func (*BusinessOpeningHours) GetType() string { + return TypeBusinessOpeningHours +} + +// Contains information about a Telegram Business account +type BusinessInfo struct { + meta + // Location of the business; may be null if none + Location *BusinessLocation `json:"location"` + // Opening hours of the business; may be null if none. The hours are guaranteed to be valid and has already been split by week days + OpeningHours *BusinessOpeningHours `json:"opening_hours"` + // The greeting message; may be null if none or the Business account is not of the current user + GreetingMessageSettings *BusinessGreetingMessageSettings `json:"greeting_message_settings"` + // The away message; may be null if none or the Business account is not of the current user + AwayMessageSettings *BusinessAwayMessageSettings `json:"away_message_settings"` +} + +func (entity *BusinessInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessInfo + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessInfo) GetClass() string { + return ClassBusinessInfo +} + +func (*BusinessInfo) GetType() string { + return TypeBusinessInfo +} + // Information about the sticker, which was used to create the chat photo type ChatPhotoStickerTypeRegularOrMask struct { meta @@ -6941,6 +7302,8 @@ type UserFullInfo struct { PremiumGiftOptions []*PremiumPaymentOption `json:"premium_gift_options"` // Number of group chats where both the other user and the current user are a member; 0 for the current user GroupInCommonCount int32 `json:"group_in_common_count"` + // Information about business settings for Telegram Business accounts; may be null if none + BusinessInfo *BusinessInfo `json:"business_info"` // For bots, information about the bot; may be null if the user isn't a bot BotInfo *BotInfo `json:"bot_info"` } @@ -6978,6 +7341,7 @@ func (userFullInfo *UserFullInfo) UnmarshalJSON(data []byte) error { Bio *FormattedText `json:"bio"` PremiumGiftOptions []*PremiumPaymentOption `json:"premium_gift_options"` GroupInCommonCount int32 `json:"group_in_common_count"` + BusinessInfo *BusinessInfo `json:"business_info"` BotInfo *BotInfo `json:"bot_info"` } @@ -7000,6 +7364,7 @@ func (userFullInfo *UserFullInfo) UnmarshalJSON(data []byte) error { userFullInfo.Bio = tmp.Bio userFullInfo.PremiumGiftOptions = tmp.PremiumGiftOptions userFullInfo.GroupInCommonCount = tmp.GroupInCommonCount + userFullInfo.BusinessInfo = tmp.BusinessInfo userFullInfo.BotInfo = tmp.BotInfo fieldBlockList, _ := UnmarshalBlockList(tmp.BlockList) @@ -11138,6 +11503,8 @@ type ChatFolder struct { Title string `json:"title"` // The chosen icon for the chat folder; may be null. If null, use getChatFolderDefaultIconName to get default icon name for the folder Icon *ChatFolderIcon `json:"icon"` + // The identifier of the chosen color for the chat folder icon; from -1 to 6. If -1, then color is didabled + ColorId int32 `json:"color_id"` // True, if at least one link has been created for the folder IsShareable bool `json:"is_shareable"` // The chat identifiers of pinned chats in the folder. There can be up to getOption("chat_folder_chosen_chat_count_max") pinned and always included non-secret chats and the same number of secret chats, but the limit can be increased with Telegram Premium @@ -11189,6 +11556,8 @@ type ChatFolderInfo struct { Title string `json:"title"` // The chosen or default icon for the chat folder Icon *ChatFolderIcon `json:"icon"` + // The identifier of the chosen color for the chat folder icon; from -1 to 6. If -1, then color is didabled + ColorId int32 `json:"color_id"` // True, if at least one link has been created for the folder IsShareable bool `json:"is_shareable"` // True, if the chat folder has invite links created by the current user @@ -11799,6 +12168,8 @@ type Chat struct { LastMessage *Message `json:"last_message"` // Positions of the chat in chat lists Positions []*ChatPosition `json:"positions"` + // 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 []ChatList `json:"chat_lists"` // 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 MessageSender `json:"message_sender_id"` // Block list to which the chat is added; may be null if none @@ -11886,6 +12257,7 @@ func (chat *Chat) UnmarshalJSON(data []byte) error { Permissions *ChatPermissions `json:"permissions"` LastMessage *Message `json:"last_message"` Positions []*ChatPosition `json:"positions"` + ChatLists []json.RawMessage `json:"chat_lists"` MessageSenderId json.RawMessage `json:"message_sender_id"` BlockList json.RawMessage `json:"block_list"` HasProtectedContent bool `json:"has_protected_content"` @@ -11959,6 +12331,9 @@ func (chat *Chat) UnmarshalJSON(data []byte) error { fieldType, _ := UnmarshalChatType(tmp.Type) chat.Type = fieldType + fieldChatLists, _ := UnmarshalListOfChatList(tmp.ChatLists) + chat.ChatLists = fieldChatLists + fieldMessageSenderId, _ := UnmarshalMessageSender(tmp.MessageSenderId) chat.MessageSenderId = fieldMessageSenderId @@ -25691,6 +26066,107 @@ func (*StoryInteractions) GetType() string { return TypeStoryInteractions } +// Describes a message that can be used for quick reply +type QuickReplyMessage struct { + meta + // Unique message identifier among all quick replies + Id int64 `json:"id"` + // The sending state of the message; may be null if the message isn't being sent and didn't fail to be sent + SendingState MessageSendingState `json:"sending_state"` + // True, if the message can be edited + CanBeEdited bool `json:"can_be_edited"` + // Information about the identifier of the quick reply message to which the message replies + ReplyToMessageId int64 `json:"reply_to_message_id"` + // If non-zero, the user identifier of the bot through which this message was sent + ViaBotUserId int64 `json:"via_bot_user_id"` + // Unique identifier of an album this message belongs to. Only audios, documents, photos and videos can be grouped together in albums + MediaAlbumId JsonInt64 `json:"media_album_id"` + // Content of the message + Content MessageContent `json:"content"` + // Inline keyboard reply markup for the message; may be null if none + ReplyMarkup ReplyMarkup `json:"reply_markup"` +} + +func (entity *QuickReplyMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub QuickReplyMessage + + return json.Marshal((*stub)(entity)) +} + +func (*QuickReplyMessage) GetClass() string { + return ClassQuickReplyMessage +} + +func (*QuickReplyMessage) GetType() string { + return TypeQuickReplyMessage +} + +func (quickReplyMessage *QuickReplyMessage) UnmarshalJSON(data []byte) error { + var tmp struct { + Id int64 `json:"id"` + SendingState json.RawMessage `json:"sending_state"` + CanBeEdited bool `json:"can_be_edited"` + ReplyToMessageId int64 `json:"reply_to_message_id"` + ViaBotUserId int64 `json:"via_bot_user_id"` + MediaAlbumId JsonInt64 `json:"media_album_id"` + Content json.RawMessage `json:"content"` + ReplyMarkup json.RawMessage `json:"reply_markup"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + quickReplyMessage.Id = tmp.Id + quickReplyMessage.CanBeEdited = tmp.CanBeEdited + quickReplyMessage.ReplyToMessageId = tmp.ReplyToMessageId + quickReplyMessage.ViaBotUserId = tmp.ViaBotUserId + quickReplyMessage.MediaAlbumId = tmp.MediaAlbumId + + fieldSendingState, _ := UnmarshalMessageSendingState(tmp.SendingState) + quickReplyMessage.SendingState = fieldSendingState + + fieldContent, _ := UnmarshalMessageContent(tmp.Content) + quickReplyMessage.Content = fieldContent + + fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup) + quickReplyMessage.ReplyMarkup = fieldReplyMarkup + + return nil +} + +// Describes a shortcut that can be used for a quick reply +type QuickReplyShortcut struct { + meta + // Unique shortcut identifier + Id int32 `json:"id"` + // The name of the shortcut that can be used to use the shortcut + Name string `json:"name"` + // The first shortcut message + FirstMessage *QuickReplyMessage `json:"first_message"` + // The total number of messages in the shortcut + MessageCount int32 `json:"message_count"` +} + +func (entity *QuickReplyShortcut) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub QuickReplyShortcut + + return json.Marshal((*stub)(entity)) +} + +func (*QuickReplyShortcut) GetClass() string { + return ClassQuickReplyShortcut +} + +func (*QuickReplyShortcut) GetType() string { + return TypeQuickReplyShortcut +} + // Contains a public forward as a message type PublicForwardMessage struct { meta @@ -34229,6 +34705,56 @@ func (*ChatTheme) GetType() string { return TypeChatTheme } +// Describes a time zone +type TimeZone struct { + meta + // Unique time zone identifier + Id string `json:"id"` + // Time zone name + Name string `json:"name"` + // Current UTC time offset for the time zone + UtcTimeOffset int32 `json:"utc_time_offset"` +} + +func (entity *TimeZone) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TimeZone + + return json.Marshal((*stub)(entity)) +} + +func (*TimeZone) GetClass() string { + return ClassTimeZone +} + +func (*TimeZone) GetType() string { + return TypeTimeZone +} + +// Contains a list of time zones +type TimeZones struct { + meta + // A list of time zones + TimeZones []*TimeZone `json:"time_zones"` +} + +func (entity *TimeZones) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TimeZones + + return json.Marshal((*stub)(entity)) +} + +func (*TimeZones) GetClass() string { + return ClassTimeZones +} + +func (*TimeZones) GetType() string { + return TypeTimeZones +} + // Contains a list of hashtags type Hashtags struct { meta @@ -43713,6 +44239,102 @@ func (*UpdateChatPosition) UpdateType() string { return TypeUpdateChatPosition } +// A chat was added to a chat list +type UpdateChatAddedToList struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // The chat list to which the chat was added + ChatList ChatList `json:"chat_list"` +} + +func (entity *UpdateChatAddedToList) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateChatAddedToList + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateChatAddedToList) GetClass() string { + return ClassUpdate +} + +func (*UpdateChatAddedToList) GetType() string { + return TypeUpdateChatAddedToList +} + +func (*UpdateChatAddedToList) UpdateType() string { + return TypeUpdateChatAddedToList +} + +func (updateChatAddedToList *UpdateChatAddedToList) UnmarshalJSON(data []byte) error { + var tmp struct { + ChatId int64 `json:"chat_id"` + ChatList json.RawMessage `json:"chat_list"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + updateChatAddedToList.ChatId = tmp.ChatId + + fieldChatList, _ := UnmarshalChatList(tmp.ChatList) + updateChatAddedToList.ChatList = fieldChatList + + return nil +} + +// A chat was removed from a chat list +type UpdateChatRemovedFromList struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // The chat list from which the chat was removed + ChatList ChatList `json:"chat_list"` +} + +func (entity *UpdateChatRemovedFromList) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateChatRemovedFromList + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateChatRemovedFromList) GetClass() string { + return ClassUpdate +} + +func (*UpdateChatRemovedFromList) GetType() string { + return TypeUpdateChatRemovedFromList +} + +func (*UpdateChatRemovedFromList) UpdateType() string { + return TypeUpdateChatRemovedFromList +} + +func (updateChatRemovedFromList *UpdateChatRemovedFromList) UnmarshalJSON(data []byte) error { + var tmp struct { + ChatId int64 `json:"chat_id"` + ChatList json.RawMessage `json:"chat_list"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + updateChatRemovedFromList.ChatId = tmp.ChatId + + fieldChatList, _ := UnmarshalChatList(tmp.ChatList) + updateChatRemovedFromList.ChatList = fieldChatList + + return nil +} + // Incoming messages were read or the number of unread messages has been changed type UpdateChatReadInbox struct { meta @@ -44467,6 +45089,8 @@ type UpdateChatFolders struct { ChatFolders []*ChatFolderInfo `json:"chat_folders"` // Position of the main chat list among chat folders, 0-based MainChatListPosition int32 `json:"main_chat_list_position"` + // True, if folder tags are enabled + AreTagsEnabled bool `json:"are_tags_enabled"` } func (entity *UpdateChatFolders) MarshalJSON() ([]byte, error) { @@ -44572,6 +45196,116 @@ func (*UpdateSavedMessagesTopicCount) UpdateType() string { return TypeUpdateSavedMessagesTopicCount } +// Basic information about a quick reply shortcut has changed. This update is guaranteed to come before the quick shortcut name is returned to the application +type UpdateQuickReplyShortcut struct { + meta + // New data about the shortcut + Shortcut *QuickReplyShortcut `json:"shortcut"` +} + +func (entity *UpdateQuickReplyShortcut) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateQuickReplyShortcut + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateQuickReplyShortcut) GetClass() string { + return ClassUpdate +} + +func (*UpdateQuickReplyShortcut) GetType() string { + return TypeUpdateQuickReplyShortcut +} + +func (*UpdateQuickReplyShortcut) UpdateType() string { + return TypeUpdateQuickReplyShortcut +} + +// A quick reply shortcut and all its messages were deleted +type UpdateQuickReplyShortcutDeleted struct { + meta + // The identifier of the deleted shortcut + ShortcutId int32 `json:"shortcut_id"` +} + +func (entity *UpdateQuickReplyShortcutDeleted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateQuickReplyShortcutDeleted + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateQuickReplyShortcutDeleted) GetClass() string { + return ClassUpdate +} + +func (*UpdateQuickReplyShortcutDeleted) GetType() string { + return TypeUpdateQuickReplyShortcutDeleted +} + +func (*UpdateQuickReplyShortcutDeleted) UpdateType() string { + return TypeUpdateQuickReplyShortcutDeleted +} + +// The list of quick reply shortcuts has changed +type UpdateQuickReplyShortcuts struct { + meta + // The new list of identifiers of quick reply shortcuts + ShortcutIds []int32 `json:"shortcut_ids"` +} + +func (entity *UpdateQuickReplyShortcuts) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateQuickReplyShortcuts + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateQuickReplyShortcuts) GetClass() string { + return ClassUpdate +} + +func (*UpdateQuickReplyShortcuts) GetType() string { + return TypeUpdateQuickReplyShortcuts +} + +func (*UpdateQuickReplyShortcuts) UpdateType() string { + return TypeUpdateQuickReplyShortcuts +} + +// The list of quick reply shortcut messages has changed +type UpdateQuickReplyShortcutMessages struct { + meta + // The identifier of the shortcut + ShortcutId int32 `json:"shortcut_id"` + // The new list of quick reply messages for the shortcut in order from the first to the last sent + Messages []*QuickReplyMessage `json:"messages"` +} + +func (entity *UpdateQuickReplyShortcutMessages) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateQuickReplyShortcutMessages + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateQuickReplyShortcutMessages) GetClass() string { + return ClassUpdate +} + +func (*UpdateQuickReplyShortcutMessages) GetType() string { + return TypeUpdateQuickReplyShortcutMessages +} + +func (*UpdateQuickReplyShortcutMessages) UpdateType() string { + return TypeUpdateQuickReplyShortcutMessages +} + // Basic information about a topic in a forum chat was changed type UpdateForumTopicInfo struct { meta diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 7e00275..1e3daca 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -508,6 +508,43 @@ func UnmarshalListOfUserType(dataList []json.RawMessage) ([]UserType, error) { return list, nil } +func UnmarshalBusinessAwayMessageSchedule(data json.RawMessage) (BusinessAwayMessageSchedule, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeBusinessAwayMessageScheduleAlways: + return UnmarshalBusinessAwayMessageScheduleAlways(data) + + case TypeBusinessAwayMessageScheduleOutsideOfOpeningHours: + return UnmarshalBusinessAwayMessageScheduleOutsideOfOpeningHours(data) + + case TypeBusinessAwayMessageScheduleCustom: + return UnmarshalBusinessAwayMessageScheduleCustom(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfBusinessAwayMessageSchedule(dataList []json.RawMessage) ([]BusinessAwayMessageSchedule, error) { + list := []BusinessAwayMessageSchedule{} + + for _, data := range dataList { + entity, err := UnmarshalBusinessAwayMessageSchedule(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalChatPhotoStickerType(data json.RawMessage) (ChatPhotoStickerType, error) { var meta meta @@ -6627,6 +6664,12 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateChatPosition: return UnmarshalUpdateChatPosition(data) + case TypeUpdateChatAddedToList: + return UnmarshalUpdateChatAddedToList(data) + + case TypeUpdateChatRemovedFromList: + return UnmarshalUpdateChatRemovedFromList(data) + case TypeUpdateChatReadInbox: return UnmarshalUpdateChatReadInbox(data) @@ -6708,6 +6751,18 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateSavedMessagesTopicCount: return UnmarshalUpdateSavedMessagesTopicCount(data) + case TypeUpdateQuickReplyShortcut: + return UnmarshalUpdateQuickReplyShortcut(data) + + case TypeUpdateQuickReplyShortcutDeleted: + return UnmarshalUpdateQuickReplyShortcutDeleted(data) + + case TypeUpdateQuickReplyShortcuts: + return UnmarshalUpdateQuickReplyShortcuts(data) + + case TypeUpdateQuickReplyShortcutMessages: + return UnmarshalUpdateQuickReplyShortcutMessages(data) + case TypeUpdateForumTopicInfo: return UnmarshalUpdateForumTopicInfo(data) @@ -7802,6 +7857,94 @@ func UnmarshalChatLocation(data json.RawMessage) (*ChatLocation, error) { return &resp, err } +func UnmarshalBusinessAwayMessageScheduleAlways(data json.RawMessage) (*BusinessAwayMessageScheduleAlways, error) { + var resp BusinessAwayMessageScheduleAlways + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessAwayMessageScheduleOutsideOfOpeningHours(data json.RawMessage) (*BusinessAwayMessageScheduleOutsideOfOpeningHours, error) { + var resp BusinessAwayMessageScheduleOutsideOfOpeningHours + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessAwayMessageScheduleCustom(data json.RawMessage) (*BusinessAwayMessageScheduleCustom, error) { + var resp BusinessAwayMessageScheduleCustom + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessLocation(data json.RawMessage) (*BusinessLocation, error) { + var resp BusinessLocation + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessRecipients(data json.RawMessage) (*BusinessRecipients, error) { + var resp BusinessRecipients + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessAwayMessageSettings(data json.RawMessage) (*BusinessAwayMessageSettings, error) { + var resp BusinessAwayMessageSettings + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessGreetingMessageSettings(data json.RawMessage) (*BusinessGreetingMessageSettings, error) { + var resp BusinessGreetingMessageSettings + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessConnectedBot(data json.RawMessage) (*BusinessConnectedBot, error) { + var resp BusinessConnectedBot + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessOpeningHoursInterval(data json.RawMessage) (*BusinessOpeningHoursInterval, error) { + var resp BusinessOpeningHoursInterval + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessOpeningHours(data json.RawMessage) (*BusinessOpeningHours, error) { + var resp BusinessOpeningHours + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessInfo(data json.RawMessage) (*BusinessInfo, error) { + var resp BusinessInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatPhotoStickerTypeRegularOrMask(data json.RawMessage) (*ChatPhotoStickerTypeRegularOrMask, error) { var resp ChatPhotoStickerTypeRegularOrMask @@ -12498,6 +12641,22 @@ func UnmarshalStoryInteractions(data json.RawMessage) (*StoryInteractions, error return &resp, err } +func UnmarshalQuickReplyMessage(data json.RawMessage) (*QuickReplyMessage, error) { + var resp QuickReplyMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalQuickReplyShortcut(data json.RawMessage) (*QuickReplyShortcut, error) { + var resp QuickReplyShortcut + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPublicForwardMessage(data json.RawMessage) (*PublicForwardMessage, error) { var resp PublicForwardMessage @@ -14578,6 +14737,22 @@ func UnmarshalChatTheme(data json.RawMessage) (*ChatTheme, error) { return &resp, err } +func UnmarshalTimeZone(data json.RawMessage) (*TimeZone, error) { + var resp TimeZone + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTimeZones(data json.RawMessage) (*TimeZones, error) { + var resp TimeZones + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalHashtags(data json.RawMessage) (*Hashtags, error) { var resp Hashtags @@ -17194,6 +17369,22 @@ func UnmarshalUpdateChatPosition(data json.RawMessage) (*UpdateChatPosition, err return &resp, err } +func UnmarshalUpdateChatAddedToList(data json.RawMessage) (*UpdateChatAddedToList, error) { + var resp UpdateChatAddedToList + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateChatRemovedFromList(data json.RawMessage) (*UpdateChatRemovedFromList, error) { + var resp UpdateChatRemovedFromList + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateChatReadInbox(data json.RawMessage) (*UpdateChatReadInbox, error) { var resp UpdateChatReadInbox @@ -17410,6 +17601,38 @@ func UnmarshalUpdateSavedMessagesTopicCount(data json.RawMessage) (*UpdateSavedM return &resp, err } +func UnmarshalUpdateQuickReplyShortcut(data json.RawMessage) (*UpdateQuickReplyShortcut, error) { + var resp UpdateQuickReplyShortcut + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateQuickReplyShortcutDeleted(data json.RawMessage) (*UpdateQuickReplyShortcutDeleted, error) { + var resp UpdateQuickReplyShortcutDeleted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateQuickReplyShortcuts(data json.RawMessage) (*UpdateQuickReplyShortcuts, error) { + var resp UpdateQuickReplyShortcuts + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateQuickReplyShortcutMessages(data json.RawMessage) (*UpdateQuickReplyShortcutMessages, error) { + var resp UpdateQuickReplyShortcutMessages + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateForumTopicInfo(data json.RawMessage) (*UpdateForumTopicInfo, error) { var resp UpdateForumTopicInfo @@ -18484,6 +18707,39 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatLocation: return UnmarshalChatLocation(data) + case TypeBusinessAwayMessageScheduleAlways: + return UnmarshalBusinessAwayMessageScheduleAlways(data) + + case TypeBusinessAwayMessageScheduleOutsideOfOpeningHours: + return UnmarshalBusinessAwayMessageScheduleOutsideOfOpeningHours(data) + + case TypeBusinessAwayMessageScheduleCustom: + return UnmarshalBusinessAwayMessageScheduleCustom(data) + + case TypeBusinessLocation: + return UnmarshalBusinessLocation(data) + + case TypeBusinessRecipients: + return UnmarshalBusinessRecipients(data) + + case TypeBusinessAwayMessageSettings: + return UnmarshalBusinessAwayMessageSettings(data) + + case TypeBusinessGreetingMessageSettings: + return UnmarshalBusinessGreetingMessageSettings(data) + + case TypeBusinessConnectedBot: + return UnmarshalBusinessConnectedBot(data) + + case TypeBusinessOpeningHoursInterval: + return UnmarshalBusinessOpeningHoursInterval(data) + + case TypeBusinessOpeningHours: + return UnmarshalBusinessOpeningHours(data) + + case TypeBusinessInfo: + return UnmarshalBusinessInfo(data) + case TypeChatPhotoStickerTypeRegularOrMask: return UnmarshalChatPhotoStickerTypeRegularOrMask(data) @@ -20245,6 +20501,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStoryInteractions: return UnmarshalStoryInteractions(data) + case TypeQuickReplyMessage: + return UnmarshalQuickReplyMessage(data) + + case TypeQuickReplyShortcut: + return UnmarshalQuickReplyShortcut(data) + case TypePublicForwardMessage: return UnmarshalPublicForwardMessage(data) @@ -21025,6 +21287,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatTheme: return UnmarshalChatTheme(data) + case TypeTimeZone: + return UnmarshalTimeZone(data) + + case TypeTimeZones: + return UnmarshalTimeZones(data) + case TypeHashtags: return UnmarshalHashtags(data) @@ -22006,6 +22274,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateChatPosition: return UnmarshalUpdateChatPosition(data) + case TypeUpdateChatAddedToList: + return UnmarshalUpdateChatAddedToList(data) + + case TypeUpdateChatRemovedFromList: + return UnmarshalUpdateChatRemovedFromList(data) + case TypeUpdateChatReadInbox: return UnmarshalUpdateChatReadInbox(data) @@ -22087,6 +22361,18 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateSavedMessagesTopicCount: return UnmarshalUpdateSavedMessagesTopicCount(data) + case TypeUpdateQuickReplyShortcut: + return UnmarshalUpdateQuickReplyShortcut(data) + + case TypeUpdateQuickReplyShortcutDeleted: + return UnmarshalUpdateQuickReplyShortcutDeleted(data) + + case TypeUpdateQuickReplyShortcuts: + return UnmarshalUpdateQuickReplyShortcuts(data) + + case TypeUpdateQuickReplyShortcutMessages: + return UnmarshalUpdateQuickReplyShortcutMessages(data) + case TypeUpdateForumTopicInfo: return UnmarshalUpdateForumTopicInfo(data) diff --git a/data/td_api.tl b/data/td_api.tl index 9653ed9..bdeba25 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -577,6 +577,67 @@ botMenuButton text:string url:string = BotMenuButton; chatLocation location:location address:string = ChatLocation; +//@class BusinessAwayMessageSchedule @description Describes conditions for sending of away messages by a Telegram Business account + +//@description Send away messages always +businessAwayMessageScheduleAlways = BusinessAwayMessageSchedule; + +//@description Send away messages outside of the business opening hours +businessAwayMessageScheduleOutsideOfOpeningHours = BusinessAwayMessageSchedule; + +//@description Send away messages only in the specified time span +//@start_date Point in time (Unix timestamp) when the away messages will start to be sent +//@end_date Point in time (Unix timestamp) when the away messages will stop to be sent +businessAwayMessageScheduleCustom start_date:int32 end_date:int32 = BusinessAwayMessageSchedule; + + +//@description Represents a location of a business @location The location; may be null if not specified @address Location address; 1-96 characters +businessLocation location:location address:string = BusinessLocation; + +//@description Describes private chats chosen for automatic interaction with a business +//@chat_ids Identifiers of selected private chats +//@select_existing_chats True, if all existing private chats are selected +//@select_new_chats True, if all new private chats are selected +//@select_contacts True, if all private chats with contacts are selected +//@select_non_contacts True, if all private chats with non-contacts are selected +//@exclude_selected If true, then all private chats except the selected are chosen. Otherwise, only the selected chats are chosen +businessRecipients chat_ids:vector select_existing_chats:Bool select_new_chats:Bool select_contacts:Bool select_non_contacts:Bool exclude_selected:Bool = BusinessRecipients; + +//@description Describes settings for messages that are automatically sent by a Telegram Business account when it is away +//@shortcut_id Unique quick reply shortcut identifier for the away messages +//@recipients Chosen recipients of the away messages +//@schedule Settings used to check whether the current user is away +//@offline_only True, if the messages must not be sent if the account was online in the last 10 minutes +businessAwayMessageSettings shortcut_id:int32 recipients:businessRecipients schedule:BusinessAwayMessageSchedule offline_only:Bool = BusinessAwayMessageSettings; + +//@description Describes settings for greeting messages that are automatically sent by a Telegram Business account as response to incoming messages in an inactive private chat +//@shortcut_id Unique quick reply shortcut identifier for the greeting messages +//@recipients Chosen recipients of the greeting messages +//@inactivity_days The number of days after which a chat will be considered as inactive; currently, must be on of 7, 14, 21, or 28 +businessGreetingMessageSettings shortcut_id:int32 recipients:businessRecipients inactivity_days:int32 = BusinessGreetingMessageSettings; + +//@description Describes a bot connected to a business account +//@bot_user_id User identifier of the bot +//@recipients Private chats that will be accessible to the bot +//@can_reply True, if the bot can send messages to the private chats; false otherwise +businessConnectedBot bot_user_id:int53 recipients:businessRecipients can_reply:Bool = BusinessConnectedBot; + +//@description Describes an interval of time when the business is open +//@start_minute The first minute of the interval since start of the week; 0-7*24*60 +//@end_minute The first minute after the end of the interval since start of the week; 1-8*24*60 +businessOpeningHoursInterval start_minute:int32 end_minute:int32 = BusinessOpeningHoursInterval; + +//@description Describes opening hours of a business @time_zone_id Unique time zone identifier @opening_hours Intervals of the time when the business is open +businessOpeningHours time_zone_id:string opening_hours:vector = BusinessOpeningHours; + +//@description Contains information about a Telegram Business account +//@location Location of the business; may be null if none +//@opening_hours Opening hours of the business; may be null if none. The hours are guaranteed to be valid and has already been split by week days +//@greeting_message_settings The greeting message; may be null if none or the Business account is not of the current user +//@away_message_settings The away message; may be null if none or the Business account is not of the current user +businessInfo location:businessLocation opening_hours:businessOpeningHours greeting_message_settings:businessGreetingMessageSettings away_message_settings:businessAwayMessageSettings = BusinessInfo; + + //@class ChatPhotoStickerType @description Describes type of a sticker, which was used to create a chat photo //@description Information about the sticker, which was used to create the chat photo @@ -852,8 +913,9 @@ botInfo short_description:string description:string photo:photo animation:animat //@bio A short user bio; may be null for bots //@premium_gift_options The list of available options for gifting Telegram Premium to the user //@group_in_common_count Number of group chats where both the other user and the current user are a member; 0 for the current user +//@business_info Information about business settings for Telegram Business accounts; may be null if none //@bot_info For bots, information about the bot; may be null if the user isn't a bot -userFullInfo personal_photo:chatPhoto photo:chatPhoto public_photo:chatPhoto block_list:BlockList can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool has_private_forwards:Bool has_restricted_voice_and_video_note_messages:Bool has_pinned_stories:Bool need_phone_number_privacy_exception:Bool set_chat_background:Bool bio:formattedText premium_gift_options:vector group_in_common_count:int32 bot_info:botInfo = UserFullInfo; +userFullInfo personal_photo:chatPhoto photo:chatPhoto public_photo:chatPhoto block_list:BlockList can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool has_private_forwards:Bool has_restricted_voice_and_video_note_messages:Bool has_pinned_stories:Bool need_phone_number_privacy_exception:Bool set_chat_background:Bool bio:formattedText premium_gift_options:vector group_in_common_count:int32 business_info:businessInfo bot_info:botInfo = UserFullInfo; //@description Represents a list of users @total_count Approximate total number of users found @user_ids A list of user identifiers users total_count:int32 user_ids:vector = Users; @@ -1567,6 +1629,7 @@ chatFolderIcon name:string = ChatFolderIcon; //@description Represents a folder for user chats //@title The title of the folder; 1-12 characters without line feeds //@icon The chosen icon for the chat folder; may be null. If null, use getChatFolderDefaultIconName to get default icon name for the folder +//@color_id The identifier of the chosen color for the chat folder icon; from -1 to 6. If -1, then color is didabled //@is_shareable True, if at least one link has been created for the folder //@pinned_chat_ids The chat identifiers of pinned chats in the folder. There can be up to getOption("chat_folder_chosen_chat_count_max") pinned and always included non-secret chats and the same number of secret chats, but the limit can be increased with Telegram Premium //@included_chat_ids The chat identifiers of always included chats in the folder. There can be up to getOption("chat_folder_chosen_chat_count_max") pinned and always included non-secret chats and the same number of secret chats, but the limit can be increased with Telegram Premium @@ -1579,15 +1642,16 @@ chatFolderIcon name:string = ChatFolderIcon; //@include_bots True, if bots need to be included //@include_groups True, if basic groups and supergroups need to be included //@include_channels True, if channels need to be included -chatFolder title:string icon:chatFolderIcon is_shareable:Bool pinned_chat_ids:vector included_chat_ids:vector excluded_chat_ids:vector exclude_muted:Bool exclude_read:Bool exclude_archived:Bool include_contacts:Bool include_non_contacts:Bool include_bots:Bool include_groups:Bool include_channels:Bool = ChatFolder; +chatFolder title:string icon:chatFolderIcon color_id:int32 is_shareable:Bool pinned_chat_ids:vector included_chat_ids:vector excluded_chat_ids:vector exclude_muted:Bool exclude_read:Bool exclude_archived:Bool include_contacts:Bool include_non_contacts:Bool include_bots:Bool include_groups:Bool include_channels:Bool = ChatFolder; //@description Contains basic information about a chat folder //@id Unique chat folder identifier //@title The title of the folder; 1-12 characters without line feeds //@icon The chosen or default icon for the chat folder +//@color_id The identifier of the chosen color for the chat folder icon; from -1 to 6. If -1, then color is didabled //@is_shareable True, if at least one link has been created for the folder //@has_my_invite_links True, if the chat folder has invite links created by the current user -chatFolderInfo id:int32 title:string icon:chatFolderIcon is_shareable:Bool has_my_invite_links:Bool = ChatFolderInfo; +chatFolderInfo id:int32 title:string icon:chatFolderIcon color_id:int32 is_shareable:Bool has_my_invite_links:Bool = ChatFolderInfo; //@description Contains a chat folder invite link //@invite_link The chat folder invite link @@ -1687,6 +1751,7 @@ videoChat group_call_id:int32 has_participants:Bool default_participant_id:Messa //@permissions Actions that non-administrator chat members are allowed to take in the chat //@last_message Last message in the chat; may be null if none or unknown //@positions Positions of the chat in chat lists +//@chat_lists 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 //@message_sender_id 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 //@block_list Block list to which the chat is added; may be null if none //@has_protected_content True, if chat content can't be saved locally, forwarded, or copied @@ -1715,7 +1780,7 @@ videoChat group_call_id:int32 has_participants:Bool default_participant_id:Messa //@reply_markup_message_id Identifier of the message from which reply markup needs to be used; 0 if there is no default custom reply markup in the chat //@draft_message A draft of a message in the chat; may be null if none //@client_data 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 -chat id:int53 type:ChatType title:string photo:chatPhotoInfo accent_color_id:int32 background_custom_emoji_id:int64 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 permissions:chatPermissions last_message:message positions:vector message_sender_id:MessageSender block_list:BlockList has_protected_content:Bool is_translatable:Bool is_marked_as_unread:Bool view_as_topics:Bool has_scheduled_messages:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_reported:Bool default_disable_notification:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 unread_reaction_count:int32 notification_settings:chatNotificationSettings available_reactions:ChatAvailableReactions message_auto_delete_time:int32 emoji_status:emojiStatus background:chatBackground theme_name:string action_bar:ChatActionBar video_chat:videoChat pending_join_requests:chatJoinRequestsInfo reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat; +chat id:int53 type:ChatType title:string photo:chatPhotoInfo accent_color_id:int32 background_custom_emoji_id:int64 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 permissions:chatPermissions last_message:message positions:vector chat_lists:vector message_sender_id:MessageSender block_list:BlockList has_protected_content:Bool is_translatable:Bool is_marked_as_unread:Bool view_as_topics:Bool has_scheduled_messages:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_reported:Bool default_disable_notification:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 unread_reaction_count:int32 notification_settings:chatNotificationSettings available_reactions:ChatAvailableReactions message_auto_delete_time:int32 emoji_status:emojiStatus background:chatBackground theme_name:string action_bar:ChatActionBar video_chat:videoChat pending_join_requests:chatJoinRequestsInfo reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat; //@description Represents a list of chats @total_count Approximate total number of chats found @chat_ids List of chat identifiers chats total_count:int32 chat_ids:vector = Chats; @@ -3718,6 +3783,25 @@ storyInteraction actor_id:MessageSender interaction_date:int32 block_list:BlockL storyInteractions total_count:int32 total_forward_count:int32 total_reaction_count:int32 interactions:vector next_offset:string = StoryInteractions; +//@description Describes a message that can be used for quick reply +//@id Unique message identifier among all quick replies +//@sending_state The sending state of the message; may be null if the message isn't being sent and didn't fail to be sent +//@can_be_edited True, if the message can be edited +//@reply_to_message_id Information about the identifier of the quick reply message to which the message replies +//@via_bot_user_id If non-zero, the user identifier of the bot through which this message was sent +//@media_album_id Unique identifier of an album this message belongs to. Only audios, documents, photos and videos can be grouped together in albums +//@content Content of the message +//@reply_markup Inline keyboard reply markup for the message; may be null if none +quickReplyMessage id:int53 sending_state:MessageSendingState can_be_edited:Bool reply_to_message_id:int53 via_bot_user_id:int53 media_album_id:int64 content:MessageContent reply_markup:ReplyMarkup = QuickReplyMessage; + +//@description Describes a shortcut that can be used for a quick reply +//@id Unique shortcut identifier +//@name The name of the shortcut that can be used to use the shortcut +//@first_message The first shortcut message +//@message_count The total number of messages in the shortcut +quickReplyShortcut id:int32 name:string first_message:quickReplyMessage message_count:int32 = QuickReplyShortcut; + + //@class PublicForward @description Describes a public forward or repost of a story //@description Contains a public forward as a message @message Information about the message @@ -5027,6 +5111,16 @@ themeSettings accent_color:int32 background:background outgoing_message_fill:Bac chatTheme name:string light_settings:themeSettings dark_settings:themeSettings = ChatTheme; +//@description Describes a time zone +//@id Unique time zone identifier +//@name Time zone name +//@utc_time_offset Current UTC time offset for the time zone +timeZone id:string name:string utc_time_offset:int32 = TimeZone; + +//@description Contains a list of time zones @time_zones A list of time zones +timeZones time_zones:vector = TimeZones; + + //@description Contains a list of hashtags @hashtags A list of hashtags hashtags hashtags:vector = Hashtags; @@ -6456,6 +6550,12 @@ updateChatLastMessage chat_id:int53 last_message:message positions:vector main_chat_list_position:int32 = Update; +//@description The list of chat folders or a chat folder has changed +//@chat_folders The new list of chat folders +//@main_chat_list_position Position of the main chat list among chat folders, 0-based +//@are_tags_enabled True, if folder tags are enabled +updateChatFolders chat_folders:vector main_chat_list_position:int32 are_tags_enabled:Bool = Update; //@description The number of online group members has changed. This update with non-zero number of online group members is sent only for currently opened chats. //-There is no guarantee that it is sent just after the number of online users has changed @@ -6548,6 +6651,21 @@ updateSavedMessagesTopic topic:savedMessagesTopic = Update; //@description Number of Saved Messages topics has changed @topic_count Approximate total number of Saved Messages topics updateSavedMessagesTopicCount topic_count:int32 = Update; +//@description Basic information about a quick reply shortcut has changed. This update is guaranteed to come before the quick shortcut name is returned to the application +//@shortcut New data about the shortcut +updateQuickReplyShortcut shortcut:quickReplyShortcut = Update; + +//@description A quick reply shortcut and all its messages were deleted @shortcut_id The identifier of the deleted shortcut +updateQuickReplyShortcutDeleted shortcut_id:int32 = Update; + +//@description The list of quick reply shortcuts has changed @shortcut_ids The new list of identifiers of quick reply shortcuts +updateQuickReplyShortcuts shortcut_ids:vector = Update; + +//@description The list of quick reply shortcut messages has changed +//@shortcut_id The identifier of the shortcut +//@messages The new list of quick reply messages for the shortcut in order from the first to the last sent +updateQuickReplyShortcutMessages shortcut_id:int32 messages:vector = Update; + //@description Basic information about a topic in a forum chat was changed @chat_id Chat identifier @info New information about the topic updateForumTopicInfo chat_id:int53 info:forumTopicInfo = Update; @@ -7571,6 +7689,12 @@ sendInlineQueryResultMessage chat_id:int53 message_thread_id:int53 reply_to:Inpu //@remove_caption Pass true to remove media captions of message copies. Ignored if send_copy is false forwardMessages chat_id:int53 message_thread_id:int53 from_chat_id:int53 message_ids:vector options:messageSendOptions send_copy:Bool remove_caption:Bool = Messages; +//@description Sends messages from a quick reply shortcut. Requires Telegram Business subscription +//@chat_id Identifier of the chat to which to send messages. The chat must be a private chat with a regular user +//@shortcut_id Unique identifier of the quick reply shortcut +//@sending_id Non-persistent identifier, which will be returned back in messageSendingStatePending object and can be used to match sent messages and corresponding updateNewMessage updates +sendQuickReplyShortcutMessages chat_id:int53 shortcut_id:int32 sending_id:int32 = Messages; + //@description Resends messages which failed to send. Can be called only for messages for which messageSendingStateFailed.can_retry is true and after specified in messageSendingStateFailed.retry_after time passed. //-If a message is re-sent, the corresponding failed to send message is deleted. Returns the sent messages in the same order as the message identifiers passed in message_ids. If a message can't be re-sent, null will be returned instead of the message //@chat_id Identifier of the chat to send messages @@ -7678,6 +7802,31 @@ editInlineMessageReplyMarkup inline_message_id:string reply_markup:ReplyMarkup = editMessageSchedulingState chat_id:int53 message_id:int53 scheduling_state:MessageSchedulingState = Ok; +//@description Checks validness of a name for a quick reply shortcut. Can be called synchronously @name The name of the shortcut; 1-32 characters +checkQuickReplyShortcutName name:string = Ok; + +//@description Loads quick reply shortcuts created by the current user. The loaded topics will be sent through updateQuickReplyShortcuts +loadQuickReplyShortcuts = Ok; + +//@description Changes name of a quick reply shortcut @shortcut_id Unique identifier of the quick reply shortcut @name New name for the shortcut. Use checkQuickReplyShortcutName to check its validness +setQuickReplyShortcutName shortcut_id:int32 name:string = Ok; + +//@description Deletes a quick reply shortcut @shortcut_id Unique identifier of the quick reply shortcut +deleteQuickReplyShortcut shortcut_id:int32 = Ok; + +//@description Changes the order of quick reply shortcuts @shortcut_ids The new order of quick reply shortcuts +reorderQuickReplyShortcuts shortcut_ids:vector = Ok; + +//@description Loads quick reply messages that can be sent by a given quick reply shortcut. The loaded messages will be sent through updateQuickReplyShortcutMessages +//@shortcut_id Unique identifier of the quick reply shortcut +loadQuickReplyShortcutMessages shortcut_id:int32 = Ok; + +//@description Deletes specified quick reply messages +//@shortcut_id Unique identifier of the quick reply shortcut to which the messages belong +//@message_ids Unique identifiers of the messages +deleteQuickReplyShortcutMessages shortcut_id:int32 message_ids:vector = Ok; + + //@description Returns list of custom emojis, which can be used as forum topic icon by all users getForumTopicDefaultIcons = Stickers; @@ -8141,6 +8290,9 @@ getChatFolderChatCount folder:chatFolder = Count; //@description Changes the order of chat folders @chat_folder_ids Identifiers of chat folders in the new correct order @main_chat_list_position Position of the main chat list among chat folders, 0-based. Can be non-zero only for Premium users reorderChatFolders chat_folder_ids:vector main_chat_list_position:int32 = Ok; +//@description Toggles whether chat folder tags are enabled @are_tags_enabled Pass true to enable folder tags; pass false to disable them +toggleChatFolderTags are_tags_enabled:Bool = Ok; + //@description Returns recommended chat folders for the current user getRecommendedChatFolders = RecommendedChatFolders; @@ -9115,7 +9267,7 @@ reorderInstalledStickerSets sticker_type:StickerType sticker_set_ids:vector = Ok; //@description Changes the emoji status of the current user; for Telegram Premium users only @emoji_status New emoji status; pass null to switch to the default badge setEmojiStatus emoji_status:emojiStatus = Ok; -//@description Changes the location of the current user. Needs to be called if getOption("is_location_visible") is true and location changes for more than 1 kilometer @location The new location of the user +//@description Changes the location of the current user. Needs to be called if getOption("is_location_visible") is true and location changes for more than 1 kilometer. Must not be called if the user has a business location @location The new location of the user setLocation location:location = Ok; +//@description Changes the business location of the current user. Requires Telegram Business subscription @location The new location of the business; pass null to remove the location +setBusinessLocation location:businessLocation = Ok; + +//@description Changes the business opening hours of the current user. Requires Telegram Business subscription @opening_hours The new opening hours of the business; pass null to remove the opening hours +setBusinessOpeningHours opening_hours:businessOpeningHours = Ok; + +//@description Changes the business greeting message settings of the current user. Requires Telegram Business subscription @greeting_message_settings The new settings for the greeting message of the business; pass null to disable the greeting message +setBusinessGreetingMessageSettings greeting_message_settings:businessGreetingMessageSettings = Ok; + +//@description Changes the business away message settings of the current user. Requires Telegram Business subscription @away_message_settings The new settings for the away message of the business; pass null to disable the away message +setBusinessAwayMessageSettings away_message_settings:businessAwayMessageSettings = Ok; + //@description Changes the phone number of the user and sends an authentication code to the user's new phone number; for official Android and iOS applications only. On success, returns information about the sent code //@phone_number The new phone number of the user in international format //@settings Settings for the authentication of the user's phone number; pass null to use default settings @@ -9257,6 +9421,16 @@ resendChangePhoneNumberCode = AuthenticationCodeInfo; checkChangePhoneNumberCode code:string = Ok; +//@description Returns the business bot that is connected to the current user account. Returns a 404 error if there is no connected bot +getBusinessConnectedBot = BusinessConnectedBot; + +//@description Adds or changes business bot that is connected to the current user account @bot Connection settings for the bot +setBusinessConnectedBot bot:businessConnectedBot = Ok; + +//@description Deletes the business bot that is connected to the current user account @bot_user_id Unique user identifier for the bot +deleteBusinessConnectedBot bot_user_id:int53 = Ok; + + //@description Returns an HTTPS link, which can be used to get information about the current user getUserLink = UserLink; @@ -9477,6 +9651,10 @@ closeSecretChat secret_chat_id:int32 = Ok; getChatEventLog chat_id:int53 query:string from_event_id:int64 limit:int32 filters:chatEventLogFilters user_ids:vector = ChatEvents; +//@description Returns the list of supported time zones +getTimeZones = TimeZones; + + //@description Returns an invoice payment form. This method must be called when the user presses inline button of the type inlineKeyboardButtonTypeBuy //@input_invoice The invoice //@theme Preferred payment form theme; pass null to use the default theme From 0465eebee71b37e2d79cf7cc7a136b4de1afc385 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Mon, 1 Apr 2024 02:33:46 +0800 Subject: [PATCH 15/54] Update to TDLib 1.8.27 --- client/function.go | 456 +++++++++++++- client/type.go | 1329 ++++++++++++++++++++++++++++++++++++++++- client/unmarshaler.go | 619 +++++++++++++++++++ data/td_api.tl | 384 ++++++++++-- 4 files changed, 2661 insertions(+), 127 deletions(-) diff --git a/client/function.go b/client/function.go index 27f7285..44e7348 100755 --- a/client/function.go +++ b/client/function.go @@ -2200,6 +2200,25 @@ func (client *Client) GetInactiveSupergroupChats() (*Chats, error) { return UnmarshalChats(result.Data) } +// Returns a list of channel chats, which can be used as a personal chat +func (client *Client) GetSuitablePersonalChats() (*Chats, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getSuitablePersonalChats", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChats(result.Data) +} + type LoadSavedMessagesTopicsRequest struct { // The maximum number of topics to be loaded. For optimal performance, the number of loaded topics is chosen by TDLib and can be smaller than the specified limit, even if the end of the list is not reached Limit int32 `json:"limit"` @@ -3133,6 +3152,56 @@ func (client *Client) ClickChatSponsoredMessage(req *ClickChatSponsoredMessageRe return UnmarshalOk(result.Data) } +type ReportChatSponsoredMessageRequest struct { + // Chat identifier of the sponsored message + ChatId int64 `json:"chat_id"` + // Identifier of the sponsored message + MessageId int64 `json:"message_id"` + // Option identifier chosen by the user; leave empty for the initial request + OptionId []byte `json:"option_id"` +} + +// Reports a sponsored message to Telegram moderators +func (client *Client) ReportChatSponsoredMessage(req *ReportChatSponsoredMessageRequest) (ReportChatSponsoredMessageResult, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reportChatSponsoredMessage", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "option_id": req.OptionId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypeReportChatSponsoredMessageResultOk: + return UnmarshalReportChatSponsoredMessageResultOk(result.Data) + + case TypeReportChatSponsoredMessageResultFailed: + return UnmarshalReportChatSponsoredMessageResultFailed(result.Data) + + case TypeReportChatSponsoredMessageResultOptionRequired: + return UnmarshalReportChatSponsoredMessageResultOptionRequired(result.Data) + + case TypeReportChatSponsoredMessageResultAdsHidden: + return UnmarshalReportChatSponsoredMessageResultAdsHidden(result.Data) + + case TypeReportChatSponsoredMessageResultPremiumRequired: + return UnmarshalReportChatSponsoredMessageResultPremiumRequired(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + type RemoveNotificationRequest struct { // Identifier of notification group to which the notification belongs NotificationGroupId int32 `json:"notification_group_id"` @@ -4260,6 +4329,91 @@ func (client *Client) EditMessageSchedulingState(req *EditMessageSchedulingState return UnmarshalOk(result.Data) } +type SendBusinessMessageRequest struct { + // Unique identifier of business connection on behalf of which to send the request + BusinessConnectionId string `json:"business_connection_id"` + // Target chat + ChatId int64 `json:"chat_id"` + // Information about the message to be replied; pass null if none + ReplyTo InputMessageReplyTo `json:"reply_to"` + // Pass true to disable notification for the message + DisableNotification bool `json:"disable_notification"` + // Pass true if the content of the message must be protected from forwarding and saving + ProtectContent bool `json:"protect_content"` + // Markup for replying to the message; pass null if none + ReplyMarkup ReplyMarkup `json:"reply_markup"` + // The content of the message to be sent + InputMessageContent InputMessageContent `json:"input_message_content"` +} + +// Sends a message on behalf of a business account; for bots only. Returns the message after it was sent +func (client *Client) SendBusinessMessage(req *SendBusinessMessageRequest) (*BusinessMessage, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendBusinessMessage", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "chat_id": req.ChatId, + "reply_to": req.ReplyTo, + "disable_notification": req.DisableNotification, + "protect_content": req.ProtectContent, + "reply_markup": req.ReplyMarkup, + "input_message_content": req.InputMessageContent, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBusinessMessage(result.Data) +} + +type SendBusinessMessageAlbumRequest struct { + // Unique identifier of business connection on behalf of which to send the request + BusinessConnectionId string `json:"business_connection_id"` + // Target chat + ChatId int64 `json:"chat_id"` + // Information about the message to be replied; pass null if none + ReplyTo InputMessageReplyTo `json:"reply_to"` + // Pass true to disable notification for the message + DisableNotification bool `json:"disable_notification"` + // Pass true if the content of the message must be protected from forwarding and saving + ProtectContent bool `json:"protect_content"` + // Contents of messages to be sent. At most 10 messages can be added to an album + InputMessageContents []InputMessageContent `json:"input_message_contents"` +} + +// Sends 2-10 messages grouped together into an album on behalf of a business account; for bots only. Currently, only audio, document, photo and video messages can be grouped into an album. Documents and audio files can be only grouped in an album with messages of the same type. Returns sent messages +func (client *Client) SendBusinessMessageAlbum(req *SendBusinessMessageAlbumRequest) (*BusinessMessages, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendBusinessMessageAlbum", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "chat_id": req.ChatId, + "reply_to": req.ReplyTo, + "disable_notification": req.DisableNotification, + "protect_content": req.ProtectContent, + "input_message_contents": req.InputMessageContents, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBusinessMessages(result.Data) +} + type CheckQuickReplyShortcutNameRequest struct { // The name of the shortcut; 1-32 characters Name string `json:"name"` @@ -5719,6 +5873,32 @@ func (client *Client) HideSuggestedAction(req *HideSuggestedActionRequest) (*Ok, return UnmarshalOk(result.Data) } +type GetBusinessConnectionRequest struct { + // Identifier of the business connection to return + ConnectionId string `json:"connection_id"` +} + +// Returns information about a business connection by its identifier; for bots only +func (client *Client) GetBusinessConnection(req *GetBusinessConnectionRequest) (*BusinessConnection, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getBusinessConnection", + }, + Data: map[string]interface{}{ + "connection_id": req.ConnectionId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBusinessConnection(result.Data) +} + type GetLoginUrlInfoRequest struct { // Chat identifier of the message with the button ChatId int64 `json:"chat_id"` @@ -6494,6 +6674,8 @@ type SendChatActionRequest struct { ChatId int64 `json:"chat_id"` // If not 0, the message thread identifier in which the action was performed MessageThreadId int64 `json:"message_thread_id"` + // Unique identifier of business connection on behalf of which to send the request; for bots only + BusinessConnectionId string `json:"business_connection_id"` // The action description; pass null to cancel the currently active action Action ChatAction `json:"action"` } @@ -6507,6 +6689,7 @@ func (client *Client) SendChatAction(req *SendChatActionRequest) (*Ok, error) { Data: map[string]interface{}{ "chat_id": req.ChatId, "message_thread_id": req.MessageThreadId, + "business_connection_id": req.BusinessConnectionId, "action": req.Action, }, }) @@ -9451,7 +9634,7 @@ type SendStoryRequest struct { Content InputStoryContent `json:"content"` // Clickable rectangle areas to be shown on the story media; pass null if none Areas *InputStoryAreas `json:"areas"` - // Story caption; pass null to use an empty caption; 0-getOption("story_caption_length_max") characters + // Story caption; pass null to use an empty caption; 0-getOption("story_caption_length_max") characters; can have entities only if getOption("can_use_text_entities_in_story_caption") Caption *FormattedText `json:"caption"` // The privacy settings for the story; ignored for stories sent to supergroup and channel chats PrivacySettings StoryPrivacySettings `json:"privacy_settings"` @@ -13353,7 +13536,7 @@ func (client *Client) GetInstalledStickerSets(req *GetInstalledStickerSetsReques type GetArchivedStickerSetsRequest struct { // Type of the sticker sets to return StickerType StickerType `json:"sticker_type"` - // Identifier of the sticker set from which to return the result + // Identifier of the sticker set from which to return the result; use 0 to get results from the beginning OffsetStickerSetId JsonInt64 `json:"offset_sticker_set_id"` // The maximum number of sticker sets to return; up to 100 Limit int32 `json:"limit"` @@ -13673,7 +13856,7 @@ type AddRecentStickerRequest struct { Sticker InputFile `json:"sticker"` } -// Manually adds a new sticker to the list of recently used stickers. The new sticker is added to the top of the list. If the sticker was already in the list, it is removed from the list first. Only stickers belonging to a sticker set or in WEBP format can be added to this list. Emoji stickers can't be added to recent stickers +// Manually adds a new sticker to the list of recently used stickers. The new sticker is added to the top of the list. If the sticker was already in the list, it is removed from the list first. Only stickers belonging to a sticker set or in WEBP or WEBM format can be added to this list. Emoji stickers can't be added to recent stickers func (client *Client) AddRecentSticker(req *AddRecentStickerRequest) (*Stickers, error) { result, err := client.Send(Request{ meta: meta{ @@ -13774,7 +13957,7 @@ type AddFavoriteStickerRequest struct { Sticker InputFile `json:"sticker"` } -// Adds a new sticker to the list of favorite stickers. The new sticker is added to the top of the list. If the sticker was already in the list, it is removed from the list first. Only stickers belonging to a sticker set or in WEBP format can be added to this list. Emoji stickers can't be added to favorite stickers +// Adds a new sticker to the list of favorite stickers. The new sticker is added to the top of the list. If the sticker was already in the list, it is removed from the list first. Only stickers belonging to a sticker set or in WEBP or WEBM format can be added to this list. Emoji stickers can't be added to favorite stickers func (client *Client) AddFavoriteSticker(req *AddFavoriteStickerRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -14518,6 +14701,58 @@ func (client *Client) ReorderActiveUsernames(req *ReorderActiveUsernamesRequest) return UnmarshalOk(result.Data) } +type SetBirthdateRequest struct { + // The new value of the current user's birthdate; pass null to remove the birthdate + Birthdate *Birthdate `json:"birthdate"` +} + +// Changes the birthdate of the current user +func (client *Client) SetBirthdate(req *SetBirthdateRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBirthdate", + }, + Data: map[string]interface{}{ + "birthdate": req.Birthdate, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetPersonalChatRequest struct { + // Identifier of the new personal chat; pass 0 to remove the chat. Use getSuitablePersonalChats to get suitable chats + ChatId int64 `json:"chat_id"` +} + +// Changes the personal chat of the current user +func (client *Client) SetPersonalChat(req *SetPersonalChatRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setPersonalChat", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type SetEmojiStatusRequest struct { // New emoji status; pass null to switch to the default badge EmojiStatus *EmojiStatus `json:"emoji_status"` @@ -14597,7 +14832,7 @@ func (client *Client) SetBusinessLocation(req *SetBusinessLocationRequest) (*Ok, } type SetBusinessOpeningHoursRequest struct { - // The new opening hours of the business; pass null to remove the opening hours + // The new opening hours of the business; pass null to remove the opening hours; up to 28 time intervals can be specified OpeningHours *BusinessOpeningHours `json:"opening_hours"` } @@ -14674,6 +14909,32 @@ func (client *Client) SetBusinessAwayMessageSettings(req *SetBusinessAwayMessage return UnmarshalOk(result.Data) } +type SetBusinessIntroRequest struct { + // The new intro of the business; pass null to remove the intro + Intro *InputBusinessIntro `json:"intro"` +} + +// Changes the business intro of the current user. Requires Telegram Business subscription +func (client *Client) SetBusinessIntro(req *SetBusinessIntroRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBusinessIntro", + }, + Data: map[string]interface{}{ + "intro": req.Intro, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type ChangePhoneNumberRequest struct { // The new phone number of the user in international format PhoneNumber string `json:"phone_number"` @@ -17144,7 +17405,7 @@ type SetNewChatPrivacySettingsRequest struct { Settings *NewChatPrivacySettings `json:"settings"` } -// Changes privacy settings for new chat creation; for Telegram Premium users only +// Changes privacy settings for new chat creation; can be used only if getOption("can_set_new_chat_privacy_settings") func (client *Client) SetNewChatPrivacySettings(req *SetNewChatPrivacySettingsRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -18774,15 +19035,13 @@ type CreateNewStickerSetRequest struct { UserId int64 `json:"user_id"` // Sticker set title; 1-64 characters Title string `json:"title"` - // Sticker set name. Can contain only English letters, digits and underscores. Must end with *"_by_"* (** is case insensitive) for bots; 1-64 characters + // Sticker set name. Can contain only English letters, digits and underscores. Must end with *"_by_"* (** is case insensitive) for bots; 0-64 characters. If empty, then the name returned by getSuggestedStickerSetName will be used automatically Name string `json:"name"` - // Format of the stickers in the set - StickerFormat StickerFormat `json:"sticker_format"` // Type of the stickers in the set StickerType StickerType `json:"sticker_type"` // Pass true if stickers in the sticker set must be repainted; for custom emoji sticker sets only NeedsRepainting bool `json:"needs_repainting"` - // List of stickers to be added to the set; must be non-empty. All stickers must have the same format. For TGS stickers, uploadStickerFile must be used before the sticker is shown + // List of stickers to be added to the set; 1-200 stickers for custom emoji sticker sets, and 1-120 stickers otherwise. For TGS stickers, uploadStickerFile must be used before the sticker is shown Stickers []*InputSticker `json:"stickers"` // Source of the sticker set; may be empty if unknown Source string `json:"source"` @@ -18798,7 +19057,6 @@ func (client *Client) CreateNewStickerSet(req *CreateNewStickerSetRequest) (*Sti "user_id": req.UserId, "title": req.Title, "name": req.Name, - "sticker_format": req.StickerFormat, "sticker_type": req.StickerType, "needs_repainting": req.NeedsRepainting, "stickers": req.Stickers, @@ -18817,15 +19075,15 @@ func (client *Client) CreateNewStickerSet(req *CreateNewStickerSetRequest) (*Sti } type AddStickerToSetRequest struct { - // Sticker set owner + // Sticker set owner; ignored for regular users UserId int64 `json:"user_id"` - // Sticker set name + // Sticker set name. The sticker set must be owned by the current user, and contain less than 200 stickers for custom emoji sticker sets and less than 120 otherwise Name string `json:"name"` // Sticker to add to the set Sticker *InputSticker `json:"sticker"` } -// Adds a new sticker to a set; for bots only +// Adds a new sticker to a set func (client *Client) AddStickerToSet(req *AddStickerToSetRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -18848,16 +19106,53 @@ func (client *Client) AddStickerToSet(req *AddStickerToSetRequest) (*Ok, error) return UnmarshalOk(result.Data) } -type SetStickerSetThumbnailRequest struct { - // Sticker set owner +type ReplaceStickerInSetRequest struct { + // Sticker set owner; ignored for regular users UserId int64 `json:"user_id"` - // Sticker set name + // Sticker set name. The sticker set must be owned by the current user Name string `json:"name"` - // Thumbnail to set in PNG, TGS, or WEBM format; pass null to remove the sticker set thumbnail. Thumbnail format must match the format of stickers in the set - Thumbnail InputFile `json:"thumbnail"` + // Sticker to remove from the set + OldSticker InputFile `json:"old_sticker"` + // Sticker to add to the set + NewSticker *InputSticker `json:"new_sticker"` } -// Sets a sticker set thumbnail; for bots only +// Replaces existing sticker in a set. The function is equivalent to removeStickerFromSet, then addStickerToSet, then setStickerPositionInSet +func (client *Client) ReplaceStickerInSet(req *ReplaceStickerInSetRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "replaceStickerInSet", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "name": req.Name, + "old_sticker": req.OldSticker, + "new_sticker": req.NewSticker, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetStickerSetThumbnailRequest struct { + // Sticker set owner; ignored for regular users + UserId int64 `json:"user_id"` + // Sticker set name. The sticker set must be owned by the current user + Name string `json:"name"` + // Thumbnail to set; pass null to remove the sticker set thumbnail + Thumbnail InputFile `json:"thumbnail"` + // Format of the thumbnail; pass null if thumbnail is removed + Format StickerFormat `json:"format"` +} + +// Sets a sticker set thumbnail func (client *Client) SetStickerSetThumbnail(req *SetStickerSetThumbnailRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -18867,6 +19162,7 @@ func (client *Client) SetStickerSetThumbnail(req *SetStickerSetThumbnailRequest) "user_id": req.UserId, "name": req.Name, "thumbnail": req.Thumbnail, + "format": req.Format, }, }) if err != nil { @@ -18881,13 +19177,13 @@ func (client *Client) SetStickerSetThumbnail(req *SetStickerSetThumbnailRequest) } type SetCustomEmojiStickerSetThumbnailRequest struct { - // Sticker set name + // Sticker set name. The sticker set must be owned by the current user Name string `json:"name"` // Identifier of the custom emoji from the sticker set, which will be set as sticker set thumbnail; pass 0 to remove the sticker set thumbnail CustomEmojiId JsonInt64 `json:"custom_emoji_id"` } -// Sets a custom emoji sticker set thumbnail; for bots only +// Sets a custom emoji sticker set thumbnail func (client *Client) SetCustomEmojiStickerSetThumbnail(req *SetCustomEmojiStickerSetThumbnailRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -18910,13 +19206,13 @@ func (client *Client) SetCustomEmojiStickerSetThumbnail(req *SetCustomEmojiStick } type SetStickerSetTitleRequest struct { - // Sticker set name + // Sticker set name. The sticker set must be owned by the current user Name string `json:"name"` // New sticker set title Title string `json:"title"` } -// Sets a sticker set title; for bots only +// Sets a sticker set title func (client *Client) SetStickerSetTitle(req *SetStickerSetTitleRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -18939,11 +19235,11 @@ func (client *Client) SetStickerSetTitle(req *SetStickerSetTitleRequest) (*Ok, e } type DeleteStickerSetRequest struct { - // Sticker set name + // Sticker set name. The sticker set must be owned by the current user Name string `json:"name"` } -// Deleted a sticker set; for bots only +// Completely deletes a sticker set func (client *Client) DeleteStickerSet(req *DeleteStickerSetRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -18971,7 +19267,7 @@ type SetStickerPositionInSetRequest struct { Position int32 `json:"position"` } -// Changes the position of a sticker in the set to which it belongs; for bots only. The sticker set must have been created by the bot +// Changes the position of a sticker in the set to which it belongs. The sticker set must be owned by the current user func (client *Client) SetStickerPositionInSet(req *SetStickerPositionInSetRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -18994,11 +19290,11 @@ func (client *Client) SetStickerPositionInSet(req *SetStickerPositionInSetReques } type RemoveStickerFromSetRequest struct { - // Sticker + // Sticker to remove from the set Sticker InputFile `json:"sticker"` } -// Removes a sticker from the set to which it belongs; for bots only. The sticker set must have been created by the bot +// Removes a sticker from the set to which it belongs. The sticker set must be owned by the current user func (client *Client) RemoveStickerFromSet(req *RemoveStickerFromSetRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -19026,7 +19322,7 @@ type SetStickerEmojisRequest struct { Emojis string `json:"emojis"` } -// Changes the list of emoji corresponding to a sticker; for bots only. The sticker must belong to a regular or custom emoji sticker set created by the bot +// Changes the list of emoji corresponding to a sticker. The sticker must belong to a regular or custom emoji sticker set that is owned by the current user func (client *Client) SetStickerEmojis(req *SetStickerEmojisRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -19055,7 +19351,7 @@ type SetStickerKeywordsRequest struct { Keywords []string `json:"keywords"` } -// Changes the list of keywords of a sticker; for bots only. The sticker must belong to a regular or custom emoji sticker set created by the bot +// Changes the list of keywords of a sticker. The sticker must belong to a regular or custom emoji sticker set that is owned by the current user func (client *Client) SetStickerKeywords(req *SetStickerKeywordsRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -19084,7 +19380,7 @@ type SetStickerMaskPositionRequest struct { MaskPosition *MaskPosition `json:"mask_position"` } -// Changes the mask position of a mask sticker; for bots only. The sticker must belong to a mask sticker set created by the bot +// Changes the mask position of a mask sticker. The sticker must belong to a mask sticker set that is owned by the current user func (client *Client) SetStickerMaskPosition(req *SetStickerMaskPositionRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -19106,6 +19402,35 @@ func (client *Client) SetStickerMaskPosition(req *SetStickerMaskPositionRequest) return UnmarshalOk(result.Data) } +type GetOwnedStickerSetsRequest struct { + // Identifier of the sticker set from which to return owned sticker sets; use 0 to get results from the beginning + OffsetStickerSetId JsonInt64 `json:"offset_sticker_set_id"` + // The maximum number of sticker sets to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned objects is chosen by TDLib and can be smaller than the specified limit + Limit int32 `json:"limit"` +} + +// Returns sticker sets owned by the current user +func (client *Client) GetOwnedStickerSets(req *GetOwnedStickerSetsRequest) (*StickerSets, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getOwnedStickerSets", + }, + Data: map[string]interface{}{ + "offset_sticker_set_id": req.OffsetStickerSetId, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStickerSets(result.Data) +} + type GetMapThumbnailFileRequest struct { // Location of the map center Location *Location `json:"location"` @@ -19517,6 +19842,32 @@ func (client *Client) AssignGooglePlayTransaction(req *AssignGooglePlayTransacti return UnmarshalOk(result.Data) } +type GetBusinessFeaturesRequest struct { + // Source of the request; pass null if the method is called from settings or some non-standard source + Source BusinessFeature `json:"source"` +} + +// Returns information about features, available to Business users +func (client *Client) GetBusinessFeatures(req *GetBusinessFeaturesRequest) (*BusinessFeatures, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getBusinessFeatures", + }, + Data: map[string]interface{}{ + "source": req.Source, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBusinessFeatures(result.Data) +} + type AcceptTermsOfServiceRequest struct { // Terms of service identifier TermsOfServiceId string `json:"terms_of_service_id"` @@ -19765,6 +20116,32 @@ func GetPhoneNumberInfoSync(req *GetPhoneNumberInfoSyncRequest) (*PhoneNumberInf func (client *Client) GetPhoneNumberInfoSync(req *GetPhoneNumberInfoSyncRequest) (*PhoneNumberInfo, error) { return GetPhoneNumberInfoSync(req)} +type GetCollectibleItemInfoRequest struct { + // Type of the collectible item. The item must be used by a user and must be visible to the current user + Type CollectibleItemType `json:"type"` +} + +// Returns information about a given collectible item that was purchased at https://fragment.com +func (client *Client) GetCollectibleItemInfo(req *GetCollectibleItemInfoRequest) (*CollectibleItemInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getCollectibleItemInfo", + }, + Data: map[string]interface{}{ + "type": req.Type, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalCollectibleItemInfo(result.Data) +} + type GetDeepLinkInfoRequest struct { // The link Link string `json:"link"` @@ -21064,12 +21441,27 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateSuggestedActions: return UnmarshalUpdateSuggestedActions(result.Data) + case TypeUpdateContactCloseBirthdays: + return UnmarshalUpdateContactCloseBirthdays(result.Data) + case TypeUpdateAddChatMembersPrivacyForbidden: return UnmarshalUpdateAddChatMembersPrivacyForbidden(result.Data) case TypeUpdateAutosaveSettings: return UnmarshalUpdateAutosaveSettings(result.Data) + case TypeUpdateBusinessConnection: + return UnmarshalUpdateBusinessConnection(result.Data) + + case TypeUpdateNewBusinessMessage: + return UnmarshalUpdateNewBusinessMessage(result.Data) + + case TypeUpdateBusinessMessageEdited: + return UnmarshalUpdateBusinessMessageEdited(result.Data) + + case TypeUpdateBusinessMessagesDeleted: + return UnmarshalUpdateBusinessMessagesDeleted(result.Data) + case TypeUpdateNewInlineQuery: return UnmarshalUpdateNewInlineQuery(result.Data) diff --git a/client/type.go b/client/type.go index 036f037..1fe1ffd 100755 --- a/client/type.go +++ b/client/type.go @@ -38,6 +38,7 @@ const ( ClassInputMessageReplyTo = "InputMessageReplyTo" ClassMessageSource = "MessageSource" ClassMessageSponsorType = "MessageSponsorType" + ClassReportChatSponsoredMessageResult = "ReportChatSponsoredMessageResult" ClassNotificationSettingsScope = "NotificationSettingsScope" ClassChatType = "ChatType" ClassChatList = "ChatList" @@ -54,6 +55,7 @@ const ( ClassPageBlockHorizontalAlignment = "PageBlockHorizontalAlignment" ClassPageBlockVerticalAlignment = "PageBlockVerticalAlignment" ClassPageBlock = "PageBlock" + ClassCollectibleItemType = "CollectibleItemType" ClassInputCredentials = "InputCredentials" ClassPaymentProvider = "PaymentProvider" ClassInputInvoice = "InputInvoice" @@ -99,6 +101,7 @@ const ( ClassLanguagePackStringValue = "LanguagePackStringValue" ClassPremiumLimitType = "PremiumLimitType" ClassPremiumFeature = "PremiumFeature" + ClassBusinessFeature = "BusinessFeature" ClassPremiumStoryFeature = "PremiumStoryFeature" ClassPremiumSource = "PremiumSource" ClassStorePaymentPurpose = "StorePaymentPurpose" @@ -188,11 +191,15 @@ const ( ClassBotCommands = "BotCommands" ClassBotMenuButton = "BotMenuButton" ClassChatLocation = "ChatLocation" + ClassBirthdate = "Birthdate" + ClassCloseBirthdayUser = "CloseBirthdayUser" ClassBusinessLocation = "BusinessLocation" ClassBusinessRecipients = "BusinessRecipients" ClassBusinessAwayMessageSettings = "BusinessAwayMessageSettings" ClassBusinessGreetingMessageSettings = "BusinessGreetingMessageSettings" ClassBusinessConnectedBot = "BusinessConnectedBot" + ClassBusinessIntro = "BusinessIntro" + ClassInputBusinessIntro = "InputBusinessIntro" ClassBusinessOpeningHoursInterval = "BusinessOpeningHoursInterval" ClassBusinessOpeningHours = "BusinessOpeningHours" ClassBusinessInfo = "BusinessInfo" @@ -259,9 +266,12 @@ const ( ClassMessagePositions = "MessagePositions" ClassMessageCalendarDay = "MessageCalendarDay" ClassMessageCalendar = "MessageCalendar" + ClassBusinessMessage = "BusinessMessage" + ClassBusinessMessages = "BusinessMessages" ClassMessageSponsor = "MessageSponsor" ClassSponsoredMessage = "SponsoredMessage" ClassSponsoredMessages = "SponsoredMessages" + ClassReportChatSponsoredMessageOption = "ReportChatSponsoredMessageOption" ClassFileDownload = "FileDownload" ClassDownloadedFileCounts = "DownloadedFileCounts" ClassFoundFileDownloads = "FoundFileDownloads" @@ -297,6 +307,8 @@ const ( ClassForumTopic = "ForumTopic" ClassForumTopics = "ForumTopics" ClassLinkPreviewOptions = "LinkPreviewOptions" + ClassSharedUser = "SharedUser" + ClassSharedChat = "SharedChat" ClassPageBlockCaption = "PageBlockCaption" ClassPageBlockListItem = "PageBlockListItem" ClassPageBlockTableCell = "PageBlockTableCell" @@ -306,6 +318,7 @@ const ( ClassCountryInfo = "CountryInfo" ClassCountries = "Countries" ClassPhoneNumberInfo = "PhoneNumberInfo" + ClassCollectibleItemInfo = "CollectibleItemInfo" ClassBankCardActionOpenUrl = "BankCardActionOpenUrl" ClassBankCardInfo = "BankCardInfo" ClassAddress = "Address" @@ -396,6 +409,7 @@ const ( ClassEmojiReaction = "EmojiReaction" ClassAnimations = "Animations" ClassImportedContacts = "ImportedContacts" + ClassBusinessConnection = "BusinessConnection" ClassAttachmentMenuBotColor = "AttachmentMenuBotColor" ClassAttachmentMenuBot = "AttachmentMenuBot" ClassSentWebAppMessage = "SentWebAppMessage" @@ -416,7 +430,9 @@ const ( ClassLocalizationTargetInfo = "LocalizationTargetInfo" ClassPremiumLimit = "PremiumLimit" ClassPremiumFeatures = "PremiumFeatures" + ClassBusinessFeatures = "BusinessFeatures" ClassPremiumFeaturePromotionAnimation = "PremiumFeaturePromotionAnimation" + ClassBusinessFeaturePromotionAnimation = "BusinessFeaturePromotionAnimation" ClassPremiumState = "PremiumState" ClassPushReceiverId = "PushReceiverId" ClassThemeSettings = "ThemeSettings" @@ -589,6 +605,8 @@ const ( TypeBotCommands = "botCommands" TypeBotMenuButton = "botMenuButton" TypeChatLocation = "chatLocation" + TypeBirthdate = "birthdate" + TypeCloseBirthdayUser = "closeBirthdayUser" TypeBusinessAwayMessageScheduleAlways = "businessAwayMessageScheduleAlways" TypeBusinessAwayMessageScheduleOutsideOfOpeningHours = "businessAwayMessageScheduleOutsideOfOpeningHours" TypeBusinessAwayMessageScheduleCustom = "businessAwayMessageScheduleCustom" @@ -597,6 +615,8 @@ const ( TypeBusinessAwayMessageSettings = "businessAwayMessageSettings" TypeBusinessGreetingMessageSettings = "businessGreetingMessageSettings" TypeBusinessConnectedBot = "businessConnectedBot" + TypeBusinessIntro = "businessIntro" + TypeInputBusinessIntro = "inputBusinessIntro" TypeBusinessOpeningHoursInterval = "businessOpeningHoursInterval" TypeBusinessOpeningHours = "businessOpeningHours" TypeBusinessInfo = "businessInfo" @@ -722,6 +742,8 @@ const ( TypeMessagePositions = "messagePositions" TypeMessageCalendarDay = "messageCalendarDay" TypeMessageCalendar = "messageCalendar" + TypeBusinessMessage = "businessMessage" + TypeBusinessMessages = "businessMessages" TypeMessageSourceChatHistory = "messageSourceChatHistory" TypeMessageSourceMessageThreadHistory = "messageSourceMessageThreadHistory" TypeMessageSourceForumTopicHistory = "messageSourceForumTopicHistory" @@ -740,6 +762,12 @@ const ( TypeMessageSponsor = "messageSponsor" TypeSponsoredMessage = "sponsoredMessage" TypeSponsoredMessages = "sponsoredMessages" + TypeReportChatSponsoredMessageOption = "reportChatSponsoredMessageOption" + TypeReportChatSponsoredMessageResultOk = "reportChatSponsoredMessageResultOk" + TypeReportChatSponsoredMessageResultFailed = "reportChatSponsoredMessageResultFailed" + TypeReportChatSponsoredMessageResultOptionRequired = "reportChatSponsoredMessageResultOptionRequired" + TypeReportChatSponsoredMessageResultAdsHidden = "reportChatSponsoredMessageResultAdsHidden" + TypeReportChatSponsoredMessageResultPremiumRequired = "reportChatSponsoredMessageResultPremiumRequired" TypeFileDownload = "fileDownload" TypeDownloadedFileCounts = "downloadedFileCounts" TypeFoundFileDownloads = "foundFileDownloads" @@ -823,6 +851,8 @@ const ( TypeForumTopic = "forumTopic" TypeForumTopics = "forumTopics" TypeLinkPreviewOptions = "linkPreviewOptions" + TypeSharedUser = "sharedUser" + TypeSharedChat = "sharedChat" TypeRichTextPlain = "richTextPlain" TypeRichTextBold = "richTextBold" TypeRichTextItalic = "richTextItalic" @@ -884,6 +914,9 @@ const ( TypeCountryInfo = "countryInfo" TypeCountries = "countries" TypePhoneNumberInfo = "phoneNumberInfo" + TypeCollectibleItemTypeUsername = "collectibleItemTypeUsername" + TypeCollectibleItemTypePhoneNumber = "collectibleItemTypePhoneNumber" + TypeCollectibleItemInfo = "collectibleItemInfo" TypeBankCardActionOpenUrl = "bankCardActionOpenUrl" TypeBankCardInfo = "bankCardInfo" TypeAddress = "address" @@ -1258,6 +1291,7 @@ const ( TypeSpeechRecognitionResultPending = "speechRecognitionResultPending" TypeSpeechRecognitionResultText = "speechRecognitionResultText" TypeSpeechRecognitionResultError = "speechRecognitionResultError" + TypeBusinessConnection = "businessConnection" TypeAttachmentMenuBotColor = "attachmentMenuBotColor" TypeAttachmentMenuBot = "attachmentMenuBot" TypeSentWebAppMessage = "sentWebAppMessage" @@ -1402,6 +1436,18 @@ const ( TypePremiumFeatureSavedMessagesTags = "premiumFeatureSavedMessagesTags" TypePremiumFeatureMessagePrivacy = "premiumFeatureMessagePrivacy" TypePremiumFeatureLastSeenTimes = "premiumFeatureLastSeenTimes" + TypePremiumFeatureBusiness = "premiumFeatureBusiness" + TypeBusinessFeatureLocation = "businessFeatureLocation" + TypeBusinessFeatureOpeningHours = "businessFeatureOpeningHours" + TypeBusinessFeatureQuickReplies = "businessFeatureQuickReplies" + TypeBusinessFeatureGreetingMessage = "businessFeatureGreetingMessage" + TypeBusinessFeatureAwayMessage = "businessFeatureAwayMessage" + TypeBusinessFeatureAccountLinks = "businessFeatureAccountLinks" + TypeBusinessFeatureIntro = "businessFeatureIntro" + TypeBusinessFeatureBots = "businessFeatureBots" + TypeBusinessFeatureEmojiStatus = "businessFeatureEmojiStatus" + TypeBusinessFeatureChatFolderTags = "businessFeatureChatFolderTags" + TypeBusinessFeatureUpgradedStories = "businessFeatureUpgradedStories" TypePremiumStoryFeaturePriorityOrder = "premiumStoryFeaturePriorityOrder" TypePremiumStoryFeatureStealthMode = "premiumStoryFeatureStealthMode" TypePremiumStoryFeaturePermanentViewsHistory = "premiumStoryFeaturePermanentViewsHistory" @@ -1411,12 +1457,15 @@ const ( TypePremiumStoryFeatureVideoQuality = "premiumStoryFeatureVideoQuality" TypePremiumLimit = "premiumLimit" TypePremiumFeatures = "premiumFeatures" + TypeBusinessFeatures = "businessFeatures" TypePremiumSourceLimitExceeded = "premiumSourceLimitExceeded" TypePremiumSourceFeature = "premiumSourceFeature" + TypePremiumSourceBusinessFeature = "premiumSourceBusinessFeature" TypePremiumSourceStoryFeature = "premiumSourceStoryFeature" TypePremiumSourceLink = "premiumSourceLink" TypePremiumSourceSettings = "premiumSourceSettings" TypePremiumFeaturePromotionAnimation = "premiumFeaturePromotionAnimation" + TypeBusinessFeaturePromotionAnimation = "businessFeaturePromotionAnimation" TypePremiumState = "premiumState" TypeStorePaymentPurposePremiumSubscription = "storePaymentPurposePremiumSubscription" TypeStorePaymentPurposeGiftedPremium = "storePaymentPurposeGiftedPremium" @@ -1540,6 +1589,7 @@ const ( TypeStoryPrivacySettingsSelectedUsers = "storyPrivacySettingsSelectedUsers" TypeUserPrivacySettingRuleAllowAll = "userPrivacySettingRuleAllowAll" TypeUserPrivacySettingRuleAllowContacts = "userPrivacySettingRuleAllowContacts" + TypeUserPrivacySettingRuleAllowPremiumUsers = "userPrivacySettingRuleAllowPremiumUsers" TypeUserPrivacySettingRuleAllowUsers = "userPrivacySettingRuleAllowUsers" TypeUserPrivacySettingRuleAllowChatMembers = "userPrivacySettingRuleAllowChatMembers" TypeUserPrivacySettingRuleRestrictAll = "userPrivacySettingRuleRestrictAll" @@ -1552,6 +1602,7 @@ const ( TypeUserPrivacySettingShowLinkInForwardedMessages = "userPrivacySettingShowLinkInForwardedMessages" TypeUserPrivacySettingShowPhoneNumber = "userPrivacySettingShowPhoneNumber" TypeUserPrivacySettingShowBio = "userPrivacySettingShowBio" + TypeUserPrivacySettingShowBirthdate = "userPrivacySettingShowBirthdate" TypeUserPrivacySettingAllowChatInvites = "userPrivacySettingAllowChatInvites" TypeUserPrivacySettingAllowCalls = "userPrivacySettingAllowCalls" TypeUserPrivacySettingAllowPeerToPeerCalls = "userPrivacySettingAllowPeerToPeerCalls" @@ -1720,6 +1771,7 @@ const ( TypeSuggestedActionRestorePremium = "suggestedActionRestorePremium" TypeSuggestedActionSubscribeToAnnualPremium = "suggestedActionSubscribeToAnnualPremium" TypeSuggestedActionGiftPremiumForChristmas = "suggestedActionGiftPremiumForChristmas" + TypeSuggestedActionSetBirthdate = "suggestedActionSetBirthdate" TypeCount = "count" TypeText = "text" TypeSeconds = "seconds" @@ -1876,8 +1928,13 @@ const ( TypeUpdateAnimatedEmojiMessageClicked = "updateAnimatedEmojiMessageClicked" TypeUpdateAnimationSearchParameters = "updateAnimationSearchParameters" TypeUpdateSuggestedActions = "updateSuggestedActions" + TypeUpdateContactCloseBirthdays = "updateContactCloseBirthdays" TypeUpdateAddChatMembersPrivacyForbidden = "updateAddChatMembersPrivacyForbidden" TypeUpdateAutosaveSettings = "updateAutosaveSettings" + TypeUpdateBusinessConnection = "updateBusinessConnection" + TypeUpdateNewBusinessMessage = "updateNewBusinessMessage" + TypeUpdateBusinessMessageEdited = "updateBusinessMessageEdited" + TypeUpdateBusinessMessagesDeleted = "updateBusinessMessagesDeleted" TypeUpdateNewInlineQuery = "updateNewInlineQuery" TypeUpdateNewChosenInlineResult = "updateNewChosenInlineResult" TypeUpdateNewCallbackQuery = "updateNewCallbackQuery" @@ -2064,6 +2121,11 @@ type MessageSponsorType interface { MessageSponsorTypeType() string } +// Describes result of sponsored message report +type ReportChatSponsoredMessageResult interface { + ReportChatSponsoredMessageResultType() string +} + // Describes the types of chats to which notification settings are relevant type NotificationSettingsScope interface { NotificationSettingsScopeType() string @@ -2144,6 +2206,11 @@ type PageBlock interface { PageBlockType() string } +// Describes a collectible item that can be purchased at https://fragment.com +type CollectibleItemType interface { + CollectibleItemTypeType() string +} + // Contains information about the payment method chosen by the user type InputCredentials interface { InputCredentialsType() string @@ -2369,6 +2436,11 @@ type PremiumFeature interface { PremiumFeatureType() string } +// Describes a feature available to Business user accounts +type BusinessFeature interface { + BusinessFeatureType() string +} + // Describes a story feature available to Premium users type PremiumStoryFeature interface { PremiumStoryFeatureType() string @@ -4006,7 +4078,7 @@ func (*ThumbnailFormatPng) ThumbnailFormatType() string { return TypeThumbnailFormatPng } -// The thumbnail is in TGS format. It will be used only for TGS sticker sets +// The thumbnail is in TGS format. It will be used only for sticker sets type ThumbnailFormatTgs struct{ meta } @@ -4031,7 +4103,7 @@ func (*ThumbnailFormatTgs) ThumbnailFormatType() string { return TypeThumbnailFormatTgs } -// The thumbnail is in WEBM format. It will be used only for WEBM sticker sets +// The thumbnail is in WEBM format. It will be used only for sticker sets type ThumbnailFormatWebm struct{ meta } @@ -4056,7 +4128,7 @@ func (*ThumbnailFormatWebm) ThumbnailFormatType() string { return TypeThumbnailFormatWebm } -// The thumbnail is in WEBP format. It will be used only for some stickers +// The thumbnail is in WEBP format. It will be used only for some stickers and sticker sets type ThumbnailFormatWebp struct{ meta } @@ -5022,7 +5094,7 @@ func (voiceNote *VoiceNote) UnmarshalJSON(data []byte) error { // Describes an animated or custom representation of an emoji type AnimatedEmoji struct { meta - // Sticker for the emoji; may be null if yet unknown for a custom emoji. If the sticker is a custom emoji, it can have arbitrary format different from stickerFormatTgs + // Sticker for the emoji; may be null if yet unknown for a custom emoji. If the sticker is a custom emoji, then it can have arbitrary format Sticker *Sticker `json:"sticker"` // Expected width of the sticker, which can be used if the sticker is null StickerWidth int32 `json:"sticker_width"` @@ -5522,6 +5594,8 @@ type UserTypeBot struct { InlineQueryPlaceholder string `json:"inline_query_placeholder"` // True, if the location of the user is expected to be sent with every inline query to this bot NeedLocation bool `json:"need_location"` + // True, if the bot supports connection to Telegram Business accounts + CanConnectToBusiness bool `json:"can_connect_to_business"` // True, if the bot can be added to attachment or side menu CanBeAddedToAttachmentMenu bool `json:"can_be_added_to_attachment_menu"` } @@ -5671,6 +5745,58 @@ func (*ChatLocation) GetType() string { return TypeChatLocation } +// Represents a birthdate of a user +type Birthdate struct { + meta + // Day of the month; 1-31 + Day int32 `json:"day"` + // Month of the year; 1-12 + Month int32 `json:"month"` + // Birth year; 0 if unknown + Year int32 `json:"year"` +} + +func (entity *Birthdate) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Birthdate + + return json.Marshal((*stub)(entity)) +} + +func (*Birthdate) GetClass() string { + return ClassBirthdate +} + +func (*Birthdate) GetType() string { + return TypeBirthdate +} + +// Describes a user that had or will have a birthday soon +type CloseBirthdayUser struct { + meta + // User identifier + UserId int64 `json:"user_id"` + // Birthdate of the user + Birthdate *Birthdate `json:"birthdate"` +} + +func (entity *CloseBirthdayUser) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CloseBirthdayUser + + return json.Marshal((*stub)(entity)) +} + +func (*CloseBirthdayUser) GetClass() string { + return ClassCloseBirthdayUser +} + +func (*CloseBirthdayUser) GetType() string { + return TypeCloseBirthdayUser +} + // Send away messages always type BusinessAwayMessageScheduleAlways struct{ meta @@ -5780,6 +5906,8 @@ type BusinessRecipients struct { meta // Identifiers of selected private chats ChatIds []int64 `json:"chat_ids"` + // Identifiers of private chats that are always excluded; for businessConnectedBot only + ExcludedChatIds []int64 `json:"excluded_chat_ids"` // True, if all existing private chats are selected SelectExistingChats bool `json:"select_existing_chats"` // True, if all new private chats are selected @@ -5914,6 +6042,81 @@ func (*BusinessConnectedBot) GetType() string { return TypeBusinessConnectedBot } +// Describes settings for a business account intro +type BusinessIntro struct { + meta + // Title text of the intro + Title string `json:"title"` + // Message text of the intro + Message string `json:"message"` + // Greeting sticker of the intro; may be null if none + Sticker *Sticker `json:"sticker"` +} + +func (entity *BusinessIntro) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessIntro + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessIntro) GetClass() string { + return ClassBusinessIntro +} + +func (*BusinessIntro) GetType() string { + return TypeBusinessIntro +} + +// Describes settings for a business account intro to set +type InputBusinessIntro struct { + meta + // Title text of the intro; 0-getOption("business_intro_title_length_max") characters + Title string `json:"title"` + // Message text of the intro; 0-getOption("business_intro_message_length_max") characters + Message string `json:"message"` + // Greeting sticker of the intro; pass null if none. The sticker must belong to a sticker set and must not be a custom emoji + Sticker InputFile `json:"sticker"` +} + +func (entity *InputBusinessIntro) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputBusinessIntro + + return json.Marshal((*stub)(entity)) +} + +func (*InputBusinessIntro) GetClass() string { + return ClassInputBusinessIntro +} + +func (*InputBusinessIntro) GetType() string { + return TypeInputBusinessIntro +} + +func (inputBusinessIntro *InputBusinessIntro) UnmarshalJSON(data []byte) error { + var tmp struct { + Title string `json:"title"` + Message string `json:"message"` + Sticker json.RawMessage `json:"sticker"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + inputBusinessIntro.Title = tmp.Title + inputBusinessIntro.Message = tmp.Message + + fieldSticker, _ := UnmarshalInputFile(tmp.Sticker) + inputBusinessIntro.Sticker = fieldSticker + + return nil +} + // Describes an interval of time when the business is open type BusinessOpeningHoursInterval struct { meta @@ -5975,6 +6178,8 @@ type BusinessInfo struct { GreetingMessageSettings *BusinessGreetingMessageSettings `json:"greeting_message_settings"` // The away message; may be null if none or the Business account is not of the current user AwayMessageSettings *BusinessAwayMessageSettings `json:"away_message_settings"` + // Information about intro of the business; may be null if none + Intro *BusinessIntro `json:"intro"` } func (entity *BusinessInfo) MarshalJSON() ([]byte, error) { @@ -7005,7 +7210,7 @@ type Usernames struct { ActiveUsernames []string `json:"active_usernames"` // List of currently disabled usernames; the username can be activated with toggleUsernameIsActive, toggleBotUsernameIsActive, or toggleSupergroupUsernameIsActive DisabledUsernames []string `json:"disabled_usernames"` - // The active username, which can be changed with setUsername or setSupergroupUsername + // The active username, which can be changed with setUsername or setSupergroupUsername. Information about other active usernames can be received using getCollectibleItemInfo EditableUsername string `json:"editable_username"` } @@ -7298,6 +7503,10 @@ type UserFullInfo struct { SetChatBackground bool `json:"set_chat_background"` // A short user bio; may be null for bots Bio *FormattedText `json:"bio"` + // Birthdate of the user; may be null if unknown + Birthdate *Birthdate `json:"birthdate"` + // Identifier of the personal chat of the user; 0 if none + PersonalChatId int64 `json:"personal_chat_id"` // The list of available options for gifting Telegram Premium to the user PremiumGiftOptions []*PremiumPaymentOption `json:"premium_gift_options"` // Number of group chats where both the other user and the current user are a member; 0 for the current user @@ -7339,6 +7548,8 @@ func (userFullInfo *UserFullInfo) UnmarshalJSON(data []byte) error { NeedPhoneNumberPrivacyException bool `json:"need_phone_number_privacy_exception"` SetChatBackground bool `json:"set_chat_background"` Bio *FormattedText `json:"bio"` + Birthdate *Birthdate `json:"birthdate"` + PersonalChatId int64 `json:"personal_chat_id"` PremiumGiftOptions []*PremiumPaymentOption `json:"premium_gift_options"` GroupInCommonCount int32 `json:"group_in_common_count"` BusinessInfo *BusinessInfo `json:"business_info"` @@ -7362,6 +7573,8 @@ func (userFullInfo *UserFullInfo) UnmarshalJSON(data []byte) error { userFullInfo.NeedPhoneNumberPrivacyException = tmp.NeedPhoneNumberPrivacyException userFullInfo.SetChatBackground = tmp.SetChatBackground userFullInfo.Bio = tmp.Bio + userFullInfo.Birthdate = tmp.Birthdate + userFullInfo.PersonalChatId = tmp.PersonalChatId userFullInfo.PremiumGiftOptions = tmp.PremiumGiftOptions userFullInfo.GroupInCommonCount = tmp.GroupInCommonCount userFullInfo.BusinessInfo = tmp.BusinessInfo @@ -10090,6 +10303,8 @@ type Message struct { IsOutgoing bool `json:"is_outgoing"` // True, if the message is pinned IsPinned bool `json:"is_pinned"` + // True, if the message was sent because of a scheduled action by the message sender, for example, as away, or greeting service message + IsFromOffline bool `json:"is_from_offline"` // True, if the message can be edited. For live location and poll messages this fields shows whether editMessageLiveLocation or stopPoll can be used with this message by the application CanBeEdited bool `json:"can_be_edited"` // True, if the message can be forwarded @@ -10148,8 +10363,10 @@ type Message struct { SelfDestructIn float64 `json:"self_destruct_in"` // Time left before the message will be automatically deleted by message_auto_delete_time setting of the chat, in seconds; 0 if never AutoDeleteIn float64 `json:"auto_delete_in"` - // If non-zero, the user identifier of the bot through which this message was sent + // If non-zero, the user identifier of the inline bot through which this message was sent ViaBotUserId int64 `json:"via_bot_user_id"` + // If non-zero, the user identifier of the business bot that sent this message + SenderBusinessBotUserId int64 `json:"sender_business_bot_user_id"` // Number of times the sender of the message boosted the supergroup at the time the message was sent; 0 if none or unknown. For messages sent by the current user, supergroupFullInfo.my_boost_count must be used instead SenderBoostCount int32 `json:"sender_boost_count"` // For channel posts and anonymous group messages, optional author signature @@ -10189,6 +10406,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { SchedulingState json.RawMessage `json:"scheduling_state"` IsOutgoing bool `json:"is_outgoing"` IsPinned bool `json:"is_pinned"` + IsFromOffline bool `json:"is_from_offline"` CanBeEdited bool `json:"can_be_edited"` CanBeForwarded bool `json:"can_be_forwarded"` CanBeRepliedInAnotherChat bool `json:"can_be_replied_in_another_chat"` @@ -10219,6 +10437,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { SelfDestructIn float64 `json:"self_destruct_in"` AutoDeleteIn float64 `json:"auto_delete_in"` ViaBotUserId int64 `json:"via_bot_user_id"` + SenderBusinessBotUserId int64 `json:"sender_business_bot_user_id"` SenderBoostCount int32 `json:"sender_boost_count"` AuthorSignature string `json:"author_signature"` MediaAlbumId JsonInt64 `json:"media_album_id"` @@ -10236,6 +10455,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { message.ChatId = tmp.ChatId message.IsOutgoing = tmp.IsOutgoing message.IsPinned = tmp.IsPinned + message.IsFromOffline = tmp.IsFromOffline message.CanBeEdited = tmp.CanBeEdited message.CanBeForwarded = tmp.CanBeForwarded message.CanBeRepliedInAnotherChat = tmp.CanBeRepliedInAnotherChat @@ -10264,6 +10484,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { message.SelfDestructIn = tmp.SelfDestructIn message.AutoDeleteIn = tmp.AutoDeleteIn message.ViaBotUserId = tmp.ViaBotUserId + message.SenderBusinessBotUserId = tmp.SenderBusinessBotUserId message.SenderBoostCount = tmp.SenderBoostCount message.AuthorSignature = tmp.AuthorSignature message.MediaAlbumId = tmp.MediaAlbumId @@ -10474,6 +10695,54 @@ func (*MessageCalendar) GetType() string { return TypeMessageCalendar } +// Describes a message from a business account as received by a bot +type BusinessMessage struct { + meta + // The message + Message *Message `json:"message"` + // Message that is replied by the message in the same chat; may be null if none + ReplyToMessage *Message `json:"reply_to_message"` +} + +func (entity *BusinessMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessMessage + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessMessage) GetClass() string { + return ClassBusinessMessage +} + +func (*BusinessMessage) GetType() string { + return TypeBusinessMessage +} + +// Contains a list of messages from a business account as received by a bot +type BusinessMessages struct { + meta + // List of business messages + Messages []*BusinessMessage `json:"messages"` +} + +func (entity *BusinessMessages) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessMessages + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessMessages) GetClass() string { + return ClassBusinessMessages +} + +func (*BusinessMessages) GetType() string { + return TypeBusinessMessages +} + // The message is from a chat history type MessageSourceChatHistory struct{ meta @@ -10981,6 +11250,8 @@ type SponsoredMessage struct { MessageId int64 `json:"message_id"` // True, if the message needs to be labeled as "recommended" instead of "sponsored" IsRecommended bool `json:"is_recommended"` + // True, if the message can be reported to Telegram moderators through reportChatSponsoredMessage + CanBeReported bool `json:"can_be_reported"` // Content of the message. Currently, can be only of the type messageText Content MessageContent `json:"content"` // Information about the sponsor of the message @@ -11011,6 +11282,7 @@ func (sponsoredMessage *SponsoredMessage) UnmarshalJSON(data []byte) error { var tmp struct { MessageId int64 `json:"message_id"` IsRecommended bool `json:"is_recommended"` + CanBeReported bool `json:"can_be_reported"` Content json.RawMessage `json:"content"` Sponsor *MessageSponsor `json:"sponsor"` ButtonText string `json:"button_text"` @@ -11024,6 +11296,7 @@ func (sponsoredMessage *SponsoredMessage) UnmarshalJSON(data []byte) error { sponsoredMessage.MessageId = tmp.MessageId sponsoredMessage.IsRecommended = tmp.IsRecommended + sponsoredMessage.CanBeReported = tmp.CanBeReported sponsoredMessage.Sponsor = tmp.Sponsor sponsoredMessage.ButtonText = tmp.ButtonText sponsoredMessage.AdditionalInfo = tmp.AdditionalInfo @@ -11059,6 +11332,160 @@ func (*SponsoredMessages) GetType() string { return TypeSponsoredMessages } +// Describes an option to report a sponsored message +type ReportChatSponsoredMessageOption struct { + meta + // Unique identifier of the option + Id []byte `json:"id"` + // Text of the option + Text string `json:"text"` +} + +func (entity *ReportChatSponsoredMessageOption) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReportChatSponsoredMessageOption + + return json.Marshal((*stub)(entity)) +} + +func (*ReportChatSponsoredMessageOption) GetClass() string { + return ClassReportChatSponsoredMessageOption +} + +func (*ReportChatSponsoredMessageOption) GetType() string { + return TypeReportChatSponsoredMessageOption +} + +// The message was reported successfully +type ReportChatSponsoredMessageResultOk struct{ + meta +} + +func (entity *ReportChatSponsoredMessageResultOk) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReportChatSponsoredMessageResultOk + + return json.Marshal((*stub)(entity)) +} + +func (*ReportChatSponsoredMessageResultOk) GetClass() string { + return ClassReportChatSponsoredMessageResult +} + +func (*ReportChatSponsoredMessageResultOk) GetType() string { + return TypeReportChatSponsoredMessageResultOk +} + +func (*ReportChatSponsoredMessageResultOk) ReportChatSponsoredMessageResultType() string { + return TypeReportChatSponsoredMessageResultOk +} + +// The sponsored message is too old or not found +type ReportChatSponsoredMessageResultFailed struct{ + meta +} + +func (entity *ReportChatSponsoredMessageResultFailed) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReportChatSponsoredMessageResultFailed + + return json.Marshal((*stub)(entity)) +} + +func (*ReportChatSponsoredMessageResultFailed) GetClass() string { + return ClassReportChatSponsoredMessageResult +} + +func (*ReportChatSponsoredMessageResultFailed) GetType() string { + return TypeReportChatSponsoredMessageResultFailed +} + +func (*ReportChatSponsoredMessageResultFailed) ReportChatSponsoredMessageResultType() string { + return TypeReportChatSponsoredMessageResultFailed +} + +// The user must choose an option to report the message and repeat request with the chosen option +type ReportChatSponsoredMessageResultOptionRequired struct { + meta + // Title for the option choice + Title string `json:"title"` + // List of available options + Options []*ReportChatSponsoredMessageOption `json:"options"` +} + +func (entity *ReportChatSponsoredMessageResultOptionRequired) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReportChatSponsoredMessageResultOptionRequired + + return json.Marshal((*stub)(entity)) +} + +func (*ReportChatSponsoredMessageResultOptionRequired) GetClass() string { + return ClassReportChatSponsoredMessageResult +} + +func (*ReportChatSponsoredMessageResultOptionRequired) GetType() string { + return TypeReportChatSponsoredMessageResultOptionRequired +} + +func (*ReportChatSponsoredMessageResultOptionRequired) ReportChatSponsoredMessageResultType() string { + return TypeReportChatSponsoredMessageResultOptionRequired +} + +// Sponsored messages were hidden for the user in all chats +type ReportChatSponsoredMessageResultAdsHidden struct{ + meta +} + +func (entity *ReportChatSponsoredMessageResultAdsHidden) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReportChatSponsoredMessageResultAdsHidden + + return json.Marshal((*stub)(entity)) +} + +func (*ReportChatSponsoredMessageResultAdsHidden) GetClass() string { + return ClassReportChatSponsoredMessageResult +} + +func (*ReportChatSponsoredMessageResultAdsHidden) GetType() string { + return TypeReportChatSponsoredMessageResultAdsHidden +} + +func (*ReportChatSponsoredMessageResultAdsHidden) ReportChatSponsoredMessageResultType() string { + return TypeReportChatSponsoredMessageResultAdsHidden +} + +// The user asked to hide sponsored messages, but Telegram Premium is required for this +type ReportChatSponsoredMessageResultPremiumRequired struct{ + meta +} + +func (entity *ReportChatSponsoredMessageResultPremiumRequired) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReportChatSponsoredMessageResultPremiumRequired + + return json.Marshal((*stub)(entity)) +} + +func (*ReportChatSponsoredMessageResultPremiumRequired) GetClass() string { + return ClassReportChatSponsoredMessageResult +} + +func (*ReportChatSponsoredMessageResultPremiumRequired) GetType() string { + return TypeReportChatSponsoredMessageResultPremiumRequired +} + +func (*ReportChatSponsoredMessageResultPremiumRequired) ReportChatSponsoredMessageResultType() string { + return TypeReportChatSponsoredMessageResultPremiumRequired +} + // Describes a file added to file download list type FileDownload struct { meta @@ -11503,7 +11930,7 @@ type ChatFolder struct { Title string `json:"title"` // The chosen icon for the chat folder; may be null. If null, use getChatFolderDefaultIconName to get default icon name for the folder Icon *ChatFolderIcon `json:"icon"` - // The identifier of the chosen color for the chat folder icon; from -1 to 6. If -1, then color is didabled + // The identifier of the chosen color for the chat folder icon; from -1 to 6. If -1, then color is didabled. Can't be changed if folder tags are disabled or the current user doesn't have Telegram Premium subscription ColorId int32 `json:"color_id"` // True, if at least one link has been created for the folder IsShareable bool `json:"is_shareable"` @@ -12780,6 +13207,12 @@ type KeyboardButtonTypeRequestUsers struct { UserIsPremium bool `json:"user_is_premium"` // The maximum number of users to share MaxQuantity int32 `json:"max_quantity"` + // Pass true to request name of the users; bots only + RequestName bool `json:"request_name"` + // Pass true to request username of the users; bots only + RequestUsername bool `json:"request_username"` + // Pass true to request photo of the users; bots only + RequestPhoto bool `json:"request_photo"` } func (entity *KeyboardButtonTypeRequestUsers) MarshalJSON() ([]byte, error) { @@ -12825,6 +13258,12 @@ type KeyboardButtonTypeRequestChat struct { BotAdministratorRights *ChatAdministratorRights `json:"bot_administrator_rights"` // True, if the bot must be a member of the chat; for basic group and supergroup chats only BotIsMember bool `json:"bot_is_member"` + // Pass true to request title of the chat; bots only + RequestTitle bool `json:"request_title"` + // Pass true to request username of the chat; bots only + RequestUsername bool `json:"request_username"` + // Pass true to request photo of the chat; bots only + RequestPhoto bool `json:"request_photo"` } func (entity *KeyboardButtonTypeRequestChat) MarshalJSON() ([]byte, error) { @@ -13830,6 +14269,66 @@ func (*LinkPreviewOptions) GetType() string { return TypeLinkPreviewOptions } +// Contains information about a user shared with a bot +type SharedUser struct { + meta + // User identifier + UserId int64 `json:"user_id"` + // First name of the user; for bots only + FirstName string `json:"first_name"` + // Last name of the user; for bots only + LastName string `json:"last_name"` + // Username of the user; for bots only + Username string `json:"username"` + // Profile photo of the user; for bots only; may be null + Photo *Photo `json:"photo"` +} + +func (entity *SharedUser) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SharedUser + + return json.Marshal((*stub)(entity)) +} + +func (*SharedUser) GetClass() string { + return ClassSharedUser +} + +func (*SharedUser) GetType() string { + return TypeSharedUser +} + +// Contains information about a chat shared with a bot +type SharedChat struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // Title of the chat; for bots only + Title string `json:"title"` + // Username of the chat; for bots only + Username string `json:"username"` + // Photo of the chat; for bots only; may be null + Photo *Photo `json:"photo"` +} + +func (entity *SharedChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SharedChat + + return json.Marshal((*stub)(entity)) +} + +func (*SharedChat) GetClass() string { + return ClassSharedChat +} + +func (*SharedChat) GetType() string { + return TypeSharedChat +} + // A plain text type RichTextPlain struct { meta @@ -16287,7 +16786,7 @@ type PhoneNumberInfo struct { CountryCallingCode string `json:"country_calling_code"` // The phone number without country calling code formatted accordingly to local rules. Expected digits are returned as '-', but even more digits might be entered by the user FormattedPhoneNumber string `json:"formatted_phone_number"` - // True, if the phone number was bought on Fragment and isn't tied to a SIM card + // True, if the phone number was bought at https://fragment.com and isn't tied to a SIM card. Information about the phone number can be received using getCollectibleItemInfo IsAnonymous bool `json:"is_anonymous"` } @@ -16307,6 +16806,93 @@ func (*PhoneNumberInfo) GetType() string { return TypePhoneNumberInfo } +// A username +type CollectibleItemTypeUsername struct { + meta + // The username + Username string `json:"username"` +} + +func (entity *CollectibleItemTypeUsername) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CollectibleItemTypeUsername + + return json.Marshal((*stub)(entity)) +} + +func (*CollectibleItemTypeUsername) GetClass() string { + return ClassCollectibleItemType +} + +func (*CollectibleItemTypeUsername) GetType() string { + return TypeCollectibleItemTypeUsername +} + +func (*CollectibleItemTypeUsername) CollectibleItemTypeType() string { + return TypeCollectibleItemTypeUsername +} + +// A phone number +type CollectibleItemTypePhoneNumber struct { + meta + // The phone number + PhoneNumber string `json:"phone_number"` +} + +func (entity *CollectibleItemTypePhoneNumber) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CollectibleItemTypePhoneNumber + + return json.Marshal((*stub)(entity)) +} + +func (*CollectibleItemTypePhoneNumber) GetClass() string { + return ClassCollectibleItemType +} + +func (*CollectibleItemTypePhoneNumber) GetType() string { + return TypeCollectibleItemTypePhoneNumber +} + +func (*CollectibleItemTypePhoneNumber) CollectibleItemTypeType() string { + return TypeCollectibleItemTypePhoneNumber +} + +// Contains information about a collectible item and its last purchase +type CollectibleItemInfo struct { + meta + // Point in time (Unix timestamp) when the item was purchased + PurchaseDate int32 `json:"purchase_date"` + // Currency for the paid amount + Currency string `json:"currency"` + // The paid amount, in the smallest units of the currency + Amount int64 `json:"amount"` + // Cryptocurrency used to pay for the item + Cryptocurrency string `json:"cryptocurrency"` + // The paid amount, in the smallest units of the cryptocurrency + CryptocurrencyAmount JsonInt64 `json:"cryptocurrency_amount"` + // Individual URL for the item on https://fragment.com + Url string `json:"url"` +} + +func (entity *CollectibleItemInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CollectibleItemInfo + + return json.Marshal((*stub)(entity)) +} + +func (*CollectibleItemInfo) GetClass() string { + return ClassCollectibleItemInfo +} + +func (*CollectibleItemInfo) GetType() string { + return TypeCollectibleItemInfo +} + // Describes an action associated with a bank card number type BankCardActionOpenUrl struct { meta @@ -17103,7 +17689,7 @@ type MessageExtendedMediaPreview struct { Width int32 `json:"width"` // Media height; 0 if unknown Height int32 `json:"height"` - // Media duration; 0 if unknown + // Media duration, in seconds; 0 if unknown Duration int32 `json:"duration"` // Media minithumbnail; may be null Minithumbnail *Minithumbnail `json:"minithumbnail"` @@ -17229,7 +17815,7 @@ type PremiumGiveawayParameters struct { OnlyNewMembers bool `json:"only_new_members"` // True, if the list of winners of the giveaway will be available to everyone HasPublicWinners bool `json:"has_public_winners"` - // The list of two-letter ISO 3166-1 alpha-2 codes of countries, users from which will be eligible for the giveaway. If empty, then all users can participate in the giveaway. There can be up to getOption("giveaway_country_count_max") chosen countries. Users with phone number that was bought on Fragment can participate in any giveaway and the country code "FT" must not be specified in the list + // The list of two-letter ISO 3166-1 alpha-2 codes of countries, users from which will be eligible for the giveaway. If empty, then all users can participate in the giveaway. There can be up to getOption("giveaway_country_count_max") chosen countries. Users with phone number that was bought at https://fragment.com can participate in any giveaway and the country code "FT" must not be specified in the list CountryCodes []string `json:"country_codes"` // Additional description of the giveaway prize; 0-128 characters PrizeDescription string `json:"prize_description"` @@ -21313,8 +21899,8 @@ func (*MessageContactRegistered) MessageContentType() string { // The current user shared users, which were requested by the bot type MessageUsersShared struct { meta - // Identifier of the shared users - UserIds []int64 `json:"user_ids"` + // The shared users + Users []*SharedUser `json:"users"` // Identifier of the keyboard button with the request ButtonId int32 `json:"button_id"` } @@ -21342,8 +21928,8 @@ func (*MessageUsersShared) MessageContentType() string { // The current user shared a chat, which was requested by the bot type MessageChatShared struct { meta - // Identifier of the shared chat - ChatId int64 `json:"chat_id"` + // The shared chat + Chat *SharedChat `json:"chat"` // Identifier of the keyboard button with the request ButtonId int32 `json:"button_id"` } @@ -22842,7 +23428,7 @@ type InputMessageVideoNote struct { VideoNote InputFile `json:"video_note"` // Video thumbnail; may be null if empty; pass null to skip thumbnail uploading Thumbnail *InputThumbnail `json:"thumbnail"` - // Duration of the video, in seconds + // Duration of the video, in seconds; 0-60 Duration int32 `json:"duration"` // Video width and height; must be positive and not greater than 640 Length int32 `json:"length"` @@ -24401,14 +24987,14 @@ type StickerSet struct { Thumbnail *Thumbnail `json:"thumbnail"` // Sticker set thumbnail's outline represented as a list of closed vector paths; may be empty. The coordinate system origin is in the upper-left corner ThumbnailOutline []*ClosedVectorPath `json:"thumbnail_outline"` + // True, if the sticker set is owned by the current user + IsOwned bool `json:"is_owned"` // True, if the sticker set has been installed by the current user IsInstalled bool `json:"is_installed"` // True, if the sticker set has been archived. A sticker set can't be installed and archived simultaneously IsArchived bool `json:"is_archived"` // True, if the sticker set is official IsOfficial bool `json:"is_official"` - // Format of the stickers in the set - StickerFormat StickerFormat `json:"sticker_format"` // Type of the stickers in the set StickerType StickerType `json:"sticker_type"` // True, if stickers in the sticker set are custom emoji that must be repainted; for custom emoji sticker sets only @@ -24446,10 +25032,10 @@ func (stickerSet *StickerSet) UnmarshalJSON(data []byte) error { Name string `json:"name"` Thumbnail *Thumbnail `json:"thumbnail"` ThumbnailOutline []*ClosedVectorPath `json:"thumbnail_outline"` + IsOwned bool `json:"is_owned"` IsInstalled bool `json:"is_installed"` IsArchived bool `json:"is_archived"` IsOfficial bool `json:"is_official"` - StickerFormat json.RawMessage `json:"sticker_format"` StickerType json.RawMessage `json:"sticker_type"` NeedsRepainting bool `json:"needs_repainting"` IsAllowedAsChatEmojiStatus bool `json:"is_allowed_as_chat_emoji_status"` @@ -24468,6 +25054,7 @@ func (stickerSet *StickerSet) UnmarshalJSON(data []byte) error { stickerSet.Name = tmp.Name stickerSet.Thumbnail = tmp.Thumbnail stickerSet.ThumbnailOutline = tmp.ThumbnailOutline + stickerSet.IsOwned = tmp.IsOwned stickerSet.IsInstalled = tmp.IsInstalled stickerSet.IsArchived = tmp.IsArchived stickerSet.IsOfficial = tmp.IsOfficial @@ -24477,9 +25064,6 @@ func (stickerSet *StickerSet) UnmarshalJSON(data []byte) error { stickerSet.Stickers = tmp.Stickers stickerSet.Emojis = tmp.Emojis - fieldStickerFormat, _ := UnmarshalStickerFormat(tmp.StickerFormat) - stickerSet.StickerFormat = fieldStickerFormat - fieldStickerType, _ := UnmarshalStickerType(tmp.StickerType) stickerSet.StickerType = fieldStickerType @@ -24499,14 +25083,14 @@ type StickerSetInfo struct { Thumbnail *Thumbnail `json:"thumbnail"` // Sticker set thumbnail's outline represented as a list of closed vector paths; may be empty. The coordinate system origin is in the upper-left corner ThumbnailOutline []*ClosedVectorPath `json:"thumbnail_outline"` + // True, if the sticker set is owned by the current user + IsOwned bool `json:"is_owned"` // True, if the sticker set has been installed by the current user IsInstalled bool `json:"is_installed"` // True, if the sticker set has been archived. A sticker set can't be installed and archived simultaneously IsArchived bool `json:"is_archived"` // True, if the sticker set is official IsOfficial bool `json:"is_official"` - // Format of the stickers in the set - StickerFormat StickerFormat `json:"sticker_format"` // Type of the stickers in the set StickerType StickerType `json:"sticker_type"` // True, if stickers in the sticker set are custom emoji that must be repainted; for custom emoji sticker sets only @@ -24544,10 +25128,10 @@ func (stickerSetInfo *StickerSetInfo) UnmarshalJSON(data []byte) error { Name string `json:"name"` Thumbnail *Thumbnail `json:"thumbnail"` ThumbnailOutline []*ClosedVectorPath `json:"thumbnail_outline"` + IsOwned bool `json:"is_owned"` IsInstalled bool `json:"is_installed"` IsArchived bool `json:"is_archived"` IsOfficial bool `json:"is_official"` - StickerFormat json.RawMessage `json:"sticker_format"` StickerType json.RawMessage `json:"sticker_type"` NeedsRepainting bool `json:"needs_repainting"` IsAllowedAsChatEmojiStatus bool `json:"is_allowed_as_chat_emoji_status"` @@ -24566,6 +25150,7 @@ func (stickerSetInfo *StickerSetInfo) UnmarshalJSON(data []byte) error { stickerSetInfo.Name = tmp.Name stickerSetInfo.Thumbnail = tmp.Thumbnail stickerSetInfo.ThumbnailOutline = tmp.ThumbnailOutline + stickerSetInfo.IsOwned = tmp.IsOwned stickerSetInfo.IsInstalled = tmp.IsInstalled stickerSetInfo.IsArchived = tmp.IsArchived stickerSetInfo.IsOfficial = tmp.IsOfficial @@ -24575,9 +25160,6 @@ func (stickerSetInfo *StickerSetInfo) UnmarshalJSON(data []byte) error { stickerSetInfo.Size = tmp.Size stickerSetInfo.Covers = tmp.Covers - fieldStickerFormat, _ := UnmarshalStickerFormat(tmp.StickerFormat) - stickerSetInfo.StickerFormat = fieldStickerFormat - fieldStickerType, _ := UnmarshalStickerType(tmp.StickerType) stickerSetInfo.StickerType = fieldStickerType @@ -28447,6 +29029,39 @@ func (*SpeechRecognitionResultError) SpeechRecognitionResultType() string { return TypeSpeechRecognitionResultError } +// Describes a connection of the bot with a business account +type BusinessConnection struct { + meta + // Unique identifier of the connection + Id string `json:"id"` + // Identifier of the business user that created the connection + UserId int64 `json:"user_id"` + // Chat identifier of the private chat with the user + UserChatId int64 `json:"user_chat_id"` + // Point in time (Unix timestamp) when the connection was established + Date int32 `json:"date"` + // True, if the bot can send messages to the connected user; false otherwise + CanReply bool `json:"can_reply"` + // True, if the connection is enabled; false otherwise + IsEnabled bool `json:"is_enabled"` +} + +func (entity *BusinessConnection) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessConnection + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessConnection) GetClass() string { + return ClassBusinessConnection +} + +func (*BusinessConnection) GetType() string { + return TypeBusinessConnection +} + // Describes a color to highlight a bot added to attachment menu type AttachmentMenuBotColor struct { meta @@ -32905,7 +33520,7 @@ func (*PremiumFeatureProfileBadge) PremiumFeatureType() string { return TypePremiumFeatureProfileBadge } -// An emoji status shown along with the user's name +// The ability to show an emoji status along with the user's name type PremiumFeatureEmojiStatus struct{ meta } @@ -33205,6 +33820,306 @@ func (*PremiumFeatureLastSeenTimes) PremiumFeatureType() string { return TypePremiumFeatureLastSeenTimes } +// The ability to use Business features +type PremiumFeatureBusiness struct{ + meta +} + +func (entity *PremiumFeatureBusiness) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumFeatureBusiness + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumFeatureBusiness) GetClass() string { + return ClassPremiumFeature +} + +func (*PremiumFeatureBusiness) GetType() string { + return TypePremiumFeatureBusiness +} + +func (*PremiumFeatureBusiness) PremiumFeatureType() string { + return TypePremiumFeatureBusiness +} + +// The ability to set location +type BusinessFeatureLocation struct{ + meta +} + +func (entity *BusinessFeatureLocation) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessFeatureLocation + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessFeatureLocation) GetClass() string { + return ClassBusinessFeature +} + +func (*BusinessFeatureLocation) GetType() string { + return TypeBusinessFeatureLocation +} + +func (*BusinessFeatureLocation) BusinessFeatureType() string { + return TypeBusinessFeatureLocation +} + +// The ability to set opening hours +type BusinessFeatureOpeningHours struct{ + meta +} + +func (entity *BusinessFeatureOpeningHours) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessFeatureOpeningHours + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessFeatureOpeningHours) GetClass() string { + return ClassBusinessFeature +} + +func (*BusinessFeatureOpeningHours) GetType() string { + return TypeBusinessFeatureOpeningHours +} + +func (*BusinessFeatureOpeningHours) BusinessFeatureType() string { + return TypeBusinessFeatureOpeningHours +} + +// The ability to use quick replies +type BusinessFeatureQuickReplies struct{ + meta +} + +func (entity *BusinessFeatureQuickReplies) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessFeatureQuickReplies + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessFeatureQuickReplies) GetClass() string { + return ClassBusinessFeature +} + +func (*BusinessFeatureQuickReplies) GetType() string { + return TypeBusinessFeatureQuickReplies +} + +func (*BusinessFeatureQuickReplies) BusinessFeatureType() string { + return TypeBusinessFeatureQuickReplies +} + +// The ability to set up a greeting message +type BusinessFeatureGreetingMessage struct{ + meta +} + +func (entity *BusinessFeatureGreetingMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessFeatureGreetingMessage + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessFeatureGreetingMessage) GetClass() string { + return ClassBusinessFeature +} + +func (*BusinessFeatureGreetingMessage) GetType() string { + return TypeBusinessFeatureGreetingMessage +} + +func (*BusinessFeatureGreetingMessage) BusinessFeatureType() string { + return TypeBusinessFeatureGreetingMessage +} + +// The ability to set up an away message +type BusinessFeatureAwayMessage struct{ + meta +} + +func (entity *BusinessFeatureAwayMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessFeatureAwayMessage + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessFeatureAwayMessage) GetClass() string { + return ClassBusinessFeature +} + +func (*BusinessFeatureAwayMessage) GetType() string { + return TypeBusinessFeatureAwayMessage +} + +func (*BusinessFeatureAwayMessage) BusinessFeatureType() string { + return TypeBusinessFeatureAwayMessage +} + +// The ability to create links to the business account with predefined message text +type BusinessFeatureAccountLinks struct{ + meta +} + +func (entity *BusinessFeatureAccountLinks) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessFeatureAccountLinks + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessFeatureAccountLinks) GetClass() string { + return ClassBusinessFeature +} + +func (*BusinessFeatureAccountLinks) GetType() string { + return TypeBusinessFeatureAccountLinks +} + +func (*BusinessFeatureAccountLinks) BusinessFeatureType() string { + return TypeBusinessFeatureAccountLinks +} + +// The ability to customize intro +type BusinessFeatureIntro struct{ + meta +} + +func (entity *BusinessFeatureIntro) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessFeatureIntro + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessFeatureIntro) GetClass() string { + return ClassBusinessFeature +} + +func (*BusinessFeatureIntro) GetType() string { + return TypeBusinessFeatureIntro +} + +func (*BusinessFeatureIntro) BusinessFeatureType() string { + return TypeBusinessFeatureIntro +} + +// The ability to connect a bot to the account +type BusinessFeatureBots struct{ + meta +} + +func (entity *BusinessFeatureBots) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessFeatureBots + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessFeatureBots) GetClass() string { + return ClassBusinessFeature +} + +func (*BusinessFeatureBots) GetType() string { + return TypeBusinessFeatureBots +} + +func (*BusinessFeatureBots) BusinessFeatureType() string { + return TypeBusinessFeatureBots +} + +// The ability to show an emoji status along with the business name +type BusinessFeatureEmojiStatus struct{ + meta +} + +func (entity *BusinessFeatureEmojiStatus) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessFeatureEmojiStatus + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessFeatureEmojiStatus) GetClass() string { + return ClassBusinessFeature +} + +func (*BusinessFeatureEmojiStatus) GetType() string { + return TypeBusinessFeatureEmojiStatus +} + +func (*BusinessFeatureEmojiStatus) BusinessFeatureType() string { + return TypeBusinessFeatureEmojiStatus +} + +// The ability to display folder names for each chat in the chat list +type BusinessFeatureChatFolderTags struct{ + meta +} + +func (entity *BusinessFeatureChatFolderTags) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessFeatureChatFolderTags + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessFeatureChatFolderTags) GetClass() string { + return ClassBusinessFeature +} + +func (*BusinessFeatureChatFolderTags) GetType() string { + return TypeBusinessFeatureChatFolderTags +} + +func (*BusinessFeatureChatFolderTags) BusinessFeatureType() string { + return TypeBusinessFeatureChatFolderTags +} + +// Allowed to use many additional features for stories +type BusinessFeatureUpgradedStories struct{ + meta +} + +func (entity *BusinessFeatureUpgradedStories) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessFeatureUpgradedStories + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessFeatureUpgradedStories) GetClass() string { + return ClassBusinessFeature +} + +func (*BusinessFeatureUpgradedStories) GetType() string { + return TypeBusinessFeatureUpgradedStories +} + +func (*BusinessFeatureUpgradedStories) BusinessFeatureType() string { + return TypeBusinessFeatureUpgradedStories +} + // Stories of the current user are displayed before stories of non-Premium contacts, supergroups, and channels type PremiumStoryFeaturePriorityOrder struct{ meta @@ -33478,6 +34393,45 @@ func (premiumFeatures *PremiumFeatures) UnmarshalJSON(data []byte) error { return nil } +// Contains information about features, available to Business user accounts +type BusinessFeatures struct { + meta + // The list of available business features + Features []BusinessFeature `json:"features"` +} + +func (entity *BusinessFeatures) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessFeatures + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessFeatures) GetClass() string { + return ClassBusinessFeatures +} + +func (*BusinessFeatures) GetType() string { + return TypeBusinessFeatures +} + +func (businessFeatures *BusinessFeatures) UnmarshalJSON(data []byte) error { + var tmp struct { + Features []json.RawMessage `json:"features"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldFeatures, _ := UnmarshalListOfBusinessFeature(tmp.Features) + businessFeatures.Features = fieldFeatures + + return nil +} + // A limit was exceeded type PremiumSourceLimitExceeded struct { meta @@ -33564,6 +34518,49 @@ func (premiumSourceFeature *PremiumSourceFeature) UnmarshalJSON(data []byte) err return nil } +// A user tried to use a Business feature +type PremiumSourceBusinessFeature struct { + meta + // The used feature; pass null if none specific feature was used + Feature BusinessFeature `json:"feature"` +} + +func (entity *PremiumSourceBusinessFeature) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumSourceBusinessFeature + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumSourceBusinessFeature) GetClass() string { + return ClassPremiumSource +} + +func (*PremiumSourceBusinessFeature) GetType() string { + return TypePremiumSourceBusinessFeature +} + +func (*PremiumSourceBusinessFeature) PremiumSourceType() string { + return TypePremiumSourceBusinessFeature +} + +func (premiumSourceBusinessFeature *PremiumSourceBusinessFeature) UnmarshalJSON(data []byte) error { + var tmp struct { + Feature json.RawMessage `json:"feature"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldFeature, _ := UnmarshalBusinessFeature(tmp.Feature) + premiumSourceBusinessFeature.Feature = fieldFeature + + return nil +} + // A user tried to use a Premium story feature type PremiumSourceStoryFeature struct { meta @@ -33703,6 +34700,50 @@ func (premiumFeaturePromotionAnimation *PremiumFeaturePromotionAnimation) Unmars return nil } +// Describes a promotion animation for a Business feature +type BusinessFeaturePromotionAnimation struct { + meta + // Business feature + Feature BusinessFeature `json:"feature"` + // Promotion animation for the feature + Animation *Animation `json:"animation"` +} + +func (entity *BusinessFeaturePromotionAnimation) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessFeaturePromotionAnimation + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessFeaturePromotionAnimation) GetClass() string { + return ClassBusinessFeaturePromotionAnimation +} + +func (*BusinessFeaturePromotionAnimation) GetType() string { + return TypeBusinessFeaturePromotionAnimation +} + +func (businessFeaturePromotionAnimation *BusinessFeaturePromotionAnimation) UnmarshalJSON(data []byte) error { + var tmp struct { + Feature json.RawMessage `json:"feature"` + Animation *Animation `json:"animation"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + businessFeaturePromotionAnimation.Animation = tmp.Animation + + fieldFeature, _ := UnmarshalBusinessFeature(tmp.Feature) + businessFeaturePromotionAnimation.Feature = fieldFeature + + return nil +} + // Contains state of Telegram Premium subscription and promotion videos for Premium features type PremiumState struct { meta @@ -33712,6 +34753,8 @@ type PremiumState struct { PaymentOptions []*PremiumStatePaymentOption `json:"payment_options"` // The list of available promotion animations for Premium features Animations []*PremiumFeaturePromotionAnimation `json:"animations"` + // The list of available promotion animations for Business features + BusinessAnimations []*BusinessFeaturePromotionAnimation `json:"business_animations"` } func (entity *PremiumState) MarshalJSON() ([]byte, error) { @@ -35111,7 +36154,7 @@ func (*CheckChatUsernameResultUsernameOccupied) CheckChatUsernameResultType() st return TypeCheckChatUsernameResultUsernameOccupied } -// The username can be purchased at fragment.com +// The username can be purchased at https://fragment.com. Information about the username can be received using getCollectibleItemInfo type CheckChatUsernameResultUsernamePurchasable struct{ meta } @@ -37278,6 +38321,31 @@ func (*UserPrivacySettingRuleAllowContacts) UserPrivacySettingRuleType() string return TypeUserPrivacySettingRuleAllowContacts } +// A rule to allow all Premium Users to do something; currently, allowed only for userPrivacySettingAllowChatInvites +type UserPrivacySettingRuleAllowPremiumUsers struct{ + meta +} + +func (entity *UserPrivacySettingRuleAllowPremiumUsers) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserPrivacySettingRuleAllowPremiumUsers + + return json.Marshal((*stub)(entity)) +} + +func (*UserPrivacySettingRuleAllowPremiumUsers) GetClass() string { + return ClassUserPrivacySettingRule +} + +func (*UserPrivacySettingRuleAllowPremiumUsers) GetType() string { + return TypeUserPrivacySettingRuleAllowPremiumUsers +} + +func (*UserPrivacySettingRuleAllowPremiumUsers) UserPrivacySettingRuleType() string { + return TypeUserPrivacySettingRuleAllowPremiumUsers +} + // A rule to allow certain specified users to do something type UserPrivacySettingRuleAllowUsers struct { meta @@ -37600,6 +38668,31 @@ func (*UserPrivacySettingShowBio) UserPrivacySettingType() string { return TypeUserPrivacySettingShowBio } +// A privacy setting for managing whether the user's birthdate is visible +type UserPrivacySettingShowBirthdate struct{ + meta +} + +func (entity *UserPrivacySettingShowBirthdate) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserPrivacySettingShowBirthdate + + return json.Marshal((*stub)(entity)) +} + +func (*UserPrivacySettingShowBirthdate) GetClass() string { + return ClassUserPrivacySetting +} + +func (*UserPrivacySettingShowBirthdate) GetType() string { + return TypeUserPrivacySettingShowBirthdate +} + +func (*UserPrivacySettingShowBirthdate) UserPrivacySettingType() string { + return TypeUserPrivacySettingShowBirthdate +} + // A privacy setting for managing whether the user can be invited to chats type UserPrivacySettingAllowChatInvites struct{ meta @@ -39491,7 +40584,7 @@ func (*InternalLinkTypeMessageDraft) InternalLinkTypeType() string { // The link contains a request of Telegram passport data. Call getPassportAuthorizationForm with the given parameters to process the link if the link was received from outside of the application; otherwise, ignore it type InternalLinkTypePassportDataRequest struct { meta - // User identifier of the service's bot + // User identifier of the service's bot; the corresponding user may be unknown yet BotUserId int64 `json:"bot_user_id"` // Telegram Passport element types requested by the service Scope string `json:"scope"` @@ -42242,6 +43335,31 @@ func (*SuggestedActionGiftPremiumForChristmas) SuggestedActionType() string { return TypeSuggestedActionGiftPremiumForChristmas } +// Suggests the user to set birthdate +type SuggestedActionSetBirthdate struct{ + meta +} + +func (entity *SuggestedActionSetBirthdate) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedActionSetBirthdate + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedActionSetBirthdate) GetClass() string { + return ClassSuggestedAction +} + +func (*SuggestedActionSetBirthdate) GetType() string { + return TypeSuggestedActionSetBirthdate +} + +func (*SuggestedActionSetBirthdate) SuggestedActionType() string { + return TypeSuggestedActionSetBirthdate +} + // Contains a counter type Count struct { meta @@ -42586,6 +43704,8 @@ type InputSticker struct { meta // File with the sticker; must fit in a 512x512 square. For WEBP stickers the file must be in WEBP or PNG format, which will be converted to WEBP server-side. See https://core.telegram.org/animated_stickers#technical-requirements for technical requirements Sticker InputFile `json:"sticker"` + // Format of the sticker + Format StickerFormat `json:"format"` // String with 1-20 emoji corresponding to the sticker Emojis string `json:"emojis"` // Position where the mask is placed; pass null if not specified @@ -42613,6 +43733,7 @@ func (*InputSticker) GetType() string { func (inputSticker *InputSticker) UnmarshalJSON(data []byte) error { var tmp struct { Sticker json.RawMessage `json:"sticker"` + Format json.RawMessage `json:"format"` Emojis string `json:"emojis"` MaskPosition *MaskPosition `json:"mask_position"` Keywords []string `json:"keywords"` @@ -42630,6 +43751,9 @@ func (inputSticker *InputSticker) UnmarshalJSON(data []byte) error { fieldSticker, _ := UnmarshalInputFile(tmp.Sticker) inputSticker.Sticker = fieldSticker + fieldFormat, _ := UnmarshalStickerFormat(tmp.Format) + inputSticker.Format = fieldFormat + return nil } @@ -47356,7 +48480,7 @@ func (*UpdateSavedMessagesTags) UpdateType() string { // The parameters of speech recognition without Telegram Premium subscription has changed type UpdateSpeechRecognitionTrial struct { meta - // The maximum allowed duration of media for speech recognition without Telegram Premium subscription + // The maximum allowed duration of media for speech recognition without Telegram Premium subscription, in seconds MaxMediaDuration int32 `json:"max_media_duration"` // The total number of allowed speech recognitions per week; 0 if none WeeklyCount int32 `json:"weekly_count"` @@ -47522,6 +48646,33 @@ func (updateSuggestedActions *UpdateSuggestedActions) UnmarshalJSON(data []byte) return nil } +// The list of contacts that had birthdays recently or will have birthday soon has changed +type UpdateContactCloseBirthdays struct { + meta + // List of contact users with close birthday + CloseBirthdayUsers []*CloseBirthdayUser `json:"close_birthday_users"` +} + +func (entity *UpdateContactCloseBirthdays) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateContactCloseBirthdays + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateContactCloseBirthdays) GetClass() string { + return ClassUpdate +} + +func (*UpdateContactCloseBirthdays) GetType() string { + return TypeUpdateContactCloseBirthdays +} + +func (*UpdateContactCloseBirthdays) UpdateType() string { + return TypeUpdateContactCloseBirthdays +} + // Adding users to a chat has failed because of their privacy settings. An invite link can be shared with the users if appropriate type UpdateAddChatMembersPrivacyForbidden struct { meta @@ -47599,6 +48750,122 @@ func (updateAutosaveSettings *UpdateAutosaveSettings) UnmarshalJSON(data []byte) return nil } +// A business connection has changed; for bots only +type UpdateBusinessConnection struct { + meta + // New data about the connection + Connection *BusinessConnection `json:"connection"` +} + +func (entity *UpdateBusinessConnection) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateBusinessConnection + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateBusinessConnection) GetClass() string { + return ClassUpdate +} + +func (*UpdateBusinessConnection) GetType() string { + return TypeUpdateBusinessConnection +} + +func (*UpdateBusinessConnection) UpdateType() string { + return TypeUpdateBusinessConnection +} + +// A new message was added to a business account; for bots only +type UpdateNewBusinessMessage struct { + meta + // Unique identifier of the business connection + ConnectionId string `json:"connection_id"` + // The new message + Message *BusinessMessage `json:"message"` +} + +func (entity *UpdateNewBusinessMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateNewBusinessMessage + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateNewBusinessMessage) GetClass() string { + return ClassUpdate +} + +func (*UpdateNewBusinessMessage) GetType() string { + return TypeUpdateNewBusinessMessage +} + +func (*UpdateNewBusinessMessage) UpdateType() string { + return TypeUpdateNewBusinessMessage +} + +// A message in a business account was edited; for bots only +type UpdateBusinessMessageEdited struct { + meta + // Unique identifier of the business connection + ConnectionId string `json:"connection_id"` + // The edited message + Message *BusinessMessage `json:"message"` +} + +func (entity *UpdateBusinessMessageEdited) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateBusinessMessageEdited + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateBusinessMessageEdited) GetClass() string { + return ClassUpdate +} + +func (*UpdateBusinessMessageEdited) GetType() string { + return TypeUpdateBusinessMessageEdited +} + +func (*UpdateBusinessMessageEdited) UpdateType() string { + return TypeUpdateBusinessMessageEdited +} + +// Messages in a business account were deleted; for bots only +type UpdateBusinessMessagesDeleted struct { + meta + // Unique identifier of the business connection + ConnectionId string `json:"connection_id"` + // Identifier of a chat in the business account in which messages were deleted + ChatId int64 `json:"chat_id"` + // Unique message identifiers of the deleted messages + MessageIds []int64 `json:"message_ids"` +} + +func (entity *UpdateBusinessMessagesDeleted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateBusinessMessagesDeleted + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateBusinessMessagesDeleted) GetClass() string { + return ClassUpdate +} + +func (*UpdateBusinessMessagesDeleted) GetType() string { + return TypeUpdateBusinessMessagesDeleted +} + +func (*UpdateBusinessMessagesDeleted) UpdateType() string { + return TypeUpdateBusinessMessagesDeleted +} + // A new incoming inline query; for bots only type UpdateNewInlineQuery struct { meta diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 1e3daca..25f7d9f 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -1271,6 +1271,49 @@ func UnmarshalListOfMessageSponsorType(dataList []json.RawMessage) ([]MessageSpo return list, nil } +func UnmarshalReportChatSponsoredMessageResult(data json.RawMessage) (ReportChatSponsoredMessageResult, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeReportChatSponsoredMessageResultOk: + return UnmarshalReportChatSponsoredMessageResultOk(data) + + case TypeReportChatSponsoredMessageResultFailed: + return UnmarshalReportChatSponsoredMessageResultFailed(data) + + case TypeReportChatSponsoredMessageResultOptionRequired: + return UnmarshalReportChatSponsoredMessageResultOptionRequired(data) + + case TypeReportChatSponsoredMessageResultAdsHidden: + return UnmarshalReportChatSponsoredMessageResultAdsHidden(data) + + case TypeReportChatSponsoredMessageResultPremiumRequired: + return UnmarshalReportChatSponsoredMessageResultPremiumRequired(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfReportChatSponsoredMessageResult(dataList []json.RawMessage) ([]ReportChatSponsoredMessageResult, error) { + list := []ReportChatSponsoredMessageResult{} + + for _, data := range dataList { + entity, err := UnmarshalReportChatSponsoredMessageResult(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalNotificationSettingsScope(data json.RawMessage) (NotificationSettingsScope, error) { var meta meta @@ -2019,6 +2062,40 @@ func UnmarshalListOfPageBlock(dataList []json.RawMessage) ([]PageBlock, error) { return list, nil } +func UnmarshalCollectibleItemType(data json.RawMessage) (CollectibleItemType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeCollectibleItemTypeUsername: + return UnmarshalCollectibleItemTypeUsername(data) + + case TypeCollectibleItemTypePhoneNumber: + return UnmarshalCollectibleItemTypePhoneNumber(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfCollectibleItemType(dataList []json.RawMessage) ([]CollectibleItemType, error) { + list := []CollectibleItemType{} + + for _, data := range dataList { + entity, err := UnmarshalCollectibleItemType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalInputCredentials(data json.RawMessage) (InputCredentials, error) { var meta meta @@ -4490,6 +4567,9 @@ func UnmarshalPremiumFeature(data json.RawMessage) (PremiumFeature, error) { case TypePremiumFeatureLastSeenTimes: return UnmarshalPremiumFeatureLastSeenTimes(data) + case TypePremiumFeatureBusiness: + return UnmarshalPremiumFeatureBusiness(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -4509,6 +4589,67 @@ func UnmarshalListOfPremiumFeature(dataList []json.RawMessage) ([]PremiumFeature return list, nil } +func UnmarshalBusinessFeature(data json.RawMessage) (BusinessFeature, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeBusinessFeatureLocation: + return UnmarshalBusinessFeatureLocation(data) + + case TypeBusinessFeatureOpeningHours: + return UnmarshalBusinessFeatureOpeningHours(data) + + case TypeBusinessFeatureQuickReplies: + return UnmarshalBusinessFeatureQuickReplies(data) + + case TypeBusinessFeatureGreetingMessage: + return UnmarshalBusinessFeatureGreetingMessage(data) + + case TypeBusinessFeatureAwayMessage: + return UnmarshalBusinessFeatureAwayMessage(data) + + case TypeBusinessFeatureAccountLinks: + return UnmarshalBusinessFeatureAccountLinks(data) + + case TypeBusinessFeatureIntro: + return UnmarshalBusinessFeatureIntro(data) + + case TypeBusinessFeatureBots: + return UnmarshalBusinessFeatureBots(data) + + case TypeBusinessFeatureEmojiStatus: + return UnmarshalBusinessFeatureEmojiStatus(data) + + case TypeBusinessFeatureChatFolderTags: + return UnmarshalBusinessFeatureChatFolderTags(data) + + case TypeBusinessFeatureUpgradedStories: + return UnmarshalBusinessFeatureUpgradedStories(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfBusinessFeature(dataList []json.RawMessage) ([]BusinessFeature, error) { + list := []BusinessFeature{} + + for _, data := range dataList { + entity, err := UnmarshalBusinessFeature(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalPremiumStoryFeature(data json.RawMessage) (PremiumStoryFeature, error) { var meta meta @@ -4573,6 +4714,9 @@ func UnmarshalPremiumSource(data json.RawMessage) (PremiumSource, error) { case TypePremiumSourceFeature: return UnmarshalPremiumSourceFeature(data) + case TypePremiumSourceBusinessFeature: + return UnmarshalPremiumSourceBusinessFeature(data) + case TypePremiumSourceStoryFeature: return UnmarshalPremiumSourceStoryFeature(data) @@ -5447,6 +5591,9 @@ func UnmarshalUserPrivacySettingRule(data json.RawMessage) (UserPrivacySettingRu case TypeUserPrivacySettingRuleAllowContacts: return UnmarshalUserPrivacySettingRuleAllowContacts(data) + case TypeUserPrivacySettingRuleAllowPremiumUsers: + return UnmarshalUserPrivacySettingRuleAllowPremiumUsers(data) + case TypeUserPrivacySettingRuleAllowUsers: return UnmarshalUserPrivacySettingRuleAllowUsers(data) @@ -5508,6 +5655,9 @@ func UnmarshalUserPrivacySetting(data json.RawMessage) (UserPrivacySetting, erro case TypeUserPrivacySettingShowBio: return UnmarshalUserPrivacySettingShowBio(data) + case TypeUserPrivacySettingShowBirthdate: + return UnmarshalUserPrivacySettingShowBirthdate(data) + case TypeUserPrivacySettingAllowChatInvites: return UnmarshalUserPrivacySettingAllowChatInvites(data) @@ -6317,6 +6467,9 @@ func UnmarshalSuggestedAction(data json.RawMessage) (SuggestedAction, error) { case TypeSuggestedActionGiftPremiumForChristmas: return UnmarshalSuggestedActionGiftPremiumForChristmas(data) + case TypeSuggestedActionSetBirthdate: + return UnmarshalSuggestedActionSetBirthdate(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -6958,12 +7111,27 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateSuggestedActions: return UnmarshalUpdateSuggestedActions(data) + case TypeUpdateContactCloseBirthdays: + return UnmarshalUpdateContactCloseBirthdays(data) + case TypeUpdateAddChatMembersPrivacyForbidden: return UnmarshalUpdateAddChatMembersPrivacyForbidden(data) case TypeUpdateAutosaveSettings: return UnmarshalUpdateAutosaveSettings(data) + case TypeUpdateBusinessConnection: + return UnmarshalUpdateBusinessConnection(data) + + case TypeUpdateNewBusinessMessage: + return UnmarshalUpdateNewBusinessMessage(data) + + case TypeUpdateBusinessMessageEdited: + return UnmarshalUpdateBusinessMessageEdited(data) + + case TypeUpdateBusinessMessagesDeleted: + return UnmarshalUpdateBusinessMessagesDeleted(data) + case TypeUpdateNewInlineQuery: return UnmarshalUpdateNewInlineQuery(data) @@ -7857,6 +8025,22 @@ func UnmarshalChatLocation(data json.RawMessage) (*ChatLocation, error) { return &resp, err } +func UnmarshalBirthdate(data json.RawMessage) (*Birthdate, error) { + var resp Birthdate + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCloseBirthdayUser(data json.RawMessage) (*CloseBirthdayUser, error) { + var resp CloseBirthdayUser + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalBusinessAwayMessageScheduleAlways(data json.RawMessage) (*BusinessAwayMessageScheduleAlways, error) { var resp BusinessAwayMessageScheduleAlways @@ -7921,6 +8105,22 @@ func UnmarshalBusinessConnectedBot(data json.RawMessage) (*BusinessConnectedBot, return &resp, err } +func UnmarshalBusinessIntro(data json.RawMessage) (*BusinessIntro, error) { + var resp BusinessIntro + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputBusinessIntro(data json.RawMessage) (*InputBusinessIntro, error) { + var resp InputBusinessIntro + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalBusinessOpeningHoursInterval(data json.RawMessage) (*BusinessOpeningHoursInterval, error) { var resp BusinessOpeningHoursInterval @@ -8921,6 +9121,22 @@ func UnmarshalMessageCalendar(data json.RawMessage) (*MessageCalendar, error) { return &resp, err } +func UnmarshalBusinessMessage(data json.RawMessage) (*BusinessMessage, error) { + var resp BusinessMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessMessages(data json.RawMessage) (*BusinessMessages, error) { + var resp BusinessMessages + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageSourceChatHistory(data json.RawMessage) (*MessageSourceChatHistory, error) { var resp MessageSourceChatHistory @@ -9065,6 +9281,54 @@ func UnmarshalSponsoredMessages(data json.RawMessage) (*SponsoredMessages, error return &resp, err } +func UnmarshalReportChatSponsoredMessageOption(data json.RawMessage) (*ReportChatSponsoredMessageOption, error) { + var resp ReportChatSponsoredMessageOption + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReportChatSponsoredMessageResultOk(data json.RawMessage) (*ReportChatSponsoredMessageResultOk, error) { + var resp ReportChatSponsoredMessageResultOk + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReportChatSponsoredMessageResultFailed(data json.RawMessage) (*ReportChatSponsoredMessageResultFailed, error) { + var resp ReportChatSponsoredMessageResultFailed + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReportChatSponsoredMessageResultOptionRequired(data json.RawMessage) (*ReportChatSponsoredMessageResultOptionRequired, error) { + var resp ReportChatSponsoredMessageResultOptionRequired + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReportChatSponsoredMessageResultAdsHidden(data json.RawMessage) (*ReportChatSponsoredMessageResultAdsHidden, error) { + var resp ReportChatSponsoredMessageResultAdsHidden + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReportChatSponsoredMessageResultPremiumRequired(data json.RawMessage) (*ReportChatSponsoredMessageResultPremiumRequired, error) { + var resp ReportChatSponsoredMessageResultPremiumRequired + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalFileDownload(data json.RawMessage) (*FileDownload, error) { var resp FileDownload @@ -9729,6 +9993,22 @@ func UnmarshalLinkPreviewOptions(data json.RawMessage) (*LinkPreviewOptions, err return &resp, err } +func UnmarshalSharedUser(data json.RawMessage) (*SharedUser, error) { + var resp SharedUser + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSharedChat(data json.RawMessage) (*SharedChat, error) { + var resp SharedChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalRichTextPlain(data json.RawMessage) (*RichTextPlain, error) { var resp RichTextPlain @@ -10217,6 +10497,30 @@ func UnmarshalPhoneNumberInfo(data json.RawMessage) (*PhoneNumberInfo, error) { return &resp, err } +func UnmarshalCollectibleItemTypeUsername(data json.RawMessage) (*CollectibleItemTypeUsername, error) { + var resp CollectibleItemTypeUsername + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCollectibleItemTypePhoneNumber(data json.RawMessage) (*CollectibleItemTypePhoneNumber, error) { + var resp CollectibleItemTypePhoneNumber + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCollectibleItemInfo(data json.RawMessage) (*CollectibleItemInfo, error) { + var resp CollectibleItemInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalBankCardActionOpenUrl(data json.RawMessage) (*BankCardActionOpenUrl, error) { var resp BankCardActionOpenUrl @@ -13209,6 +13513,14 @@ func UnmarshalSpeechRecognitionResultError(data json.RawMessage) (*SpeechRecogni return &resp, err } +func UnmarshalBusinessConnection(data json.RawMessage) (*BusinessConnection, error) { + var resp BusinessConnection + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalAttachmentMenuBotColor(data json.RawMessage) (*AttachmentMenuBotColor, error) { var resp AttachmentMenuBotColor @@ -14361,6 +14673,102 @@ func UnmarshalPremiumFeatureLastSeenTimes(data json.RawMessage) (*PremiumFeature return &resp, err } +func UnmarshalPremiumFeatureBusiness(data json.RawMessage) (*PremiumFeatureBusiness, error) { + var resp PremiumFeatureBusiness + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessFeatureLocation(data json.RawMessage) (*BusinessFeatureLocation, error) { + var resp BusinessFeatureLocation + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessFeatureOpeningHours(data json.RawMessage) (*BusinessFeatureOpeningHours, error) { + var resp BusinessFeatureOpeningHours + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessFeatureQuickReplies(data json.RawMessage) (*BusinessFeatureQuickReplies, error) { + var resp BusinessFeatureQuickReplies + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessFeatureGreetingMessage(data json.RawMessage) (*BusinessFeatureGreetingMessage, error) { + var resp BusinessFeatureGreetingMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessFeatureAwayMessage(data json.RawMessage) (*BusinessFeatureAwayMessage, error) { + var resp BusinessFeatureAwayMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessFeatureAccountLinks(data json.RawMessage) (*BusinessFeatureAccountLinks, error) { + var resp BusinessFeatureAccountLinks + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessFeatureIntro(data json.RawMessage) (*BusinessFeatureIntro, error) { + var resp BusinessFeatureIntro + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessFeatureBots(data json.RawMessage) (*BusinessFeatureBots, error) { + var resp BusinessFeatureBots + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessFeatureEmojiStatus(data json.RawMessage) (*BusinessFeatureEmojiStatus, error) { + var resp BusinessFeatureEmojiStatus + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessFeatureChatFolderTags(data json.RawMessage) (*BusinessFeatureChatFolderTags, error) { + var resp BusinessFeatureChatFolderTags + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessFeatureUpgradedStories(data json.RawMessage) (*BusinessFeatureUpgradedStories, error) { + var resp BusinessFeatureUpgradedStories + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPremiumStoryFeaturePriorityOrder(data json.RawMessage) (*PremiumStoryFeaturePriorityOrder, error) { var resp PremiumStoryFeaturePriorityOrder @@ -14433,6 +14841,14 @@ func UnmarshalPremiumFeatures(data json.RawMessage) (*PremiumFeatures, error) { return &resp, err } +func UnmarshalBusinessFeatures(data json.RawMessage) (*BusinessFeatures, error) { + var resp BusinessFeatures + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPremiumSourceLimitExceeded(data json.RawMessage) (*PremiumSourceLimitExceeded, error) { var resp PremiumSourceLimitExceeded @@ -14449,6 +14865,14 @@ func UnmarshalPremiumSourceFeature(data json.RawMessage) (*PremiumSourceFeature, return &resp, err } +func UnmarshalPremiumSourceBusinessFeature(data json.RawMessage) (*PremiumSourceBusinessFeature, error) { + var resp PremiumSourceBusinessFeature + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPremiumSourceStoryFeature(data json.RawMessage) (*PremiumSourceStoryFeature, error) { var resp PremiumSourceStoryFeature @@ -14481,6 +14905,14 @@ func UnmarshalPremiumFeaturePromotionAnimation(data json.RawMessage) (*PremiumFe return &resp, err } +func UnmarshalBusinessFeaturePromotionAnimation(data json.RawMessage) (*BusinessFeaturePromotionAnimation, error) { + var resp BusinessFeaturePromotionAnimation + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPremiumState(data json.RawMessage) (*PremiumState, error) { var resp PremiumState @@ -15465,6 +15897,14 @@ func UnmarshalUserPrivacySettingRuleAllowContacts(data json.RawMessage) (*UserPr return &resp, err } +func UnmarshalUserPrivacySettingRuleAllowPremiumUsers(data json.RawMessage) (*UserPrivacySettingRuleAllowPremiumUsers, error) { + var resp UserPrivacySettingRuleAllowPremiumUsers + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUserPrivacySettingRuleAllowUsers(data json.RawMessage) (*UserPrivacySettingRuleAllowUsers, error) { var resp UserPrivacySettingRuleAllowUsers @@ -15561,6 +16001,14 @@ func UnmarshalUserPrivacySettingShowBio(data json.RawMessage) (*UserPrivacySetti return &resp, err } +func UnmarshalUserPrivacySettingShowBirthdate(data json.RawMessage) (*UserPrivacySettingShowBirthdate, error) { + var resp UserPrivacySettingShowBirthdate + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUserPrivacySettingAllowChatInvites(data json.RawMessage) (*UserPrivacySettingAllowChatInvites, error) { var resp UserPrivacySettingAllowChatInvites @@ -16905,6 +17353,14 @@ func UnmarshalSuggestedActionGiftPremiumForChristmas(data json.RawMessage) (*Sug return &resp, err } +func UnmarshalSuggestedActionSetBirthdate(data json.RawMessage) (*SuggestedActionSetBirthdate, error) { + var resp SuggestedActionSetBirthdate + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalCount(data json.RawMessage) (*Count, error) { var resp Count @@ -18153,6 +18609,14 @@ func UnmarshalUpdateSuggestedActions(data json.RawMessage) (*UpdateSuggestedActi return &resp, err } +func UnmarshalUpdateContactCloseBirthdays(data json.RawMessage) (*UpdateContactCloseBirthdays, error) { + var resp UpdateContactCloseBirthdays + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateAddChatMembersPrivacyForbidden(data json.RawMessage) (*UpdateAddChatMembersPrivacyForbidden, error) { var resp UpdateAddChatMembersPrivacyForbidden @@ -18169,6 +18633,38 @@ func UnmarshalUpdateAutosaveSettings(data json.RawMessage) (*UpdateAutosaveSetti return &resp, err } +func UnmarshalUpdateBusinessConnection(data json.RawMessage) (*UpdateBusinessConnection, error) { + var resp UpdateBusinessConnection + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateNewBusinessMessage(data json.RawMessage) (*UpdateNewBusinessMessage, error) { + var resp UpdateNewBusinessMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateBusinessMessageEdited(data json.RawMessage) (*UpdateBusinessMessageEdited, error) { + var resp UpdateBusinessMessageEdited + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateBusinessMessagesDeleted(data json.RawMessage) (*UpdateBusinessMessagesDeleted, error) { + var resp UpdateBusinessMessagesDeleted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateNewInlineQuery(data json.RawMessage) (*UpdateNewInlineQuery, error) { var resp UpdateNewInlineQuery @@ -18707,6 +19203,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatLocation: return UnmarshalChatLocation(data) + case TypeBirthdate: + return UnmarshalBirthdate(data) + + case TypeCloseBirthdayUser: + return UnmarshalCloseBirthdayUser(data) + case TypeBusinessAwayMessageScheduleAlways: return UnmarshalBusinessAwayMessageScheduleAlways(data) @@ -18731,6 +19233,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeBusinessConnectedBot: return UnmarshalBusinessConnectedBot(data) + case TypeBusinessIntro: + return UnmarshalBusinessIntro(data) + + case TypeInputBusinessIntro: + return UnmarshalInputBusinessIntro(data) + case TypeBusinessOpeningHoursInterval: return UnmarshalBusinessOpeningHoursInterval(data) @@ -19106,6 +19614,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageCalendar: return UnmarshalMessageCalendar(data) + case TypeBusinessMessage: + return UnmarshalBusinessMessage(data) + + case TypeBusinessMessages: + return UnmarshalBusinessMessages(data) + case TypeMessageSourceChatHistory: return UnmarshalMessageSourceChatHistory(data) @@ -19160,6 +19674,24 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSponsoredMessages: return UnmarshalSponsoredMessages(data) + case TypeReportChatSponsoredMessageOption: + return UnmarshalReportChatSponsoredMessageOption(data) + + case TypeReportChatSponsoredMessageResultOk: + return UnmarshalReportChatSponsoredMessageResultOk(data) + + case TypeReportChatSponsoredMessageResultFailed: + return UnmarshalReportChatSponsoredMessageResultFailed(data) + + case TypeReportChatSponsoredMessageResultOptionRequired: + return UnmarshalReportChatSponsoredMessageResultOptionRequired(data) + + case TypeReportChatSponsoredMessageResultAdsHidden: + return UnmarshalReportChatSponsoredMessageResultAdsHidden(data) + + case TypeReportChatSponsoredMessageResultPremiumRequired: + return UnmarshalReportChatSponsoredMessageResultPremiumRequired(data) + case TypeFileDownload: return UnmarshalFileDownload(data) @@ -19409,6 +19941,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeLinkPreviewOptions: return UnmarshalLinkPreviewOptions(data) + case TypeSharedUser: + return UnmarshalSharedUser(data) + + case TypeSharedChat: + return UnmarshalSharedChat(data) + case TypeRichTextPlain: return UnmarshalRichTextPlain(data) @@ -19592,6 +20130,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePhoneNumberInfo: return UnmarshalPhoneNumberInfo(data) + case TypeCollectibleItemTypeUsername: + return UnmarshalCollectibleItemTypeUsername(data) + + case TypeCollectibleItemTypePhoneNumber: + return UnmarshalCollectibleItemTypePhoneNumber(data) + + case TypeCollectibleItemInfo: + return UnmarshalCollectibleItemInfo(data) + case TypeBankCardActionOpenUrl: return UnmarshalBankCardActionOpenUrl(data) @@ -20714,6 +21261,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSpeechRecognitionResultError: return UnmarshalSpeechRecognitionResultError(data) + case TypeBusinessConnection: + return UnmarshalBusinessConnection(data) + case TypeAttachmentMenuBotColor: return UnmarshalAttachmentMenuBotColor(data) @@ -21146,6 +21696,42 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePremiumFeatureLastSeenTimes: return UnmarshalPremiumFeatureLastSeenTimes(data) + case TypePremiumFeatureBusiness: + return UnmarshalPremiumFeatureBusiness(data) + + case TypeBusinessFeatureLocation: + return UnmarshalBusinessFeatureLocation(data) + + case TypeBusinessFeatureOpeningHours: + return UnmarshalBusinessFeatureOpeningHours(data) + + case TypeBusinessFeatureQuickReplies: + return UnmarshalBusinessFeatureQuickReplies(data) + + case TypeBusinessFeatureGreetingMessage: + return UnmarshalBusinessFeatureGreetingMessage(data) + + case TypeBusinessFeatureAwayMessage: + return UnmarshalBusinessFeatureAwayMessage(data) + + case TypeBusinessFeatureAccountLinks: + return UnmarshalBusinessFeatureAccountLinks(data) + + case TypeBusinessFeatureIntro: + return UnmarshalBusinessFeatureIntro(data) + + case TypeBusinessFeatureBots: + return UnmarshalBusinessFeatureBots(data) + + case TypeBusinessFeatureEmojiStatus: + return UnmarshalBusinessFeatureEmojiStatus(data) + + case TypeBusinessFeatureChatFolderTags: + return UnmarshalBusinessFeatureChatFolderTags(data) + + case TypeBusinessFeatureUpgradedStories: + return UnmarshalBusinessFeatureUpgradedStories(data) + case TypePremiumStoryFeaturePriorityOrder: return UnmarshalPremiumStoryFeaturePriorityOrder(data) @@ -21173,12 +21759,18 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePremiumFeatures: return UnmarshalPremiumFeatures(data) + case TypeBusinessFeatures: + return UnmarshalBusinessFeatures(data) + case TypePremiumSourceLimitExceeded: return UnmarshalPremiumSourceLimitExceeded(data) case TypePremiumSourceFeature: return UnmarshalPremiumSourceFeature(data) + case TypePremiumSourceBusinessFeature: + return UnmarshalPremiumSourceBusinessFeature(data) + case TypePremiumSourceStoryFeature: return UnmarshalPremiumSourceStoryFeature(data) @@ -21191,6 +21783,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePremiumFeaturePromotionAnimation: return UnmarshalPremiumFeaturePromotionAnimation(data) + case TypeBusinessFeaturePromotionAnimation: + return UnmarshalBusinessFeaturePromotionAnimation(data) + case TypePremiumState: return UnmarshalPremiumState(data) @@ -21560,6 +22155,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUserPrivacySettingRuleAllowContacts: return UnmarshalUserPrivacySettingRuleAllowContacts(data) + case TypeUserPrivacySettingRuleAllowPremiumUsers: + return UnmarshalUserPrivacySettingRuleAllowPremiumUsers(data) + case TypeUserPrivacySettingRuleAllowUsers: return UnmarshalUserPrivacySettingRuleAllowUsers(data) @@ -21596,6 +22194,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUserPrivacySettingShowBio: return UnmarshalUserPrivacySettingShowBio(data) + case TypeUserPrivacySettingShowBirthdate: + return UnmarshalUserPrivacySettingShowBirthdate(data) + case TypeUserPrivacySettingAllowChatInvites: return UnmarshalUserPrivacySettingAllowChatInvites(data) @@ -22100,6 +22701,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSuggestedActionGiftPremiumForChristmas: return UnmarshalSuggestedActionGiftPremiumForChristmas(data) + case TypeSuggestedActionSetBirthdate: + return UnmarshalSuggestedActionSetBirthdate(data) + case TypeCount: return UnmarshalCount(data) @@ -22568,12 +23172,27 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateSuggestedActions: return UnmarshalUpdateSuggestedActions(data) + case TypeUpdateContactCloseBirthdays: + return UnmarshalUpdateContactCloseBirthdays(data) + case TypeUpdateAddChatMembersPrivacyForbidden: return UnmarshalUpdateAddChatMembersPrivacyForbidden(data) case TypeUpdateAutosaveSettings: return UnmarshalUpdateAutosaveSettings(data) + case TypeUpdateBusinessConnection: + return UnmarshalUpdateBusinessConnection(data) + + case TypeUpdateNewBusinessMessage: + return UnmarshalUpdateNewBusinessMessage(data) + + case TypeUpdateBusinessMessageEdited: + return UnmarshalUpdateBusinessMessageEdited(data) + + case TypeUpdateBusinessMessagesDeleted: + return UnmarshalUpdateBusinessMessagesDeleted(data) + case TypeUpdateNewInlineQuery: return UnmarshalUpdateNewInlineQuery(data) diff --git a/data/td_api.tl b/data/td_api.tl index bdeba25..7cc4ddc 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -260,13 +260,13 @@ thumbnailFormatMpeg4 = ThumbnailFormat; //@description The thumbnail is in PNG format. It will be used only for background patterns thumbnailFormatPng = ThumbnailFormat; -//@description The thumbnail is in TGS format. It will be used only for TGS sticker sets +//@description The thumbnail is in TGS format. It will be used only for sticker sets thumbnailFormatTgs = ThumbnailFormat; -//@description The thumbnail is in WEBM format. It will be used only for WEBM sticker sets +//@description The thumbnail is in WEBM format. It will be used only for sticker sets thumbnailFormatWebm = ThumbnailFormat; -//@description The thumbnail is in WEBP format. It will be used only for some stickers +//@description The thumbnail is in WEBP format. It will be used only for some stickers and sticker sets thumbnailFormatWebp = ThumbnailFormat; @@ -445,7 +445,7 @@ videoNote duration:int32 waveform:bytes length:int32 minithumbnail:minithumbnail voiceNote duration:int32 waveform:bytes mime_type:string speech_recognition_result:SpeechRecognitionResult voice:file = VoiceNote; //@description Describes an animated or custom representation of an emoji -//@sticker Sticker for the emoji; may be null if yet unknown for a custom emoji. If the sticker is a custom emoji, it can have arbitrary format different from stickerFormatTgs +//@sticker Sticker for the emoji; may be null if yet unknown for a custom emoji. If the sticker is a custom emoji, then it can have arbitrary format //@sticker_width Expected width of the sticker, which can be used if the sticker is null //@sticker_height Expected height of the sticker, which can be used if the sticker is null //@fitzpatrick_type Emoji modifier fitzpatrick type; 0-6; 0 if none @@ -556,8 +556,9 @@ userTypeDeleted = UserType; //@is_inline True, if the bot supports inline queries //@inline_query_placeholder Placeholder for inline queries (displayed on the application input field) //@need_location True, if the location of the user is expected to be sent with every inline query to this bot +//@can_connect_to_business True, if the bot supports connection to Telegram Business accounts //@can_be_added_to_attachment_menu True, if the bot can be added to attachment or side menu -userTypeBot can_be_edited:Bool can_join_groups:Bool can_read_all_group_messages:Bool is_inline:Bool inline_query_placeholder:string need_location:Bool can_be_added_to_attachment_menu:Bool = UserType; +userTypeBot can_be_edited:Bool can_join_groups:Bool can_read_all_group_messages:Bool is_inline:Bool inline_query_placeholder:string need_location:Bool can_connect_to_business:Bool can_be_added_to_attachment_menu:Bool = UserType; //@description No information on the user besides the user identifier is available, yet this user has not been deleted. This object is extremely rare and must be handled like a deleted user. It is not possible to perform any actions on users of this type userTypeUnknown = UserType; @@ -577,6 +578,13 @@ botMenuButton text:string url:string = BotMenuButton; chatLocation location:location address:string = ChatLocation; +//@description Represents a birthdate of a user @day Day of the month; 1-31 @month Month of the year; 1-12 @year Birth year; 0 if unknown +birthdate day:int32 month:int32 year:int32 = Birthdate; + +//@description Describes a user that had or will have a birthday soon @user_id User identifier @birthdate Birthdate of the user +closeBirthdayUser user_id:int53 birthdate:birthdate = CloseBirthdayUser; + + //@class BusinessAwayMessageSchedule @description Describes conditions for sending of away messages by a Telegram Business account //@description Send away messages always @@ -596,12 +604,13 @@ businessLocation location:location address:string = BusinessLocation; //@description Describes private chats chosen for automatic interaction with a business //@chat_ids Identifiers of selected private chats +//@excluded_chat_ids Identifiers of private chats that are always excluded; for businessConnectedBot only //@select_existing_chats True, if all existing private chats are selected //@select_new_chats True, if all new private chats are selected //@select_contacts True, if all private chats with contacts are selected //@select_non_contacts True, if all private chats with non-contacts are selected //@exclude_selected If true, then all private chats except the selected are chosen. Otherwise, only the selected chats are chosen -businessRecipients chat_ids:vector select_existing_chats:Bool select_new_chats:Bool select_contacts:Bool select_non_contacts:Bool exclude_selected:Bool = BusinessRecipients; +businessRecipients chat_ids:vector excluded_chat_ids:vector select_existing_chats:Bool select_new_chats:Bool select_contacts:Bool select_non_contacts:Bool exclude_selected:Bool = BusinessRecipients; //@description Describes settings for messages that are automatically sent by a Telegram Business account when it is away //@shortcut_id Unique quick reply shortcut identifier for the away messages @@ -622,6 +631,18 @@ businessGreetingMessageSettings shortcut_id:int32 recipients:businessRecipients //@can_reply True, if the bot can send messages to the private chats; false otherwise businessConnectedBot bot_user_id:int53 recipients:businessRecipients can_reply:Bool = BusinessConnectedBot; +//@description Describes settings for a business account intro +//@title Title text of the intro +//@message Message text of the intro +//@sticker Greeting sticker of the intro; may be null if none +businessIntro title:string message:string sticker:sticker = BusinessIntro; + +//@description Describes settings for a business account intro to set +//@title Title text of the intro; 0-getOption("business_intro_title_length_max") characters +//@message Message text of the intro; 0-getOption("business_intro_message_length_max") characters +//@sticker Greeting sticker of the intro; pass null if none. The sticker must belong to a sticker set and must not be a custom emoji +inputBusinessIntro title:string message:string sticker:InputFile = InputBusinessIntro; + //@description Describes an interval of time when the business is open //@start_minute The first minute of the interval since start of the week; 0-7*24*60 //@end_minute The first minute after the end of the interval since start of the week; 1-8*24*60 @@ -635,7 +656,8 @@ businessOpeningHours time_zone_id:string opening_hours:vector = EmojiStatuses; //@description Describes usernames assigned to a user, a supergroup, or a channel //@active_usernames List of active usernames; the first one must be shown as the primary username. The order of active usernames can be changed with reorderActiveUsernames, reorderBotActiveUsernames or reorderSupergroupActiveUsernames //@disabled_usernames List of currently disabled usernames; the username can be activated with toggleUsernameIsActive, toggleBotUsernameIsActive, or toggleSupergroupUsernameIsActive -//@editable_username The active username, which can be changed with setUsername or setSupergroupUsername +//@editable_username The active username, which can be changed with setUsername or setSupergroupUsername. Information about other active usernames can be received using getCollectibleItemInfo usernames active_usernames:vector disabled_usernames:vector editable_username:string = Usernames; @@ -911,11 +933,13 @@ botInfo short_description:string description:string photo:photo animation:animat //@need_phone_number_privacy_exception True, if the current user needs to explicitly allow to share their phone number with the user when the method addContact is used //@set_chat_background True, if the user set chat background for both chat users and it wasn't reverted yet //@bio A short user bio; may be null for bots +//@birthdate Birthdate of the user; may be null if unknown +//@personal_chat_id Identifier of the personal chat of the user; 0 if none //@premium_gift_options The list of available options for gifting Telegram Premium to the user //@group_in_common_count Number of group chats where both the other user and the current user are a member; 0 for the current user //@business_info Information about business settings for Telegram Business accounts; may be null if none //@bot_info For bots, information about the bot; may be null if the user isn't a bot -userFullInfo personal_photo:chatPhoto photo:chatPhoto public_photo:chatPhoto block_list:BlockList can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool has_private_forwards:Bool has_restricted_voice_and_video_note_messages:Bool has_pinned_stories:Bool need_phone_number_privacy_exception:Bool set_chat_background:Bool bio:formattedText premium_gift_options:vector group_in_common_count:int32 business_info:businessInfo bot_info:botInfo = UserFullInfo; +userFullInfo personal_photo:chatPhoto photo:chatPhoto public_photo:chatPhoto block_list:BlockList can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool has_private_forwards:Bool has_restricted_voice_and_video_note_messages:Bool has_pinned_stories:Bool need_phone_number_privacy_exception:Bool set_chat_background:Bool bio:formattedText birthdate:birthdate personal_chat_id:int53 premium_gift_options:vector group_in_common_count:int32 business_info:businessInfo bot_info:botInfo = UserFullInfo; //@description Represents a list of users @total_count Approximate total number of users found @user_ids A list of user identifiers users total_count:int32 user_ids:vector = Users; @@ -1405,6 +1429,7 @@ inputMessageReplyToStory story_sender_chat_id:int53 story_id:int32 = InputMessag //@scheduling_state The scheduling state of the message; may be null if the message isn't scheduled //@is_outgoing True, if the message is outgoing //@is_pinned True, if the message is pinned +//@is_from_offline True, if the message was sent because of a scheduled action by the message sender, for example, as away, or greeting service message //@can_be_edited True, if the message can be edited. For live location and poll messages this fields shows whether editMessageLiveLocation or stopPoll can be used with this message by the application //@can_be_forwarded True, if the message can be forwarded //@can_be_replied_in_another_chat True, if the message can be replied in another chat or topic @@ -1434,14 +1459,15 @@ inputMessageReplyToStory story_sender_chat_id:int53 story_id:int32 = InputMessag //@self_destruct_type The message's self-destruct type; may be null if none //@self_destruct_in Time left before the message self-destruct timer expires, in seconds; 0 if self-destruction isn't scheduled yet //@auto_delete_in Time left before the message will be automatically deleted by message_auto_delete_time setting of the chat, in seconds; 0 if never -//@via_bot_user_id If non-zero, the user identifier of the bot through which this message was sent +//@via_bot_user_id If non-zero, the user identifier of the inline bot through which this message was sent +//@sender_business_bot_user_id If non-zero, the user identifier of the business bot that sent this message //@sender_boost_count Number of times the sender of the message boosted the supergroup at the time the message was sent; 0 if none or unknown. For messages sent by the current user, supergroupFullInfo.my_boost_count must be used instead //@author_signature For channel posts and anonymous group messages, optional author signature //@media_album_id Unique identifier of an album this message belongs to. Only audios, documents, photos and videos can be grouped together in albums //@restriction_reason If non-empty, contains a human-readable description of the reason why access to this message must be restricted //@content Content of the message //@reply_markup Reply markup for the message; may be null if none -message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_get_added_reactions:Bool can_get_statistics:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_viewers:Bool can_get_media_timestamp_links:Bool can_report_reactions:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector reply_to:MessageReplyTo message_thread_id:int53 saved_messages_topic_id:int53 self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 sender_boost_count:int32 author_signature:string media_album_id:int64 restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; +message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool is_from_offline:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_get_added_reactions:Bool can_get_statistics:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_viewers:Bool can_get_media_timestamp_links:Bool can_report_reactions:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector reply_to:MessageReplyTo message_thread_id:int53 saved_messages_topic_id:int53 self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 sender_business_bot_user_id:int53 sender_boost_count:int32 author_signature:string media_album_id:int64 restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; //@description Contains a list of messages @total_count Approximate total number of messages found @messages List of messages; messages may be null messages total_count:int32 messages:vector = Messages; @@ -1465,6 +1491,13 @@ messageCalendarDay total_count:int32 message:message = MessageCalendarDay; messageCalendar total_count:int32 days:vector = MessageCalendar; +//@description Describes a message from a business account as received by a bot @message The message @reply_to_message Message that is replied by the message in the same chat; may be null if none +businessMessage message:message reply_to_message:message = BusinessMessage; + +//@description Contains a list of messages from a business account as received by a bot @messages List of business messages +businessMessages messages:vector = BusinessMessages; + + //@class MessageSource @description Describes source of a message //@description The message is from a chat history @@ -1525,15 +1558,37 @@ messageSponsor type:MessageSponsorType photo:chatPhotoInfo info:string = Message //@description Describes a sponsored message //@message_id Message identifier; unique for the chat to which the sponsored message belongs among both ordinary and sponsored messages //@is_recommended True, if the message needs to be labeled as "recommended" instead of "sponsored" +//@can_be_reported True, if the message can be reported to Telegram moderators through reportChatSponsoredMessage //@content Content of the message. Currently, can be only of the type messageText //@sponsor Information about the sponsor of the message //@button_text If non-empty, text for the message action button //@additional_info If non-empty, additional information about the sponsored message to be shown along with the message -sponsoredMessage message_id:int53 is_recommended:Bool content:MessageContent sponsor:messageSponsor button_text:string additional_info:string = SponsoredMessage; +sponsoredMessage message_id:int53 is_recommended:Bool can_be_reported:Bool content:MessageContent sponsor:messageSponsor button_text:string additional_info:string = SponsoredMessage; //@description Contains a list of sponsored messages @messages List of sponsored messages @messages_between The minimum number of messages between shown sponsored messages, or 0 if only one sponsored message must be shown after all ordinary messages sponsoredMessages messages:vector messages_between:int32 = SponsoredMessages; +//@description Describes an option to report a sponsored message @id Unique identifier of the option @text Text of the option +reportChatSponsoredMessageOption id:bytes text:string = ReportChatSponsoredMessageOption; + + +//@class ReportChatSponsoredMessageResult @description Describes result of sponsored message report + +//@description The message was reported successfully +reportChatSponsoredMessageResultOk = ReportChatSponsoredMessageResult; + +//@description The sponsored message is too old or not found +reportChatSponsoredMessageResultFailed = ReportChatSponsoredMessageResult; + +//@description The user must choose an option to report the message and repeat request with the chosen option @title Title for the option choice @options List of available options +reportChatSponsoredMessageResultOptionRequired title:string options:vector = ReportChatSponsoredMessageResult; + +//@description Sponsored messages were hidden for the user in all chats +reportChatSponsoredMessageResultAdsHidden = ReportChatSponsoredMessageResult; + +//@description The user asked to hide sponsored messages, but Telegram Premium is required for this +reportChatSponsoredMessageResultPremiumRequired = ReportChatSponsoredMessageResult; + //@description Describes a file added to file download list //@file_id File identifier @@ -1629,7 +1684,7 @@ chatFolderIcon name:string = ChatFolderIcon; //@description Represents a folder for user chats //@title The title of the folder; 1-12 characters without line feeds //@icon The chosen icon for the chat folder; may be null. If null, use getChatFolderDefaultIconName to get default icon name for the folder -//@color_id The identifier of the chosen color for the chat folder icon; from -1 to 6. If -1, then color is didabled +//@color_id The identifier of the chosen color for the chat folder icon; from -1 to 6. If -1, then color is didabled. Can't be changed if folder tags are disabled or the current user doesn't have Telegram Premium subscription //@is_shareable True, if at least one link has been created for the folder //@pinned_chat_ids The chat identifiers of pinned chats in the folder. There can be up to getOption("chat_folder_chosen_chat_count_max") pinned and always included non-secret chats and the same number of secret chats, but the limit can be increased with Telegram Premium //@included_chat_ids The chat identifiers of always included chats in the folder. There can be up to getOption("chat_folder_chosen_chat_count_max") pinned and always included non-secret chats and the same number of secret chats, but the limit can be increased with Telegram Premium @@ -1854,7 +1909,10 @@ keyboardButtonTypeRequestPoll force_regular:Bool force_quiz:Bool = KeyboardButto //@restrict_user_is_premium True, if the shared users must or must not be Telegram Premium users //@user_is_premium True, if the shared users must be Telegram Premium users; otherwise, the shared users must not be Telegram Premium users. Ignored if restrict_user_is_premium is false //@max_quantity The maximum number of users to share -keyboardButtonTypeRequestUsers id:int32 restrict_user_is_bot:Bool user_is_bot:Bool restrict_user_is_premium:Bool user_is_premium:Bool max_quantity:int32 = KeyboardButtonType; +//@request_name Pass true to request name of the users; bots only +//@request_username Pass true to request username of the users; bots only +//@request_photo Pass true to request photo of the users; bots only +keyboardButtonTypeRequestUsers id:int32 restrict_user_is_bot:Bool user_is_bot:Bool restrict_user_is_premium:Bool user_is_premium:Bool max_quantity:int32 request_name:Bool request_username:Bool request_photo:Bool = KeyboardButtonType; //@description A button that requests a chat to be shared by the current user; available only in private chats. Use the method shareChatWithBot to complete the request //@id Unique button identifier @@ -1867,7 +1925,10 @@ keyboardButtonTypeRequestUsers id:int32 restrict_user_is_bot:Bool user_is_bot:Bo //@user_administrator_rights Expected user administrator rights in the chat; may be null if they aren't restricted //@bot_administrator_rights Expected bot administrator rights in the chat; may be null if they aren't restricted //@bot_is_member True, if the bot must be a member of the chat; for basic group and supergroup chats only -keyboardButtonTypeRequestChat id:int32 chat_is_channel:Bool restrict_chat_is_forum:Bool chat_is_forum:Bool restrict_chat_has_username:Bool chat_has_username:Bool chat_is_created:Bool user_administrator_rights:chatAdministratorRights bot_administrator_rights:chatAdministratorRights bot_is_member:Bool = KeyboardButtonType; +//@request_title Pass true to request title of the chat; bots only +//@request_username Pass true to request username of the chat; bots only +//@request_photo Pass true to request photo of the chat; bots only +keyboardButtonTypeRequestChat id:int32 chat_is_channel:Bool restrict_chat_is_forum:Bool chat_is_forum:Bool restrict_chat_has_username:Bool chat_has_username:Bool chat_is_created:Bool user_administrator_rights:chatAdministratorRights bot_administrator_rights:chatAdministratorRights bot_is_member:Bool request_title:Bool request_username:Bool request_photo:Bool = KeyboardButtonType; //@description A button that opens a Web App by calling getWebAppUrl @url An HTTP URL to pass to getWebAppUrl keyboardButtonTypeWebApp url:string = KeyboardButtonType; @@ -2037,6 +2098,22 @@ forumTopics total_count:int32 topics:vector next_offset_date:int32 n linkPreviewOptions is_disabled:Bool url:string force_small_media:Bool force_large_media:Bool show_above_text:Bool = LinkPreviewOptions; +//@description Contains information about a user shared with a bot +//@user_id User identifier +//@first_name First name of the user; for bots only +//@last_name Last name of the user; for bots only +//@username Username of the user; for bots only +//@photo Profile photo of the user; for bots only; may be null +sharedUser user_id:int53 first_name:string last_name:string username:string photo:photo = SharedUser; + +//@description Contains information about a chat shared with a bot +//@chat_id Chat identifier +//@title Title of the chat; for bots only +//@username Username of the chat; for bots only +//@photo Photo of the chat; for bots only; may be null +sharedChat chat_id:int53 title:string username:string photo:photo = SharedChat; + + //@class RichText @description Describes a text object inside an instant-view web page //@description A plain text @text Text @@ -2342,10 +2419,29 @@ countries countries:vector = Countries; //@country Information about the country to which the phone number belongs; may be null //@country_calling_code The part of the phone number denoting country calling code or its part //@formatted_phone_number The phone number without country calling code formatted accordingly to local rules. Expected digits are returned as '-', but even more digits might be entered by the user -//@is_anonymous True, if the phone number was bought on Fragment and isn't tied to a SIM card +//@is_anonymous True, if the phone number was bought at https://fragment.com and isn't tied to a SIM card. Information about the phone number can be received using getCollectibleItemInfo phoneNumberInfo country:countryInfo country_calling_code:string formatted_phone_number:string is_anonymous:Bool = PhoneNumberInfo; +//@class CollectibleItemType @description Describes a collectible item that can be purchased at https://fragment.com + +//@description A username @username The username +collectibleItemTypeUsername username:string = CollectibleItemType; + +//@description A phone number @phone_number The phone number +collectibleItemTypePhoneNumber phone_number:string = CollectibleItemType; + + +//@description Contains information about a collectible item and its last purchase +//@purchase_date Point in time (Unix timestamp) when the item was purchased +//@currency Currency for the paid amount +//@amount The paid amount, in the smallest units of the currency +//@cryptocurrency Cryptocurrency used to pay for the item +//@cryptocurrency_amount The paid amount, in the smallest units of the cryptocurrency +//@url Individual URL for the item on https://fragment.com +collectibleItemInfo purchase_date:int32 currency:string amount:int53 cryptocurrency:string cryptocurrency_amount:int64 url:string = CollectibleItemInfo; + + //@description Describes an action associated with a bank card number @text Action text @url The URL to be opened bankCardActionOpenUrl text:string url:string = BankCardActionOpenUrl; @@ -2506,7 +2602,7 @@ inputInvoiceTelegram purpose:TelegramPaymentPurpose = InputInvoice; //@description The media is hidden until the invoice is paid //@width Media width; 0 if unknown //@height Media height; 0 if unknown -//@duration Media duration; 0 if unknown +//@duration Media duration, in seconds; 0 if unknown //@minithumbnail Media minithumbnail; may be null //@caption Media caption messageExtendedMediaPreview width:int32 height:int32 duration:int32 minithumbnail:minithumbnail caption:formattedText = MessageExtendedMedia; @@ -2529,7 +2625,7 @@ messageExtendedMediaUnsupported caption:formattedText = MessageExtendedMedia; //@only_new_members True, if only new members of the chats will be eligible for the giveaway //@has_public_winners True, if the list of winners of the giveaway will be available to everyone //@country_codes The list of two-letter ISO 3166-1 alpha-2 codes of countries, users from which will be eligible for the giveaway. If empty, then all users can participate in the giveaway. -//-There can be up to getOption("giveaway_country_count_max") chosen countries. Users with phone number that was bought on Fragment can participate in any giveaway and the country code "FT" must not be specified in the list +//-There can be up to getOption("giveaway_country_count_max") chosen countries. Users with phone number that was bought at https://fragment.com can participate in any giveaway and the country code "FT" must not be specified in the list //@prize_description Additional description of the giveaway prize; 0-128 characters premiumGiveawayParameters boosted_chat_id:int53 additional_chat_ids:vector winners_selection_date:int32 only_new_members:Bool has_public_winners:Bool country_codes:vector prize_description:string = PremiumGiveawayParameters; @@ -3091,11 +3187,11 @@ messagePremiumGiveawayWinners boosted_chat_id:int53 giveaway_message_id:int53 ad //@description A contact has registered with Telegram messageContactRegistered = MessageContent; -//@description The current user shared users, which were requested by the bot @user_ids Identifier of the shared users @button_id Identifier of the keyboard button with the request -messageUsersShared user_ids:vector button_id:int32 = MessageContent; +//@description The current user shared users, which were requested by the bot @users The shared users @button_id Identifier of the keyboard button with the request +messageUsersShared users:vector button_id:int32 = MessageContent; -//@description The current user shared a chat, which was requested by the bot @chat_id Identifier of the shared chat @button_id Identifier of the keyboard button with the request -messageChatShared chat_id:int53 button_id:int32 = MessageContent; +//@description The current user shared a chat, which was requested by the bot @chat The shared chat @button_id Identifier of the keyboard button with the request +messageChatShared chat:sharedChat button_id:int32 = MessageContent; //@description The user allowed the bot to send messages @reason The reason why the bot was allowed to write messages messageBotWriteAccessAllowed reason:BotWriteAccessAllowReason = MessageContent; @@ -3297,7 +3393,7 @@ inputMessageVideo video:InputFile thumbnail:inputThumbnail added_sticker_file_id //@description A video note message //@video_note Video note to be sent //@thumbnail Video thumbnail; may be null if empty; pass null to skip thumbnail uploading -//@duration Duration of the video, in seconds +//@duration Duration of the video, in seconds; 0-60 //@length Video width and height; must be positive and not greater than 640 //@self_destruct_type Video note self-destruct type; may be null if none; pass null if none; private chats only inputMessageVideoNote video_note:InputFile thumbnail:inputThumbnail duration:int32 length:int32 self_destruct_type:MessageSelfDestructType = InputMessageContent; @@ -3508,17 +3604,17 @@ emojis emojis:vector = Emojis; //@name Name of the sticker set //@thumbnail Sticker set thumbnail in WEBP, TGS, or WEBM format with width and height 100; may be null. The file can be downloaded only before the thumbnail is changed //@thumbnail_outline Sticker set thumbnail's outline represented as a list of closed vector paths; may be empty. The coordinate system origin is in the upper-left corner +//@is_owned True, if the sticker set is owned by the current user //@is_installed True, if the sticker set has been installed by the current user //@is_archived True, if the sticker set has been archived. A sticker set can't be installed and archived simultaneously //@is_official True, if the sticker set is official -//@sticker_format Format of the stickers in the set //@sticker_type Type of the stickers in the set //@needs_repainting True, if stickers in the sticker set are custom emoji that must be repainted; for custom emoji sticker sets only //@is_allowed_as_chat_emoji_status True, if stickers in the sticker set are custom emoji that can be used as chat emoji status; for custom emoji sticker sets only //@is_viewed True for already viewed trending sticker sets //@stickers List of stickers in this set //@emojis A list of emoji corresponding to the stickers in the same order. The list is only for informational purposes, because a sticker is always sent with a fixed emoji from the corresponding Sticker object -stickerSet id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:vector is_installed:Bool is_archived:Bool is_official:Bool sticker_format:StickerFormat sticker_type:StickerType needs_repainting:Bool is_allowed_as_chat_emoji_status:Bool is_viewed:Bool stickers:vector emojis:vector = StickerSet; +stickerSet id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:vector is_owned:Bool is_installed:Bool is_archived:Bool is_official:Bool sticker_type:StickerType needs_repainting:Bool is_allowed_as_chat_emoji_status:Bool is_viewed:Bool stickers:vector emojis:vector = StickerSet; //@description Represents short information about a sticker set //@id Identifier of the sticker set @@ -3526,17 +3622,17 @@ stickerSet id:int64 title:string name:string thumbnail:thumbnail thumbnail_outli //@name Name of the sticker set //@thumbnail Sticker set thumbnail in WEBP, TGS, or WEBM format with width and height 100; may be null. The file can be downloaded only before the thumbnail is changed //@thumbnail_outline Sticker set thumbnail's outline represented as a list of closed vector paths; may be empty. The coordinate system origin is in the upper-left corner +//@is_owned True, if the sticker set is owned by the current user //@is_installed True, if the sticker set has been installed by the current user //@is_archived True, if the sticker set has been archived. A sticker set can't be installed and archived simultaneously //@is_official True, if the sticker set is official -//@sticker_format Format of the stickers in the set //@sticker_type Type of the stickers in the set //@needs_repainting True, if stickers in the sticker set are custom emoji that must be repainted; for custom emoji sticker sets only //@is_allowed_as_chat_emoji_status True, if stickers in the sticker set are custom emoji that can be used as chat emoji status; for custom emoji sticker sets only //@is_viewed True for already viewed trending sticker sets //@size Total number of stickers in the set //@covers Up to the first 5 stickers from the set, depending on the context. If the application needs more stickers the full sticker set needs to be requested -stickerSetInfo id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:vector is_installed:Bool is_archived:Bool is_official:Bool sticker_format:StickerFormat sticker_type:StickerType needs_repainting:Bool is_allowed_as_chat_emoji_status:Bool is_viewed:Bool size:int32 covers:vector = StickerSetInfo; +stickerSetInfo id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:vector is_owned:Bool is_installed:Bool is_archived:Bool is_official:Bool sticker_type:StickerType needs_repainting:Bool is_allowed_as_chat_emoji_status:Bool is_viewed:Bool size:int32 covers:vector = StickerSetInfo; //@description Represents a list of sticker sets @total_count Approximate total number of sticker sets found @sets List of sticker sets stickerSets total_count:int32 sets:vector = StickerSets; @@ -4220,6 +4316,16 @@ speechRecognitionResultText text:string = SpeechRecognitionResult; speechRecognitionResultError error:error = SpeechRecognitionResult; +//@description Describes a connection of the bot with a business account +//@id Unique identifier of the connection +//@user_id Identifier of the business user that created the connection +//@user_chat_id Chat identifier of the private chat with the user +//@date Point in time (Unix timestamp) when the connection was established +//@can_reply True, if the bot can send messages to the connected user; false otherwise +//@is_enabled True, if the connection is enabled; false otherwise +businessConnection id:string user_id:int53 user_chat_id:int53 date:int32 can_reply:Bool is_enabled:Bool = BusinessConnection; + + //@description Describes a color to highlight a bot added to attachment menu @light_color Color in the RGB24 format for light themes @dark_color Color in the RGB24 format for dark themes attachmentMenuBotColor light_color:int32 dark_color:int32 = AttachmentMenuBotColor; @@ -4859,7 +4965,7 @@ premiumFeatureAdvancedChatManagement = PremiumFeature; //@description A badge in the user's profile premiumFeatureProfileBadge = PremiumFeature; -//@description An emoji status shown along with the user's name +//@description The ability to show an emoji status along with the user's name premiumFeatureEmojiStatus = PremiumFeature; //@description Profile photo animation on message and chat screens @@ -4896,6 +5002,45 @@ premiumFeatureMessagePrivacy = PremiumFeature; //@description The ability to view last seen and read times of other users even they can't view last seen or read time for the current user premiumFeatureLastSeenTimes = PremiumFeature; +//@description The ability to use Business features +premiumFeatureBusiness = PremiumFeature; + + +//@class BusinessFeature @description Describes a feature available to Business user accounts + +//@description The ability to set location +businessFeatureLocation = BusinessFeature; + +//@description The ability to set opening hours +businessFeatureOpeningHours = BusinessFeature; + +//@description The ability to use quick replies +businessFeatureQuickReplies = BusinessFeature; + +//@description The ability to set up a greeting message +businessFeatureGreetingMessage = BusinessFeature; + +//@description The ability to set up an away message +businessFeatureAwayMessage = BusinessFeature; + +//@description The ability to create links to the business account with predefined message text +businessFeatureAccountLinks = BusinessFeature; + +//@description The ability to customize intro +businessFeatureIntro = BusinessFeature; + +//@description The ability to connect a bot to the account +businessFeatureBots = BusinessFeature; + +//@description The ability to show an emoji status along with the business name +businessFeatureEmojiStatus = BusinessFeature; + +//@description The ability to display folder names for each chat in the chat list +businessFeatureChatFolderTags = BusinessFeature; + +//@description Allowed to use many additional features for stories +businessFeatureUpgradedStories = BusinessFeature; + //@class PremiumStoryFeature @description Describes a story feature available to Premium users @@ -4930,6 +5075,9 @@ premiumLimit type:PremiumLimitType default_value:int32 premium_value:int32 = Pre //@payment_link An internal link to be opened to pay for Telegram Premium if store payment isn't possible; may be null if direct payment isn't available premiumFeatures features:vector limits:vector payment_link:InternalLinkType = PremiumFeatures; +//@description Contains information about features, available to Business user accounts @features The list of available business features +businessFeatures features:vector = BusinessFeatures; + //@class PremiumSource @description Describes a source from which the Premium features screen is opened @@ -4939,6 +5087,9 @@ premiumSourceLimitExceeded limit_type:PremiumLimitType = PremiumSource; //@description A user tried to use a Premium feature @feature The used feature premiumSourceFeature feature:PremiumFeature = PremiumSource; +//@description A user tried to use a Business feature @feature The used feature; pass null if none specific feature was used +premiumSourceBusinessFeature feature:BusinessFeature = PremiumSource; + //@description A user tried to use a Premium story feature @feature The used feature premiumSourceStoryFeature feature:PremiumStoryFeature = PremiumSource; @@ -4952,11 +5103,15 @@ premiumSourceSettings = PremiumSource; //@description Describes a promotion animation for a Premium feature @feature Premium feature @animation Promotion animation for the feature premiumFeaturePromotionAnimation feature:PremiumFeature animation:animation = PremiumFeaturePromotionAnimation; +//@description Describes a promotion animation for a Business feature @feature Business feature @animation Promotion animation for the feature +businessFeaturePromotionAnimation feature:BusinessFeature animation:animation = BusinessFeaturePromotionAnimation; + //@description Contains state of Telegram Premium subscription and promotion videos for Premium features //@state Text description of the state of the current Premium subscription; may be empty if the current user has no Telegram Premium subscription //@payment_options The list of available options for buying Telegram Premium //@animations The list of available promotion animations for Premium features -premiumState state:formattedText payment_options:vector animations:vector = PremiumState; +//@business_animations The list of available promotion animations for Business features +premiumState state:formattedText payment_options:vector animations:vector business_animations:vector = PremiumState; //@class StorePaymentPurpose @description Describes a purpose of an in-store payment @@ -5172,7 +5327,7 @@ checkChatUsernameResultUsernameInvalid = CheckChatUsernameResult; //@description The username is occupied checkChatUsernameResultUsernameOccupied = CheckChatUsernameResult; -//@description The username can be purchased at fragment.com +//@description The username can be purchased at https://fragment.com. Information about the username can be received using getCollectibleItemInfo checkChatUsernameResultUsernamePurchasable = CheckChatUsernameResult; //@description The user has too many chats with username, one of them must be made private first @@ -5477,6 +5632,9 @@ userPrivacySettingRuleAllowAll = UserPrivacySettingRule; //@description A rule to allow all contacts of the user to do something userPrivacySettingRuleAllowContacts = UserPrivacySettingRule; +//@description A rule to allow all Premium Users to do something; currently, allowed only for userPrivacySettingAllowChatInvites +userPrivacySettingRuleAllowPremiumUsers = UserPrivacySettingRule; + //@description A rule to allow certain specified users to do something @user_ids The user identifiers, total number of users in all rules must not exceed 1000 userPrivacySettingRuleAllowUsers user_ids:vector = UserPrivacySettingRule; @@ -5516,6 +5674,9 @@ userPrivacySettingShowPhoneNumber = UserPrivacySetting; //@description A privacy setting for managing whether the user's bio is visible userPrivacySettingShowBio = UserPrivacySetting; +//@description A privacy setting for managing whether the user's birthdate is visible +userPrivacySettingShowBirthdate = UserPrivacySetting; + //@description A privacy setting for managing whether the user can be invited to chats userPrivacySettingAllowChatInvites = UserPrivacySetting; @@ -5822,7 +5983,7 @@ internalLinkTypeMessage url:string = InternalLinkType; internalLinkTypeMessageDraft text:formattedText contains_link:Bool = InternalLinkType; //@description The link contains a request of Telegram passport data. Call getPassportAuthorizationForm with the given parameters to process the link if the link was received from outside of the application; otherwise, ignore it -//@bot_user_id User identifier of the service's bot +//@bot_user_id User identifier of the service's bot; the corresponding user may be unknown yet //@scope Telegram Passport element types requested by the service //@public_key Service's public key //@nonce Unique request identifier provided by the service @@ -6250,6 +6411,9 @@ suggestedActionSubscribeToAnnualPremium = SuggestedAction; //@description Suggests the user to gift Telegram Premium to friends for Christmas suggestedActionGiftPremiumForChristmas = SuggestedAction; +//@description Suggests the user to set birthdate +suggestedActionSetBirthdate = SuggestedAction; + //@description Contains a counter @count Count count count:int32 = Count; @@ -6306,10 +6470,11 @@ proxies proxies:vector = Proxies; //@description A sticker to be added to a sticker set //@sticker File with the sticker; must fit in a 512x512 square. For WEBP stickers the file must be in WEBP or PNG format, which will be converted to WEBP server-side. //-See https://core.telegram.org/animated_stickers#technical-requirements for technical requirements +//@format Format of the sticker //@emojis String with 1-20 emoji corresponding to the sticker //@mask_position Position where the mask is placed; pass null if not specified //@keywords List of up to 20 keywords with total length up to 64 characters, which can be used to find the sticker -inputSticker sticker:InputFile emojis:string mask_position:maskPosition keywords:vector = InputSticker; +inputSticker sticker:InputFile format:StickerFormat emojis:string mask_position:maskPosition keywords:vector = InputSticker; //@description Represents a date range @start_date Point in time (Unix timestamp) at which the date range begins @end_date Point in time (Unix timestamp) at which the date range ends @@ -6902,7 +7067,7 @@ updateDefaultReactionType reaction_type:ReactionType = Update; updateSavedMessagesTags saved_messages_topic_id:int53 tags:savedMessagesTags = Update; //@description The parameters of speech recognition without Telegram Premium subscription has changed -//@max_media_duration The maximum allowed duration of media for speech recognition without Telegram Premium subscription +//@max_media_duration The maximum allowed duration of media for speech recognition without Telegram Premium subscription, in seconds //@weekly_count The total number of allowed speech recognitions per week; 0 if none //@left_count Number of left speech recognition attempts this week //@next_reset_date Point in time (Unix timestamp) when the weekly number of tries will reset; 0 if unknown @@ -6923,12 +7088,30 @@ updateAnimationSearchParameters provider:string emojis:vector = Update; //@description The list of suggested to the user actions has changed @added_actions Added suggested actions @removed_actions Removed suggested actions updateSuggestedActions added_actions:vector removed_actions:vector = Update; +//@description The list of contacts that had birthdays recently or will have birthday soon has changed @close_birthday_users List of contact users with close birthday +updateContactCloseBirthdays close_birthday_users:vector = Update; + //@description Adding users to a chat has failed because of their privacy settings. An invite link can be shared with the users if appropriate @chat_id Chat identifier @user_ids Identifiers of users, which weren't added because of their privacy settings updateAddChatMembersPrivacyForbidden chat_id:int53 user_ids:vector = Update; //@description Autosave settings for some type of chats were updated @scope Type of chats for which autosave settings were updated @settings The new autosave settings; may be null if the settings are reset to default updateAutosaveSettings scope:AutosaveSettingsScope settings:scopeAutosaveSettings = Update; +//@description A business connection has changed; for bots only @connection New data about the connection +updateBusinessConnection connection:businessConnection = Update; + +//@description A new message was added to a business account; for bots only @connection_id Unique identifier of the business connection @message The new message +updateNewBusinessMessage connection_id:string message:businessMessage = Update; + +//@description A message in a business account was edited; for bots only @connection_id Unique identifier of the business connection @message The edited message +updateBusinessMessageEdited connection_id:string message:businessMessage = Update; + +//@description Messages in a business account were deleted; for bots only +//@connection_id Unique identifier of the business connection +//@chat_id Identifier of a chat in the business account in which messages were deleted +//@message_ids Unique message identifiers of the deleted messages +updateBusinessMessagesDeleted connection_id:string chat_id:int53 message_ids:vector = Update; + //@description A new incoming inline query; for bots only //@id Unique query identifier //@sender_user_id Identifier of the user who sent the query @@ -7400,6 +7583,9 @@ getSuitableDiscussionChats = Chats; //@description Returns a list of recently inactive supergroups and channels. Can be used when user reaches limit on the number of joined supergroups and channels and receives CHANNELS_TOO_MUCH error. Also, the limit can be increased with Telegram Premium getInactiveSupergroupChats = Chats; +//@description Returns a list of channel chats, which can be used as a personal chat +getSuitablePersonalChats = Chats; + //@description Loads more Saved Messages topics. The loaded topics will be sent through updateSavedMessagesTopic. Topics are sorted by their topic.order in descending order. Returns a 404 error if all topics have been loaded //@limit The maximum number of topics to be loaded. For optimal performance, the number of loaded topics is chosen by TDLib and can be smaller than the specified limit, even if the end of the list is not reached @@ -7585,6 +7771,12 @@ getChatSponsoredMessages chat_id:int53 = SponsoredMessages; //@message_id Identifier of the sponsored message clickChatSponsoredMessage chat_id:int53 message_id:int53 = Ok; +//@description Reports a sponsored message to Telegram moderators +//@chat_id Chat identifier of the sponsored message +//@message_id Identifier of the sponsored message +//@option_id Option identifier chosen by the user; leave empty for the initial request +reportChatSponsoredMessage chat_id:int53 message_id:int53 option_id:bytes = ReportChatSponsoredMessageResult; + //@description Removes an active notification from notification list. Needs to be called only if the notification is removed by the current user @notification_group_id Identifier of notification group to which the notification belongs @notification_id Identifier of removed notification removeNotification notification_group_id:int32 notification_id:int32 = Ok; @@ -7654,7 +7846,8 @@ setChatMessageSender chat_id:int53 message_sender_id:MessageSender = Ok; //@input_message_content The content of the message to be sent sendMessage chat_id:int53 message_thread_id:int53 reply_to:InputMessageReplyTo options:messageSendOptions reply_markup:ReplyMarkup input_message_content:InputMessageContent = Message; -//@description Sends 2-10 messages grouped together into an album. Currently, only audio, document, photo and video messages can be grouped into an album. Documents and audio files can be only grouped in an album with messages of the same type. Returns sent messages +//@description Sends 2-10 messages grouped together into an album. Currently, only audio, document, photo and video messages can be grouped into an album. +//-Documents and audio files can be only grouped in an album with messages of the same type. Returns sent messages //@chat_id Target chat //@message_thread_id If not 0, the message thread identifier in which the messages will be sent //@reply_to Information about the message or story to be replied; pass null if none @@ -7802,6 +7995,27 @@ editInlineMessageReplyMarkup inline_message_id:string reply_markup:ReplyMarkup = editMessageSchedulingState chat_id:int53 message_id:int53 scheduling_state:MessageSchedulingState = Ok; +//@description Sends a message on behalf of a business account; for bots only. Returns the message after it was sent +//@business_connection_id Unique identifier of business connection on behalf of which to send the request +//@chat_id Target chat +//@reply_to Information about the message to be replied; pass null if none +//@disable_notification Pass true to disable notification for the message +//@protect_content Pass true if the content of the message must be protected from forwarding and saving +//@reply_markup Markup for replying to the message; pass null if none +//@input_message_content The content of the message to be sent +sendBusinessMessage business_connection_id:string chat_id:int53 reply_to:InputMessageReplyTo disable_notification:Bool protect_content:Bool reply_markup:ReplyMarkup input_message_content:InputMessageContent = BusinessMessage; + +//@description Sends 2-10 messages grouped together into an album on behalf of a business account; for bots only. Currently, only audio, document, photo and video messages can be grouped into an album. +//-Documents and audio files can be only grouped in an album with messages of the same type. Returns sent messages +//@business_connection_id Unique identifier of business connection on behalf of which to send the request +//@chat_id Target chat +//@reply_to Information about the message to be replied; pass null if none +//@disable_notification Pass true to disable notification for the message +//@protect_content Pass true if the content of the message must be protected from forwarding and saving +//@input_message_contents Contents of messages to be sent. At most 10 messages can be added to an album +sendBusinessMessageAlbum business_connection_id:string chat_id:int53 reply_to:InputMessageReplyTo disable_notification:Bool protect_content:Bool input_message_contents:vector = BusinessMessages; + + //@description Checks validness of a name for a quick reply shortcut. Can be called synchronously @name The name of the shortcut; 1-32 characters checkQuickReplyShortcutName name:string = Ok; @@ -8019,6 +8233,10 @@ stopPoll chat_id:int53 message_id:int53 reply_markup:ReplyMarkup = Ok; hideSuggestedAction action:SuggestedAction = Ok; +//@description Returns information about a business connection by its identifier; for bots only @connection_id Identifier of the business connection to return +getBusinessConnection connection_id:string = BusinessConnection; + + //@description Returns information about a button of type inlineKeyboardButtonTypeLoginUrl. The method needs to be called when the user presses the button //@chat_id Chat identifier of the message with the button //@message_id Message identifier of the message with the button @@ -8171,8 +8389,12 @@ getInlineGameHighScores inline_message_id:string user_id:int53 = GameHighScores; deleteChatReplyMarkup chat_id:int53 message_id:int53 = Ok; -//@description Sends a notification about user activity in a chat @chat_id Chat identifier @message_thread_id If not 0, the message thread identifier in which the action was performed @action The action description; pass null to cancel the currently active action -sendChatAction chat_id:int53 message_thread_id:int53 action:ChatAction = Ok; +//@description Sends a notification about user activity in a chat +//@chat_id Chat identifier +//@message_thread_id If not 0, the message thread identifier in which the action was performed +//@business_connection_id Unique identifier of business connection on behalf of which to send the request; for bots only +//@action The action description; pass null to cancel the currently active action +sendChatAction chat_id:int53 message_thread_id:int53 business_connection_id:string action:ChatAction = Ok; //@description Informs TDLib that the chat is opened by the user. Many useful activities depend on the chat being opened or closed (e.g., in supergroups and channels all updates are received only for opened chats) @chat_id Chat identifier @@ -8585,7 +8807,7 @@ canSendStory chat_id:int53 = CanSendStoryResult; //@chat_id Identifier of the chat that will post the story //@content Content of the story //@areas Clickable rectangle areas to be shown on the story media; pass null if none -//@caption Story caption; pass null to use an empty caption; 0-getOption("story_caption_length_max") characters +//@caption Story caption; pass null to use an empty caption; 0-getOption("story_caption_length_max") characters; can have entities only if getOption("can_use_text_entities_in_story_caption") //@privacy_settings The privacy settings for the story; ignored for stories sent to supergroup and channel chats //@active_period Period after which the story is moved to archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400 for Telegram Premium users, and 86400 otherwise //@from_story_full_id Full identifier of the original story, which content was used to create the story @@ -9228,7 +9450,10 @@ getPremiumStickers limit:int32 = Stickers; //@description Returns a list of installed sticker sets @sticker_type Type of the sticker sets to return getInstalledStickerSets sticker_type:StickerType = StickerSets; -//@description Returns a list of archived sticker sets @sticker_type Type of the sticker sets to return @offset_sticker_set_id Identifier of the sticker set from which to return the result @limit The maximum number of sticker sets to return; up to 100 +//@description Returns a list of archived sticker sets +//@sticker_type Type of the sticker sets to return +//@offset_sticker_set_id Identifier of the sticker set from which to return the result; use 0 to get results from the beginning +//@limit The maximum number of sticker sets to return; up to 100 getArchivedStickerSets sticker_type:StickerType offset_sticker_set_id:int64 limit:int32 = StickerSets; //@description Returns a list of trending sticker sets. For optimal performance, the number of returned sticker sets is chosen by TDLib @@ -9267,7 +9492,7 @@ reorderInstalledStickerSets sticker_type:StickerType sticker_set_ids:vector = Ok; +//@description Changes the birthdate of the current user @birthdate The new value of the current user's birthdate; pass null to remove the birthdate +setBirthdate birthdate:birthdate = Ok; + +//@description Changes the personal chat of the current user @chat_id Identifier of the new personal chat; pass 0 to remove the chat. Use getSuitablePersonalChats to get suitable chats +setPersonalChat chat_id:int53 = Ok; + //@description Changes the emoji status of the current user; for Telegram Premium users only @emoji_status New emoji status; pass null to switch to the default badge setEmojiStatus emoji_status:emojiStatus = Ok; @@ -9400,7 +9631,8 @@ setLocation location:location = Ok; //@description Changes the business location of the current user. Requires Telegram Business subscription @location The new location of the business; pass null to remove the location setBusinessLocation location:businessLocation = Ok; -//@description Changes the business opening hours of the current user. Requires Telegram Business subscription @opening_hours The new opening hours of the business; pass null to remove the opening hours +//@description Changes the business opening hours of the current user. Requires Telegram Business subscription +//@opening_hours The new opening hours of the business; pass null to remove the opening hours; up to 28 time intervals can be specified setBusinessOpeningHours opening_hours:businessOpeningHours = Ok; //@description Changes the business greeting message settings of the current user. Requires Telegram Business subscription @greeting_message_settings The new settings for the greeting message of the business; pass null to disable the greeting message @@ -9409,6 +9641,9 @@ setBusinessGreetingMessageSettings greeting_message_settings:businessGreetingMes //@description Changes the business away message settings of the current user. Requires Telegram Business subscription @away_message_settings The new settings for the away message of the business; pass null to disable the away message setBusinessAwayMessageSettings away_message_settings:businessAwayMessageSettings = Ok; +//@description Changes the business intro of the current user. Requires Telegram Business subscription @intro The new intro of the business; pass null to remove the intro +setBusinessIntro intro:inputBusinessIntro = Ok; + //@description Changes the phone number of the user and sends an authentication code to the user's new phone number; for official Android and iOS applications only. On success, returns information about the sent code //@phone_number The new phone number of the user in international format //@settings Settings for the authentication of the user's phone number; pass null to use default settings @@ -9784,7 +10019,7 @@ setReadDatePrivacySettings settings:readDatePrivacySettings = Ok; //@description Returns privacy settings for message read date getReadDatePrivacySettings = ReadDatePrivacySettings; -//@description Changes privacy settings for new chat creation; for Telegram Premium users only @settings New settings +//@description Changes privacy settings for new chat creation; can be used only if getOption("can_set_new_chat_privacy_settings") @settings New settings setNewChatPrivacySettings settings:newChatPrivacySettings = Ok; //@description Returns privacy settings for new chat creation @@ -10023,61 +10258,73 @@ checkStickerSetName name:string = CheckStickerSetNameResult; //@description Creates a new sticker set. Returns the newly created sticker set //@user_id Sticker set owner; ignored for regular users //@title Sticker set title; 1-64 characters -//@name Sticker set name. Can contain only English letters, digits and underscores. Must end with *"_by_"* (** is case insensitive) for bots; 1-64 characters -//@sticker_format Format of the stickers in the set +//@name Sticker set name. Can contain only English letters, digits and underscores. Must end with *"_by_"* (** is case insensitive) for bots; 0-64 characters. +//-If empty, then the name returned by getSuggestedStickerSetName will be used automatically //@sticker_type Type of the stickers in the set //@needs_repainting Pass true if stickers in the sticker set must be repainted; for custom emoji sticker sets only -//@stickers List of stickers to be added to the set; must be non-empty. All stickers must have the same format. For TGS stickers, uploadStickerFile must be used before the sticker is shown +//@stickers List of stickers to be added to the set; 1-200 stickers for custom emoji sticker sets, and 1-120 stickers otherwise. For TGS stickers, uploadStickerFile must be used before the sticker is shown //@source Source of the sticker set; may be empty if unknown -createNewStickerSet user_id:int53 title:string name:string sticker_format:StickerFormat sticker_type:StickerType needs_repainting:Bool stickers:vector source:string = StickerSet; +createNewStickerSet user_id:int53 title:string name:string sticker_type:StickerType needs_repainting:Bool stickers:vector source:string = StickerSet; - -//@description Adds a new sticker to a set; for bots only -//@user_id Sticker set owner -//@name Sticker set name +//@description Adds a new sticker to a set +//@user_id Sticker set owner; ignored for regular users +//@name Sticker set name. The sticker set must be owned by the current user, and contain less than 200 stickers for custom emoji sticker sets and less than 120 otherwise //@sticker Sticker to add to the set addStickerToSet user_id:int53 name:string sticker:inputSticker = Ok; -//@description Sets a sticker set thumbnail; for bots only -//@user_id Sticker set owner -//@name Sticker set name -//@thumbnail Thumbnail to set in PNG, TGS, or WEBM format; pass null to remove the sticker set thumbnail. Thumbnail format must match the format of stickers in the set -setStickerSetThumbnail user_id:int53 name:string thumbnail:InputFile = Ok; +//@description Replaces existing sticker in a set. The function is equivalent to removeStickerFromSet, then addStickerToSet, then setStickerPositionInSet +//@user_id Sticker set owner; ignored for regular users +//@name Sticker set name. The sticker set must be owned by the current user +//@old_sticker Sticker to remove from the set +//@new_sticker Sticker to add to the set +replaceStickerInSet user_id:int53 name:string old_sticker:InputFile new_sticker:inputSticker = Ok; -//@description Sets a custom emoji sticker set thumbnail; for bots only -//@name Sticker set name +//@description Sets a sticker set thumbnail +//@user_id Sticker set owner; ignored for regular users +//@name Sticker set name. The sticker set must be owned by the current user +//@thumbnail Thumbnail to set; pass null to remove the sticker set thumbnail +//@format Format of the thumbnail; pass null if thumbnail is removed +setStickerSetThumbnail user_id:int53 name:string thumbnail:InputFile format:StickerFormat = Ok; + +//@description Sets a custom emoji sticker set thumbnail +//@name Sticker set name. The sticker set must be owned by the current user //@custom_emoji_id Identifier of the custom emoji from the sticker set, which will be set as sticker set thumbnail; pass 0 to remove the sticker set thumbnail setCustomEmojiStickerSetThumbnail name:string custom_emoji_id:int64 = Ok; -//@description Sets a sticker set title; for bots only @name Sticker set name @title New sticker set title +//@description Sets a sticker set title @name Sticker set name. The sticker set must be owned by the current user @title New sticker set title setStickerSetTitle name:string title:string = Ok; -//@description Deleted a sticker set; for bots only @name Sticker set name +//@description Completely deletes a sticker set @name Sticker set name. The sticker set must be owned by the current user deleteStickerSet name:string = Ok; -//@description Changes the position of a sticker in the set to which it belongs; for bots only. The sticker set must have been created by the bot +//@description Changes the position of a sticker in the set to which it belongs. The sticker set must be owned by the current user //@sticker Sticker //@position New position of the sticker in the set, 0-based setStickerPositionInSet sticker:InputFile position:int32 = Ok; -//@description Removes a sticker from the set to which it belongs; for bots only. The sticker set must have been created by the bot @sticker Sticker +//@description Removes a sticker from the set to which it belongs. The sticker set must be owned by the current user @sticker Sticker to remove from the set removeStickerFromSet sticker:InputFile = Ok; -//@description Changes the list of emoji corresponding to a sticker; for bots only. The sticker must belong to a regular or custom emoji sticker set created by the bot +//@description Changes the list of emoji corresponding to a sticker. The sticker must belong to a regular or custom emoji sticker set that is owned by the current user //@sticker Sticker //@emojis New string with 1-20 emoji corresponding to the sticker setStickerEmojis sticker:InputFile emojis:string = Ok; -//@description Changes the list of keywords of a sticker; for bots only. The sticker must belong to a regular or custom emoji sticker set created by the bot +//@description Changes the list of keywords of a sticker. The sticker must belong to a regular or custom emoji sticker set that is owned by the current user //@sticker Sticker //@keywords List of up to 20 keywords with total length up to 64 characters, which can be used to find the sticker setStickerKeywords sticker:InputFile keywords:vector = Ok; -//@description Changes the mask position of a mask sticker; for bots only. The sticker must belong to a mask sticker set created by the bot +//@description Changes the mask position of a mask sticker. The sticker must belong to a mask sticker set that is owned by the current user //@sticker Sticker //@mask_position Position where the mask is placed; pass null to remove mask position setStickerMaskPosition sticker:InputFile mask_position:maskPosition = Ok; +//@description Returns sticker sets owned by the current user +//@offset_sticker_set_id Identifier of the sticker set from which to return owned sticker sets; use 0 to get results from the beginning +//@limit The maximum number of sticker sets to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned objects is chosen by TDLib and can be smaller than the specified limit +getOwnedStickerSets offset_sticker_set_id:int64 limit:int32 = StickerSets; + //@description Returns information about a file with a map thumbnail in PNG format. Only map thumbnail files with size less than 1MB can be downloaded //@location Location of the map center @@ -10141,6 +10388,10 @@ assignAppStoreTransaction receipt:bytes purpose:StorePaymentPurpose = Ok; assignGooglePlayTransaction package_name:string store_product_id:string purchase_token:string purpose:StorePaymentPurpose = Ok; +//@description Returns information about features, available to Business users @source Source of the request; pass null if the method is called from settings or some non-standard source +getBusinessFeatures source:BusinessFeature = BusinessFeatures; + + //@description Accepts Telegram terms of services @terms_of_service_id Terms of service identifier acceptTermsOfService terms_of_service_id:string = Ok; @@ -10179,6 +10430,11 @@ getPhoneNumberInfo phone_number_prefix:string = PhoneNumberInfo; getPhoneNumberInfoSync language_code:string phone_number_prefix:string = PhoneNumberInfo; +//@description Returns information about a given collectible item that was purchased at https://fragment.com +//@type Type of the collectible item. The item must be used by a user and must be visible to the current user +getCollectibleItemInfo type:CollectibleItemType = CollectibleItemInfo; + + //@description Returns information about a tg:// deep link. Use "tg://need_update_for_some_feature" or "tg:some_unsupported_feature" for testing. Returns a 404 error for unknown links. Can be called before authorization @link The link getDeepLinkInfo link:string = DeepLinkInfo; From 303a1268301c2941314be59113b8f0df8a04d9e5 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Thu, 25 Apr 2024 00:44:23 +0800 Subject: [PATCH 16/54] Update to TDLib 1.8.28 --- client/function.go | 708 ++++++++++++++++++++++-------- client/type.go | 973 +++++++++++++++++++++++++++++++++++++----- client/unmarshaler.go | 418 ++++++++++++++++-- data/td_api.tl | 399 ++++++++++++----- 4 files changed, 2075 insertions(+), 423 deletions(-) diff --git a/client/function.go b/client/function.go index 44e7348..bf2bef8 100755 --- a/client/function.go +++ b/client/function.go @@ -1854,7 +1854,7 @@ type OpenChatSimilarChatRequest struct { OpenedChatId int64 `json:"opened_chat_id"` } -// Informs TDLib that a chat was opened from the list of similar chats. The method is independent from openChat and closeChat methods +// Informs TDLib that a chat was opened from the list of similar chats. The method is independent of openChat and closeChat methods func (client *Client) OpenChatSimilarChat(req *OpenChatSimilarChatRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -4600,6 +4600,137 @@ func (client *Client) DeleteQuickReplyShortcutMessages(req *DeleteQuickReplyShor return UnmarshalOk(result.Data) } +type AddQuickReplyShortcutMessageRequest struct { + // Name of the target shortcut + ShortcutName string `json:"shortcut_name"` + // Identifier of a quick reply message in the same shortcut to be replied; pass 0 if none + ReplyToMessageId int64 `json:"reply_to_message_id"` + // The content of the message to be added; inputMessagePoll, inputMessageForwarded and inputMessageLocation with live_period aren't supported + InputMessageContent InputMessageContent `json:"input_message_content"` +} + +// Adds a message to a quick reply shortcut. If shortcut doesn't exist and there are less than getOption("quick_reply_shortcut_count_max") shortcuts, then a new shortcut is created. The shortcut must not contain more than getOption("quick_reply_shortcut_message_count_max") messages after adding the new message. Returns the added message +func (client *Client) AddQuickReplyShortcutMessage(req *AddQuickReplyShortcutMessageRequest) (*QuickReplyMessage, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addQuickReplyShortcutMessage", + }, + Data: map[string]interface{}{ + "shortcut_name": req.ShortcutName, + "reply_to_message_id": req.ReplyToMessageId, + "input_message_content": req.InputMessageContent, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalQuickReplyMessage(result.Data) +} + +type AddQuickReplyShortcutInlineQueryResultMessageRequest struct { + // Name of the target shortcut + ShortcutName string `json:"shortcut_name"` + // Identifier of a quick reply message in the same shortcut to be replied; pass 0 if none + ReplyToMessageId int64 `json:"reply_to_message_id"` + // Identifier of the inline query + QueryId JsonInt64 `json:"query_id"` + // Identifier of the inline query result + ResultId string `json:"result_id"` + // Pass true to hide the bot, via which the message is sent. Can be used only for bots getOption("animation_search_bot_username"), getOption("photo_search_bot_username"), and getOption("venue_search_bot_username") + HideViaBot bool `json:"hide_via_bot"` +} + +// Adds a message to a quick reply shortcut via inline bot. If shortcut doesn't exist and there are less than getOption("quick_reply_shortcut_count_max") shortcuts, then a new shortcut is created. The shortcut must not contain more than getOption("quick_reply_shortcut_message_count_max") messages after adding the new message. Returns the added message +func (client *Client) AddQuickReplyShortcutInlineQueryResultMessage(req *AddQuickReplyShortcutInlineQueryResultMessageRequest) (*QuickReplyMessage, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addQuickReplyShortcutInlineQueryResultMessage", + }, + Data: map[string]interface{}{ + "shortcut_name": req.ShortcutName, + "reply_to_message_id": req.ReplyToMessageId, + "query_id": req.QueryId, + "result_id": req.ResultId, + "hide_via_bot": req.HideViaBot, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalQuickReplyMessage(result.Data) +} + +type ReaddQuickReplyShortcutMessagesRequest struct { + // Name of the target shortcut + ShortcutName string `json:"shortcut_name"` + // Identifiers of the quick reply messages to readd. Message identifiers must be in a strictly increasing order + MessageIds []int64 `json:"message_ids"` +} + +// Readds quick reply messages which failed to add. Can be called only for messages for which messageSendingStateFailed.can_retry is true and after specified in messageSendingStateFailed.retry_after time passed. If a message is readded, the corresponding failed to send message is deleted. Returns the sent messages in the same order as the message identifiers passed in message_ids. If a message can't be readded, null will be returned instead of the message +func (client *Client) ReaddQuickReplyShortcutMessages(req *ReaddQuickReplyShortcutMessagesRequest) (*QuickReplyMessages, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "readdQuickReplyShortcutMessages", + }, + Data: map[string]interface{}{ + "shortcut_name": req.ShortcutName, + "message_ids": req.MessageIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalQuickReplyMessages(result.Data) +} + +type EditQuickReplyMessageRequest struct { + // Unique identifier of the quick reply shortcut with the message + ShortcutId int32 `json:"shortcut_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` + // New content of the message. Must be one of the following types: inputMessageText, inputMessageAnimation, inputMessageAudio, inputMessageDocument, inputMessagePhoto or inputMessageVideo + InputMessageContent InputMessageContent `json:"input_message_content"` +} + +// Asynchronously edits the text, media or caption of a quick reply message. Use quickReplyMessage.can_be_edited to check whether a message can be edited. Text message can be edited only to a text message. The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa +func (client *Client) EditQuickReplyMessage(req *EditQuickReplyMessageRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editQuickReplyMessage", + }, + Data: map[string]interface{}{ + "shortcut_id": req.ShortcutId, + "message_id": req.MessageId, + "input_message_content": req.InputMessageContent, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + // Returns list of custom emojis, which can be used as forum topic icon by all users func (client *Client) GetForumTopicDefaultIcons() (*Stickers, error) { result, err := client.Send(Request{ @@ -6883,7 +7014,7 @@ type GetInternalLinkTypeRequest struct { Link string `json:"link"` } -// Returns information about the type of an internal link. Returns a 404 error if the link is not internal. Can be called before authorization +// Returns information about the type of internal link. Returns a 404 error if the link is not internal. Can be called before authorization func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (InternalLinkType, error) { result, err := client.Send(Request{ meta: meta{ @@ -6923,6 +7054,9 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeBotStartInGroup: return UnmarshalInternalLinkTypeBotStartInGroup(result.Data) + case TypeInternalLinkTypeBusinessChat: + return UnmarshalInternalLinkTypeBusinessChat(result.Data) + case TypeInternalLinkTypeChangePhoneNumber: return UnmarshalInternalLinkTypeChangePhoneNumber(result.Data) @@ -7332,8 +7466,8 @@ type CreateNewBasicGroupChatRequest struct { MessageAutoDeleteTime int32 `json:"message_auto_delete_time"` } -// Creates a new basic group and sends a corresponding messageBasicGroupChatCreate. Returns the newly created chat -func (client *Client) CreateNewBasicGroupChat(req *CreateNewBasicGroupChatRequest) (*Chat, error) { +// Creates a new basic group and sends a corresponding messageBasicGroupChatCreate. Returns information about the newly created chat +func (client *Client) CreateNewBasicGroupChat(req *CreateNewBasicGroupChatRequest) (*CreatedBasicGroupChat, error) { result, err := client.Send(Request{ meta: meta{ Type: "createNewBasicGroupChat", @@ -7352,7 +7486,7 @@ func (client *Client) CreateNewBasicGroupChat(req *CreateNewBasicGroupChatReques return nil, buildResponseError(result.Data) } - return UnmarshalChat(result.Data) + return UnmarshalCreatedBasicGroupChat(result.Data) } type CreateNewSupergroupChatRequest struct { @@ -8941,8 +9075,8 @@ type AddChatMemberRequest struct { ForwardLimit int32 `json:"forward_limit"` } -// Adds a new member to a chat; requires can_invite_users member right. Members can't be added to private or secret chats -func (client *Client) AddChatMember(req *AddChatMemberRequest) (*Ok, error) { +// Adds a new member to a chat; requires can_invite_users member right. Members can't be added to private or secret chats. Returns information about members that weren't added +func (client *Client) AddChatMember(req *AddChatMemberRequest) (*FailedToAddMembers, error) { result, err := client.Send(Request{ meta: meta{ Type: "addChatMember", @@ -8961,7 +9095,7 @@ func (client *Client) AddChatMember(req *AddChatMemberRequest) (*Ok, error) { return nil, buildResponseError(result.Data) } - return UnmarshalOk(result.Data) + return UnmarshalFailedToAddMembers(result.Data) } type AddChatMembersRequest struct { @@ -8971,8 +9105,8 @@ type AddChatMembersRequest struct { UserIds []int64 `json:"user_ids"` } -// Adds multiple new members to a chat; requires can_invite_users member right. Currently, this method is only available for supergroups and channels. This method can't be used to join a chat. Members can't be added to a channel if it has more than 200 members -func (client *Client) AddChatMembers(req *AddChatMembersRequest) (*Ok, error) { +// Adds multiple new members to a chat; requires can_invite_users member right. Currently, this method is only available for supergroups and channels. This method can't be used to join a chat. Members can't be added to a channel if it has more than 200 members. Returns information about members that weren't added +func (client *Client) AddChatMembers(req *AddChatMembersRequest) (*FailedToAddMembers, error) { result, err := client.Send(Request{ meta: meta{ Type: "addChatMembers", @@ -8990,7 +9124,7 @@ func (client *Client) AddChatMembers(req *AddChatMembersRequest) (*Ok, error) { return nil, buildResponseError(result.Data) } - return UnmarshalOk(result.Data) + return UnmarshalFailedToAddMembers(result.Data) } type SetChatMemberStatusRequest struct { @@ -10296,7 +10430,7 @@ type GetChatBoostFeaturesRequest struct { IsChannel bool `json:"is_channel"` } -// Returns list of features available on the first 10 chat boost levels; this is an offline request +// Returns list of features available for different chat boost levels; this is an offline request func (client *Client) GetChatBoostFeatures(req *GetChatBoostFeaturesRequest) (*ChatBoostFeatures, error) { result, err := client.Send(Request{ meta: meta{ @@ -11043,7 +11177,7 @@ type AddFileToDownloadsRequest struct { Priority int32 `json:"priority"` } -// Adds a file from a message to the list of file downloads. Download progress and completion of the download will be notified through updateFile updates. If message database is used, the list of file downloads is persistent across application restarts. The downloading is independent from download using downloadFile, i.e. it continues if downloadFile is canceled or is used to download a part of the file +// Adds a file from a message to the list of file downloads. Download progress and completion of the download will be notified through updateFile updates. If message database is used, the list of file downloads is persistent across application restarts. The downloading is independent of download using downloadFile, i.e. it continues if downloadFile is canceled or is used to download a part of the file func (client *Client) AddFileToDownloads(req *AddFileToDownloadsRequest) (*File, error) { result, err := client.Send(Request{ meta: meta{ @@ -13481,6 +13615,25 @@ func (client *Client) SearchStickers(req *SearchStickersRequest) (*Stickers, err return UnmarshalStickers(result.Data) } +// Returns greeting stickers from regular sticker sets that can be used for the start page of other users +func (client *Client) GetGreetingStickers() (*Stickers, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getGreetingStickers", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStickers(result.Data) +} + type GetPremiumStickersRequest struct { // The maximum number of stickers to be returned; 0-100 Limit int32 `json:"limit"` @@ -14909,19 +15062,19 @@ func (client *Client) SetBusinessAwayMessageSettings(req *SetBusinessAwayMessage return UnmarshalOk(result.Data) } -type SetBusinessIntroRequest struct { - // The new intro of the business; pass null to remove the intro - Intro *InputBusinessIntro `json:"intro"` +type SetBusinessStartPageRequest struct { + // The new start page of the business; pass null to remove custom start page + StartPage *InputBusinessStartPage `json:"start_page"` } -// Changes the business intro of the current user. Requires Telegram Business subscription -func (client *Client) SetBusinessIntro(req *SetBusinessIntroRequest) (*Ok, error) { +// Changes the business start page of the current user. Requires Telegram Business subscription +func (client *Client) SetBusinessStartPage(req *SetBusinessStartPageRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "setBusinessIntro", + Type: "setBusinessStartPage", }, Data: map[string]interface{}{ - "intro": req.Intro, + "start_page": req.StartPage, }, }) if err != nil { @@ -14935,22 +15088,25 @@ func (client *Client) SetBusinessIntro(req *SetBusinessIntroRequest) (*Ok, error return UnmarshalOk(result.Data) } -type ChangePhoneNumberRequest struct { - // The new phone number of the user in international format +type SendPhoneNumberCodeRequest struct { + // The phone number, in international format PhoneNumber string `json:"phone_number"` // Settings for the authentication of the user's phone number; pass null to use default settings Settings *PhoneNumberAuthenticationSettings `json:"settings"` + // Type of the request for which the code is sent + Type PhoneNumberCodeType `json:"type"` } -// Changes the phone number of the user and sends an authentication code to the user's new phone number; for official Android and iOS applications only. On success, returns information about the sent code -func (client *Client) ChangePhoneNumber(req *ChangePhoneNumberRequest) (*AuthenticationCodeInfo, error) { +// Sends a code to the specified phone number. Aborts previous phone number verification if there was one. On success, returns information about the sent code +func (client *Client) SendPhoneNumberCode(req *SendPhoneNumberCodeRequest) (*AuthenticationCodeInfo, error) { result, err := client.Send(Request{ meta: meta{ - Type: "changePhoneNumber", + Type: "sendPhoneNumberCode", }, Data: map[string]interface{}{ "phone_number": req.PhoneNumber, "settings": req.Settings, + "type": req.Type, }, }) if err != nil { @@ -14964,11 +15120,37 @@ func (client *Client) ChangePhoneNumber(req *ChangePhoneNumberRequest) (*Authent return UnmarshalAuthenticationCodeInfo(result.Data) } -// Resends the authentication code sent to confirm a new phone number for the current user. Works only if the previously received authenticationCodeInfo next_code_type was not null and the server-specified timeout has passed -func (client *Client) ResendChangePhoneNumberCode() (*AuthenticationCodeInfo, error) { +type SendPhoneNumberFirebaseSmsRequest struct { + // SafetyNet Attestation API token for the Android application, or secret from push notification for the iOS application + Token string `json:"token"` +} + +// Sends Firebase Authentication SMS to the specified phone number. Works only when received a code of the type authenticationCodeTypeFirebaseAndroid or authenticationCodeTypeFirebaseIos +func (client *Client) SendPhoneNumberFirebaseSms(req *SendPhoneNumberFirebaseSmsRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "resendChangePhoneNumberCode", + Type: "sendPhoneNumberFirebaseSms", + }, + Data: map[string]interface{}{ + "token": req.Token, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Resends the authentication code sent to a phone number. Works only if the previously received authenticationCodeInfo next_code_type was not null and the server-specified timeout has passed +func (client *Client) ResendPhoneNumberCode() (*AuthenticationCodeInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "resendPhoneNumberCode", }, Data: map[string]interface{}{}, }) @@ -14983,16 +15165,16 @@ func (client *Client) ResendChangePhoneNumberCode() (*AuthenticationCodeInfo, er return UnmarshalAuthenticationCodeInfo(result.Data) } -type CheckChangePhoneNumberCodeRequest struct { +type CheckPhoneNumberCodeRequest struct { // Authentication code to check Code string `json:"code"` } -// Checks the authentication code sent to confirm a new phone number of the user -func (client *Client) CheckChangePhoneNumberCode(req *CheckChangePhoneNumberCodeRequest) (*Ok, error) { +// Check the authentication code and completes the request for which the code was sent if appropriate +func (client *Client) CheckPhoneNumberCode(req *CheckPhoneNumberCodeRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "checkChangePhoneNumberCode", + Type: "checkPhoneNumberCode", }, Data: map[string]interface{}{ "code": req.Code, @@ -15080,6 +15262,187 @@ func (client *Client) DeleteBusinessConnectedBot(req *DeleteBusinessConnectedBot return UnmarshalOk(result.Data) } +type ToggleBusinessConnectedBotChatIsPausedRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Pass true to pause the connected bot in the chat; pass false to resume the bot + IsPaused bool `json:"is_paused"` +} + +// Pauses or resumes the connected business bot in a specific chat +func (client *Client) ToggleBusinessConnectedBotChatIsPaused(req *ToggleBusinessConnectedBotChatIsPausedRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleBusinessConnectedBotChatIsPaused", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "is_paused": req.IsPaused, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type RemoveBusinessConnectedBotFromChatRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` +} + +// Removes the connected business bot from a specific chat by adding the chat to businessRecipients.excluded_chat_ids +func (client *Client) RemoveBusinessConnectedBotFromChat(req *RemoveBusinessConnectedBotFromChatRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removeBusinessConnectedBotFromChat", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Returns business chat links created for the current account +func (client *Client) GetBusinessChatLinks() (*BusinessChatLinks, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getBusinessChatLinks", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBusinessChatLinks(result.Data) +} + +type CreateBusinessChatLinkRequest struct { + // Information about the link to create + LinkInfo *InputBusinessChatLink `json:"link_info"` +} + +// Creates a business chat link for the current account. Requires Telegram Business subscription. There can be up to getOption("business_chat_link_count_max") links created. Returns the created link +func (client *Client) CreateBusinessChatLink(req *CreateBusinessChatLinkRequest) (*BusinessChatLink, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "createBusinessChatLink", + }, + Data: map[string]interface{}{ + "link_info": req.LinkInfo, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBusinessChatLink(result.Data) +} + +type EditBusinessChatLinkRequest struct { + // The link to edit + Link string `json:"link"` + // New description of the link + LinkInfo *InputBusinessChatLink `json:"link_info"` +} + +// Edits a business chat link of the current account. Requires Telegram Business subscription. Returns the edited link +func (client *Client) EditBusinessChatLink(req *EditBusinessChatLinkRequest) (*BusinessChatLink, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editBusinessChatLink", + }, + Data: map[string]interface{}{ + "link": req.Link, + "link_info": req.LinkInfo, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBusinessChatLink(result.Data) +} + +type DeleteBusinessChatLinkRequest struct { + // The link to delete + Link string `json:"link"` +} + +// Deletes a business chat link of the current account +func (client *Client) DeleteBusinessChatLink(req *DeleteBusinessChatLinkRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteBusinessChatLink", + }, + Data: map[string]interface{}{ + "link": req.Link, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetBusinessChatLinkInfoRequest struct { + // Name of the link + LinkName string `json:"link_name"` +} + +// Returns information about a business chat link +func (client *Client) GetBusinessChatLinkInfo(req *GetBusinessChatLinkInfoRequest) (*BusinessChatLinkInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getBusinessChatLinkInfo", + }, + Data: map[string]interface{}{ + "link_name": req.LinkName, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBusinessChatLinkInfo(result.Data) +} + // Returns an HTTPS link, which can be used to get information about the current user func (client *Client) GetUserLink() (*UserLink, error) { result, err := client.Send(Request{ @@ -16236,6 +16599,35 @@ func (client *Client) ToggleSupergroupIsAllHistoryAvailable(req *ToggleSupergrou return UnmarshalOk(result.Data) } +type ToggleSupergroupCanHaveSponsoredMessagesRequest struct { + // The identifier of the channel + SupergroupId int64 `json:"supergroup_id"` + // The new value of can_have_sponsored_messages + CanHaveSponsoredMessages bool `json:"can_have_sponsored_messages"` +} + +// Toggles whether sponsored messages are shown in the channel chat; requires owner privileges in the channel. The chat must have at least chatBoostFeatures.min_sponsored_message_disable_boost_level boost level to disable sponsored messages +func (client *Client) ToggleSupergroupCanHaveSponsoredMessages(req *ToggleSupergroupCanHaveSponsoredMessagesRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleSupergroupCanHaveSponsoredMessages", + }, + Data: map[string]interface{}{ + "supergroup_id": req.SupergroupId, + "can_have_sponsored_messages": req.CanHaveSponsoredMessages, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type ToggleSupergroupHasHiddenMembersRequest struct { // Identifier of the supergroup SupergroupId int64 `json:"supergroup_id"` @@ -16414,7 +16806,7 @@ type GetSupergroupMembersRequest struct { Filter SupergroupMembersFilter `json:"filter"` // Number of users to skip Offset int32 `json:"offset"` - // The maximum number of users be returned; up to 200 + // The maximum number of users to be returned; up to 200 Limit int32 `json:"limit"` } @@ -17808,6 +18200,96 @@ func (client *Client) ReportMessageReactions(req *ReportMessageReactionsRequest) return UnmarshalOk(result.Data) } +type GetChatRevenueStatisticsRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Pass true if a dark theme is used by the application + IsDark bool `json:"is_dark"` +} + +// Returns detailed revenue statistics about a chat. Currently, this method can be used only for channels if supergroupFullInfo.can_get_revenue_statistics == true +func (client *Client) GetChatRevenueStatistics(req *GetChatRevenueStatisticsRequest) (*ChatRevenueStatistics, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatRevenueStatistics", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "is_dark": req.IsDark, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatRevenueStatistics(result.Data) +} + +type GetChatRevenueWithdrawalUrlRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // The 2-step verification password of the current user + Password string `json:"password"` +} + +// Returns URL for chat revenue withdrawal; requires owner privileges in the chat. Currently, this method can be used only for channels if supergroupFullInfo.can_get_revenue_statistics == true and getOption("can_withdraw_chat_revenue") +func (client *Client) GetChatRevenueWithdrawalUrl(req *GetChatRevenueWithdrawalUrlRequest) (*HttpUrl, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatRevenueWithdrawalUrl", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "password": req.Password, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalHttpUrl(result.Data) +} + +type GetChatRevenueTransactionsRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Number of transactions to skip + Offset int32 `json:"offset"` + // The maximum number of transactions to be returned; up to 200 + Limit int32 `json:"limit"` +} + +// Returns list of revenue transactions for a chat. Currently, this method can be used only for channels if supergroupFullInfo.can_get_revenue_statistics == true +func (client *Client) GetChatRevenueTransactions(req *GetChatRevenueTransactionsRequest) (*ChatRevenueTransactions, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatRevenueTransactions", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatRevenueTransactions(result.Data) +} + type GetChatStatisticsRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -18590,80 +19072,6 @@ func (client *Client) GetPreferredCountryLanguage(req *GetPreferredCountryLangua return UnmarshalText(result.Data) } -type SendPhoneNumberVerificationCodeRequest struct { - // The phone number of the user, in international format - PhoneNumber string `json:"phone_number"` - // Settings for the authentication of the user's phone number; pass null to use default settings - Settings *PhoneNumberAuthenticationSettings `json:"settings"` -} - -// Sends a code to verify a phone number to be added to a user's Telegram Passport -func (client *Client) SendPhoneNumberVerificationCode(req *SendPhoneNumberVerificationCodeRequest) (*AuthenticationCodeInfo, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "sendPhoneNumberVerificationCode", - }, - Data: map[string]interface{}{ - "phone_number": req.PhoneNumber, - "settings": req.Settings, - }, - }) - if err != nil { - return nil, err - } - - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } - - return UnmarshalAuthenticationCodeInfo(result.Data) -} - -// Resends the code to verify a phone number to be added to a user's Telegram Passport -func (client *Client) ResendPhoneNumberVerificationCode() (*AuthenticationCodeInfo, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "resendPhoneNumberVerificationCode", - }, - Data: map[string]interface{}{}, - }) - if err != nil { - return nil, err - } - - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } - - return UnmarshalAuthenticationCodeInfo(result.Data) -} - -type CheckPhoneNumberVerificationCodeRequest struct { - // Verification code to check - Code string `json:"code"` -} - -// Checks the phone number verification code for Telegram Passport -func (client *Client) CheckPhoneNumberVerificationCode(req *CheckPhoneNumberVerificationCodeRequest) (*Ok, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "checkPhoneNumberVerificationCode", - }, - Data: map[string]interface{}{ - "code": req.Code, - }, - }) - if err != nil { - return nil, err - } - - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } - - return UnmarshalOk(result.Data) -} - type SendEmailAddressVerificationCodeRequest struct { // Email address EmailAddress string `json:"email_address"` @@ -18828,83 +19236,6 @@ func (client *Client) SendPassportAuthorizationForm(req *SendPassportAuthorizati return UnmarshalOk(result.Data) } -type SendPhoneNumberConfirmationCodeRequest struct { - // Hash value from the link - Hash string `json:"hash"` - // Phone number value from the link - PhoneNumber string `json:"phone_number"` - // Settings for the authentication of the user's phone number; pass null to use default settings - Settings *PhoneNumberAuthenticationSettings `json:"settings"` -} - -// Sends phone number confirmation code to handle links of the type internalLinkTypePhoneNumberConfirmation -func (client *Client) SendPhoneNumberConfirmationCode(req *SendPhoneNumberConfirmationCodeRequest) (*AuthenticationCodeInfo, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "sendPhoneNumberConfirmationCode", - }, - Data: map[string]interface{}{ - "hash": req.Hash, - "phone_number": req.PhoneNumber, - "settings": req.Settings, - }, - }) - if err != nil { - return nil, err - } - - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } - - return UnmarshalAuthenticationCodeInfo(result.Data) -} - -// Resends phone number confirmation code -func (client *Client) ResendPhoneNumberConfirmationCode() (*AuthenticationCodeInfo, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "resendPhoneNumberConfirmationCode", - }, - Data: map[string]interface{}{}, - }) - if err != nil { - return nil, err - } - - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } - - return UnmarshalAuthenticationCodeInfo(result.Data) -} - -type CheckPhoneNumberConfirmationCodeRequest struct { - // Confirmation code to check - Code string `json:"code"` -} - -// Checks phone number confirmation code -func (client *Client) CheckPhoneNumberConfirmationCode(req *CheckPhoneNumberConfirmationCodeRequest) (*Ok, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "checkPhoneNumberConfirmationCode", - }, - Data: map[string]interface{}{ - "code": req.Code, - }, - }) - if err != nil { - return nil, err - } - - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } - - return UnmarshalOk(result.Data) -} - type SetBotUpdatesStatusRequest struct { // The number of pending updates PendingUpdateCount int32 `json:"pending_update_count"` @@ -21162,6 +21493,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateChatActionBar: return UnmarshalUpdateChatActionBar(result.Data) + case TypeUpdateChatBusinessBotManageBar: + return UnmarshalUpdateChatBusinessBotManageBar(result.Data) + case TypeUpdateChatAvailableReactions: return UnmarshalUpdateChatAvailableReactions(result.Data) @@ -21441,12 +21775,12 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateSuggestedActions: return UnmarshalUpdateSuggestedActions(result.Data) + case TypeUpdateSpeedLimitNotification: + return UnmarshalUpdateSpeedLimitNotification(result.Data) + case TypeUpdateContactCloseBirthdays: return UnmarshalUpdateContactCloseBirthdays(result.Data) - case TypeUpdateAddChatMembersPrivacyForbidden: - return UnmarshalUpdateAddChatMembersPrivacyForbidden(result.Data) - case TypeUpdateAutosaveSettings: return UnmarshalUpdateAutosaveSettings(result.Data) diff --git a/client/type.go b/client/type.go index 1fe1ffd..3f7c343 100755 --- a/client/type.go +++ b/client/type.go @@ -143,8 +143,11 @@ const ( ClassStatisticalGraph = "StatisticalGraph" ClassChatStatisticsObjectType = "ChatStatisticsObjectType" ClassChatStatistics = "ChatStatistics" + ClassChatRevenueWithdrawalState = "ChatRevenueWithdrawalState" + ClassChatRevenueTransactionType = "ChatRevenueTransactionType" ClassVectorPathCommand = "VectorPathCommand" ClassBotCommandScope = "BotCommandScope" + ClassPhoneNumberCodeType = "PhoneNumberCodeType" ClassUpdate = "Update" ClassLogStream = "LogStream" ClassError = "Error" @@ -198,11 +201,15 @@ const ( ClassBusinessAwayMessageSettings = "BusinessAwayMessageSettings" ClassBusinessGreetingMessageSettings = "BusinessGreetingMessageSettings" ClassBusinessConnectedBot = "BusinessConnectedBot" - ClassBusinessIntro = "BusinessIntro" - ClassInputBusinessIntro = "InputBusinessIntro" + ClassBusinessStartPage = "BusinessStartPage" + ClassInputBusinessStartPage = "InputBusinessStartPage" ClassBusinessOpeningHoursInterval = "BusinessOpeningHoursInterval" ClassBusinessOpeningHours = "BusinessOpeningHours" ClassBusinessInfo = "BusinessInfo" + ClassBusinessChatLink = "BusinessChatLink" + ClassBusinessChatLinks = "BusinessChatLinks" + ClassInputBusinessChatLink = "InputBusinessChatLink" + ClassBusinessChatLinkInfo = "BusinessChatLinkInfo" ClassChatPhotoSticker = "ChatPhotoSticker" ClassAnimatedChatPhoto = "AnimatedChatPhoto" ClassChatPhoto = "ChatPhoto" @@ -291,9 +298,13 @@ const ( ClassChatPosition = "ChatPosition" ClassSavedMessagesTag = "SavedMessagesTag" ClassSavedMessagesTags = "SavedMessagesTags" + ClassBusinessBotManageBar = "BusinessBotManageBar" ClassVideoChat = "VideoChat" ClassChat = "Chat" ClassChats = "Chats" + ClassFailedToAddMember = "FailedToAddMember" + ClassFailedToAddMembers = "FailedToAddMembers" + ClassCreatedBasicGroupChat = "CreatedBasicGroupChat" ClassChatNearby = "ChatNearby" ClassChatsNearby = "ChatsNearby" ClassKeyboardButton = "KeyboardButton" @@ -378,6 +389,7 @@ const ( ClassStoryInteraction = "StoryInteraction" ClassStoryInteractions = "StoryInteractions" ClassQuickReplyMessage = "QuickReplyMessage" + ClassQuickReplyMessages = "QuickReplyMessages" ClassQuickReplyShortcut = "QuickReplyShortcut" ClassPublicForwards = "PublicForwards" ClassChatBoostLevelFeatures = "ChatBoostLevelFeatures" @@ -489,8 +501,11 @@ const ( ClassChatStatisticsMessageSenderInfo = "ChatStatisticsMessageSenderInfo" ClassChatStatisticsAdministratorActionsInfo = "ChatStatisticsAdministratorActionsInfo" ClassChatStatisticsInviterInfo = "ChatStatisticsInviterInfo" + ClassChatRevenueStatistics = "ChatRevenueStatistics" ClassMessageStatistics = "MessageStatistics" ClassStoryStatistics = "StoryStatistics" + ClassChatRevenueTransaction = "ChatRevenueTransaction" + ClassChatRevenueTransactions = "ChatRevenueTransactions" ClassPoint = "Point" ClassUpdates = "Updates" ClassLogVerbosityLevel = "LogVerbosityLevel" @@ -615,11 +630,15 @@ const ( TypeBusinessAwayMessageSettings = "businessAwayMessageSettings" TypeBusinessGreetingMessageSettings = "businessGreetingMessageSettings" TypeBusinessConnectedBot = "businessConnectedBot" - TypeBusinessIntro = "businessIntro" - TypeInputBusinessIntro = "inputBusinessIntro" + TypeBusinessStartPage = "businessStartPage" + TypeInputBusinessStartPage = "inputBusinessStartPage" TypeBusinessOpeningHoursInterval = "businessOpeningHoursInterval" TypeBusinessOpeningHours = "businessOpeningHours" TypeBusinessInfo = "businessInfo" + TypeBusinessChatLink = "businessChatLink" + TypeBusinessChatLinks = "businessChatLinks" + TypeInputBusinessChatLink = "inputBusinessChatLink" + TypeBusinessChatLinkInfo = "businessChatLinkInfo" TypeChatPhotoStickerTypeRegularOrMask = "chatPhotoStickerTypeRegularOrMask" TypeChatPhotoStickerTypeCustomEmoji = "chatPhotoStickerTypeCustomEmoji" TypeChatPhotoSticker = "chatPhotoSticker" @@ -801,9 +820,13 @@ const ( TypeChatAvailableReactionsSome = "chatAvailableReactionsSome" TypeSavedMessagesTag = "savedMessagesTag" TypeSavedMessagesTags = "savedMessagesTags" + TypeBusinessBotManageBar = "businessBotManageBar" TypeVideoChat = "videoChat" TypeChat = "chat" TypeChats = "chats" + TypeFailedToAddMember = "failedToAddMember" + TypeFailedToAddMembers = "failedToAddMembers" + TypeCreatedBasicGroupChat = "createdBasicGroupChat" TypeChatNearby = "chatNearby" TypeChatsNearby = "chatsNearby" TypePublicChatTypeHasUsername = "publicChatTypeHasUsername" @@ -1221,6 +1244,7 @@ const ( TypeStoryInteraction = "storyInteraction" TypeStoryInteractions = "storyInteractions" TypeQuickReplyMessage = "quickReplyMessage" + TypeQuickReplyMessages = "quickReplyMessages" TypeQuickReplyShortcut = "quickReplyShortcut" TypePublicForwardMessage = "publicForwardMessage" TypePublicForwardStory = "publicForwardStory" @@ -1443,7 +1467,7 @@ const ( TypeBusinessFeatureGreetingMessage = "businessFeatureGreetingMessage" TypeBusinessFeatureAwayMessage = "businessFeatureAwayMessage" TypeBusinessFeatureAccountLinks = "businessFeatureAccountLinks" - TypeBusinessFeatureIntro = "businessFeatureIntro" + TypeBusinessFeatureStartPage = "businessFeatureStartPage" TypeBusinessFeatureBots = "businessFeatureBots" TypeBusinessFeatureEmojiStatus = "businessFeatureEmojiStatus" TypeBusinessFeatureChatFolderTags = "businessFeatureChatFolderTags" @@ -1657,6 +1681,7 @@ const ( TypeInternalLinkTypeBotAddToChannel = "internalLinkTypeBotAddToChannel" TypeInternalLinkTypeBotStart = "internalLinkTypeBotStart" TypeInternalLinkTypeBotStartInGroup = "internalLinkTypeBotStartInGroup" + TypeInternalLinkTypeBusinessChat = "internalLinkTypeBusinessChat" TypeInternalLinkTypeChangePhoneNumber = "internalLinkTypeChangePhoneNumber" TypeInternalLinkTypeChatBoost = "internalLinkTypeChatBoost" TypeInternalLinkTypeChatFolderInvite = "internalLinkTypeChatFolderInvite" @@ -1798,8 +1823,17 @@ const ( TypeChatStatisticsInviterInfo = "chatStatisticsInviterInfo" TypeChatStatisticsSupergroup = "chatStatisticsSupergroup" TypeChatStatisticsChannel = "chatStatisticsChannel" + TypeChatRevenueStatistics = "chatRevenueStatistics" TypeMessageStatistics = "messageStatistics" TypeStoryStatistics = "storyStatistics" + TypeChatRevenueWithdrawalStatePending = "chatRevenueWithdrawalStatePending" + TypeChatRevenueWithdrawalStateCompleted = "chatRevenueWithdrawalStateCompleted" + TypeChatRevenueWithdrawalStateFailed = "chatRevenueWithdrawalStateFailed" + TypeChatRevenueTransactionTypeEarnings = "chatRevenueTransactionTypeEarnings" + TypeChatRevenueTransactionTypeWithdrawal = "chatRevenueTransactionTypeWithdrawal" + TypeChatRevenueTransactionTypeRefund = "chatRevenueTransactionTypeRefund" + TypeChatRevenueTransaction = "chatRevenueTransaction" + TypeChatRevenueTransactions = "chatRevenueTransactions" TypePoint = "point" TypeVectorPathCommandLine = "vectorPathCommandLine" TypeVectorPathCommandCubicBezierCurve = "vectorPathCommandCubicBezierCurve" @@ -1810,6 +1844,9 @@ const ( TypeBotCommandScopeChat = "botCommandScopeChat" TypeBotCommandScopeChatAdministrators = "botCommandScopeChatAdministrators" TypeBotCommandScopeChatMember = "botCommandScopeChatMember" + TypePhoneNumberCodeTypeChange = "phoneNumberCodeTypeChange" + TypePhoneNumberCodeTypeVerify = "phoneNumberCodeTypeVerify" + TypePhoneNumberCodeTypeConfirmOwnership = "phoneNumberCodeTypeConfirmOwnership" TypeUpdateAuthorizationState = "updateAuthorizationState" TypeUpdateNewMessage = "updateNewMessage" TypeUpdateMessageSendAcknowledged = "updateMessageSendAcknowledged" @@ -1835,6 +1872,7 @@ const ( TypeUpdateChatReadInbox = "updateChatReadInbox" TypeUpdateChatReadOutbox = "updateChatReadOutbox" TypeUpdateChatActionBar = "updateChatActionBar" + TypeUpdateChatBusinessBotManageBar = "updateChatBusinessBotManageBar" TypeUpdateChatAvailableReactions = "updateChatAvailableReactions" TypeUpdateChatDraftMessage = "updateChatDraftMessage" TypeUpdateChatEmojiStatus = "updateChatEmojiStatus" @@ -1928,8 +1966,8 @@ const ( TypeUpdateAnimatedEmojiMessageClicked = "updateAnimatedEmojiMessageClicked" TypeUpdateAnimationSearchParameters = "updateAnimationSearchParameters" TypeUpdateSuggestedActions = "updateSuggestedActions" + TypeUpdateSpeedLimitNotification = "updateSpeedLimitNotification" TypeUpdateContactCloseBirthdays = "updateContactCloseBirthdays" - TypeUpdateAddChatMembersPrivacyForbidden = "updateAddChatMembersPrivacyForbidden" TypeUpdateAutosaveSettings = "updateAutosaveSettings" TypeUpdateBusinessConnection = "updateBusinessConnection" TypeUpdateNewBusinessMessage = "updateNewBusinessMessage" @@ -2006,7 +2044,7 @@ type StickerFormat interface { StickerFormatType() string } -// Describes type of a sticker +// Describes type of sticker type StickerType interface { StickerTypeType() string } @@ -2016,12 +2054,12 @@ type StickerFullType interface { StickerFullTypeType() string } -// Describes the type of a poll +// Describes the type of poll type PollType interface { PollTypeType() string } -// Represents the type of a user. The following types are possible: regular users, deleted users and bots +// Represents the type of user. The following types are possible: regular users, deleted users and bots type UserType interface { UserTypeType() string } @@ -2031,7 +2069,7 @@ type BusinessAwayMessageSchedule interface { BusinessAwayMessageScheduleType() string } -// Describes type of a sticker, which was used to create a chat photo +// Describes type of sticker, which was used to create a chat photo type ChatPhotoStickerType interface { ChatPhotoStickerTypeType() string } @@ -2066,7 +2104,7 @@ type SupergroupMembersFilter interface { SupergroupMembersFilterType() string } -// Describes the type of a chat to which points an invite link +// Describes the type of chat to which points an invite link type InviteLinkChatType interface { InviteLinkChatTypeType() string } @@ -2116,7 +2154,7 @@ type MessageSource interface { MessageSourceType() string } -// Describes type of a message sponsor +// Describes type of message sponsor type MessageSponsorType interface { MessageSponsorTypeType() string } @@ -2131,7 +2169,7 @@ type NotificationSettingsScope interface { NotificationSettingsScopeType() string } -// Describes the type of a chat +// Describes the type of chat type ChatType interface { ChatTypeType() string } @@ -2166,7 +2204,7 @@ type KeyboardButtonType interface { KeyboardButtonTypeType() string } -// Describes the type of an inline keyboard button +// Describes the type of inline keyboard button type InlineKeyboardButtonType interface { InlineKeyboardButtonTypeType() string } @@ -2181,7 +2219,7 @@ type LoginUrlInfo interface { LoginUrlInfoType() string } -// Describes type of a Saved Messages topic +// Describes type of Saved Messages topic type SavedMessagesTopicType interface { SavedMessagesTopicTypeType() string } @@ -2231,7 +2269,7 @@ type MessageExtendedMedia interface { MessageExtendedMediaType() string } -// Contains the type of a Telegram Passport element +// Contains the type of Telegram Passport element type PassportElementType interface { PassportElementTypeType() string } @@ -2296,17 +2334,17 @@ type UserStatus interface { UserStatusType() string } -// Describes type of an emoji category +// Describes type of emoji category type EmojiCategoryType interface { EmojiCategoryTypeType() string } -// Describes type of a clickable rectangle area on a story media +// Describes type of clickable rectangle area on a story media type StoryAreaType interface { StoryAreaTypeType() string } -// Describes type of a clickable rectangle area on a story media to be added +// Describes type of clickable rectangle area on a story media to be added type InputStoryAreaType interface { InputStoryAreaTypeType() string } @@ -2351,7 +2389,7 @@ type CallDiscardReason interface { CallDiscardReasonType() string } -// Describes the type of a call server +// Describes the type of call server type CallServerType interface { CallServerTypeType() string } @@ -2366,7 +2404,7 @@ type GroupCallVideoQuality interface { GroupCallVideoQualityType() string } -// Describes the exact type of a problem with a call +// Describes the exact type of problem with a call type CallProblem interface { CallProblemType() string } @@ -2406,7 +2444,7 @@ type InlineQueryResult interface { InlineQueryResultType() string } -// Represents a type of a button in results of inline query +// Represents a type of button in results of inline query type InlineQueryResultsButtonType interface { InlineQueryResultsButtonTypeType() string } @@ -2426,7 +2464,7 @@ type LanguagePackStringValue interface { LanguagePackStringValueType() string } -// Describes type of a limit, increased for Premium users +// Describes type of limit, increased for Premium users type PremiumLimitType interface { PremiumLimitTypeType() string } @@ -2471,7 +2509,7 @@ type BackgroundFill interface { BackgroundFillType() string } -// Describes the type of a background +// Describes the type of background type BackgroundType interface { BackgroundTypeType() string } @@ -2556,7 +2594,7 @@ type CanSendMessageToUserResult interface { CanSendMessageToUserResultType() string } -// Represents the type of a session +// Represents the type of session type SessionType interface { SessionTypeType() string } @@ -2576,17 +2614,17 @@ type InternalLinkType interface { InternalLinkTypeType() string } -// Describes a type of a block list +// Describes a type of block list type BlockList interface { BlockListType() string } -// Represents the type of a file +// Represents the type of file type FileType interface { FileTypeType() string } -// Represents the type of a network +// Represents the type of network type NetworkType interface { NetworkTypeType() string } @@ -2611,7 +2649,7 @@ type TopChatCategory interface { TopChatCategoryType() string } -// Describes the type of a URL linking to an internal Telegram entity +// Describes the type of URL linking to an internal Telegram entity type TMeUrlType interface { TMeUrlTypeType() string } @@ -2626,7 +2664,7 @@ type TextParseMode interface { TextParseModeType() string } -// Describes the type of a proxy server +// Describes the type of proxy server type ProxyType interface { ProxyTypeType() string } @@ -2636,7 +2674,7 @@ type StatisticalGraph interface { StatisticalGraphType() string } -// Describes type of an object, for which statistics are provided +// Describes type of object, for which statistics are provided type ChatStatisticsObjectType interface { ChatStatisticsObjectTypeType() string } @@ -2646,6 +2684,16 @@ type ChatStatistics interface { ChatStatisticsType() string } +// Describes state of a chat revenue withdrawal +type ChatRevenueWithdrawalState interface { + ChatRevenueWithdrawalStateType() string +} + +// Describes type of transaction for revenue earned from sponsored messages in a chat +type ChatRevenueTransactionType interface { + ChatRevenueTransactionTypeType() string +} + // Represents a vector path command type VectorPathCommand interface { VectorPathCommandType() string @@ -2656,6 +2704,11 @@ type BotCommandScope interface { BotCommandScopeType() string } +// Describes type of the request for which a code is sent to a phone number +type PhoneNumberCodeType interface { + PhoneNumberCodeTypeType() string +} + // Contains notifications about data changes type Update interface { UpdateType() string @@ -6042,61 +6095,61 @@ func (*BusinessConnectedBot) GetType() string { return TypeBusinessConnectedBot } -// Describes settings for a business account intro -type BusinessIntro struct { +// Describes settings for a business account start page +type BusinessStartPage struct { meta - // Title text of the intro + // Title text of the start page Title string `json:"title"` - // Message text of the intro + // Message text of the start page Message string `json:"message"` - // Greeting sticker of the intro; may be null if none + // Greeting sticker of the start page; may be null if none Sticker *Sticker `json:"sticker"` } -func (entity *BusinessIntro) MarshalJSON() ([]byte, error) { +func (entity *BusinessStartPage) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub BusinessIntro + type stub BusinessStartPage return json.Marshal((*stub)(entity)) } -func (*BusinessIntro) GetClass() string { - return ClassBusinessIntro +func (*BusinessStartPage) GetClass() string { + return ClassBusinessStartPage } -func (*BusinessIntro) GetType() string { - return TypeBusinessIntro +func (*BusinessStartPage) GetType() string { + return TypeBusinessStartPage } -// Describes settings for a business account intro to set -type InputBusinessIntro struct { +// Describes settings for a business account start page to set +type InputBusinessStartPage struct { meta - // Title text of the intro; 0-getOption("business_intro_title_length_max") characters + // Title text of the start page; 0-getOption("business_start_page_title_length_max") characters Title string `json:"title"` - // Message text of the intro; 0-getOption("business_intro_message_length_max") characters + // Message text of the start page; 0-getOption("business_start_page_message_length_max") characters Message string `json:"message"` - // Greeting sticker of the intro; pass null if none. The sticker must belong to a sticker set and must not be a custom emoji + // Greeting sticker of the start page; pass null if none. The sticker must belong to a sticker set and must not be a custom emoji Sticker InputFile `json:"sticker"` } -func (entity *InputBusinessIntro) MarshalJSON() ([]byte, error) { +func (entity *InputBusinessStartPage) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub InputBusinessIntro + type stub InputBusinessStartPage return json.Marshal((*stub)(entity)) } -func (*InputBusinessIntro) GetClass() string { - return ClassInputBusinessIntro +func (*InputBusinessStartPage) GetClass() string { + return ClassInputBusinessStartPage } -func (*InputBusinessIntro) GetType() string { - return TypeInputBusinessIntro +func (*InputBusinessStartPage) GetType() string { + return TypeInputBusinessStartPage } -func (inputBusinessIntro *InputBusinessIntro) UnmarshalJSON(data []byte) error { +func (inputBusinessStartPage *InputBusinessStartPage) UnmarshalJSON(data []byte) error { var tmp struct { Title string `json:"title"` Message string `json:"message"` @@ -6108,11 +6161,11 @@ func (inputBusinessIntro *InputBusinessIntro) UnmarshalJSON(data []byte) error { return err } - inputBusinessIntro.Title = tmp.Title - inputBusinessIntro.Message = tmp.Message + inputBusinessStartPage.Title = tmp.Title + inputBusinessStartPage.Message = tmp.Message fieldSticker, _ := UnmarshalInputFile(tmp.Sticker) - inputBusinessIntro.Sticker = fieldSticker + inputBusinessStartPage.Sticker = fieldSticker return nil } @@ -6178,8 +6231,8 @@ type BusinessInfo struct { GreetingMessageSettings *BusinessGreetingMessageSettings `json:"greeting_message_settings"` // The away message; may be null if none or the Business account is not of the current user AwayMessageSettings *BusinessAwayMessageSettings `json:"away_message_settings"` - // Information about intro of the business; may be null if none - Intro *BusinessIntro `json:"intro"` + // Information about start page of the account; may be null if none + StartPage *BusinessStartPage `json:"start_page"` } func (entity *BusinessInfo) MarshalJSON() ([]byte, error) { @@ -6198,6 +6251,108 @@ func (*BusinessInfo) GetType() string { return TypeBusinessInfo } +// Contains information about a business chat link +type BusinessChatLink struct { + meta + // The HTTPS link + Link string `json:"link"` + // Message draft text that will be added to the input field + Text *FormattedText `json:"text"` + // Link title + Title string `json:"title"` + // Number of times the link was used + ViewCount int32 `json:"view_count"` +} + +func (entity *BusinessChatLink) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessChatLink + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessChatLink) GetClass() string { + return ClassBusinessChatLink +} + +func (*BusinessChatLink) GetType() string { + return TypeBusinessChatLink +} + +// Contains a list of business chat links created by the user +type BusinessChatLinks struct { + meta + // List of links + Links []*BusinessChatLink `json:"links"` +} + +func (entity *BusinessChatLinks) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessChatLinks + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessChatLinks) GetClass() string { + return ClassBusinessChatLinks +} + +func (*BusinessChatLinks) GetType() string { + return TypeBusinessChatLinks +} + +// Describes a business chat link to create or edit +type InputBusinessChatLink struct { + meta + // Message draft text that will be added to the input field + Text *FormattedText `json:"text"` + // Link title + Title string `json:"title"` +} + +func (entity *InputBusinessChatLink) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputBusinessChatLink + + return json.Marshal((*stub)(entity)) +} + +func (*InputBusinessChatLink) GetClass() string { + return ClassInputBusinessChatLink +} + +func (*InputBusinessChatLink) GetType() string { + return TypeInputBusinessChatLink +} + +// Contains information about a business chat link +type BusinessChatLinkInfo struct { + meta + // Identifier of the private chat that created the link + ChatId int64 `json:"chat_id"` + // Message draft text that must be added to the input field + Text *FormattedText `json:"text"` +} + +func (entity *BusinessChatLinkInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessChatLinkInfo + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessChatLinkInfo) GetClass() string { + return ClassBusinessChatLinkInfo +} + +func (*BusinessChatLinkInfo) GetType() string { + return TypeBusinessChatLinkInfo +} + // Information about the sticker, which was used to create the chat photo type ChatPhotoStickerTypeRegularOrMask struct { meta @@ -8971,10 +9126,14 @@ type SupergroupFullInfo struct { CanSetLocation bool `json:"can_set_location"` // True, if the supergroup or channel statistics are available CanGetStatistics bool `json:"can_get_statistics"` + // True, if the supergroup or channel revenue statistics are available + CanGetRevenueStatistics bool `json:"can_get_revenue_statistics"` // True, if aggressive anti-spam checks can be enabled or disabled in the supergroup CanToggleAggressiveAntiSpam bool `json:"can_toggle_aggressive_anti_spam"` // 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, so this option affects only private non-forum supergroups without a linked chat. The value of this field is only available to chat administrators IsAllHistoryAvailable bool `json:"is_all_history_available"` + // True, if the chat can have sponsored messages. The value of this field is only available to the owner of the chat + CanHaveSponsoredMessages bool `json:"can_have_sponsored_messages"` // True, if aggressive anti-spam checks are enabled in the supergroup. The value of this field is only available to chat administrators HasAggressiveAntiSpamEnabled bool `json:"has_aggressive_anti_spam_enabled"` // True, if the supergroup or channel has pinned stories @@ -9727,7 +9886,7 @@ type MessageForwardInfo struct { Date int32 `json:"date"` // For messages forwarded to the chat with the current user (Saved Messages), to the Replies bot chat, or to the channel's discussion group, information about the source message from which the message was forwarded last time; may be null for other forwards or if unknown Source *ForwardSource `json:"source"` - // The type of a public service announcement for the forwarded message + // The type of public service announcement for the forwarded message PublicServiceAnnouncementType string `json:"public_service_announcement_type"` } @@ -10371,7 +10530,7 @@ type Message struct { SenderBoostCount int32 `json:"sender_boost_count"` // For channel posts and anonymous group messages, optional author signature AuthorSignature string `json:"author_signature"` - // Unique identifier of an album this message belongs to. Only audios, documents, photos and videos can be grouped together in albums + // Unique identifier of an album this message belongs to; 0 if none. Only audios, documents, photos and videos can be grouped together in albums MediaAlbumId JsonInt64 `json:"media_album_id"` // If non-empty, contains a human-readable description of the reason why access to this message must be restricted RestrictionReason string `json:"restriction_reason"` @@ -11930,7 +12089,7 @@ type ChatFolder struct { Title string `json:"title"` // The chosen icon for the chat folder; may be null. If null, use getChatFolderDefaultIconName to get default icon name for the folder Icon *ChatFolderIcon `json:"icon"` - // The identifier of the chosen color for the chat folder icon; from -1 to 6. If -1, then color is didabled. Can't be changed if folder tags are disabled or the current user doesn't have Telegram Premium subscription + // The identifier of the chosen color for the chat folder icon; from -1 to 6. If -1, then color is disabled. Can't be changed if folder tags are disabled or the current user doesn't have Telegram Premium subscription ColorId int32 `json:"color_id"` // True, if at least one link has been created for the folder IsShareable bool `json:"is_shareable"` @@ -11983,7 +12142,7 @@ type ChatFolderInfo struct { Title string `json:"title"` // The chosen or default icon for the chat folder Icon *ChatFolderIcon `json:"icon"` - // The identifier of the chosen color for the chat folder icon; from -1 to 6. If -1, then color is didabled + // The identifier of the chosen color for the chat folder icon; from -1 to 6. If -1, then color is disabled ColorId int32 `json:"color_id"` // True, if at least one link has been created for the folder IsShareable bool `json:"is_shareable"` @@ -12522,6 +12681,35 @@ func (*SavedMessagesTags) GetType() string { return TypeSavedMessagesTags } +// Contains information about a business bot that manages the chat +type BusinessBotManageBar struct { + meta + // User identifier of the bot + BotUserId int64 `json:"bot_user_id"` + // URL to be opened to manage the bot + ManageUrl string `json:"manage_url"` + // True, if the bot is paused. Use toggleBusinessConnectedBotChatIsPaused to change the value of the field + IsBotPaused bool `json:"is_bot_paused"` + // True, if the bot can reply + CanBotReply bool `json:"can_bot_reply"` +} + +func (entity *BusinessBotManageBar) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessBotManageBar + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessBotManageBar) GetClass() string { + return ClassBusinessBotManageBar +} + +func (*BusinessBotManageBar) GetType() string { + return TypeBusinessBotManageBar +} + // Describes a video chat type VideoChat struct { meta @@ -12643,6 +12831,8 @@ type Chat struct { ThemeName string `json:"theme_name"` // Information about actions which must be possible to do through the chat action bar; may be null if none ActionBar ChatActionBar `json:"action_bar"` + // Information about bar for managing a business bot in the chat; may be null if none + BusinessBotManageBar *BusinessBotManageBar `json:"business_bot_manage_bar"` // Information about video chat of the chat VideoChat *VideoChat `json:"video_chat"` // Information about pending join requests; may be null if none @@ -12708,6 +12898,7 @@ func (chat *Chat) UnmarshalJSON(data []byte) error { Background *ChatBackground `json:"background"` ThemeName string `json:"theme_name"` ActionBar json.RawMessage `json:"action_bar"` + BusinessBotManageBar *BusinessBotManageBar `json:"business_bot_manage_bar"` VideoChat *VideoChat `json:"video_chat"` PendingJoinRequests *ChatJoinRequestsInfo `json:"pending_join_requests"` ReplyMarkupMessageId int64 `json:"reply_markup_message_id"` @@ -12749,6 +12940,7 @@ func (chat *Chat) UnmarshalJSON(data []byte) error { chat.EmojiStatus = tmp.EmojiStatus chat.Background = tmp.Background chat.ThemeName = tmp.ThemeName + chat.BusinessBotManageBar = tmp.BusinessBotManageBar chat.VideoChat = tmp.VideoChat chat.PendingJoinRequests = tmp.PendingJoinRequests chat.ReplyMarkupMessageId = tmp.ReplyMarkupMessageId @@ -12801,6 +12993,81 @@ func (*Chats) GetType() string { return TypeChats } +// Contains information about a user that has failed to be added to a chat +type FailedToAddMember struct { + meta + // User identifier + UserId int64 `json:"user_id"` + // True, if subscription to Telegram Premium would have allowed to add the user to the chat + PremiumWouldAllowInvite bool `json:"premium_would_allow_invite"` + // True, if subscription to Telegram Premium is required to send the user chat invite link + PremiumRequiredToSendMessages bool `json:"premium_required_to_send_messages"` +} + +func (entity *FailedToAddMember) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FailedToAddMember + + return json.Marshal((*stub)(entity)) +} + +func (*FailedToAddMember) GetClass() string { + return ClassFailedToAddMember +} + +func (*FailedToAddMember) GetType() string { + return TypeFailedToAddMember +} + +// Represents a list of users that has failed to be added to a chat +type FailedToAddMembers struct { + meta + // Information about users that weren't added to the chat + FailedToAddMembers []*FailedToAddMember `json:"failed_to_add_members"` +} + +func (entity *FailedToAddMembers) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FailedToAddMembers + + return json.Marshal((*stub)(entity)) +} + +func (*FailedToAddMembers) GetClass() string { + return ClassFailedToAddMembers +} + +func (*FailedToAddMembers) GetType() string { + return TypeFailedToAddMembers +} + +// Contains information about a newly created basic group chat +type CreatedBasicGroupChat struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // Information about failed to add members + FailedToAddMembers *FailedToAddMembers `json:"failed_to_add_members"` +} + +func (entity *CreatedBasicGroupChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CreatedBasicGroupChat + + return json.Marshal((*stub)(entity)) +} + +func (*CreatedBasicGroupChat) GetClass() string { + return ClassCreatedBasicGroupChat +} + +func (*CreatedBasicGroupChat) GetType() string { + return TypeCreatedBasicGroupChat +} + // Describes a chat located nearby type ChatNearby struct { meta @@ -20845,7 +21112,7 @@ func (*MessageVideoChatEnded) MessageContentType() string { return TypeMessageVideoChatEnded } -// A message with information about an invite to a video chat +// A message with information about an invitation to a video chat type MessageInviteVideoChatParticipants struct { meta // Identifier of the video chat. The video chat can be received through the method getGroupCall @@ -26657,11 +26924,11 @@ type QuickReplyMessage struct { SendingState MessageSendingState `json:"sending_state"` // True, if the message can be edited CanBeEdited bool `json:"can_be_edited"` - // Information about the identifier of the quick reply message to which the message replies + // The identifier of the quick reply message to which the message replies; 0 if none ReplyToMessageId int64 `json:"reply_to_message_id"` // If non-zero, the user identifier of the bot through which this message was sent ViaBotUserId int64 `json:"via_bot_user_id"` - // Unique identifier of an album this message belongs to. Only audios, documents, photos and videos can be grouped together in albums + // Unique identifier of an album this message belongs to; 0 if none. Only audios, documents, photos and videos can be grouped together in albums MediaAlbumId JsonInt64 `json:"media_album_id"` // Content of the message Content MessageContent `json:"content"` @@ -26720,6 +26987,29 @@ func (quickReplyMessage *QuickReplyMessage) UnmarshalJSON(data []byte) error { return nil } +// Contains a list of quick reply messages +type QuickReplyMessages struct { + meta + // List of quick reply messages; messages may be null + Messages []*QuickReplyMessage `json:"messages"` +} + +func (entity *QuickReplyMessages) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub QuickReplyMessages + + return json.Marshal((*stub)(entity)) +} + +func (*QuickReplyMessages) GetClass() string { + return ClassQuickReplyMessages +} + +func (*QuickReplyMessages) GetType() string { + return TypeQuickReplyMessages +} + // Describes a shortcut that can be used for a quick reply type QuickReplyShortcut struct { meta @@ -26880,6 +27170,8 @@ type ChatBoostLevelFeatures struct { CanSetCustomEmojiStickerSet bool `json:"can_set_custom_emoji_sticker_set"` // True, if speech recognition can be used for video note and voice note messages by all users CanRecognizeSpeech bool `json:"can_recognize_speech"` + // True, if sponsored messages can be disabled in the chat + CanDisableSponsoredMessages bool `json:"can_disable_sponsored_messages"` } func (entity *ChatBoostLevelFeatures) MarshalJSON() ([]byte, error) { @@ -26917,6 +27209,8 @@ type ChatBoostFeatures struct { MinCustomEmojiStickerSetBoostLevel int32 `json:"min_custom_emoji_sticker_set_boost_level"` // The minimum boost level allowing to recognize speech in video note and voice note messages for non-Premium users; for supergroup chats only MinSpeechRecognitionBoostLevel int32 `json:"min_speech_recognition_boost_level"` + // The minimum boost level allowing to disable sponsored messages in the chat; for channel chats only + MinSponsoredMessageDisableBoostLevel int32 `json:"min_sponsored_message_disable_boost_level"` } func (entity *ChatBoostFeatures) MarshalJSON() ([]byte, error) { @@ -27620,6 +27914,8 @@ type CallStateReady struct { Emojis []string `json:"emojis"` // True, if peer-to-peer connection is allowed by users privacy settings AllowP2p bool `json:"allow_p2p"` + // Custom JSON-encoded call parameters to be passed to tgcalls + CustomParameters string `json:"custom_parameters"` } func (entity *CallStateReady) MarshalJSON() ([]byte, error) { @@ -33995,29 +34291,29 @@ func (*BusinessFeatureAccountLinks) BusinessFeatureType() string { return TypeBusinessFeatureAccountLinks } -// The ability to customize intro -type BusinessFeatureIntro struct{ +// The ability to customize start page +type BusinessFeatureStartPage struct{ meta } -func (entity *BusinessFeatureIntro) MarshalJSON() ([]byte, error) { +func (entity *BusinessFeatureStartPage) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub BusinessFeatureIntro + type stub BusinessFeatureStartPage return json.Marshal((*stub)(entity)) } -func (*BusinessFeatureIntro) GetClass() string { +func (*BusinessFeatureStartPage) GetClass() string { return ClassBusinessFeature } -func (*BusinessFeatureIntro) GetType() string { - return TypeBusinessFeatureIntro +func (*BusinessFeatureStartPage) GetType() string { + return TypeBusinessFeatureStartPage } -func (*BusinessFeatureIntro) BusinessFeatureType() string { - return TypeBusinessFeatureIntro +func (*BusinessFeatureStartPage) BusinessFeatureType() string { + return TypeBusinessFeatureStartPage } // The ability to connect a bot to the account @@ -40207,6 +40503,33 @@ func (*InternalLinkTypeBotStartInGroup) InternalLinkTypeType() string { return TypeInternalLinkTypeBotStartInGroup } +// The link is a link to a business chat. Use getBusinessChatLinkInfo with the provided link name to get information about the link, then open received private chat and replace chat draft with the provided text +type InternalLinkTypeBusinessChat struct { + meta + // Name of the link + LinkName string `json:"link_name"` +} + +func (entity *InternalLinkTypeBusinessChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeBusinessChat + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeBusinessChat) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeBusinessChat) GetType() string { + return TypeInternalLinkTypeBusinessChat +} + +func (*InternalLinkTypeBusinessChat) InternalLinkTypeType() string { + return TypeInternalLinkTypeBusinessChat +} + // The link is a link to the change phone number section of the app type InternalLinkTypeChangePhoneNumber struct{ meta @@ -40616,7 +40939,7 @@ func (*InternalLinkTypePassportDataRequest) InternalLinkTypeType() string { return TypeInternalLinkTypePassportDataRequest } -// The link can be used to confirm ownership of a phone number to prevent account deletion. Call sendPhoneNumberConfirmationCode with the given hash and phone number to process the link. If succeeded, call checkPhoneNumberConfirmationCode to check entered by the user code, or resendPhoneNumberConfirmationCode to resend it +// The link can be used to confirm ownership of a phone number to prevent account deletion. Call sendPhoneNumberCode with the given phone number and with phoneNumberCodeTypeConfirmOwnership with the given hash to process the link. If succeeded, call checkPhoneNumberCode to check entered by the user code, or resendPhoneNumberCode to resend it type InternalLinkTypePhoneNumberConfirmation struct { meta // Hash value from the link @@ -40803,11 +41126,13 @@ func (internalLinkTypeProxy *InternalLinkTypeProxy) UnmarshalJSON(data []byte) e return nil } -// The link is a link to a chat by its username. Call searchPublicChat with the given chat username to process the link If the chat is found, open its profile information screen or the chat itself +// The link is a link to a chat by its username. Call searchPublicChat with the given chat username to process the link If the chat is found, open its profile information screen or the chat itself. If draft text isn't empty and the chat is a private chat, then put the draft text in the input field type InternalLinkTypePublicChat struct { meta // Username of the chat ChatUsername string `json:"chat_username"` + // Draft text for message to send in the chat + DraftText string `json:"draft_text"` } func (entity *InternalLinkTypePublicChat) MarshalJSON() ([]byte, error) { @@ -41096,11 +41421,13 @@ func (*InternalLinkTypeUnsupportedProxy) InternalLinkTypeType() string { return TypeInternalLinkTypeUnsupportedProxy } -// The link is a link to a user by its phone number. Call searchUserByPhoneNumber with the given phone number to process the link. If the user is found, then call createPrivateChat and open the chat +// The link is a link to a user by its phone number. Call searchUserByPhoneNumber with the given phone number to process the link. If the user is found, then call createPrivateChat and open the chat. If draft text isn't empty, then put the draft text in the input field type InternalLinkTypeUserPhoneNumber struct { meta // Phone number of the user PhoneNumber string `json:"phone_number"` + // Draft text for message to send in the chat + DraftText string `json:"draft_text"` } func (entity *InternalLinkTypeUserPhoneNumber) MarshalJSON() ([]byte, error) { @@ -44347,6 +44674,72 @@ func (chatStatisticsChannel *ChatStatisticsChannel) UnmarshalJSON(data []byte) e return nil } +// A detailed statistics about revenue earned from sponsored messages in a chat +type ChatRevenueStatistics struct { + meta + // A graph containing amount of revenue in a given hour + RevenueByHourGraph StatisticalGraph `json:"revenue_by_hour_graph"` + // A graph containing amount of revenue + RevenueGraph StatisticalGraph `json:"revenue_graph"` + // Cryptocurrency in which revenue is calculated + Cryptocurrency string `json:"cryptocurrency"` + // Total amount of the cryptocurrency earned, in the smallest units of the cryptocurrency + CryptocurrencyTotalAmount JsonInt64 `json:"cryptocurrency_total_amount"` + // Amount of the cryptocurrency that isn't withdrawn yet, in the smallest units of the cryptocurrency + CryptocurrencyBalanceAmount JsonInt64 `json:"cryptocurrency_balance_amount"` + // Amount of the cryptocurrency available for withdrawal, in the smallest units of the cryptocurrency + CryptocurrencyAvailableAmount JsonInt64 `json:"cryptocurrency_available_amount"` + // Current conversion rate of the cryptocurrency to USD + UsdRate float64 `json:"usd_rate"` +} + +func (entity *ChatRevenueStatistics) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatRevenueStatistics + + return json.Marshal((*stub)(entity)) +} + +func (*ChatRevenueStatistics) GetClass() string { + return ClassChatRevenueStatistics +} + +func (*ChatRevenueStatistics) GetType() string { + return TypeChatRevenueStatistics +} + +func (chatRevenueStatistics *ChatRevenueStatistics) UnmarshalJSON(data []byte) error { + var tmp struct { + RevenueByHourGraph json.RawMessage `json:"revenue_by_hour_graph"` + RevenueGraph json.RawMessage `json:"revenue_graph"` + Cryptocurrency string `json:"cryptocurrency"` + CryptocurrencyTotalAmount JsonInt64 `json:"cryptocurrency_total_amount"` + CryptocurrencyBalanceAmount JsonInt64 `json:"cryptocurrency_balance_amount"` + CryptocurrencyAvailableAmount JsonInt64 `json:"cryptocurrency_available_amount"` + UsdRate float64 `json:"usd_rate"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + chatRevenueStatistics.Cryptocurrency = tmp.Cryptocurrency + chatRevenueStatistics.CryptocurrencyTotalAmount = tmp.CryptocurrencyTotalAmount + chatRevenueStatistics.CryptocurrencyBalanceAmount = tmp.CryptocurrencyBalanceAmount + chatRevenueStatistics.CryptocurrencyAvailableAmount = tmp.CryptocurrencyAvailableAmount + chatRevenueStatistics.UsdRate = tmp.UsdRate + + fieldRevenueByHourGraph, _ := UnmarshalStatisticalGraph(tmp.RevenueByHourGraph) + chatRevenueStatistics.RevenueByHourGraph = fieldRevenueByHourGraph + + fieldRevenueGraph, _ := UnmarshalStatisticalGraph(tmp.RevenueGraph) + chatRevenueStatistics.RevenueGraph = fieldRevenueGraph + + return nil +} + // A detailed statistics about a message type MessageStatistics struct { meta @@ -44437,6 +44830,268 @@ func (storyStatistics *StoryStatistics) UnmarshalJSON(data []byte) error { return nil } +// Withdrawal is pending +type ChatRevenueWithdrawalStatePending struct{ + meta +} + +func (entity *ChatRevenueWithdrawalStatePending) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatRevenueWithdrawalStatePending + + return json.Marshal((*stub)(entity)) +} + +func (*ChatRevenueWithdrawalStatePending) GetClass() string { + return ClassChatRevenueWithdrawalState +} + +func (*ChatRevenueWithdrawalStatePending) GetType() string { + return TypeChatRevenueWithdrawalStatePending +} + +func (*ChatRevenueWithdrawalStatePending) ChatRevenueWithdrawalStateType() string { + return TypeChatRevenueWithdrawalStatePending +} + +// Withdrawal was completed +type ChatRevenueWithdrawalStateCompleted struct { + meta + // Point in time (Unix timestamp) when the withdrawal was completed + Date int32 `json:"date"` + // The URL where the withdrawal transaction can be viewed + Url string `json:"url"` +} + +func (entity *ChatRevenueWithdrawalStateCompleted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatRevenueWithdrawalStateCompleted + + return json.Marshal((*stub)(entity)) +} + +func (*ChatRevenueWithdrawalStateCompleted) GetClass() string { + return ClassChatRevenueWithdrawalState +} + +func (*ChatRevenueWithdrawalStateCompleted) GetType() string { + return TypeChatRevenueWithdrawalStateCompleted +} + +func (*ChatRevenueWithdrawalStateCompleted) ChatRevenueWithdrawalStateType() string { + return TypeChatRevenueWithdrawalStateCompleted +} + +// Withdrawal has_failed +type ChatRevenueWithdrawalStateFailed struct{ + meta +} + +func (entity *ChatRevenueWithdrawalStateFailed) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatRevenueWithdrawalStateFailed + + return json.Marshal((*stub)(entity)) +} + +func (*ChatRevenueWithdrawalStateFailed) GetClass() string { + return ClassChatRevenueWithdrawalState +} + +func (*ChatRevenueWithdrawalStateFailed) GetType() string { + return TypeChatRevenueWithdrawalStateFailed +} + +func (*ChatRevenueWithdrawalStateFailed) ChatRevenueWithdrawalStateType() string { + return TypeChatRevenueWithdrawalStateFailed +} + +// Describes earnings from sponsored messages in a chat in some time frame +type ChatRevenueTransactionTypeEarnings struct { + meta + // Point in time (Unix timestamp) when the earnings started + StartDate int32 `json:"start_date"` + // Point in time (Unix timestamp) when the earnings ended + EndDate int32 `json:"end_date"` +} + +func (entity *ChatRevenueTransactionTypeEarnings) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatRevenueTransactionTypeEarnings + + return json.Marshal((*stub)(entity)) +} + +func (*ChatRevenueTransactionTypeEarnings) GetClass() string { + return ClassChatRevenueTransactionType +} + +func (*ChatRevenueTransactionTypeEarnings) GetType() string { + return TypeChatRevenueTransactionTypeEarnings +} + +func (*ChatRevenueTransactionTypeEarnings) ChatRevenueTransactionTypeType() string { + return TypeChatRevenueTransactionTypeEarnings +} + +// Describes a withdrawal of earnings +type ChatRevenueTransactionTypeWithdrawal struct { + meta + // Point in time (Unix timestamp) when the earnings withdrawal started + WithdrawalDate int32 `json:"withdrawal_date"` + // Name of the payment provider + Provider string `json:"provider"` + // State of the withdrawal + State ChatRevenueWithdrawalState `json:"state"` +} + +func (entity *ChatRevenueTransactionTypeWithdrawal) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatRevenueTransactionTypeWithdrawal + + return json.Marshal((*stub)(entity)) +} + +func (*ChatRevenueTransactionTypeWithdrawal) GetClass() string { + return ClassChatRevenueTransactionType +} + +func (*ChatRevenueTransactionTypeWithdrawal) GetType() string { + return TypeChatRevenueTransactionTypeWithdrawal +} + +func (*ChatRevenueTransactionTypeWithdrawal) ChatRevenueTransactionTypeType() string { + return TypeChatRevenueTransactionTypeWithdrawal +} + +func (chatRevenueTransactionTypeWithdrawal *ChatRevenueTransactionTypeWithdrawal) UnmarshalJSON(data []byte) error { + var tmp struct { + WithdrawalDate int32 `json:"withdrawal_date"` + Provider string `json:"provider"` + State json.RawMessage `json:"state"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + chatRevenueTransactionTypeWithdrawal.WithdrawalDate = tmp.WithdrawalDate + chatRevenueTransactionTypeWithdrawal.Provider = tmp.Provider + + fieldState, _ := UnmarshalChatRevenueWithdrawalState(tmp.State) + chatRevenueTransactionTypeWithdrawal.State = fieldState + + return nil +} + +// Describes a refund for failed withdrawal of earnings +type ChatRevenueTransactionTypeRefund struct { + meta + // Point in time (Unix timestamp) when the transaction was refunded + RefundDate int32 `json:"refund_date"` + // Name of the payment provider + Provider string `json:"provider"` +} + +func (entity *ChatRevenueTransactionTypeRefund) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatRevenueTransactionTypeRefund + + return json.Marshal((*stub)(entity)) +} + +func (*ChatRevenueTransactionTypeRefund) GetClass() string { + return ClassChatRevenueTransactionType +} + +func (*ChatRevenueTransactionTypeRefund) GetType() string { + return TypeChatRevenueTransactionTypeRefund +} + +func (*ChatRevenueTransactionTypeRefund) ChatRevenueTransactionTypeType() string { + return TypeChatRevenueTransactionTypeRefund +} + +// Contains a chat revenue transactions +type ChatRevenueTransaction struct { + meta + // Cryptocurrency in which revenue is calculated + Cryptocurrency string `json:"cryptocurrency"` + // The withdrawn amount, in the smallest units of the cryptocurrency + CryptocurrencyAmount JsonInt64 `json:"cryptocurrency_amount"` + // Type of the transaction + Type ChatRevenueTransactionType `json:"type"` +} + +func (entity *ChatRevenueTransaction) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatRevenueTransaction + + return json.Marshal((*stub)(entity)) +} + +func (*ChatRevenueTransaction) GetClass() string { + return ClassChatRevenueTransaction +} + +func (*ChatRevenueTransaction) GetType() string { + return TypeChatRevenueTransaction +} + +func (chatRevenueTransaction *ChatRevenueTransaction) UnmarshalJSON(data []byte) error { + var tmp struct { + Cryptocurrency string `json:"cryptocurrency"` + CryptocurrencyAmount JsonInt64 `json:"cryptocurrency_amount"` + Type json.RawMessage `json:"type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + chatRevenueTransaction.Cryptocurrency = tmp.Cryptocurrency + chatRevenueTransaction.CryptocurrencyAmount = tmp.CryptocurrencyAmount + + fieldType, _ := UnmarshalChatRevenueTransactionType(tmp.Type) + chatRevenueTransaction.Type = fieldType + + return nil +} + +// Contains a list of chat revenue transactions +type ChatRevenueTransactions struct { + meta + // Total number of transactions + TotalCount int32 `json:"total_count"` + // List of transactions + Transactions []*ChatRevenueTransaction `json:"transactions"` +} + +func (entity *ChatRevenueTransactions) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatRevenueTransactions + + return json.Marshal((*stub)(entity)) +} + +func (*ChatRevenueTransactions) GetClass() string { + return ClassChatRevenueTransactions +} + +func (*ChatRevenueTransactions) GetType() string { + return TypeChatRevenueTransactions +} + // A point on a Cartesian plane type Point struct { meta @@ -44703,6 +45358,83 @@ func (*BotCommandScopeChatMember) BotCommandScopeType() string { return TypeBotCommandScopeChatMember } +// Checks ownership of a new phone number to change the user's authentication phone number; for official Android and iOS applications only. +type PhoneNumberCodeTypeChange struct{ + meta +} + +func (entity *PhoneNumberCodeTypeChange) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PhoneNumberCodeTypeChange + + return json.Marshal((*stub)(entity)) +} + +func (*PhoneNumberCodeTypeChange) GetClass() string { + return ClassPhoneNumberCodeType +} + +func (*PhoneNumberCodeTypeChange) GetType() string { + return TypePhoneNumberCodeTypeChange +} + +func (*PhoneNumberCodeTypeChange) PhoneNumberCodeTypeType() string { + return TypePhoneNumberCodeTypeChange +} + +// Verifies ownership of a phone number to be added to the user's Telegram Passport +type PhoneNumberCodeTypeVerify struct{ + meta +} + +func (entity *PhoneNumberCodeTypeVerify) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PhoneNumberCodeTypeVerify + + return json.Marshal((*stub)(entity)) +} + +func (*PhoneNumberCodeTypeVerify) GetClass() string { + return ClassPhoneNumberCodeType +} + +func (*PhoneNumberCodeTypeVerify) GetType() string { + return TypePhoneNumberCodeTypeVerify +} + +func (*PhoneNumberCodeTypeVerify) PhoneNumberCodeTypeType() string { + return TypePhoneNumberCodeTypeVerify +} + +// Confirms ownership of a phone number to prevent account deletion while handling links of the type internalLinkTypePhoneNumberConfirmation +type PhoneNumberCodeTypeConfirmOwnership struct { + meta + // Hash value from the link + Hash string `json:"hash"` +} + +func (entity *PhoneNumberCodeTypeConfirmOwnership) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PhoneNumberCodeTypeConfirmOwnership + + return json.Marshal((*stub)(entity)) +} + +func (*PhoneNumberCodeTypeConfirmOwnership) GetClass() string { + return ClassPhoneNumberCodeType +} + +func (*PhoneNumberCodeTypeConfirmOwnership) GetType() string { + return TypePhoneNumberCodeTypeConfirmOwnership +} + +func (*PhoneNumberCodeTypeConfirmOwnership) PhoneNumberCodeTypeType() string { + return TypePhoneNumberCodeTypeConfirmOwnership +} + // The user authorization state has changed type UpdateAuthorizationState struct { meta @@ -45567,6 +46299,35 @@ func (updateChatActionBar *UpdateChatActionBar) UnmarshalJSON(data []byte) error return nil } +// The bar for managing business bot was changed in a chat +type UpdateChatBusinessBotManageBar struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // The new value of the business bot manage bar; may be null + BusinessBotManageBar *BusinessBotManageBar `json:"business_bot_manage_bar"` +} + +func (entity *UpdateChatBusinessBotManageBar) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateChatBusinessBotManageBar + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateChatBusinessBotManageBar) GetClass() string { + return ClassUpdate +} + +func (*UpdateChatBusinessBotManageBar) GetType() string { + return TypeUpdateChatBusinessBotManageBar +} + +func (*UpdateChatBusinessBotManageBar) UpdateType() string { + return TypeUpdateChatBusinessBotManageBar +} + // The chat available reactions were changed type UpdateChatAvailableReactions struct { meta @@ -48646,6 +49407,33 @@ func (updateSuggestedActions *UpdateSuggestedActions) UnmarshalJSON(data []byte) return nil } +// Download or upload file speed for the user was limited, but it can be restored by subscription to Telegram Premium. The notification can be postponed until a being downloaded or uploaded file is visible to the user Use getOption("premium_download_speedup") or getOption("premium_upload_speedup") to get expected speedup after subscription to Telegram Premium +type UpdateSpeedLimitNotification struct { + meta + // True, if upload speed was limited; false, if download speed was limited + IsUpload bool `json:"is_upload"` +} + +func (entity *UpdateSpeedLimitNotification) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateSpeedLimitNotification + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateSpeedLimitNotification) GetClass() string { + return ClassUpdate +} + +func (*UpdateSpeedLimitNotification) GetType() string { + return TypeUpdateSpeedLimitNotification +} + +func (*UpdateSpeedLimitNotification) UpdateType() string { + return TypeUpdateSpeedLimitNotification +} + // The list of contacts that had birthdays recently or will have birthday soon has changed type UpdateContactCloseBirthdays struct { meta @@ -48673,35 +49461,6 @@ func (*UpdateContactCloseBirthdays) UpdateType() string { return TypeUpdateContactCloseBirthdays } -// Adding users to a chat has failed because of their privacy settings. An invite link can be shared with the users if appropriate -type UpdateAddChatMembersPrivacyForbidden struct { - meta - // Chat identifier - ChatId int64 `json:"chat_id"` - // Identifiers of users, which weren't added because of their privacy settings - UserIds []int64 `json:"user_ids"` -} - -func (entity *UpdateAddChatMembersPrivacyForbidden) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub UpdateAddChatMembersPrivacyForbidden - - return json.Marshal((*stub)(entity)) -} - -func (*UpdateAddChatMembersPrivacyForbidden) GetClass() string { - return ClassUpdate -} - -func (*UpdateAddChatMembersPrivacyForbidden) GetType() string { - return TypeUpdateAddChatMembersPrivacyForbidden -} - -func (*UpdateAddChatMembersPrivacyForbidden) UpdateType() string { - return TypeUpdateAddChatMembersPrivacyForbidden -} - // Autosave settings for some type of chats were updated type UpdateAutosaveSettings struct { meta diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 25f7d9f..2f68e92 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -4616,8 +4616,8 @@ func UnmarshalBusinessFeature(data json.RawMessage) (BusinessFeature, error) { case TypeBusinessFeatureAccountLinks: return UnmarshalBusinessFeatureAccountLinks(data) - case TypeBusinessFeatureIntro: - return UnmarshalBusinessFeatureIntro(data) + case TypeBusinessFeatureStartPage: + return UnmarshalBusinessFeatureStartPage(data) case TypeBusinessFeatureBots: return UnmarshalBusinessFeatureBots(data) @@ -5933,6 +5933,9 @@ func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { case TypeInternalLinkTypeBotStartInGroup: return UnmarshalInternalLinkTypeBotStartInGroup(data) + case TypeInternalLinkTypeBusinessChat: + return UnmarshalInternalLinkTypeBusinessChat(data) + case TypeInternalLinkTypeChangePhoneNumber: return UnmarshalInternalLinkTypeChangePhoneNumber(data) @@ -6665,6 +6668,80 @@ func UnmarshalListOfChatStatistics(dataList []json.RawMessage) ([]ChatStatistics return list, nil } +func UnmarshalChatRevenueWithdrawalState(data json.RawMessage) (ChatRevenueWithdrawalState, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeChatRevenueWithdrawalStatePending: + return UnmarshalChatRevenueWithdrawalStatePending(data) + + case TypeChatRevenueWithdrawalStateCompleted: + return UnmarshalChatRevenueWithdrawalStateCompleted(data) + + case TypeChatRevenueWithdrawalStateFailed: + return UnmarshalChatRevenueWithdrawalStateFailed(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfChatRevenueWithdrawalState(dataList []json.RawMessage) ([]ChatRevenueWithdrawalState, error) { + list := []ChatRevenueWithdrawalState{} + + for _, data := range dataList { + entity, err := UnmarshalChatRevenueWithdrawalState(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalChatRevenueTransactionType(data json.RawMessage) (ChatRevenueTransactionType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeChatRevenueTransactionTypeEarnings: + return UnmarshalChatRevenueTransactionTypeEarnings(data) + + case TypeChatRevenueTransactionTypeWithdrawal: + return UnmarshalChatRevenueTransactionTypeWithdrawal(data) + + case TypeChatRevenueTransactionTypeRefund: + return UnmarshalChatRevenueTransactionTypeRefund(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfChatRevenueTransactionType(dataList []json.RawMessage) ([]ChatRevenueTransactionType, error) { + list := []ChatRevenueTransactionType{} + + for _, data := range dataList { + entity, err := UnmarshalChatRevenueTransactionType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalVectorPathCommand(data json.RawMessage) (VectorPathCommand, error) { var meta meta @@ -6748,6 +6825,43 @@ func UnmarshalListOfBotCommandScope(dataList []json.RawMessage) ([]BotCommandSco return list, nil } +func UnmarshalPhoneNumberCodeType(data json.RawMessage) (PhoneNumberCodeType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypePhoneNumberCodeTypeChange: + return UnmarshalPhoneNumberCodeTypeChange(data) + + case TypePhoneNumberCodeTypeVerify: + return UnmarshalPhoneNumberCodeTypeVerify(data) + + case TypePhoneNumberCodeTypeConfirmOwnership: + return UnmarshalPhoneNumberCodeTypeConfirmOwnership(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfPhoneNumberCodeType(dataList []json.RawMessage) ([]PhoneNumberCodeType, error) { + list := []PhoneNumberCodeType{} + + for _, data := range dataList { + entity, err := UnmarshalPhoneNumberCodeType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalUpdate(data json.RawMessage) (Update, error) { var meta meta @@ -6832,6 +6946,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateChatActionBar: return UnmarshalUpdateChatActionBar(data) + case TypeUpdateChatBusinessBotManageBar: + return UnmarshalUpdateChatBusinessBotManageBar(data) + case TypeUpdateChatAvailableReactions: return UnmarshalUpdateChatAvailableReactions(data) @@ -7111,12 +7228,12 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateSuggestedActions: return UnmarshalUpdateSuggestedActions(data) + case TypeUpdateSpeedLimitNotification: + return UnmarshalUpdateSpeedLimitNotification(data) + case TypeUpdateContactCloseBirthdays: return UnmarshalUpdateContactCloseBirthdays(data) - case TypeUpdateAddChatMembersPrivacyForbidden: - return UnmarshalUpdateAddChatMembersPrivacyForbidden(data) - case TypeUpdateAutosaveSettings: return UnmarshalUpdateAutosaveSettings(data) @@ -8105,16 +8222,16 @@ func UnmarshalBusinessConnectedBot(data json.RawMessage) (*BusinessConnectedBot, return &resp, err } -func UnmarshalBusinessIntro(data json.RawMessage) (*BusinessIntro, error) { - var resp BusinessIntro +func UnmarshalBusinessStartPage(data json.RawMessage) (*BusinessStartPage, error) { + var resp BusinessStartPage err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalInputBusinessIntro(data json.RawMessage) (*InputBusinessIntro, error) { - var resp InputBusinessIntro +func UnmarshalInputBusinessStartPage(data json.RawMessage) (*InputBusinessStartPage, error) { + var resp InputBusinessStartPage err := json.Unmarshal(data, &resp) @@ -8145,6 +8262,38 @@ func UnmarshalBusinessInfo(data json.RawMessage) (*BusinessInfo, error) { return &resp, err } +func UnmarshalBusinessChatLink(data json.RawMessage) (*BusinessChatLink, error) { + var resp BusinessChatLink + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessChatLinks(data json.RawMessage) (*BusinessChatLinks, error) { + var resp BusinessChatLinks + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputBusinessChatLink(data json.RawMessage) (*InputBusinessChatLink, error) { + var resp InputBusinessChatLink + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessChatLinkInfo(data json.RawMessage) (*BusinessChatLinkInfo, error) { + var resp BusinessChatLinkInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatPhotoStickerTypeRegularOrMask(data json.RawMessage) (*ChatPhotoStickerTypeRegularOrMask, error) { var resp ChatPhotoStickerTypeRegularOrMask @@ -9593,6 +9742,14 @@ func UnmarshalSavedMessagesTags(data json.RawMessage) (*SavedMessagesTags, error return &resp, err } +func UnmarshalBusinessBotManageBar(data json.RawMessage) (*BusinessBotManageBar, error) { + var resp BusinessBotManageBar + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalVideoChat(data json.RawMessage) (*VideoChat, error) { var resp VideoChat @@ -9617,6 +9774,30 @@ func UnmarshalChats(data json.RawMessage) (*Chats, error) { return &resp, err } +func UnmarshalFailedToAddMember(data json.RawMessage) (*FailedToAddMember, error) { + var resp FailedToAddMember + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFailedToAddMembers(data json.RawMessage) (*FailedToAddMembers, error) { + var resp FailedToAddMembers + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCreatedBasicGroupChat(data json.RawMessage) (*CreatedBasicGroupChat, error) { + var resp CreatedBasicGroupChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatNearby(data json.RawMessage) (*ChatNearby, error) { var resp ChatNearby @@ -12953,6 +13134,14 @@ func UnmarshalQuickReplyMessage(data json.RawMessage) (*QuickReplyMessage, error return &resp, err } +func UnmarshalQuickReplyMessages(data json.RawMessage) (*QuickReplyMessages, error) { + var resp QuickReplyMessages + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalQuickReplyShortcut(data json.RawMessage) (*QuickReplyShortcut, error) { var resp QuickReplyShortcut @@ -14729,8 +14918,8 @@ func UnmarshalBusinessFeatureAccountLinks(data json.RawMessage) (*BusinessFeatur return &resp, err } -func UnmarshalBusinessFeatureIntro(data json.RawMessage) (*BusinessFeatureIntro, error) { - var resp BusinessFeatureIntro +func UnmarshalBusinessFeatureStartPage(data json.RawMessage) (*BusinessFeatureStartPage, error) { + var resp BusinessFeatureStartPage err := json.Unmarshal(data, &resp) @@ -16441,6 +16630,14 @@ func UnmarshalInternalLinkTypeBotStartInGroup(data json.RawMessage) (*InternalLi return &resp, err } +func UnmarshalInternalLinkTypeBusinessChat(data json.RawMessage) (*InternalLinkTypeBusinessChat, error) { + var resp InternalLinkTypeBusinessChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInternalLinkTypeChangePhoneNumber(data json.RawMessage) (*InternalLinkTypeChangePhoneNumber, error) { var resp InternalLinkTypeChangePhoneNumber @@ -17569,6 +17766,14 @@ func UnmarshalChatStatisticsChannel(data json.RawMessage) (*ChatStatisticsChanne return &resp, err } +func UnmarshalChatRevenueStatistics(data json.RawMessage) (*ChatRevenueStatistics, error) { + var resp ChatRevenueStatistics + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageStatistics(data json.RawMessage) (*MessageStatistics, error) { var resp MessageStatistics @@ -17585,6 +17790,70 @@ func UnmarshalStoryStatistics(data json.RawMessage) (*StoryStatistics, error) { return &resp, err } +func UnmarshalChatRevenueWithdrawalStatePending(data json.RawMessage) (*ChatRevenueWithdrawalStatePending, error) { + var resp ChatRevenueWithdrawalStatePending + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatRevenueWithdrawalStateCompleted(data json.RawMessage) (*ChatRevenueWithdrawalStateCompleted, error) { + var resp ChatRevenueWithdrawalStateCompleted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatRevenueWithdrawalStateFailed(data json.RawMessage) (*ChatRevenueWithdrawalStateFailed, error) { + var resp ChatRevenueWithdrawalStateFailed + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatRevenueTransactionTypeEarnings(data json.RawMessage) (*ChatRevenueTransactionTypeEarnings, error) { + var resp ChatRevenueTransactionTypeEarnings + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatRevenueTransactionTypeWithdrawal(data json.RawMessage) (*ChatRevenueTransactionTypeWithdrawal, error) { + var resp ChatRevenueTransactionTypeWithdrawal + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatRevenueTransactionTypeRefund(data json.RawMessage) (*ChatRevenueTransactionTypeRefund, error) { + var resp ChatRevenueTransactionTypeRefund + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatRevenueTransaction(data json.RawMessage) (*ChatRevenueTransaction, error) { + var resp ChatRevenueTransaction + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatRevenueTransactions(data json.RawMessage) (*ChatRevenueTransactions, error) { + var resp ChatRevenueTransactions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPoint(data json.RawMessage) (*Point, error) { var resp Point @@ -17665,6 +17934,30 @@ func UnmarshalBotCommandScopeChatMember(data json.RawMessage) (*BotCommandScopeC return &resp, err } +func UnmarshalPhoneNumberCodeTypeChange(data json.RawMessage) (*PhoneNumberCodeTypeChange, error) { + var resp PhoneNumberCodeTypeChange + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPhoneNumberCodeTypeVerify(data json.RawMessage) (*PhoneNumberCodeTypeVerify, error) { + var resp PhoneNumberCodeTypeVerify + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPhoneNumberCodeTypeConfirmOwnership(data json.RawMessage) (*PhoneNumberCodeTypeConfirmOwnership, error) { + var resp PhoneNumberCodeTypeConfirmOwnership + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateAuthorizationState(data json.RawMessage) (*UpdateAuthorizationState, error) { var resp UpdateAuthorizationState @@ -17865,6 +18158,14 @@ func UnmarshalUpdateChatActionBar(data json.RawMessage) (*UpdateChatActionBar, e return &resp, err } +func UnmarshalUpdateChatBusinessBotManageBar(data json.RawMessage) (*UpdateChatBusinessBotManageBar, error) { + var resp UpdateChatBusinessBotManageBar + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateChatAvailableReactions(data json.RawMessage) (*UpdateChatAvailableReactions, error) { var resp UpdateChatAvailableReactions @@ -18609,16 +18910,16 @@ func UnmarshalUpdateSuggestedActions(data json.RawMessage) (*UpdateSuggestedActi return &resp, err } -func UnmarshalUpdateContactCloseBirthdays(data json.RawMessage) (*UpdateContactCloseBirthdays, error) { - var resp UpdateContactCloseBirthdays +func UnmarshalUpdateSpeedLimitNotification(data json.RawMessage) (*UpdateSpeedLimitNotification, error) { + var resp UpdateSpeedLimitNotification err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalUpdateAddChatMembersPrivacyForbidden(data json.RawMessage) (*UpdateAddChatMembersPrivacyForbidden, error) { - var resp UpdateAddChatMembersPrivacyForbidden +func UnmarshalUpdateContactCloseBirthdays(data json.RawMessage) (*UpdateContactCloseBirthdays, error) { + var resp UpdateContactCloseBirthdays err := json.Unmarshal(data, &resp) @@ -19233,11 +19534,11 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeBusinessConnectedBot: return UnmarshalBusinessConnectedBot(data) - case TypeBusinessIntro: - return UnmarshalBusinessIntro(data) + case TypeBusinessStartPage: + return UnmarshalBusinessStartPage(data) - case TypeInputBusinessIntro: - return UnmarshalInputBusinessIntro(data) + case TypeInputBusinessStartPage: + return UnmarshalInputBusinessStartPage(data) case TypeBusinessOpeningHoursInterval: return UnmarshalBusinessOpeningHoursInterval(data) @@ -19248,6 +19549,18 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeBusinessInfo: return UnmarshalBusinessInfo(data) + case TypeBusinessChatLink: + return UnmarshalBusinessChatLink(data) + + case TypeBusinessChatLinks: + return UnmarshalBusinessChatLinks(data) + + case TypeInputBusinessChatLink: + return UnmarshalInputBusinessChatLink(data) + + case TypeBusinessChatLinkInfo: + return UnmarshalBusinessChatLinkInfo(data) + case TypeChatPhotoStickerTypeRegularOrMask: return UnmarshalChatPhotoStickerTypeRegularOrMask(data) @@ -19791,6 +20104,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSavedMessagesTags: return UnmarshalSavedMessagesTags(data) + case TypeBusinessBotManageBar: + return UnmarshalBusinessBotManageBar(data) + case TypeVideoChat: return UnmarshalVideoChat(data) @@ -19800,6 +20116,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChats: return UnmarshalChats(data) + case TypeFailedToAddMember: + return UnmarshalFailedToAddMember(data) + + case TypeFailedToAddMembers: + return UnmarshalFailedToAddMembers(data) + + case TypeCreatedBasicGroupChat: + return UnmarshalCreatedBasicGroupChat(data) + case TypeChatNearby: return UnmarshalChatNearby(data) @@ -21051,6 +21376,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeQuickReplyMessage: return UnmarshalQuickReplyMessage(data) + case TypeQuickReplyMessages: + return UnmarshalQuickReplyMessages(data) + case TypeQuickReplyShortcut: return UnmarshalQuickReplyShortcut(data) @@ -21717,8 +22045,8 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeBusinessFeatureAccountLinks: return UnmarshalBusinessFeatureAccountLinks(data) - case TypeBusinessFeatureIntro: - return UnmarshalBusinessFeatureIntro(data) + case TypeBusinessFeatureStartPage: + return UnmarshalBusinessFeatureStartPage(data) case TypeBusinessFeatureBots: return UnmarshalBusinessFeatureBots(data) @@ -22359,6 +22687,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInternalLinkTypeBotStartInGroup: return UnmarshalInternalLinkTypeBotStartInGroup(data) + case TypeInternalLinkTypeBusinessChat: + return UnmarshalInternalLinkTypeBusinessChat(data) + case TypeInternalLinkTypeChangePhoneNumber: return UnmarshalInternalLinkTypeChangePhoneNumber(data) @@ -22782,12 +23113,39 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatStatisticsChannel: return UnmarshalChatStatisticsChannel(data) + case TypeChatRevenueStatistics: + return UnmarshalChatRevenueStatistics(data) + case TypeMessageStatistics: return UnmarshalMessageStatistics(data) case TypeStoryStatistics: return UnmarshalStoryStatistics(data) + case TypeChatRevenueWithdrawalStatePending: + return UnmarshalChatRevenueWithdrawalStatePending(data) + + case TypeChatRevenueWithdrawalStateCompleted: + return UnmarshalChatRevenueWithdrawalStateCompleted(data) + + case TypeChatRevenueWithdrawalStateFailed: + return UnmarshalChatRevenueWithdrawalStateFailed(data) + + case TypeChatRevenueTransactionTypeEarnings: + return UnmarshalChatRevenueTransactionTypeEarnings(data) + + case TypeChatRevenueTransactionTypeWithdrawal: + return UnmarshalChatRevenueTransactionTypeWithdrawal(data) + + case TypeChatRevenueTransactionTypeRefund: + return UnmarshalChatRevenueTransactionTypeRefund(data) + + case TypeChatRevenueTransaction: + return UnmarshalChatRevenueTransaction(data) + + case TypeChatRevenueTransactions: + return UnmarshalChatRevenueTransactions(data) + case TypePoint: return UnmarshalPoint(data) @@ -22818,6 +23176,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeBotCommandScopeChatMember: return UnmarshalBotCommandScopeChatMember(data) + case TypePhoneNumberCodeTypeChange: + return UnmarshalPhoneNumberCodeTypeChange(data) + + case TypePhoneNumberCodeTypeVerify: + return UnmarshalPhoneNumberCodeTypeVerify(data) + + case TypePhoneNumberCodeTypeConfirmOwnership: + return UnmarshalPhoneNumberCodeTypeConfirmOwnership(data) + case TypeUpdateAuthorizationState: return UnmarshalUpdateAuthorizationState(data) @@ -22893,6 +23260,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateChatActionBar: return UnmarshalUpdateChatActionBar(data) + case TypeUpdateChatBusinessBotManageBar: + return UnmarshalUpdateChatBusinessBotManageBar(data) + case TypeUpdateChatAvailableReactions: return UnmarshalUpdateChatAvailableReactions(data) @@ -23172,12 +23542,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateSuggestedActions: return UnmarshalUpdateSuggestedActions(data) + case TypeUpdateSpeedLimitNotification: + return UnmarshalUpdateSpeedLimitNotification(data) + case TypeUpdateContactCloseBirthdays: return UnmarshalUpdateContactCloseBirthdays(data) - case TypeUpdateAddChatMembersPrivacyForbidden: - return UnmarshalUpdateAddChatMembersPrivacyForbidden(data) - case TypeUpdateAutosaveSettings: return UnmarshalUpdateAutosaveSettings(data) diff --git a/data/td_api.tl b/data/td_api.tl index 7cc4ddc..dabbcea 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -312,7 +312,7 @@ stickerFormatTgs = StickerFormat; stickerFormatWebm = StickerFormat; -//@class StickerType @description Describes type of a sticker +//@class StickerType @description Describes type of sticker //@description The sticker is a regular sticker stickerTypeRegular = StickerType; @@ -351,7 +351,7 @@ closedVectorPath commands:vector = ClosedVectorPath; pollOption text:string voter_count:int32 vote_percentage:int32 is_chosen:Bool is_being_chosen:Bool = PollOption; -//@class PollType @description Describes the type of a poll +//@class PollType @description Describes the type of poll //@description A regular poll @allow_multiple_answers True, if multiple answer options can be chosen simultaneously pollTypeRegular allow_multiple_answers:Bool = PollType; @@ -541,7 +541,7 @@ profilePhoto id:int64 small:file big:file minithumbnail:minithumbnail has_animat chatPhotoInfo small:file big:file minithumbnail:minithumbnail has_animation:Bool is_personal:Bool = ChatPhotoInfo; -//@class UserType @description Represents the type of a user. The following types are possible: regular users, deleted users and bots +//@class UserType @description Represents the type of user. The following types are possible: regular users, deleted users and bots //@description A regular user userTypeRegular = UserType; @@ -631,17 +631,17 @@ businessGreetingMessageSettings shortcut_id:int32 recipients:businessRecipients //@can_reply True, if the bot can send messages to the private chats; false otherwise businessConnectedBot bot_user_id:int53 recipients:businessRecipients can_reply:Bool = BusinessConnectedBot; -//@description Describes settings for a business account intro -//@title Title text of the intro -//@message Message text of the intro -//@sticker Greeting sticker of the intro; may be null if none -businessIntro title:string message:string sticker:sticker = BusinessIntro; +//@description Describes settings for a business account start page +//@title Title text of the start page +//@message Message text of the start page +//@sticker Greeting sticker of the start page; may be null if none +businessStartPage title:string message:string sticker:sticker = BusinessStartPage; -//@description Describes settings for a business account intro to set -//@title Title text of the intro; 0-getOption("business_intro_title_length_max") characters -//@message Message text of the intro; 0-getOption("business_intro_message_length_max") characters -//@sticker Greeting sticker of the intro; pass null if none. The sticker must belong to a sticker set and must not be a custom emoji -inputBusinessIntro title:string message:string sticker:InputFile = InputBusinessIntro; +//@description Describes settings for a business account start page to set +//@title Title text of the start page; 0-getOption("business_start_page_title_length_max") characters +//@message Message text of the start page; 0-getOption("business_start_page_message_length_max") characters +//@sticker Greeting sticker of the start page; pass null if none. The sticker must belong to a sticker set and must not be a custom emoji +inputBusinessStartPage title:string message:string sticker:InputFile = InputBusinessStartPage; //@description Describes an interval of time when the business is open //@start_minute The first minute of the interval since start of the week; 0-7*24*60 @@ -656,11 +656,32 @@ businessOpeningHours time_zone_id:string opening_hours:vector = BusinessChatLinks; + +//@description Describes a business chat link to create or edit +//@text Message draft text that will be added to the input field +//@title Link title +inputBusinessChatLink text:formattedText title:string = InputBusinessChatLink; + +//@description Contains information about a business chat link +//@chat_id Identifier of the private chat that created the link +//@text Message draft text that must be added to the input field +businessChatLinkInfo chat_id:int53 text:formattedText = BusinessChatLinkInfo; + + +//@class ChatPhotoStickerType @description Describes type of sticker, which was used to create a chat photo //@description Information about the sticker, which was used to create the chat photo //@sticker_set_id Sticker set identifier @@ -1084,7 +1105,7 @@ chatInviteLinkMember user_id:int53 joined_chat_date:int32 via_chat_folder_invite chatInviteLinkMembers total_count:int32 members:vector = ChatInviteLinkMembers; -//@class InviteLinkChatType @description Describes the type of a chat to which points an invite link +//@class InviteLinkChatType @description Describes the type of chat to which points an invite link //@description The link is an invite link for a basic group inviteLinkChatTypeBasicGroup = InviteLinkChatType; @@ -1191,9 +1212,11 @@ supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:Chat //@can_set_sticker_set True, if the supergroup sticker set can be changed //@can_set_location True, if the supergroup location can be changed //@can_get_statistics True, if the supergroup or channel statistics are available +//@can_get_revenue_statistics True, if the supergroup or channel revenue statistics are available //@can_toggle_aggressive_anti_spam True, if aggressive anti-spam checks can be enabled or disabled in the supergroup //@is_all_history_available 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, //-so this option affects only private non-forum supergroups without a linked chat. The value of this field is only available to chat administrators +//@can_have_sponsored_messages True, if the chat can have sponsored messages. The value of this field is only available to the owner of the chat //@has_aggressive_anti_spam_enabled True, if aggressive anti-spam checks are enabled in the supergroup. The value of this field is only available to chat administrators //@has_pinned_stories True, if the supergroup or channel has pinned stories //@my_boost_count Number of times the current user boosted the supergroup or channel @@ -1205,7 +1228,7 @@ supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:Chat //@bot_commands List of commands of bots in the group //@upgraded_from_basic_group_id Identifier of the basic group from which supergroup was upgraded; 0 if none //@upgraded_from_max_message_id Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none -supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool has_aggressive_anti_spam_enabled:Bool has_pinned_stories:Bool my_boost_count:int32 unrestrict_boost_count:int32 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; +supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_get_revenue_statistics:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool can_have_sponsored_messages:Bool has_aggressive_anti_spam_enabled:Bool has_pinned_stories:Bool my_boost_count:int32 unrestrict_boost_count:int32 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; //@class SecretChatState @description Describes the current secret chat state @@ -1320,7 +1343,7 @@ reactionTypeCustomEmoji custom_emoji_id:int64 = ReactionType; //@origin Origin of the forwarded message //@date Point in time (Unix timestamp) when the message was originally sent //@source For messages forwarded to the chat with the current user (Saved Messages), to the Replies bot chat, or to the channel's discussion group, information about the source message from which the message was forwarded last time; may be null for other forwards or if unknown -//@public_service_announcement_type The type of a public service announcement for the forwarded message +//@public_service_announcement_type The type of public service announcement for the forwarded message messageForwardInfo origin:MessageOrigin date:int32 source:forwardSource public_service_announcement_type:string = MessageForwardInfo; //@description Contains information about a message created with importMessages @@ -1463,7 +1486,7 @@ inputMessageReplyToStory story_sender_chat_id:int53 story_id:int32 = InputMessag //@sender_business_bot_user_id If non-zero, the user identifier of the business bot that sent this message //@sender_boost_count Number of times the sender of the message boosted the supergroup at the time the message was sent; 0 if none or unknown. For messages sent by the current user, supergroupFullInfo.my_boost_count must be used instead //@author_signature For channel posts and anonymous group messages, optional author signature -//@media_album_id Unique identifier of an album this message belongs to. Only audios, documents, photos and videos can be grouped together in albums +//@media_album_id Unique identifier of an album this message belongs to; 0 if none. Only audios, documents, photos and videos can be grouped together in albums //@restriction_reason If non-empty, contains a human-readable description of the reason why access to this message must be restricted //@content Content of the message //@reply_markup Reply markup for the message; may be null if none @@ -1531,7 +1554,7 @@ messageSourceScreenshot = MessageSource; messageSourceOther = MessageSource; -//@class MessageSponsorType @description Describes type of a message sponsor +//@class MessageSponsorType @description Describes type of message sponsor //@description The sponsor is a bot @bot_user_id User identifier of the bot @link An internal link to be opened when the sponsored message is clicked messageSponsorTypeBot bot_user_id:int53 link:InternalLinkType = MessageSponsorType; @@ -1662,7 +1685,7 @@ scopeNotificationSettings mute_for:int32 sound_id:int64 show_preview:Bool use_de draftMessage reply_to:InputMessageReplyTo date:int32 input_message_text:InputMessageContent = DraftMessage; -//@class ChatType @description Describes the type of a chat +//@class ChatType @description Describes the type of chat //@description An ordinary chat with a user @user_id User identifier chatTypePrivate user_id:int53 = ChatType; @@ -1684,7 +1707,7 @@ chatFolderIcon name:string = ChatFolderIcon; //@description Represents a folder for user chats //@title The title of the folder; 1-12 characters without line feeds //@icon The chosen icon for the chat folder; may be null. If null, use getChatFolderDefaultIconName to get default icon name for the folder -//@color_id The identifier of the chosen color for the chat folder icon; from -1 to 6. If -1, then color is didabled. Can't be changed if folder tags are disabled or the current user doesn't have Telegram Premium subscription +//@color_id The identifier of the chosen color for the chat folder icon; from -1 to 6. If -1, then color is disabled. Can't be changed if folder tags are disabled or the current user doesn't have Telegram Premium subscription //@is_shareable True, if at least one link has been created for the folder //@pinned_chat_ids The chat identifiers of pinned chats in the folder. There can be up to getOption("chat_folder_chosen_chat_count_max") pinned and always included non-secret chats and the same number of secret chats, but the limit can be increased with Telegram Premium //@included_chat_ids The chat identifiers of always included chats in the folder. There can be up to getOption("chat_folder_chosen_chat_count_max") pinned and always included non-secret chats and the same number of secret chats, but the limit can be increased with Telegram Premium @@ -1703,7 +1726,7 @@ chatFolder title:string icon:chatFolderIcon color_id:int32 is_shareable:Bool pin //@id Unique chat folder identifier //@title The title of the folder; 1-12 characters without line feeds //@icon The chosen or default icon for the chat folder -//@color_id The identifier of the chosen color for the chat folder icon; from -1 to 6. If -1, then color is didabled +//@color_id The identifier of the chosen color for the chat folder icon; from -1 to 6. If -1, then color is disabled //@is_shareable True, if at least one link has been created for the folder //@has_my_invite_links True, if the chat folder has invite links created by the current user chatFolderInfo id:int32 title:string icon:chatFolderIcon color_id:int32 is_shareable:Bool has_my_invite_links:Bool = ChatFolderInfo; @@ -1787,6 +1810,14 @@ savedMessagesTag tag:ReactionType label:string count:int32 = SavedMessagesTag; savedMessagesTags tags:vector = SavedMessagesTags; +//@description Contains information about a business bot that manages the chat +//@bot_user_id User identifier of the bot +//@manage_url URL to be opened to manage the bot +//@is_bot_paused True, if the bot is paused. Use toggleBusinessConnectedBotChatIsPaused to change the value of the field +//@can_bot_reply True, if the bot can reply +businessBotManageBar bot_user_id:int53 manage_url:string is_bot_paused:Bool can_bot_reply:Bool = BusinessBotManageBar; + + //@description Describes a video chat //@group_call_id Group call identifier of an active video chat; 0 if none. Full information about the video chat can be received through the method getGroupCall //@has_participants True, if the video chat has participants @@ -1830,17 +1861,32 @@ videoChat group_call_id:int32 has_participants:Bool default_participant_id:Messa //@background Background set for the chat; may be null if none //@theme_name If non-empty, name of a theme, set for the chat //@action_bar Information about actions which must be possible to do through the chat action bar; may be null if none +//@business_bot_manage_bar Information about bar for managing a business bot in the chat; may be null if none //@video_chat Information about video chat of the chat //@pending_join_requests Information about pending join requests; may be null if none //@reply_markup_message_id Identifier of the message from which reply markup needs to be used; 0 if there is no default custom reply markup in the chat //@draft_message A draft of a message in the chat; may be null if none //@client_data 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 -chat id:int53 type:ChatType title:string photo:chatPhotoInfo accent_color_id:int32 background_custom_emoji_id:int64 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 permissions:chatPermissions last_message:message positions:vector chat_lists:vector message_sender_id:MessageSender block_list:BlockList has_protected_content:Bool is_translatable:Bool is_marked_as_unread:Bool view_as_topics:Bool has_scheduled_messages:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_reported:Bool default_disable_notification:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 unread_reaction_count:int32 notification_settings:chatNotificationSettings available_reactions:ChatAvailableReactions message_auto_delete_time:int32 emoji_status:emojiStatus background:chatBackground theme_name:string action_bar:ChatActionBar video_chat:videoChat pending_join_requests:chatJoinRequestsInfo reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat; +chat id:int53 type:ChatType title:string photo:chatPhotoInfo accent_color_id:int32 background_custom_emoji_id:int64 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 permissions:chatPermissions last_message:message positions:vector chat_lists:vector message_sender_id:MessageSender block_list:BlockList has_protected_content:Bool is_translatable:Bool is_marked_as_unread:Bool view_as_topics:Bool has_scheduled_messages:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_reported:Bool default_disable_notification:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 unread_reaction_count:int32 notification_settings:chatNotificationSettings available_reactions:ChatAvailableReactions message_auto_delete_time:int32 emoji_status:emojiStatus background:chatBackground theme_name:string action_bar:ChatActionBar business_bot_manage_bar:businessBotManageBar video_chat:videoChat pending_join_requests:chatJoinRequestsInfo reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat; //@description Represents a list of chats @total_count Approximate total number of chats found @chat_ids List of chat identifiers chats total_count:int32 chat_ids:vector = Chats; +//@description Contains information about a user that has failed to be added to a chat +//@user_id User identifier +//@premium_would_allow_invite True, if subscription to Telegram Premium would have allowed to add the user to the chat +//@premium_required_to_send_messages True, if subscription to Telegram Premium is required to send the user chat invite link +failedToAddMember user_id:int53 premium_would_allow_invite:Bool premium_required_to_send_messages:Bool = FailedToAddMember; + +//@description Represents a list of users that has failed to be added to a chat @failed_to_add_members Information about users that weren't added to the chat +failedToAddMembers failed_to_add_members:vector = FailedToAddMembers; + + +//@description Contains information about a newly created basic group chat @chat_id Chat identifier @failed_to_add_members Information about failed to add members +createdBasicGroupChat chat_id:int53 failed_to_add_members:failedToAddMembers = CreatedBasicGroupChat; + + //@description Describes a chat located nearby @chat_id Chat identifier @distance Distance to the chat location, in meters chatNearby chat_id:int53 distance:int32 = ChatNearby; @@ -1938,7 +1984,7 @@ keyboardButtonTypeWebApp url:string = KeyboardButtonType; keyboardButton text:string type:KeyboardButtonType = KeyboardButton; -//@class InlineKeyboardButtonType @description Describes the type of an inline keyboard button +//@class InlineKeyboardButtonType @description Describes the type of inline keyboard button //@description A button that opens a specified URL @url HTTP or tg:// URL to open inlineKeyboardButtonTypeUrl url:string = InlineKeyboardButtonType; @@ -2030,7 +2076,7 @@ webAppInfo launch_id:int64 url:string = WebAppInfo; messageThreadInfo chat_id:int53 message_thread_id:int53 reply_info:messageReplyInfo unread_message_count:int32 messages:vector draft_message:draftMessage = MessageThreadInfo; -//@class SavedMessagesTopicType @description Describes type of a Saved Messages topic +//@class SavedMessagesTopicType @description Describes type of Saved Messages topic //@description Topic containing messages sent by the current user of forwarded from an unknown chat savedMessagesTopicTypeMyNotes = SavedMessagesTopicType; @@ -2634,7 +2680,7 @@ premiumGiveawayParameters boosted_chat_id:int53 additional_chat_ids:vector = MessageContent; //@description A newly created basic group @title Title of the basic group @member_user_ids User identifiers of members in the basic group @@ -3651,7 +3697,7 @@ emojiCategory name:string icon:sticker emojis:vector = EmojiCategory; emojiCategories categories:vector = EmojiCategories; -//@class EmojiCategoryType @description Describes type of an emoji category +//@class EmojiCategoryType @description Describes type of emoji category //@description The category must be used by default emojiCategoryTypeDefault = EmojiCategoryType; @@ -3672,7 +3718,7 @@ emojiCategoryTypeChatPhoto = EmojiCategoryType; storyAreaPosition x_percentage:double y_percentage:double width_percentage:double height_percentage:double rotation_angle:double = StoryAreaPosition; -//@class StoryAreaType @description Describes type of a clickable rectangle area on a story media +//@class StoryAreaType @description Describes type of clickable rectangle area on a story media //@description An area pointing to a location @location The location storyAreaTypeLocation location:location = StoryAreaType; @@ -3695,7 +3741,7 @@ storyAreaTypeMessage chat_id:int53 message_id:int53 = StoryAreaType; storyArea position:storyAreaPosition type:StoryAreaType = StoryArea; -//@class InputStoryAreaType @description Describes type of a clickable rectangle area on a story media to be added +//@class InputStoryAreaType @description Describes type of clickable rectangle area on a story media to be added //@description An area pointing to a location @location The location inputStoryAreaTypeLocation location:location = InputStoryAreaType; @@ -3883,13 +3929,16 @@ storyInteractions total_count:int32 total_forward_count:int32 total_reaction_cou //@id Unique message identifier among all quick replies //@sending_state The sending state of the message; may be null if the message isn't being sent and didn't fail to be sent //@can_be_edited True, if the message can be edited -//@reply_to_message_id Information about the identifier of the quick reply message to which the message replies +//@reply_to_message_id The identifier of the quick reply message to which the message replies; 0 if none //@via_bot_user_id If non-zero, the user identifier of the bot through which this message was sent -//@media_album_id Unique identifier of an album this message belongs to. Only audios, documents, photos and videos can be grouped together in albums +//@media_album_id Unique identifier of an album this message belongs to; 0 if none. Only audios, documents, photos and videos can be grouped together in albums //@content Content of the message //@reply_markup Inline keyboard reply markup for the message; may be null if none quickReplyMessage id:int53 sending_state:MessageSendingState can_be_edited:Bool reply_to_message_id:int53 via_bot_user_id:int53 media_album_id:int64 content:MessageContent reply_markup:ReplyMarkup = QuickReplyMessage; +//@description Contains a list of quick reply messages @messages List of quick reply messages; messages may be null +quickReplyMessages messages:vector = QuickReplyMessages; + //@description Describes a shortcut that can be used for a quick reply //@id Unique shortcut identifier //@name The name of the shortcut that can be used to use the shortcut @@ -3928,7 +3977,8 @@ publicForwards total_count:int32 forwards:vector next_offset:stri //@can_set_custom_background True, if custom background can be set in the chat for all users //@can_set_custom_emoji_sticker_set True, if custom emoji sticker set can be set for the chat //@can_recognize_speech True, if speech recognition can be used for video note and voice note messages by all users -chatBoostLevelFeatures level:int32 story_per_day_count:int32 custom_emoji_reaction_count:int32 title_color_count:int32 profile_accent_color_count:int32 can_set_profile_background_custom_emoji:Bool accent_color_count:int32 can_set_background_custom_emoji:Bool can_set_emoji_status:Bool chat_theme_background_count:int32 can_set_custom_background:Bool can_set_custom_emoji_sticker_set:Bool can_recognize_speech:Bool = ChatBoostLevelFeatures; +//@can_disable_sponsored_messages True, if sponsored messages can be disabled in the chat +chatBoostLevelFeatures level:int32 story_per_day_count:int32 custom_emoji_reaction_count:int32 title_color_count:int32 profile_accent_color_count:int32 can_set_profile_background_custom_emoji:Bool accent_color_count:int32 can_set_background_custom_emoji:Bool can_set_emoji_status:Bool chat_theme_background_count:int32 can_set_custom_background:Bool can_set_custom_emoji_sticker_set:Bool can_recognize_speech:Bool can_disable_sponsored_messages:Bool = ChatBoostLevelFeatures; //@description Contains a list of features available on the first chat boost levels //@features The list of features @@ -3939,7 +3989,8 @@ chatBoostLevelFeatures level:int32 story_per_day_count:int32 custom_emoji_reacti //@min_custom_background_boost_level The minimum boost level required to set custom chat background //@min_custom_emoji_sticker_set_boost_level The minimum boost level required to set custom emoji sticker set for the chat; for supergroup chats only //@min_speech_recognition_boost_level The minimum boost level allowing to recognize speech in video note and voice note messages for non-Premium users; for supergroup chats only -chatBoostFeatures features:vector min_profile_background_custom_emoji_boost_level:int32 min_background_custom_emoji_boost_level:int32 min_emoji_status_boost_level:int32 min_chat_theme_background_boost_level:int32 min_custom_background_boost_level:int32 min_custom_emoji_sticker_set_boost_level:int32 min_speech_recognition_boost_level:int32 = ChatBoostFeatures; +//@min_sponsored_message_disable_boost_level The minimum boost level allowing to disable sponsored messages in the chat; for channel chats only +chatBoostFeatures features:vector min_profile_background_custom_emoji_boost_level:int32 min_background_custom_emoji_boost_level:int32 min_emoji_status_boost_level:int32 min_chat_theme_background_boost_level:int32 min_custom_background_boost_level:int32 min_custom_emoji_sticker_set_boost_level:int32 min_speech_recognition_boost_level:int32 min_sponsored_message_disable_boost_level:int32 = ChatBoostFeatures; //@class ChatBoostSource @description Describes source of a chat boost @@ -4034,7 +4085,7 @@ callDiscardReasonHungUp = CallDiscardReason; callProtocol udp_p2p:Bool udp_reflector:Bool min_layer:int32 max_layer:int32 library_versions:vector = CallProtocol; -//@class CallServerType @description Describes the type of a call server +//@class CallServerType @description Describes the type of call server //@description A Telegram call reflector @peer_tag A peer tag to be used with the reflector @is_tcp True, if the server uses TCP instead of UDP callServerTypeTelegramReflector peer_tag:bytes is_tcp:Bool = CallServerType; @@ -4078,7 +4129,8 @@ callStateExchangingKeys = CallState; //@encryption_key Call encryption key //@emojis Encryption key emojis fingerprint //@allow_p2p True, if peer-to-peer connection is allowed by users privacy settings -callStateReady protocol:callProtocol servers:vector config:string encryption_key:bytes emojis:vector allow_p2p:Bool = CallState; +//@custom_parameters Custom JSON-encoded call parameters to be passed to tgcalls +callStateReady protocol:callProtocol servers:vector config:string encryption_key:bytes emojis:vector allow_p2p:Bool custom_parameters:string = CallState; //@description The call is hanging up after discardCall has been called callStateHangingUp = CallState; @@ -4177,7 +4229,7 @@ groupCallParticipantVideoInfo source_groups:vector en groupCallParticipant participant_id:MessageSender audio_source_id:int32 screen_sharing_audio_source_id:int32 video_info:groupCallParticipantVideoInfo screen_sharing_video_info:groupCallParticipantVideoInfo bio:string is_current_user:Bool is_speaking:Bool is_hand_raised:Bool can_be_muted_for_all_users:Bool can_be_unmuted_for_all_users:Bool can_be_muted_for_current_user:Bool can_be_unmuted_for_current_user:Bool is_muted_for_all_users:Bool is_muted_for_current_user:Bool can_unmute_self:Bool volume_level:int32 order:string = GroupCallParticipant; -//@class CallProblem @description Describes the exact type of a problem with a call +//@class CallProblem @description Describes the exact type of problem with a call //@description The user heard their own voice callProblemEcho = CallProblem; @@ -4597,7 +4649,7 @@ inlineQueryResultVideo id:string video:video title:string description:string = I inlineQueryResultVoiceNote id:string voice_note:voiceNote title:string = InlineQueryResult; -//@class InlineQueryResultsButtonType @description Represents a type of a button in results of inline query +//@class InlineQueryResultsButtonType @description Represents a type of button in results of inline query //@description Describes the button that opens a private chat with the bot and sends a start message to the bot with the given parameter @parameter The parameter for the bot start message inlineQueryResultsButtonTypeStartBot parameter:string = InlineQueryResultsButtonType; @@ -4873,7 +4925,7 @@ languagePackInfo id:string base_language_pack_id:string name:string native_name: localizationTargetInfo language_packs:vector = LocalizationTargetInfo; -//@class PremiumLimitType @description Describes type of a limit, increased for Premium users +//@class PremiumLimitType @description Describes type of limit, increased for Premium users //@description The maximum number of joined supergroups and channels premiumLimitTypeSupergroupCount = PremiumLimitType; @@ -5026,8 +5078,8 @@ businessFeatureAwayMessage = BusinessFeature; //@description The ability to create links to the business account with predefined message text businessFeatureAccountLinks = BusinessFeature; -//@description The ability to customize intro -businessFeatureIntro = BusinessFeature; +//@description The ability to customize start page +businessFeatureStartPage = BusinessFeature; //@description The ability to connect a bot to the account businessFeatureBots = BusinessFeature; @@ -5216,7 +5268,7 @@ backgroundFillGradient top_color:int32 bottom_color:int32 rotation_angle:int32 = backgroundFillFreeformGradient colors:vector = BackgroundFill; -//@class BackgroundType @description Describes the type of a background +//@class BackgroundType @description Describes the type of background //@description A wallpaper in JPEG format //@is_blurred True, if the wallpaper must be downscaled to fit in 450x450 square and then box-blurred with radius 12 @@ -5722,7 +5774,7 @@ accountTtl days:int32 = AccountTtl; messageAutoDeleteTime time:int32 = MessageAutoDeleteTime; -//@class SessionType @description Represents the type of a session +//@class SessionType @description Represents the type of session //@description The session is running on an Android device sessionTypeAndroid = SessionType; @@ -5921,6 +5973,11 @@ internalLinkTypeBotStart bot_username:string start_parameter:string autostart:Bo //@administrator_rights Expected administrator rights for the bot; may be null internalLinkTypeBotStartInGroup bot_username:string start_parameter:string administrator_rights:chatAdministratorRights = InternalLinkType; +//@description The link is a link to a business chat. Use getBusinessChatLinkInfo with the provided link name to get information about the link, +//-then open received private chat and replace chat draft with the provided text +//@link_name Name of the link +internalLinkTypeBusinessChat link_name:string = InternalLinkType; + //@description The link is a link to the change phone number section of the app internalLinkTypeChangePhoneNumber = InternalLinkType; @@ -5991,8 +6048,8 @@ internalLinkTypeMessageDraft text:formattedText contains_link:Bool = InternalLin //-If empty, then onActivityResult method must be used to return response on Android, or the link tgbot{bot_user_id}://passport/success or tgbot{bot_user_id}://passport/cancel must be opened otherwise internalLinkTypePassportDataRequest bot_user_id:int53 scope:string public_key:string nonce:string callback_url:string = InternalLinkType; -//@description The link can be used to confirm ownership of a phone number to prevent account deletion. Call sendPhoneNumberConfirmationCode with the given hash and phone number to process the link. -//-If succeeded, call checkPhoneNumberConfirmationCode to check entered by the user code, or resendPhoneNumberConfirmationCode to resend it +//@description The link can be used to confirm ownership of a phone number to prevent account deletion. Call sendPhoneNumberCode with the given phone number and with phoneNumberCodeTypeConfirmOwnership with the given hash to process the link. +//-If succeeded, call checkPhoneNumberCode to check entered by the user code, or resendPhoneNumberCode to resend it //@hash Hash value from the link //@phone_number Phone number value from the link internalLinkTypePhoneNumberConfirmation hash:string phone_number:string = InternalLinkType; @@ -6019,9 +6076,11 @@ internalLinkTypePrivacyAndSecuritySettings = InternalLinkType; internalLinkTypeProxy server:string port:int32 type:ProxyType = InternalLinkType; //@description The link is a link to a chat by its username. Call searchPublicChat with the given chat username to process the link -//-If the chat is found, open its profile information screen or the chat itself +//-If the chat is found, open its profile information screen or the chat itself. +//-If draft text isn't empty and the chat is a private chat, then put the draft text in the input field //@chat_username Username of the chat -internalLinkTypePublicChat chat_username:string = InternalLinkType; +//@draft_text Draft text for message to send in the chat +internalLinkTypePublicChat chat_username:string draft_text:string = InternalLinkType; //@description The link can be used to login the current user on another device, but it must be scanned from QR-code using in-app camera. An alert similar to //-"This code can be used to allow someone to log in to your Telegram account. To confirm Telegram login, please go to Settings > Devices > Scan QR and scan the code" needs to be shown @@ -6065,9 +6124,10 @@ internalLinkTypeUnknownDeepLink link:string = InternalLinkType; internalLinkTypeUnsupportedProxy = InternalLinkType; //@description The link is a link to a user by its phone number. Call searchUserByPhoneNumber with the given phone number to process the link. -//-If the user is found, then call createPrivateChat and open the chat +//-If the user is found, then call createPrivateChat and open the chat. If draft text isn't empty, then put the draft text in the input field //@phone_number Phone number of the user -internalLinkTypeUserPhoneNumber phone_number:string = InternalLinkType; +//@draft_text Draft text for message to send in the chat +internalLinkTypeUserPhoneNumber phone_number:string draft_text:string = InternalLinkType; //@description The link is a link to a user by a temporary token. Call searchUserByToken with the given token to process the link. //-If the user is found, then call createPrivateChat and open the chat @@ -6112,7 +6172,7 @@ chatBoostLink link:string is_public:Bool = ChatBoostLink; chatBoostLinkInfo is_public:Bool chat_id:int53 = ChatBoostLinkInfo; -//@class BlockList @description Describes a type of a block list +//@class BlockList @description Describes a type of block list //@description The main block list that disallows writing messages to the current user, receiving their status and photo, viewing of stories, and some other actions blockListMain = BlockList; @@ -6125,7 +6185,7 @@ blockListStories = BlockList; filePart data:bytes = FilePart; -//@class FileType @description Represents the type of a file +//@class FileType @description Represents the type of file //@description The data is not a file fileTypeNone = FileType; @@ -6217,7 +6277,7 @@ storageStatisticsFast files_size:int53 file_count:int32 database_size:int53 lang databaseStatistics statistics:string = DatabaseStatistics; -//@class NetworkType @description Represents the type of a network +//@class NetworkType @description Represents the type of network //@description The network is not available networkTypeNone = NetworkType; @@ -6357,7 +6417,7 @@ foundPosition position:int32 = FoundPosition; foundPositions total_count:int32 positions:vector = FoundPositions; -//@class TMeUrlType @description Describes the type of a URL linking to an internal Telegram entity +//@class TMeUrlType @description Describes the type of URL linking to an internal Telegram entity //@description A URL linking to a user @user_id Identifier of the user tMeUrlTypeUser user_id:int53 = TMeUrlType; @@ -6442,7 +6502,7 @@ textParseModeMarkdown version:int32 = TextParseMode; textParseModeHTML = TextParseMode; -//@class ProxyType @description Describes the type of a proxy server +//@class ProxyType @description Describes the type of proxy server //@description A SOCKS5 proxy server @username Username for logging in; may be empty @password Password for logging in; may be empty proxyTypeSocks5 username:string password:string = ProxyType; @@ -6497,7 +6557,7 @@ statisticalGraphAsync token:string = StatisticalGraph; statisticalGraphError error_message:string = StatisticalGraph; -//@class ChatStatisticsObjectType @description Describes type of an object, for which statistics are provided +//@class ChatStatisticsObjectType @description Describes type of object, for which statistics are provided //@description Describes a message sent in the chat @message_id Message identifier chatStatisticsObjectTypeMessage message_id:int53 = ChatStatisticsObjectType; @@ -6579,6 +6639,16 @@ chatStatisticsSupergroup period:dateRange member_count:statisticalValue message_ chatStatisticsChannel period:dateRange member_count:statisticalValue mean_message_view_count:statisticalValue mean_message_share_count:statisticalValue mean_message_reaction_count:statisticalValue mean_story_view_count:statisticalValue mean_story_share_count:statisticalValue mean_story_reaction_count:statisticalValue enabled_notifications_percentage:double member_count_graph:StatisticalGraph join_graph:StatisticalGraph mute_graph:StatisticalGraph view_count_by_hour_graph:StatisticalGraph view_count_by_source_graph:StatisticalGraph join_by_source_graph:StatisticalGraph language_graph:StatisticalGraph message_interaction_graph:StatisticalGraph message_reaction_graph:StatisticalGraph story_interaction_graph:StatisticalGraph story_reaction_graph:StatisticalGraph instant_view_interaction_graph:StatisticalGraph recent_interactions:vector = ChatStatistics; +//@description A detailed statistics about revenue earned from sponsored messages in a chat +//@revenue_by_hour_graph A graph containing amount of revenue in a given hour +//@revenue_graph A graph containing amount of revenue +//@cryptocurrency Cryptocurrency in which revenue is calculated +//@cryptocurrency_total_amount Total amount of the cryptocurrency earned, in the smallest units of the cryptocurrency +//@cryptocurrency_balance_amount Amount of the cryptocurrency that isn't withdrawn yet, in the smallest units of the cryptocurrency +//@cryptocurrency_available_amount Amount of the cryptocurrency available for withdrawal, in the smallest units of the cryptocurrency +//@usd_rate Current conversion rate of the cryptocurrency to USD +chatRevenueStatistics revenue_by_hour_graph:StatisticalGraph revenue_graph:StatisticalGraph cryptocurrency:string cryptocurrency_total_amount:int64 cryptocurrency_balance_amount:int64 cryptocurrency_available_amount:int64 usd_rate:double = ChatRevenueStatistics; + //@description A detailed statistics about a message //@message_interaction_graph A graph containing number of message views and shares //@message_reaction_graph A graph containing number of message reactions @@ -6590,6 +6660,48 @@ messageStatistics message_interaction_graph:StatisticalGraph message_reaction_gr storyStatistics story_interaction_graph:StatisticalGraph story_reaction_graph:StatisticalGraph = StoryStatistics; +//@class ChatRevenueWithdrawalState @description Describes state of a chat revenue withdrawal + +//@description Withdrawal is pending +chatRevenueWithdrawalStatePending = ChatRevenueWithdrawalState; + +//@description Withdrawal was completed +//@date Point in time (Unix timestamp) when the withdrawal was completed +//@url The URL where the withdrawal transaction can be viewed +chatRevenueWithdrawalStateCompleted date:int32 url:string = ChatRevenueWithdrawalState; + +//@description Withdrawal has_failed +chatRevenueWithdrawalStateFailed = ChatRevenueWithdrawalState; + + +//@class ChatRevenueTransactionType @description Describes type of transaction for revenue earned from sponsored messages in a chat + +//@description Describes earnings from sponsored messages in a chat in some time frame +//@start_date Point in time (Unix timestamp) when the earnings started +//@end_date Point in time (Unix timestamp) when the earnings ended +chatRevenueTransactionTypeEarnings start_date:int32 end_date:int32 = ChatRevenueTransactionType; + +//@description Describes a withdrawal of earnings +//@withdrawal_date Point in time (Unix timestamp) when the earnings withdrawal started +//@provider Name of the payment provider +//@state State of the withdrawal +chatRevenueTransactionTypeWithdrawal withdrawal_date:int32 provider:string state:ChatRevenueWithdrawalState = ChatRevenueTransactionType; + +//@description Describes a refund for failed withdrawal of earnings +//@refund_date Point in time (Unix timestamp) when the transaction was refunded +//@provider Name of the payment provider +chatRevenueTransactionTypeRefund refund_date:int32 provider:string = ChatRevenueTransactionType; + +//@description Contains a chat revenue transactions +//@cryptocurrency Cryptocurrency in which revenue is calculated +//@cryptocurrency_amount The withdrawn amount, in the smallest units of the cryptocurrency +//@type Type of the transaction +chatRevenueTransaction cryptocurrency:string cryptocurrency_amount:int64 type:ChatRevenueTransactionType = ChatRevenueTransaction; + +//@description Contains a list of chat revenue transactions @total_count Total number of transactions @transactions List of transactions +chatRevenueTransactions total_count:int32 transactions:vector = ChatRevenueTransactions; + + //@description A point on a Cartesian plane @x The point's first coordinate @y The point's second coordinate point x:double y:double = Point; @@ -6627,6 +6739,19 @@ botCommandScopeChatAdministrators chat_id:int53 = BotCommandScope; botCommandScopeChatMember chat_id:int53 user_id:int53 = BotCommandScope; +//@class PhoneNumberCodeType @description Describes type of the request for which a code is sent to a phone number + +//@description Checks ownership of a new phone number to change the user's authentication phone number; for official Android and iOS applications only. +phoneNumberCodeTypeChange = PhoneNumberCodeType; + +//@description Verifies ownership of a phone number to be added to the user's Telegram Passport +phoneNumberCodeTypeVerify = PhoneNumberCodeType; + +//@description Confirms ownership of a phone number to prevent account deletion while handling links of the type internalLinkTypePhoneNumberConfirmation +//@hash Hash value from the link +phoneNumberCodeTypeConfirmOwnership hash:string = PhoneNumberCodeType; + + //@class Update @description Contains notifications about data changes //@description The user authorization state has changed @authorization_state New authorization state @@ -6730,6 +6855,9 @@ updateChatReadOutbox chat_id:int53 last_read_outbox_message_id:int53 = Update; //@description The chat action bar was changed @chat_id Chat identifier @action_bar The new value of the action bar; may be null updateChatActionBar chat_id:int53 action_bar:ChatActionBar = Update; +//@description The bar for managing business bot was changed in a chat @chat_id Chat identifier @business_bot_manage_bar The new value of the business bot manage bar; may be null +updateChatBusinessBotManageBar chat_id:int53 business_bot_manage_bar:businessBotManageBar = Update; + //@description The chat available reactions were changed @chat_id Chat identifier @available_reactions The new reactions, available in the chat updateChatAvailableReactions chat_id:int53 available_reactions:ChatAvailableReactions = Update; @@ -7088,12 +7216,14 @@ updateAnimationSearchParameters provider:string emojis:vector = Update; //@description The list of suggested to the user actions has changed @added_actions Added suggested actions @removed_actions Removed suggested actions updateSuggestedActions added_actions:vector removed_actions:vector = Update; +//@description Download or upload file speed for the user was limited, but it can be restored by subscription to Telegram Premium. The notification can be postponed until a being downloaded or uploaded file is visible to the user +//-Use getOption("premium_download_speedup") or getOption("premium_upload_speedup") to get expected speedup after subscription to Telegram Premium +//@is_upload True, if upload speed was limited; false, if download speed was limited +updateSpeedLimitNotification is_upload:Bool = Update; + //@description The list of contacts that had birthdays recently or will have birthday soon has changed @close_birthday_users List of contact users with close birthday updateContactCloseBirthdays close_birthday_users:vector = Update; -//@description Adding users to a chat has failed because of their privacy settings. An invite link can be shared with the users if appropriate @chat_id Chat identifier @user_ids Identifiers of users, which weren't added because of their privacy settings -updateAddChatMembersPrivacyForbidden chat_id:int53 user_ids:vector = Update; - //@description Autosave settings for some type of chats were updated @scope Type of chats for which autosave settings were updated @settings The new autosave settings; may be null if the settings are reset to default updateAutosaveSettings scope:AutosaveSettingsScope settings:scopeAutosaveSettings = Update; @@ -7539,7 +7669,7 @@ getChatSimilarChats chat_id:int53 = Chats; //@return_local Pass true to get the number of chats without sending network requests, or -1 if the number of chats is unknown locally getChatSimilarChatCount chat_id:int53 return_local:Bool = Count; -//@description Informs TDLib that a chat was opened from the list of similar chats. The method is independent from openChat and closeChat methods +//@description Informs TDLib that a chat was opened from the list of similar chats. The method is independent of openChat and closeChat methods //@chat_id Identifier of the original chat, which similar chats were requested //@opened_chat_id Identifier of the opened chat openChatSimilarChat chat_id:int53 opened_chat_id:int53 = Ok; @@ -8040,6 +8170,35 @@ loadQuickReplyShortcutMessages shortcut_id:int32 = Ok; //@message_ids Unique identifiers of the messages deleteQuickReplyShortcutMessages shortcut_id:int32 message_ids:vector = Ok; +//@description Adds a message to a quick reply shortcut. If shortcut doesn't exist and there are less than getOption("quick_reply_shortcut_count_max") shortcuts, then a new shortcut is created. +//-The shortcut must not contain more than getOption("quick_reply_shortcut_message_count_max") messages after adding the new message. Returns the added message +//@shortcut_name Name of the target shortcut +//@reply_to_message_id Identifier of a quick reply message in the same shortcut to be replied; pass 0 if none +//@input_message_content The content of the message to be added; inputMessagePoll, inputMessageForwarded and inputMessageLocation with live_period aren't supported +addQuickReplyShortcutMessage shortcut_name:string reply_to_message_id:int53 input_message_content:InputMessageContent = QuickReplyMessage; + +//@description Adds a message to a quick reply shortcut via inline bot. If shortcut doesn't exist and there are less than getOption("quick_reply_shortcut_count_max") shortcuts, then a new shortcut is created. +//-The shortcut must not contain more than getOption("quick_reply_shortcut_message_count_max") messages after adding the new message. Returns the added message +//@shortcut_name Name of the target shortcut +//@reply_to_message_id Identifier of a quick reply message in the same shortcut to be replied; pass 0 if none +//@query_id Identifier of the inline query +//@result_id Identifier of the inline query result +//@hide_via_bot Pass true to hide the bot, via which the message is sent. Can be used only for bots getOption("animation_search_bot_username"), getOption("photo_search_bot_username"), and getOption("venue_search_bot_username") +addQuickReplyShortcutInlineQueryResultMessage shortcut_name:string reply_to_message_id:int53 query_id:int64 result_id:string hide_via_bot:Bool = QuickReplyMessage; + +//@description Readds quick reply messages which failed to add. Can be called only for messages for which messageSendingStateFailed.can_retry is true and after specified in messageSendingStateFailed.retry_after time passed. +//-If a message is readded, the corresponding failed to send message is deleted. Returns the sent messages in the same order as the message identifiers passed in message_ids. If a message can't be readded, null will be returned instead of the message +//@shortcut_name Name of the target shortcut +//@message_ids Identifiers of the quick reply messages to readd. Message identifiers must be in a strictly increasing order +readdQuickReplyShortcutMessages shortcut_name:string message_ids:vector = QuickReplyMessages; + +//@description Asynchronously edits the text, media or caption of a quick reply message. Use quickReplyMessage.can_be_edited to check whether a message can be edited. +//-Text message can be edited only to a text message. The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa +//@shortcut_id Unique identifier of the quick reply shortcut with the message +//@message_id Identifier of the message +//@input_message_content New content of the message. Must be one of the following types: inputMessageText, inputMessageAnimation, inputMessageAudio, inputMessageDocument, inputMessagePhoto or inputMessageVideo +editQuickReplyMessage shortcut_id:int32 message_id:int53 input_message_content:InputMessageContent = Ok; + //@description Returns list of custom emojis, which can be used as forum topic icon by all users getForumTopicDefaultIcons = Stickers; @@ -8423,7 +8582,7 @@ clickAnimatedEmojiMessage chat_id:int53 message_id:int53 = Sticker; //@description Returns an HTTPS or a tg: link with the given type. Can be called before authorization @type Expected type of the link @is_http Pass true to create an HTTPS link (only available for some link types); pass false to create a tg: link getInternalLink type:InternalLinkType is_http:Bool = HttpUrl; -//@description Returns information about the type of an internal link. Returns a 404 error if the link is not internal. Can be called before authorization @link The link +//@description Returns information about the type of internal link. Returns a 404 error if the link is not internal. Can be called before authorization @link The link getInternalLinkType link:string = InternalLinkType; //@description Returns information about an action to be done when the current user clicks an external link. Don't use this method for links from secret chats if web page preview is disabled in secret chats @link The link @@ -8460,11 +8619,11 @@ createSupergroupChat supergroup_id:int53 force:Bool = Chat; //@description Returns an existing chat corresponding to a known secret chat @secret_chat_id Secret chat identifier createSecretChat secret_chat_id:int32 = Chat; -//@description Creates a new basic group and sends a corresponding messageBasicGroupChatCreate. Returns the newly created chat +//@description Creates a new basic group and sends a corresponding messageBasicGroupChatCreate. Returns information about the newly created chat //@user_ids Identifiers of users to be added to the basic group; may be empty to create a basic group without other members //@title Title of the new basic group; 1-128 characters //@message_auto_delete_time Message auto-delete time value, in seconds; must be from 0 up to 365 * 86400 and be divisible by 86400. If 0, then messages aren't deleted automatically -createNewBasicGroupChat user_ids:vector title:string message_auto_delete_time:int32 = Chat; +createNewBasicGroupChat user_ids:vector title:string message_auto_delete_time:int32 = CreatedBasicGroupChat; //@description Creates a new supergroup or channel and sends a corresponding messageSupergroupChatCreate. Returns the newly created chat //@title Title of the new chat; 1-128 characters @@ -8697,16 +8856,17 @@ joinChat chat_id:int53 = Ok; //@description Removes the current user from chat members. Private and secret chats can't be left using this method @chat_id Chat identifier leaveChat chat_id:int53 = Ok; -//@description Adds a new member to a chat; requires can_invite_users member right. Members can't be added to private or secret chats +//@description Adds a new member to a chat; requires can_invite_users member right. Members can't be added to private or secret chats. Returns information about members that weren't added //@chat_id Chat identifier //@user_id Identifier of the user //@forward_limit The number of earlier messages from the chat to be forwarded to the new member; up to 100. Ignored for supergroups and channels, or if the added user is a bot -addChatMember chat_id:int53 user_id:int53 forward_limit:int32 = Ok; +addChatMember chat_id:int53 user_id:int53 forward_limit:int32 = FailedToAddMembers; -//@description Adds multiple new members to a chat; requires can_invite_users member right. Currently, this method is only available for supergroups and channels. This method can't be used to join a chat. Members can't be added to a channel if it has more than 200 members +//@description Adds multiple new members to a chat; requires can_invite_users member right. Currently, this method is only available for supergroups and channels. +//-This method can't be used to join a chat. Members can't be added to a channel if it has more than 200 members. Returns information about members that weren't added //@chat_id Chat identifier //@user_ids Identifiers of the users to be added to the chat. The maximum number of added users is 20 for supergroups and 100 for channels -addChatMembers chat_id:int53 user_ids:vector = Ok; +addChatMembers chat_id:int53 user_ids:vector = FailedToAddMembers; //@description Changes the status of a chat member; requires can_invite_users member right to add a chat member, can_promote_members administrator right to change administrator rights of the member, //-and can_restrict_members administrator right to change restrictions of a user. This function is currently not suitable for transferring chat ownership; use transferChatOwnership instead. @@ -8933,7 +9093,7 @@ getStoryPublicForwards story_sender_chat_id:int53 story_id:int32 offset:string l //@level Chat boost level getChatBoostLevelFeatures is_channel:Bool level:int32 = ChatBoostLevelFeatures; -//@description Returns list of features available on the first 10 chat boost levels; this is an offline request +//@description Returns list of features available for different chat boost levels; this is an offline request //@is_channel Pass true to get the list of features for channels; pass false to get the list of features for supergroups getChatBoostFeatures is_channel:Bool = ChatBoostFeatures; @@ -9054,7 +9214,7 @@ readFilePart file_id:int32 offset:int53 count:int53 = FilePart; deleteFile file_id:int32 = Ok; //@description Adds a file from a message to the list of file downloads. Download progress and completion of the download will be notified through updateFile updates. -//-If message database is used, the list of file downloads is persistent across application restarts. The downloading is independent from download using downloadFile, i.e. it continues if downloadFile is canceled or is used to download a part of the file +//-If message database is used, the list of file downloads is persistent across application restarts. The downloading is independent of download using downloadFile, i.e. it continues if downloadFile is canceled or is used to download a part of the file //@file_id Identifier of the file to download //@chat_id Chat identifier of the message with the file //@message_id Message identifier @@ -9444,6 +9604,9 @@ getAllStickerEmojis sticker_type:StickerType query:string chat_id:int53 return_o //@limit The maximum number of stickers to be returned; 0-100 searchStickers sticker_type:StickerType emojis:string limit:int32 = Stickers; +//@description Returns greeting stickers from regular sticker sets that can be used for the start page of other users +getGreetingStickers = Stickers; + //@description Returns premium stickers from regular sticker sets @limit The maximum number of stickers to be returned; 0-100 getPremiumStickers limit:int32 = Stickers; @@ -9641,19 +9804,25 @@ setBusinessGreetingMessageSettings greeting_message_settings:businessGreetingMes //@description Changes the business away message settings of the current user. Requires Telegram Business subscription @away_message_settings The new settings for the away message of the business; pass null to disable the away message setBusinessAwayMessageSettings away_message_settings:businessAwayMessageSettings = Ok; -//@description Changes the business intro of the current user. Requires Telegram Business subscription @intro The new intro of the business; pass null to remove the intro -setBusinessIntro intro:inputBusinessIntro = Ok; +//@description Changes the business start page of the current user. Requires Telegram Business subscription @start_page The new start page of the business; pass null to remove custom start page +setBusinessStartPage start_page:inputBusinessStartPage = Ok; -//@description Changes the phone number of the user and sends an authentication code to the user's new phone number; for official Android and iOS applications only. On success, returns information about the sent code -//@phone_number The new phone number of the user in international format + +//@description Sends a code to the specified phone number. Aborts previous phone number verification if there was one. On success, returns information about the sent code +//@phone_number The phone number, in international format //@settings Settings for the authentication of the user's phone number; pass null to use default settings -changePhoneNumber phone_number:string settings:phoneNumberAuthenticationSettings = AuthenticationCodeInfo; +//@type Type of the request for which the code is sent +sendPhoneNumberCode phone_number:string settings:phoneNumberAuthenticationSettings type:PhoneNumberCodeType = AuthenticationCodeInfo; -//@description Resends the authentication code sent to confirm a new phone number for the current user. Works only if the previously received authenticationCodeInfo next_code_type was not null and the server-specified timeout has passed -resendChangePhoneNumberCode = AuthenticationCodeInfo; +//@description Sends Firebase Authentication SMS to the specified phone number. Works only when received a code of the type authenticationCodeTypeFirebaseAndroid or authenticationCodeTypeFirebaseIos +//@token SafetyNet Attestation API token for the Android application, or secret from push notification for the iOS application +sendPhoneNumberFirebaseSms token:string = Ok; -//@description Checks the authentication code sent to confirm a new phone number of the user @code Authentication code to check -checkChangePhoneNumberCode code:string = Ok; +//@description Resends the authentication code sent to a phone number. Works only if the previously received authenticationCodeInfo next_code_type was not null and the server-specified timeout has passed +resendPhoneNumberCode = AuthenticationCodeInfo; + +//@description Check the authentication code and completes the request for which the code was sent if appropriate @code Authentication code to check +checkPhoneNumberCode code:string = Ok; //@description Returns the business bot that is connected to the current user account. Returns a 404 error if there is no connected bot @@ -9665,6 +9834,31 @@ setBusinessConnectedBot bot:businessConnectedBot = Ok; //@description Deletes the business bot that is connected to the current user account @bot_user_id Unique user identifier for the bot deleteBusinessConnectedBot bot_user_id:int53 = Ok; +//@description Pauses or resumes the connected business bot in a specific chat @chat_id Chat identifier @is_paused Pass true to pause the connected bot in the chat; pass false to resume the bot +toggleBusinessConnectedBotChatIsPaused chat_id:int53 is_paused:Bool = Ok; + +//@description Removes the connected business bot from a specific chat by adding the chat to businessRecipients.excluded_chat_ids @chat_id Chat identifier +removeBusinessConnectedBotFromChat chat_id:int53 = Ok; + + +//@description Returns business chat links created for the current account +getBusinessChatLinks = BusinessChatLinks; + +//@description Creates a business chat link for the current account. Requires Telegram Business subscription. There can be up to getOption("business_chat_link_count_max") links created. Returns the created link +//@link_info Information about the link to create +createBusinessChatLink link_info:inputBusinessChatLink = BusinessChatLink; + +//@description Edits a business chat link of the current account. Requires Telegram Business subscription. Returns the edited link +//@link The link to edit +//@link_info New description of the link +editBusinessChatLink link:string link_info:inputBusinessChatLink = BusinessChatLink; + +//@description Deletes a business chat link of the current account @link The link to delete +deleteBusinessChatLink link:string = Ok; + +//@description Returns information about a business chat link @link_name Name of the link +getBusinessChatLinkInfo link_name:string = BusinessChatLinkInfo; + //@description Returns an HTTPS link, which can be used to get information about the current user getUserLink = UserLink; @@ -9840,6 +10034,11 @@ toggleSupergroupJoinByRequest supergroup_id:int53 join_by_request:Bool = Ok; //@description Toggles whether the message history of a supergroup is available to new members; requires can_change_info member right @supergroup_id The identifier of the supergroup @is_all_history_available The new value of is_all_history_available toggleSupergroupIsAllHistoryAvailable supergroup_id:int53 is_all_history_available:Bool = Ok; +//@description Toggles whether sponsored messages are shown in the channel chat; requires owner privileges in the channel. The chat must have at least chatBoostFeatures.min_sponsored_message_disable_boost_level boost level to disable sponsored messages +//@supergroup_id The identifier of the channel +//@can_have_sponsored_messages The new value of can_have_sponsored_messages +toggleSupergroupCanHaveSponsoredMessages supergroup_id:int53 can_have_sponsored_messages:Bool = Ok; + //@description Toggles whether non-administrators can receive only administrators and bots using getSupergroupMembers or searchChatMembers. Can be called only if supergroupFullInfo.can_hide_members == true //@supergroup_id Identifier of the supergroup //@has_hidden_members New value of has_hidden_members @@ -9868,7 +10067,7 @@ reportSupergroupAntiSpamFalsePositive supergroup_id:int53 message_id:int53 = Ok; //@supergroup_id Identifier of the supergroup or channel //@filter The type of users to return; pass null to use supergroupMembersFilterRecent //@offset Number of users to skip -//@limit The maximum number of users be returned; up to 200 +//@limit The maximum number of users to be returned; up to 200 getSupergroupMembers supergroup_id:int53 filter:SupergroupMembersFilter offset:int32 limit:int32 = ChatMembers; @@ -10086,6 +10285,21 @@ reportChatPhoto chat_id:int53 file_id:int32 reason:ReportReason text:string = Ok reportMessageReactions chat_id:int53 message_id:int53 sender_id:MessageSender = Ok; +//@description Returns detailed revenue statistics about a chat. Currently, this method can be used only for channels if supergroupFullInfo.can_get_revenue_statistics == true @chat_id Chat identifier @is_dark Pass true if a dark theme is used by the application +getChatRevenueStatistics chat_id:int53 is_dark:Bool = ChatRevenueStatistics; + +//@description Returns URL for chat revenue withdrawal; requires owner privileges in the chat. Currently, this method can be used only for channels if supergroupFullInfo.can_get_revenue_statistics == true and getOption("can_withdraw_chat_revenue") +//@chat_id Chat identifier +//@password The 2-step verification password of the current user +getChatRevenueWithdrawalUrl chat_id:int53 password:string = HttpUrl; + +//@description Returns list of revenue transactions for a chat. Currently, this method can be used only for channels if supergroupFullInfo.can_get_revenue_statistics == true +//@chat_id Chat identifier +//@offset Number of transactions to skip +//@limit The maximum number of transactions to be returned; up to 200 +getChatRevenueTransactions chat_id:int53 offset:int32 limit:int32 = ChatRevenueTransactions; + + //@description Returns detailed statistics about a chat. Currently, this method can be used only for supergroups and channels. Can be used only if supergroupFullInfo.can_get_statistics == true @chat_id Chat identifier @is_dark Pass true if a dark theme is used by the application getChatStatistics chat_id:int53 is_dark:Bool = ChatStatistics; @@ -10185,18 +10399,6 @@ setPassportElementErrors user_id:int53 errors:vector getPreferredCountryLanguage country_code:string = Text; -//@description Sends a code to verify a phone number to be added to a user's Telegram Passport -//@phone_number The phone number of the user, in international format -//@settings Settings for the authentication of the user's phone number; pass null to use default settings -sendPhoneNumberVerificationCode phone_number:string settings:phoneNumberAuthenticationSettings = AuthenticationCodeInfo; - -//@description Resends the code to verify a phone number to be added to a user's Telegram Passport -resendPhoneNumberVerificationCode = AuthenticationCodeInfo; - -//@description Checks the phone number verification code for Telegram Passport @code Verification code to check -checkPhoneNumberVerificationCode code:string = Ok; - - //@description Sends a code to verify an email address to be added to a user's Telegram Passport @email_address Email address sendEmailAddressVerificationCode email_address:string = EmailAddressAuthenticationCodeInfo; @@ -10225,19 +10427,6 @@ getPassportAuthorizationFormAvailableElements authorization_form_id:int32 passwo sendPassportAuthorizationForm authorization_form_id:int32 types:vector = Ok; -//@description Sends phone number confirmation code to handle links of the type internalLinkTypePhoneNumberConfirmation -//@hash Hash value from the link -//@phone_number Phone number value from the link -//@settings Settings for the authentication of the user's phone number; pass null to use default settings -sendPhoneNumberConfirmationCode hash:string phone_number:string settings:phoneNumberAuthenticationSettings = AuthenticationCodeInfo; - -//@description Resends phone number confirmation code -resendPhoneNumberConfirmationCode = AuthenticationCodeInfo; - -//@description Checks phone number confirmation code @code Confirmation code to check -checkPhoneNumberConfirmationCode code:string = Ok; - - //@description Informs the server about the number of pending bot updates if they haven't been processed for a long time; for bots only @pending_update_count The number of pending updates @error_message The last error message setBotUpdatesStatus pending_update_count:int32 error_message:string = Ok; From 3052b01106492bffb9bec57f17cf96e08f113817 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Wed, 15 May 2024 05:13:27 +0800 Subject: [PATCH 17/54] Update to TDLib 1.8.29 --- client/function.go | 288 +++++++++++++-- client/type.go | 819 ++++++++++++++++++++++++++---------------- client/unmarshaler.go | 330 ++++++++++++----- data/td_api.tl | 318 ++++++++++------ 4 files changed, 1206 insertions(+), 549 deletions(-) diff --git a/client/function.go b/client/function.go index bf2bef8..67cdd45 100755 --- a/client/function.go +++ b/client/function.go @@ -208,7 +208,7 @@ type CheckAuthenticationEmailCodeRequest struct { Code EmailAddressAuthentication `json:"code"` } -// Checks the authentication of a email address. Works only when the current authorization state is authorizationStateWaitEmailCode +// Checks the authentication of an email address. Works only when the current authorization state is authorizationStateWaitEmailCode func (client *Client) CheckAuthenticationEmailCode(req *CheckAuthenticationEmailCodeRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -461,6 +461,32 @@ func (client *Client) SendAuthenticationFirebaseSms(req *SendAuthenticationFireb return UnmarshalOk(result.Data) } +type ReportAuthenticationCodeMissingRequest struct { + // Current mobile network code + MobileNetworkCode string `json:"mobile_network_code"` +} + +// Reports that authentication code wasn't delivered via SMS; for official mobile apps only. Works only when the current authorization state is authorizationStateWaitCode +func (client *Client) ReportAuthenticationCodeMissing(req *ReportAuthenticationCodeMissingRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reportAuthenticationCodeMissing", + }, + Data: map[string]interface{}{ + "mobile_network_code": req.MobileNetworkCode, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type CheckAuthenticationBotTokenRequest struct { // The bot token Token string `json:"token"` @@ -677,7 +703,7 @@ type SetLoginEmailAddressRequest struct { NewLoginEmailAddress string `json:"new_login_email_address"` } -// Changes the login email address of the user. The email address can be changed only if the current user already has login email and passwordState.login_email_address_pattern is non-empty. The change will not be applied until the new login email address is confirmed with checkLoginEmailAddressCode. To use Apple ID/Google ID instead of a email address, call checkLoginEmailAddressCode directly +// Changes the login email address of the user. The email address can be changed only if the current user already has login email and passwordState.login_email_address_pattern is non-empty. The change will not be applied until the new login email address is confirmed with checkLoginEmailAddressCode. To use Apple ID/Google ID instead of an email address, call checkLoginEmailAddressCode directly func (client *Client) SetLoginEmailAddress(req *SetLoginEmailAddressRequest) (*EmailAddressAuthenticationCodeInfo, error) { result, err := client.Send(Request{ meta: meta{ @@ -1792,6 +1818,25 @@ func (client *Client) SearchChatsNearby(req *SearchChatsNearbyRequest) (*ChatsNe return UnmarshalChatsNearby(result.Data) } +// Returns a list of channel chats recommended to the current user +func (client *Client) GetRecommendedChats() (*Chats, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getRecommendedChats", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChats(result.Data) +} + type GetChatSimilarChatsRequest struct { // Identifier of the target chat; must be an identifier of a channel chat ChatId int64 `json:"chat_id"` @@ -2641,6 +2686,8 @@ func (client *Client) SearchChatMessages(req *SearchChatMessagesRequest) (*Found type SearchMessagesRequest struct { // Chat list in which to search messages; pass null to search in all chats regardless of their chat list. Only Main and Archive chat lists are supported ChatList ChatList `json:"chat_list"` + // Pass true to search only for messages in channels + OnlyInChannels bool `json:"only_in_channels"` // Query to search for Query string `json:"query"` // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results @@ -2663,6 +2710,7 @@ func (client *Client) SearchMessages(req *SearchMessagesRequest) (*FoundMessages }, Data: map[string]interface{}{ "chat_list": req.ChatList, + "only_in_channels": req.OnlyInChannels, "query": req.Query, "offset": req.Offset, "limit": req.Limit, @@ -3483,7 +3531,7 @@ type GetChatAvailableMessageSendersRequest struct { ChatId int64 `json:"chat_id"` } -// Returns list of message sender identifiers, which can be used to send messages in a chat +// Returns the list of message sender identifiers, which can be used to send messages in a chat func (client *Client) GetChatAvailableMessageSenders(req *GetChatAvailableMessageSendersRequest) (*ChatMessageSenders, error) { result, err := client.Send(Request{ meta: meta{ @@ -4000,6 +4048,8 @@ type EditMessageLiveLocationRequest struct { ReplyMarkup ReplyMarkup `json:"reply_markup"` // New location content of the message; pass null to stop sharing the live location Location *Location `json:"location"` + // New time relative to the message send date, for which the location can be updated, in seconds. If 0x7FFFFFFF specified, then the location can be updated forever. Otherwise, must not exceed the current live_period by more than a day, and the live location expiration date must remain in the next 90 days. Pass 0 to keep the current live_period + LivePeriod int32 `json:"live_period"` // The new direction in which the location moves, in degrees; 1-360. Pass 0 if unknown Heading int32 `json:"heading"` // The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled @@ -4017,6 +4067,7 @@ func (client *Client) EditMessageLiveLocation(req *EditMessageLiveLocationReques "message_id": req.MessageId, "reply_markup": req.ReplyMarkup, "location": req.Location, + "live_period": req.LivePeriod, "heading": req.Heading, "proximity_alert_radius": req.ProximityAlertRadius, }, @@ -4173,6 +4224,8 @@ type EditInlineMessageLiveLocationRequest struct { ReplyMarkup ReplyMarkup `json:"reply_markup"` // New location content of the message; pass null to stop sharing the live location Location *Location `json:"location"` + // New time relative to the message send date, for which the location can be updated, in seconds. If 0x7FFFFFFF specified, then the location can be updated forever. Otherwise, must not exceed the current live_period by more than a day, and the live location expiration date must remain in the next 90 days. Pass 0 to keep the current live_period + LivePeriod int32 `json:"live_period"` // The new direction in which the location moves, in degrees; 1-360. Pass 0 if unknown Heading int32 `json:"heading"` // The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled @@ -4189,6 +4242,7 @@ func (client *Client) EditInlineMessageLiveLocation(req *EditInlineMessageLiveLo "inline_message_id": req.InlineMessageId, "reply_markup": req.ReplyMarkup, "location": req.Location, + "live_period": req.LivePeriod, "heading": req.Heading, "proximity_alert_radius": req.ProximityAlertRadius, }, @@ -4670,6 +4724,38 @@ func (client *Client) AddQuickReplyShortcutInlineQueryResultMessage(req *AddQuic return UnmarshalQuickReplyMessage(result.Data) } +type AddQuickReplyShortcutMessageAlbumRequest struct { + // Name of the target shortcut + ShortcutName string `json:"shortcut_name"` + // Identifier of a quick reply message in the same shortcut to be replied; pass 0 if none + ReplyToMessageId int64 `json:"reply_to_message_id"` + // Contents of messages to be sent. At most 10 messages can be added to an album + InputMessageContents []InputMessageContent `json:"input_message_contents"` +} + +// Adds 2-10 messages grouped together into an album to a quick reply shortcut. Currently, only audio, document, photo and video messages can be grouped into an album. Documents and audio files can be only grouped in an album with messages of the same type. Returns sent messages +func (client *Client) AddQuickReplyShortcutMessageAlbum(req *AddQuickReplyShortcutMessageAlbumRequest) (*QuickReplyMessages, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addQuickReplyShortcutMessageAlbum", + }, + Data: map[string]interface{}{ + "shortcut_name": req.ShortcutName, + "reply_to_message_id": req.ReplyToMessageId, + "input_message_contents": req.InputMessageContents, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalQuickReplyMessages(result.Data) +} + type ReaddQuickReplyShortcutMessagesRequest struct { // Name of the target shortcut ShortcutName string `json:"shortcut_name"` @@ -4731,7 +4817,7 @@ func (client *Client) EditQuickReplyMessage(req *EditQuickReplyMessageRequest) ( return UnmarshalOk(result.Data) } -// Returns list of custom emojis, which can be used as forum topic icon by all users +// Returns the list of custom emojis, which can be used as forum topic icon by all users func (client *Client) GetForumTopicDefaultIcons() (*Stickers, error) { result, err := client.Send(Request{ meta: meta{ @@ -6004,6 +6090,25 @@ func (client *Client) HideSuggestedAction(req *HideSuggestedActionRequest) (*Ok, return UnmarshalOk(result.Data) } +// Hides the list of contacts that have close birthdays for 24 hours +func (client *Client) HideContactCloseBirthdays() (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "hideContactCloseBirthdays", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type GetBusinessConnectionRequest struct { // Identifier of the business connection to return ConnectionId string `json:"connection_id"` @@ -9402,7 +9507,7 @@ func (client *Client) GetSavedNotificationSound(req *GetSavedNotificationSoundRe return UnmarshalNotificationSounds(result.Data) } -// Returns list of saved notification sounds. If a sound isn't in the list, then default sound needs to be used +// Returns the list of saved notification sounds. If a sound isn't in the list, then default sound needs to be used func (client *Client) GetSavedNotificationSounds() (*NotificationSounds, error) { result, err := client.Send(Request{ meta: meta{ @@ -9480,7 +9585,7 @@ type GetChatNotificationSettingsExceptionsRequest struct { CompareSound bool `json:"compare_sound"` } -// Returns list of chats with non-default notification settings for new messages +// Returns the list of chats with non-default notification settings for new messages func (client *Client) GetChatNotificationSettingsExceptions(req *GetChatNotificationSettingsExceptionsRequest) (*Chats, error) { result, err := client.Send(Request{ meta: meta{ @@ -9557,7 +9662,33 @@ func (client *Client) SetScopeNotificationSettings(req *SetScopeNotificationSett return UnmarshalOk(result.Data) } -// Resets all notification settings to their default values. By default, all chats are unmuted and message previews are shown +type SetReactionNotificationSettingsRequest struct { + // The new notification settings for reactions + NotificationSettings *ReactionNotificationSettings `json:"notification_settings"` +} + +// Changes notification settings for reactions +func (client *Client) SetReactionNotificationSettings(req *SetReactionNotificationSettingsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setReactionNotificationSettings", + }, + Data: map[string]interface{}{ + "notification_settings": req.NotificationSettings, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Resets all chat and scope notification settings to their default values. By default, all chats are unmuted and message previews are shown func (client *Client) ResetAllNotificationSettings() (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -9777,7 +9908,7 @@ type SendStoryRequest struct { // Full identifier of the original story, which content was used to create the story FromStoryFullId *StoryFullId `json:"from_story_full_id"` // Pass true to keep the story accessible after expiration - IsPinned bool `json:"is_pinned"` + IsPostedToChatPage bool `json:"is_posted_to_chat_page"` // Pass true if the content of the story must be protected from forwarding and screenshotting ProtectContent bool `json:"protect_content"` } @@ -9796,7 +9927,7 @@ func (client *Client) SendStory(req *SendStoryRequest) (*Story, error) { "privacy_settings": req.PrivacySettings, "active_period": req.ActivePeriod, "from_story_full_id": req.FromStoryFullId, - "is_pinned": req.IsPinned, + "is_posted_to_chat_page": req.IsPostedToChatPage, "protect_content": req.ProtectContent, }, }) @@ -9878,25 +10009,25 @@ func (client *Client) SetStoryPrivacySettings(req *SetStoryPrivacySettingsReques return UnmarshalOk(result.Data) } -type ToggleStoryIsPinnedRequest struct { +type ToggleStoryIsPostedToChatPageRequest struct { // Identifier of the chat that posted the story StorySenderChatId int64 `json:"story_sender_chat_id"` // Identifier of the story StoryId int32 `json:"story_id"` // Pass true to make the story accessible after expiration; pass false to make it private - IsPinned bool `json:"is_pinned"` + IsPostedToChatPage bool `json:"is_posted_to_chat_page"` } -// Toggles whether a story is accessible after expiration. Can be called only if story.can_toggle_is_pinned == true -func (client *Client) ToggleStoryIsPinned(req *ToggleStoryIsPinnedRequest) (*Ok, error) { +// Toggles whether a story is accessible after expiration. Can be called only if story.can_toggle_is_posted_to_chat_page == true +func (client *Client) ToggleStoryIsPostedToChatPage(req *ToggleStoryIsPostedToChatPageRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "toggleStoryIsPinned", + Type: "toggleStoryIsPostedToChatPage", }, Data: map[string]interface{}{ "story_sender_chat_id": req.StorySenderChatId, "story_id": req.StoryId, - "is_pinned": req.IsPinned, + "is_posted_to_chat_page": req.IsPostedToChatPage, }, }) if err != nil { @@ -9939,7 +10070,7 @@ func (client *Client) DeleteStory(req *DeleteStoryRequest) (*Ok, error) { return UnmarshalOk(result.Data) } -// Returns list of chats with non-default notification settings for stories +// Returns the list of chats with non-default notification settings for stories func (client *Client) GetStoryNotificationSettingsExceptions() (*Chats, error) { result, err := client.Send(Request{ meta: meta{ @@ -10039,20 +10170,20 @@ func (client *Client) GetChatActiveStories(req *GetChatActiveStoriesRequest) (*C return UnmarshalChatActiveStories(result.Data) } -type GetChatPinnedStoriesRequest struct { +type GetChatPostedToChatPageStoriesRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` - // Identifier of the story starting from which stories must be returned; use 0 to get results from the last story + // Identifier of the story starting from which stories must be returned; use 0 to get results from pinned and the newest story FromStoryId int32 `json:"from_story_id"` // The maximum number of stories to be returned For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit Limit int32 `json:"limit"` } -// Returns the list of pinned stories posted by the given chat. The stories are returned in a reverse chronological order (i.e., in order of decreasing story_id). For optimal performance, the number of returned stories is chosen by TDLib -func (client *Client) GetChatPinnedStories(req *GetChatPinnedStoriesRequest) (*Stories, error) { +// Returns the list of stories that posted by the given chat to its chat page. If from_story_id == 0, then pinned stories are returned first. Then, stories are returned in a reverse chronological order (i.e., in order of decreasing story_id). For optimal performance, the number of returned stories is chosen by TDLib +func (client *Client) GetChatPostedToChatPageStories(req *GetChatPostedToChatPageStoriesRequest) (*Stories, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getChatPinnedStories", + Type: "getChatPostedToChatPageStories", }, Data: map[string]interface{}{ "chat_id": req.ChatId, @@ -10103,6 +10234,35 @@ func (client *Client) GetChatArchivedStories(req *GetChatArchivedStoriesRequest) return UnmarshalStories(result.Data) } +type SetChatPinnedStoriesRequest struct { + // Identifier of the chat that posted the stories + ChatId int64 `json:"chat_id"` + // New list of pinned stories. All stories must be posted to the chat page first. There can be up to getOption("pinned_story_count_max") pinned stories on a chat page + StoryIds []int32 `json:"story_ids"` +} + +// Changes the list of pinned stories on a chat page; requires can_edit_stories right in the chat +func (client *Client) SetChatPinnedStories(req *SetChatPinnedStoriesRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setChatPinnedStories", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "story_ids": req.StoryIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type OpenStoryRequest struct { // The identifier of the sender of the opened story StorySenderChatId int64 `json:"story_sender_chat_id"` @@ -10403,7 +10563,7 @@ type GetChatBoostLevelFeaturesRequest struct { Level int32 `json:"level"` } -// Returns list of features available on the specific chat boost level; this is an offline request +// Returns the list of features available on the specific chat boost level; this is an offline request func (client *Client) GetChatBoostLevelFeatures(req *GetChatBoostLevelFeaturesRequest) (*ChatBoostLevelFeatures, error) { result, err := client.Send(Request{ meta: meta{ @@ -10430,7 +10590,7 @@ type GetChatBoostFeaturesRequest struct { IsChannel bool `json:"is_channel"` } -// Returns list of features available for different chat boost levels; this is an offline request +// Returns the list of features available for different chat boost levels; this is an offline request func (client *Client) GetChatBoostFeatures(req *GetChatBoostFeaturesRequest) (*ChatBoostFeatures, error) { result, err := client.Send(Request{ meta: meta{ @@ -10588,7 +10748,7 @@ type GetChatBoostsRequest struct { Limit int32 `json:"limit"` } -// Returns list of boosts applied to a chat; requires administrator rights in the chat +// Returns the list of boosts applied to a chat; requires administrator rights in the chat func (client *Client) GetChatBoosts(req *GetChatBoostsRequest) (*FoundChatBoosts, error) { result, err := client.Send(Request{ meta: meta{ @@ -10619,7 +10779,7 @@ type GetUserChatBoostsRequest struct { UserId int64 `json:"user_id"` } -// Returns list of boosts applied to a chat by a given user; requires administrator rights in the chat; for bots only +// Returns the list of boosts applied to a chat by a given user; requires administrator rights in the chat; for bots only func (client *Client) GetUserChatBoosts(req *GetUserChatBoostsRequest) (*FoundChatBoosts, error) { result, err := client.Send(Request{ meta: meta{ @@ -10966,7 +11126,7 @@ type PreliminaryUploadFileRequest struct { Priority int32 `json:"priority"` } -// Preliminary uploads a file to the cloud before sending it in a message, which can be useful for uploading of being recorded voice and video notes. Updates updateFile will be used to notify about upload progress and successful completion of the upload. The file will not have a persistent remote identifier until it is sent in a message +// Preliminary uploads a file to the cloud before sending it in a message, which can be useful for uploading of being recorded voice and video notes. In all other cases there is no need to preliminary upload a file. Updates updateFile will be used to notify about upload progress. The upload will not be completed until the file is sent in a message func (client *Client) PreliminaryUploadFile(req *PreliminaryUploadFileRequest) (*File, error) { result, err := client.Send(Request{ meta: meta{ @@ -11590,7 +11750,7 @@ type GetChatInviteLinkCountsRequest struct { ChatId int64 `json:"chat_id"` } -// Returns list of chat administrators with number of their invite links. Requires owner privileges in the chat +// Returns the list of chat administrators with number of their invite links. Requires owner privileges in the chat func (client *Client) GetChatInviteLinkCounts(req *GetChatInviteLinkCountsRequest) (*ChatInviteLinkCounts, error) { result, err := client.Send(Request{ meta: meta{ @@ -12154,7 +12314,7 @@ type GetVideoChatAvailableParticipantsRequest struct { ChatId int64 `json:"chat_id"` } -// Returns list of participant identifiers, on whose behalf a video chat in the chat can be joined +// Returns the list of participant identifiers, on whose behalf a video chat in the chat can be joined func (client *Client) GetVideoChatAvailableParticipants(req *GetVideoChatAvailableParticipantsRequest) (*MessageSenders, error) { result, err := client.Send(Request{ meta: meta{ @@ -14324,7 +14484,7 @@ type GetCustomEmojiStickersRequest struct { CustomEmojiIds []JsonInt64 `json:"custom_emoji_ids"` } -// Returns list of custom emoji stickers by their identifiers. Stickers are returned in arbitrary order. Only found stickers are returned +// Returns the list of custom emoji stickers by their identifiers. Stickers are returned in arbitrary order. Only found stickers are returned func (client *Client) GetCustomEmojiStickers(req *GetCustomEmojiStickersRequest) (*Stickers, error) { result, err := client.Send(Request{ meta: meta{ @@ -14958,6 +15118,32 @@ func (client *Client) SetLocation(req *SetLocationRequest) (*Ok, error) { return UnmarshalOk(result.Data) } +type ToggleHasSponsoredMessagesEnabledRequest struct { + // Pass true to enable sponsored messages for the current user; false to disable them + HasSponsoredMessagesEnabled bool `json:"has_sponsored_messages_enabled"` +} + +// Toggles whether the current user has sponsored messages enabled. The setting has no effect for users without Telegram Premium for which sponsored messages are always enabled +func (client *Client) ToggleHasSponsoredMessagesEnabled(req *ToggleHasSponsoredMessagesEnabledRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleHasSponsoredMessagesEnabled", + }, + Data: map[string]interface{}{ + "has_sponsored_messages_enabled": req.HasSponsoredMessagesEnabled, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type SetBusinessLocationRequest struct { // The new location of the business; pass null to remove the location Location *BusinessLocation `json:"location"` @@ -15146,6 +15332,32 @@ func (client *Client) SendPhoneNumberFirebaseSms(req *SendPhoneNumberFirebaseSms return UnmarshalOk(result.Data) } +type ReportPhoneNumberCodeMissingRequest struct { + // Current mobile network code + MobileNetworkCode string `json:"mobile_network_code"` +} + +// Reports that authentication code wasn't delivered via SMS to the specified phone number; for official mobile apps only +func (client *Client) ReportPhoneNumberCodeMissing(req *ReportPhoneNumberCodeMissingRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reportPhoneNumberCodeMissing", + }, + Data: map[string]interface{}{ + "mobile_network_code": req.MobileNetworkCode, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + // Resends the authentication code sent to a phone number. Works only if the previously received authenticationCodeInfo next_code_type was not null and the server-specified timeout has passed func (client *Client) ResendPhoneNumberCode() (*AuthenticationCodeInfo, error) { result, err := client.Send(Request{ @@ -15556,7 +15768,7 @@ type GetCommandsRequest struct { LanguageCode string `json:"language_code"` } -// Returns list of commands supported by the bot for the given user scope and language; for bots only +// Returns the list of commands supported by the bot for the given user scope and language; for bots only func (client *Client) GetCommands(req *GetCommandsRequest) (*BotCommands, error) { result, err := client.Send(Request{ meta: meta{ @@ -18001,7 +18213,7 @@ func (client *Client) GetAccountTtl() (*AccountTtl, error) { type DeleteAccountRequest struct { // The reason why the account was deleted; optional Reason string `json:"reason"` - // The 2-step verification password of the current user. If not specified, account deletion can be canceled within one week + // The 2-step verification password of the current user. If the current user isn't authorized, then an empty string can be passed and account deletion can be canceled within one week Password string `json:"password"` } @@ -18267,7 +18479,7 @@ type GetChatRevenueTransactionsRequest struct { Limit int32 `json:"limit"` } -// Returns list of revenue transactions for a chat. Currently, this method can be used only for channels if supergroupFullInfo.can_get_revenue_statistics == true +// Returns the list of revenue transactions for a chat. Currently, this method can be used only for channels if supergroupFullInfo.can_get_revenue_statistics == true func (client *Client) GetChatRevenueTransactions(req *GetChatRevenueTransactionsRequest) (*ChatRevenueTransactions, error) { result, err := client.Send(Request{ meta: meta{ @@ -20734,7 +20946,7 @@ func (client *Client) RemoveProxy(req *RemoveProxyRequest) (*Ok, error) { return UnmarshalOk(result.Data) } -// Returns list of proxies that are currently set up. Can be called before authorization +// Returns the list of proxies that are currently set up. Can be called before authorization func (client *Client) GetProxies() (*Proxies, error) { result, err := client.Send(Request{ meta: meta{ @@ -20927,7 +21139,7 @@ func GetLogVerbosityLevel() (*LogVerbosityLevel, error) { func (client *Client) GetLogVerbosityLevel() (*LogVerbosityLevel, error) { return GetLogVerbosityLevel()} -// Returns list of available TDLib internal log tags, for example, ["actor", "binlog", "connections", "notifications", "proxy"]. Can be called synchronously +// Returns the list of available TDLib internal log tags, for example, ["actor", "binlog", "connections", "notifications", "proxy"]. Can be called synchronously func GetLogTags() (*LogTags, error) { result, err := Execute(Request{ meta: meta{ @@ -20947,7 +21159,7 @@ func GetLogTags() (*LogTags, error) { } // deprecated -// Returns list of available TDLib internal log tags, for example, ["actor", "binlog", "connections", "notifications", "proxy"]. Can be called synchronously +// Returns the list of available TDLib internal log tags, for example, ["actor", "binlog", "connections", "notifications", "proxy"]. Can be called synchronously func (client *Client) GetLogTags() (*LogTags, error) { return GetLogTags()} @@ -21586,6 +21798,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateScopeNotificationSettings: return UnmarshalUpdateScopeNotificationSettings(result.Data) + case TypeUpdateReactionNotificationSettings: + return UnmarshalUpdateReactionNotificationSettings(result.Data) + case TypeUpdateNotification: return UnmarshalUpdateNotification(result.Data) @@ -21760,6 +21975,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateSavedMessagesTags: return UnmarshalUpdateSavedMessagesTags(result.Data) + case TypeUpdateChatRevenueAmount: + return UnmarshalUpdateChatRevenueAmount(result.Data) + case TypeUpdateSpeechRecognitionTrial: return UnmarshalUpdateSpeechRecognitionTrial(result.Data) diff --git a/client/type.go b/client/type.go index 3f7c343..6b44089 100755 --- a/client/type.go +++ b/client/type.go @@ -37,9 +37,9 @@ const ( ClassMessageReplyTo = "MessageReplyTo" ClassInputMessageReplyTo = "InputMessageReplyTo" ClassMessageSource = "MessageSource" - ClassMessageSponsorType = "MessageSponsorType" ClassReportChatSponsoredMessageResult = "ReportChatSponsoredMessageResult" ClassNotificationSettingsScope = "NotificationSettingsScope" + ClassReactionNotificationSource = "ReactionNotificationSource" ClassChatType = "ChatType" ClassChatList = "ChatList" ClassChatSource = "ChatSource" @@ -73,6 +73,7 @@ const ( ClassSearchMessagesFilter = "SearchMessagesFilter" ClassChatAction = "ChatAction" ClassUserStatus = "UserStatus" + ClassEmojiCategorySource = "EmojiCategorySource" ClassEmojiCategoryType = "EmojiCategoryType" ClassStoryAreaType = "StoryAreaType" ClassInputStoryAreaType = "InputStoryAreaType" @@ -284,6 +285,7 @@ const ( ClassFoundFileDownloads = "FoundFileDownloads" ClassChatNotificationSettings = "ChatNotificationSettings" ClassScopeNotificationSettings = "ScopeNotificationSettings" + ClassReactionNotificationSettings = "ReactionNotificationSettings" ClassDraftMessage = "DraftMessage" ClassChatFolderIcon = "ChatFolderIcon" ClassChatFolder = "ChatFolder" @@ -501,6 +503,7 @@ const ( ClassChatStatisticsMessageSenderInfo = "ChatStatisticsMessageSenderInfo" ClassChatStatisticsAdministratorActionsInfo = "ChatStatisticsAdministratorActionsInfo" ClassChatStatisticsInviterInfo = "ChatStatisticsInviterInfo" + ClassChatRevenueAmount = "ChatRevenueAmount" ClassChatRevenueStatistics = "ChatRevenueStatistics" ClassMessageStatistics = "MessageStatistics" ClassStoryStatistics = "StoryStatistics" @@ -525,6 +528,8 @@ const ( TypeOk = "ok" TypeAuthenticationCodeTypeTelegramMessage = "authenticationCodeTypeTelegramMessage" TypeAuthenticationCodeTypeSms = "authenticationCodeTypeSms" + TypeAuthenticationCodeTypeSmsWord = "authenticationCodeTypeSmsWord" + TypeAuthenticationCodeTypeSmsPhrase = "authenticationCodeTypeSmsPhrase" TypeAuthenticationCodeTypeCall = "authenticationCodeTypeCall" TypeAuthenticationCodeTypeFlashCall = "authenticationCodeTypeFlashCall" TypeAuthenticationCodeTypeMissedCall = "authenticationCodeTypeMissedCall" @@ -773,11 +778,6 @@ const ( TypeMessageSourceNotification = "messageSourceNotification" TypeMessageSourceScreenshot = "messageSourceScreenshot" TypeMessageSourceOther = "messageSourceOther" - TypeMessageSponsorTypeBot = "messageSponsorTypeBot" - TypeMessageSponsorTypeWebApp = "messageSponsorTypeWebApp" - TypeMessageSponsorTypePublicChannel = "messageSponsorTypePublicChannel" - TypeMessageSponsorTypePrivateChannel = "messageSponsorTypePrivateChannel" - TypeMessageSponsorTypeWebsite = "messageSponsorTypeWebsite" TypeMessageSponsor = "messageSponsor" TypeSponsoredMessage = "sponsoredMessage" TypeSponsoredMessages = "sponsoredMessages" @@ -795,6 +795,10 @@ const ( TypeNotificationSettingsScopeChannelChats = "notificationSettingsScopeChannelChats" TypeChatNotificationSettings = "chatNotificationSettings" TypeScopeNotificationSettings = "scopeNotificationSettings" + TypeReactionNotificationSourceNone = "reactionNotificationSourceNone" + TypeReactionNotificationSourceContacts = "reactionNotificationSourceContacts" + TypeReactionNotificationSourceAll = "reactionNotificationSourceAll" + TypeReactionNotificationSettings = "reactionNotificationSettings" TypeDraftMessage = "draftMessage" TypeChatTypePrivate = "chatTypePrivate" TypeChatTypeBasicGroup = "chatTypeBasicGroup" @@ -1203,9 +1207,12 @@ const ( TypeStickerSetInfo = "stickerSetInfo" TypeStickerSets = "stickerSets" TypeTrendingStickerSets = "trendingStickerSets" + TypeEmojiCategorySourceSearch = "emojiCategorySourceSearch" + TypeEmojiCategorySourcePremium = "emojiCategorySourcePremium" TypeEmojiCategory = "emojiCategory" TypeEmojiCategories = "emojiCategories" TypeEmojiCategoryTypeDefault = "emojiCategoryTypeDefault" + TypeEmojiCategoryTypeRegularStickers = "emojiCategoryTypeRegularStickers" TypeEmojiCategoryTypeEmojiStatus = "emojiCategoryTypeEmojiStatus" TypeEmojiCategoryTypeChatPhoto = "emojiCategoryTypeChatPhoto" TypeStoryAreaPosition = "storyAreaPosition" @@ -1797,6 +1804,7 @@ const ( TypeSuggestedActionSubscribeToAnnualPremium = "suggestedActionSubscribeToAnnualPremium" TypeSuggestedActionGiftPremiumForChristmas = "suggestedActionGiftPremiumForChristmas" TypeSuggestedActionSetBirthdate = "suggestedActionSetBirthdate" + TypeSuggestedActionExtendPremium = "suggestedActionExtendPremium" TypeCount = "count" TypeText = "text" TypeSeconds = "seconds" @@ -1823,6 +1831,7 @@ const ( TypeChatStatisticsInviterInfo = "chatStatisticsInviterInfo" TypeChatStatisticsSupergroup = "chatStatisticsSupergroup" TypeChatStatisticsChannel = "chatStatisticsChannel" + TypeChatRevenueAmount = "chatRevenueAmount" TypeChatRevenueStatistics = "chatRevenueStatistics" TypeMessageStatistics = "messageStatistics" TypeStoryStatistics = "storyStatistics" @@ -1903,6 +1912,7 @@ const ( TypeUpdateQuickReplyShortcutMessages = "updateQuickReplyShortcutMessages" TypeUpdateForumTopicInfo = "updateForumTopicInfo" TypeUpdateScopeNotificationSettings = "updateScopeNotificationSettings" + TypeUpdateReactionNotificationSettings = "updateReactionNotificationSettings" TypeUpdateNotification = "updateNotification" TypeUpdateNotificationGroup = "updateNotificationGroup" TypeUpdateActiveNotifications = "updateActiveNotifications" @@ -1961,6 +1971,7 @@ const ( TypeUpdateActiveEmojiReactions = "updateActiveEmojiReactions" TypeUpdateDefaultReactionType = "updateDefaultReactionType" TypeUpdateSavedMessagesTags = "updateSavedMessagesTags" + TypeUpdateChatRevenueAmount = "updateChatRevenueAmount" TypeUpdateSpeechRecognitionTrial = "updateSpeechRecognitionTrial" TypeUpdateDiceEmojis = "updateDiceEmojis" TypeUpdateAnimatedEmojiMessageClicked = "updateAnimatedEmojiMessageClicked" @@ -2009,12 +2020,12 @@ type AuthenticationCodeType interface { AuthenticationCodeTypeType() string } -// Contains authentication data for a email address +// Contains authentication data for an email address type EmailAddressAuthentication interface { EmailAddressAuthenticationType() string } -// Describes reset state of a email address +// Describes reset state of an email address type EmailAddressResetState interface { EmailAddressResetStateType() string } @@ -2154,11 +2165,6 @@ type MessageSource interface { MessageSourceType() string } -// Describes type of message sponsor -type MessageSponsorType interface { - MessageSponsorTypeType() string -} - // Describes result of sponsored message report type ReportChatSponsoredMessageResult interface { ReportChatSponsoredMessageResultType() string @@ -2169,6 +2175,11 @@ type NotificationSettingsScope interface { NotificationSettingsScopeType() string } +// Describes sources of reactions for which notifications will be shown +type ReactionNotificationSource interface { + ReactionNotificationSourceType() string +} + // Describes the type of chat type ChatType interface { ChatTypeType() string @@ -2334,6 +2345,11 @@ type UserStatus interface { UserStatusType() string } +// Describes source of stickers for an emoji category +type EmojiCategorySource interface { + EmojiCategorySourceType() string +} + // Describes type of emoji category type EmojiCategoryType interface { EmojiCategoryTypeType() string @@ -2765,7 +2781,7 @@ func (*Ok) GetType() string { return TypeOk } -// An authentication code is delivered via a private Telegram message, which can be viewed from another active session +// A digit-only authentication code is delivered via a private Telegram message, which can be viewed from another active session type AuthenticationCodeTypeTelegramMessage struct { meta // Length of the code @@ -2792,7 +2808,7 @@ func (*AuthenticationCodeTypeTelegramMessage) AuthenticationCodeTypeType() strin return TypeAuthenticationCodeTypeTelegramMessage } -// An authentication code is delivered via an SMS message to the specified phone number; applications may not receive this type of code +// A digit-only authentication code is delivered via an SMS message to the specified phone number; non-official applications may not receive this type of code type AuthenticationCodeTypeSms struct { meta // Length of the code @@ -2819,7 +2835,61 @@ func (*AuthenticationCodeTypeSms) AuthenticationCodeTypeType() string { return TypeAuthenticationCodeTypeSms } -// An authentication code is delivered via a phone call to the specified phone number +// An authentication code is a word delivered via an SMS message to the specified phone number; non-official applications may not receive this type of code +type AuthenticationCodeTypeSmsWord struct { + meta + // The first letters of the word if known + FirstLetter string `json:"first_letter"` +} + +func (entity *AuthenticationCodeTypeSmsWord) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AuthenticationCodeTypeSmsWord + + return json.Marshal((*stub)(entity)) +} + +func (*AuthenticationCodeTypeSmsWord) GetClass() string { + return ClassAuthenticationCodeType +} + +func (*AuthenticationCodeTypeSmsWord) GetType() string { + return TypeAuthenticationCodeTypeSmsWord +} + +func (*AuthenticationCodeTypeSmsWord) AuthenticationCodeTypeType() string { + return TypeAuthenticationCodeTypeSmsWord +} + +// An authentication code is a phrase from multiple words delivered via an SMS message to the specified phone number; non-official applications may not receive this type of code +type AuthenticationCodeTypeSmsPhrase struct { + meta + // The first word of the phrase if known + FirstWord string `json:"first_word"` +} + +func (entity *AuthenticationCodeTypeSmsPhrase) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AuthenticationCodeTypeSmsPhrase + + return json.Marshal((*stub)(entity)) +} + +func (*AuthenticationCodeTypeSmsPhrase) GetClass() string { + return ClassAuthenticationCodeType +} + +func (*AuthenticationCodeTypeSmsPhrase) GetType() string { + return TypeAuthenticationCodeTypeSmsPhrase +} + +func (*AuthenticationCodeTypeSmsPhrase) AuthenticationCodeTypeType() string { + return TypeAuthenticationCodeTypeSmsPhrase +} + +// A digit-only authentication code is delivered via a phone call to the specified phone number type AuthenticationCodeTypeCall struct { meta // Length of the code @@ -2902,7 +2972,7 @@ func (*AuthenticationCodeTypeMissedCall) AuthenticationCodeTypeType() string { return TypeAuthenticationCodeTypeMissedCall } -// An authentication code is delivered to https://fragment.com. The user must be logged in there via a wallet owning the phone number's NFT +// A digit-only authentication code is delivered to https://fragment.com. The user must be logged in there via a wallet owning the phone number's NFT type AuthenticationCodeTypeFragment struct { meta // URL to open to receive the code @@ -2931,7 +3001,7 @@ func (*AuthenticationCodeTypeFragment) AuthenticationCodeTypeType() string { return TypeAuthenticationCodeTypeFragment } -// An authentication code is delivered via Firebase Authentication to the official Android application +// A digit-only authentication code is delivered via Firebase Authentication to the official Android application type AuthenticationCodeTypeFirebaseAndroid struct { meta // Nonce to pass to the SafetyNet Attestation API @@ -2960,7 +3030,7 @@ func (*AuthenticationCodeTypeFirebaseAndroid) AuthenticationCodeTypeType() strin return TypeAuthenticationCodeTypeFirebaseAndroid } -// An authentication code is delivered via Firebase Authentication to the official iOS application +// A digit-only authentication code is delivered via Firebase Authentication to the official iOS application type AuthenticationCodeTypeFirebaseIos struct { meta // Receipt of successful application token validation to compare with receipt from push notification @@ -4685,8 +4755,8 @@ func (closedVectorPath *ClosedVectorPath) UnmarshalJSON(data []byte) error { // Describes one answer option of a poll type PollOption struct { meta - // Option text; 1-100 characters - Text string `json:"text"` + // Option text; 1-100 characters. Only custom emoji entities are allowed + Text *FormattedText `json:"text"` // Number of voters for this option, available only for closed or voted polls VoterCount int32 `json:"voter_count"` // The percentage of votes for this option; 0-100 @@ -5088,14 +5158,14 @@ func (videoNote *VideoNote) UnmarshalJSON(data []byte) error { return nil } -// Describes a voice note. The voice note must be encoded with the Opus codec, and stored inside an OGG container. Voice notes can have only a single audio channel +// Describes a voice note type VoiceNote struct { meta // Duration of the voice note, in seconds; as defined by the sender Duration int32 `json:"duration"` // A waveform representation of the voice note in 5-bit format Waveform []byte `json:"waveform"` - // MIME type of the file; as defined by the sender + // MIME type of the file; as defined by the sender. Usually, one of "audio/ogg" for Opus in an OGG container, "audio/mpeg" for an MP3 audio, or "audio/mp4" for an M4A audio MimeType string `json:"mime_type"` // Result of speech recognition in the voice note; may be null SpeechRecognitionResult SpeechRecognitionResult `json:"speech_recognition_result"` @@ -5337,8 +5407,8 @@ type Poll struct { meta // Unique poll identifier Id JsonInt64 `json:"id"` - // Poll question; 1-300 characters - Question string `json:"question"` + // Poll question; 1-300 characters. Only custom emoji entities are allowed + Question *FormattedText `json:"question"` // List of poll answer options Options []*PollOption `json:"options"` // Total number of voters, participating in the poll @@ -5376,7 +5446,7 @@ func (*Poll) GetType() string { func (poll *Poll) UnmarshalJSON(data []byte) error { var tmp struct { Id JsonInt64 `json:"id"` - Question string `json:"question"` + Question *FormattedText `json:"question"` Options []*PollOption `json:"options"` TotalVoterCount int32 `json:"total_voter_count"` RecentVoterIds []json.RawMessage `json:"recent_voter_ids"` @@ -6173,9 +6243,9 @@ func (inputBusinessStartPage *InputBusinessStartPage) UnmarshalJSON(data []byte) // Describes an interval of time when the business is open type BusinessOpeningHoursInterval struct { meta - // The first minute of the interval since start of the week; 0-7*24*60 + // The minute's sequence number in a week, starting on Monday, marking the start of the time interval during which the business is open; 0-7*24*60 StartMinute int32 `json:"start_minute"` - // The first minute after the end of the interval since start of the week; 1-8*24*60 + // The minute's sequence number in a week, starting on Monday, marking the end of the time interval during which the business is open; 1-8*24*60 EndMinute int32 `json:"end_minute"` } @@ -6227,6 +6297,12 @@ type BusinessInfo struct { Location *BusinessLocation `json:"location"` // Opening hours of the business; may be null if none. The hours are guaranteed to be valid and has already been split by week days OpeningHours *BusinessOpeningHours `json:"opening_hours"` + // Opening hours of the business in the local time; may be null if none. The hours are guaranteed to be valid and has already been split by week days. Local time zone identifier will be empty. An updateUserFullInfo update is not triggered when value of this field changes + LocalOpeningHours *BusinessOpeningHours `json:"local_opening_hours"` + // Time left before the business will open the next time, in seconds; 0 if unknown. An updateUserFullInfo update is not triggered when value of this field changes + NextOpenIn int32 `json:"next_open_in"` + // Time left before the business will close the next time, in seconds; 0 if unknown. An updateUserFullInfo update is not triggered when value of this field changes + NextCloseIn int32 `json:"next_close_in"` // The greeting message; may be null if none or the Business account is not of the current user GreetingMessageSettings *BusinessGreetingMessageSettings `json:"greeting_message_settings"` // The away message; may be null if none or the Business account is not of the current user @@ -6768,7 +6844,7 @@ type ChatAdministratorRights struct { CanManageVideoChats bool `json:"can_manage_video_chats"` // True, if the administrator can create new chat stories, or edit and delete posted stories; applicable to supergroups and channels only CanPostStories bool `json:"can_post_stories"` - // True, if the administrator can edit stories posted by other users, pin stories and access story archive; applicable to supergroups and channels only + // True, if the administrator can edit stories posted by other users, post stories to the chat page, pin chat stories, and access story archive; applicable to supergroups and channels only CanEditStories bool `json:"can_edit_stories"` // True, if the administrator can delete stories posted by other users; applicable to supergroups and channels only CanDeleteStories bool `json:"can_delete_stories"` @@ -7650,8 +7726,10 @@ type UserFullInfo struct { HasPrivateForwards bool `json:"has_private_forwards"` // True, if voice and video notes can't be sent or forwarded to the user HasRestrictedVoiceAndVideoNoteMessages bool `json:"has_restricted_voice_and_video_note_messages"` - // True, if the user has pinned stories - HasPinnedStories bool `json:"has_pinned_stories"` + // True, if the user has posted to profile stories + HasPostedToProfileStories bool `json:"has_posted_to_profile_stories"` + // True, if the user always enabled sponsored messages; known only for the current user + HasSponsoredMessagesEnabled bool `json:"has_sponsored_messages_enabled"` // True, if the current user needs to explicitly allow to share their phone number with the user when the method addContact is used NeedPhoneNumberPrivacyException bool `json:"need_phone_number_privacy_exception"` // True, if the user set chat background for both chat users and it wasn't reverted yet @@ -7699,7 +7777,8 @@ func (userFullInfo *UserFullInfo) UnmarshalJSON(data []byte) error { HasPrivateCalls bool `json:"has_private_calls"` HasPrivateForwards bool `json:"has_private_forwards"` HasRestrictedVoiceAndVideoNoteMessages bool `json:"has_restricted_voice_and_video_note_messages"` - HasPinnedStories bool `json:"has_pinned_stories"` + HasPostedToProfileStories bool `json:"has_posted_to_profile_stories"` + HasSponsoredMessagesEnabled bool `json:"has_sponsored_messages_enabled"` NeedPhoneNumberPrivacyException bool `json:"need_phone_number_privacy_exception"` SetChatBackground bool `json:"set_chat_background"` Bio *FormattedText `json:"bio"` @@ -7724,7 +7803,8 @@ func (userFullInfo *UserFullInfo) UnmarshalJSON(data []byte) error { userFullInfo.HasPrivateCalls = tmp.HasPrivateCalls userFullInfo.HasPrivateForwards = tmp.HasPrivateForwards userFullInfo.HasRestrictedVoiceAndVideoNoteMessages = tmp.HasRestrictedVoiceAndVideoNoteMessages - userFullInfo.HasPinnedStories = tmp.HasPinnedStories + userFullInfo.HasPostedToProfileStories = tmp.HasPostedToProfileStories + userFullInfo.HasSponsoredMessagesEnabled = tmp.HasSponsoredMessagesEnabled userFullInfo.NeedPhoneNumberPrivacyException = tmp.NeedPhoneNumberPrivacyException userFullInfo.SetChatBackground = tmp.SetChatBackground userFullInfo.Bio = tmp.Bio @@ -8982,7 +9062,7 @@ type Supergroup struct { Date int32 `json:"date"` // Status of the current user in the supergroup or channel; custom title will always be empty Status ChatMemberStatus `json:"status"` - // Number of members in the supergroup or channel; 0 if unknown. Currently, it is guaranteed to be known only if the supergroup or channel was received through getChatSimilarChats, getChatsToSendStories, getCreatedPublicChats, getGroupsInCommon, getInactiveSupergroupChats, getSuitableDiscussionChats, getUserPrivacySettingRules, getVideoChatAvailableParticipants, searchChatsNearby, searchPublicChats, or in chatFolderInviteLinkInfo.missing_chat_ids, or for public chats in which where sent messages and posted stories from publicForwards, or for public chats in which where sent messages from getMessagePublicForwards response + // Number of members in the supergroup or channel; 0 if unknown. Currently, it is guaranteed to be known only if the supergroup or channel was received through getChatSimilarChats, getChatsToSendStories, getCreatedPublicChats, getGroupsInCommon, getInactiveSupergroupChats, getRecommendedChats, getSuitableDiscussionChats, getUserPrivacySettingRules, getVideoChatAvailableParticipants, searchChatsNearby, searchPublicChats, or in chatFolderInviteLinkInfo.missing_chat_ids, or in userFullInfo.personal_chat_id, or for chats with messages or stories from publicForwards MemberCount int32 `json:"member_count"` // Approximate boost level for the chat BoostLevel int32 `json:"boost_level"` @@ -11152,215 +11232,13 @@ func (*MessageSourceOther) MessageSourceType() string { return TypeMessageSourceOther } -// The sponsor is a bot -type MessageSponsorTypeBot struct { - meta - // User identifier of the bot - BotUserId int64 `json:"bot_user_id"` - // An internal link to be opened when the sponsored message is clicked - Link InternalLinkType `json:"link"` -} - -func (entity *MessageSponsorTypeBot) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageSponsorTypeBot - - return json.Marshal((*stub)(entity)) -} - -func (*MessageSponsorTypeBot) GetClass() string { - return ClassMessageSponsorType -} - -func (*MessageSponsorTypeBot) GetType() string { - return TypeMessageSponsorTypeBot -} - -func (*MessageSponsorTypeBot) MessageSponsorTypeType() string { - return TypeMessageSponsorTypeBot -} - -func (messageSponsorTypeBot *MessageSponsorTypeBot) UnmarshalJSON(data []byte) error { - var tmp struct { - BotUserId int64 `json:"bot_user_id"` - Link json.RawMessage `json:"link"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - messageSponsorTypeBot.BotUserId = tmp.BotUserId - - fieldLink, _ := UnmarshalInternalLinkType(tmp.Link) - messageSponsorTypeBot.Link = fieldLink - - return nil -} - -// The sponsor is a web app -type MessageSponsorTypeWebApp struct { - meta - // Web App title - WebAppTitle string `json:"web_app_title"` - // An internal link to be opened when the sponsored message is clicked - Link InternalLinkType `json:"link"` -} - -func (entity *MessageSponsorTypeWebApp) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageSponsorTypeWebApp - - return json.Marshal((*stub)(entity)) -} - -func (*MessageSponsorTypeWebApp) GetClass() string { - return ClassMessageSponsorType -} - -func (*MessageSponsorTypeWebApp) GetType() string { - return TypeMessageSponsorTypeWebApp -} - -func (*MessageSponsorTypeWebApp) MessageSponsorTypeType() string { - return TypeMessageSponsorTypeWebApp -} - -func (messageSponsorTypeWebApp *MessageSponsorTypeWebApp) UnmarshalJSON(data []byte) error { - var tmp struct { - WebAppTitle string `json:"web_app_title"` - Link json.RawMessage `json:"link"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - messageSponsorTypeWebApp.WebAppTitle = tmp.WebAppTitle - - fieldLink, _ := UnmarshalInternalLinkType(tmp.Link) - messageSponsorTypeWebApp.Link = fieldLink - - return nil -} - -// The sponsor is a public channel chat -type MessageSponsorTypePublicChannel struct { - meta - // Sponsor chat identifier - ChatId int64 `json:"chat_id"` - // An internal link to be opened when the sponsored message is clicked; may be null if the sponsor chat needs to be opened instead - Link InternalLinkType `json:"link"` -} - -func (entity *MessageSponsorTypePublicChannel) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageSponsorTypePublicChannel - - return json.Marshal((*stub)(entity)) -} - -func (*MessageSponsorTypePublicChannel) GetClass() string { - return ClassMessageSponsorType -} - -func (*MessageSponsorTypePublicChannel) GetType() string { - return TypeMessageSponsorTypePublicChannel -} - -func (*MessageSponsorTypePublicChannel) MessageSponsorTypeType() string { - return TypeMessageSponsorTypePublicChannel -} - -func (messageSponsorTypePublicChannel *MessageSponsorTypePublicChannel) UnmarshalJSON(data []byte) error { - var tmp struct { - ChatId int64 `json:"chat_id"` - Link json.RawMessage `json:"link"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - messageSponsorTypePublicChannel.ChatId = tmp.ChatId - - fieldLink, _ := UnmarshalInternalLinkType(tmp.Link) - messageSponsorTypePublicChannel.Link = fieldLink - - return nil -} - -// The sponsor is a private channel chat -type MessageSponsorTypePrivateChannel struct { - meta - // Title of the chat - Title string `json:"title"` - // Invite link for the channel - InviteLink string `json:"invite_link"` -} - -func (entity *MessageSponsorTypePrivateChannel) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageSponsorTypePrivateChannel - - return json.Marshal((*stub)(entity)) -} - -func (*MessageSponsorTypePrivateChannel) GetClass() string { - return ClassMessageSponsorType -} - -func (*MessageSponsorTypePrivateChannel) GetType() string { - return TypeMessageSponsorTypePrivateChannel -} - -func (*MessageSponsorTypePrivateChannel) MessageSponsorTypeType() string { - return TypeMessageSponsorTypePrivateChannel -} - -// The sponsor is a website -type MessageSponsorTypeWebsite struct { - meta - // URL of the website - Url string `json:"url"` - // Name of the website - Name string `json:"name"` -} - -func (entity *MessageSponsorTypeWebsite) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageSponsorTypeWebsite - - return json.Marshal((*stub)(entity)) -} - -func (*MessageSponsorTypeWebsite) GetClass() string { - return ClassMessageSponsorType -} - -func (*MessageSponsorTypeWebsite) GetType() string { - return TypeMessageSponsorTypeWebsite -} - -func (*MessageSponsorTypeWebsite) MessageSponsorTypeType() string { - return TypeMessageSponsorTypeWebsite -} - // Information about the sponsor of a message type MessageSponsor struct { meta - // Type of the sponsor - Type MessageSponsorType `json:"type"` + // URL of the sponsor to be opened when the message is clicked + Url string `json:"url"` // Photo of the sponsor; may be null if must not be shown - Photo *ChatPhotoInfo `json:"photo"` + Photo *Photo `json:"photo"` // Additional optional information about the sponsor to be shown along with the message Info string `json:"info"` } @@ -11381,27 +11259,6 @@ func (*MessageSponsor) GetType() string { return TypeMessageSponsor } -func (messageSponsor *MessageSponsor) UnmarshalJSON(data []byte) error { - var tmp struct { - Type json.RawMessage `json:"type"` - Photo *ChatPhotoInfo `json:"photo"` - Info string `json:"info"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - messageSponsor.Photo = tmp.Photo - messageSponsor.Info = tmp.Info - - fieldType, _ := UnmarshalMessageSponsorType(tmp.Type) - messageSponsor.Type = fieldType - - return nil -} - // Describes a sponsored message type SponsoredMessage struct { meta @@ -11415,8 +11272,14 @@ type SponsoredMessage struct { Content MessageContent `json:"content"` // Information about the sponsor of the message Sponsor *MessageSponsor `json:"sponsor"` - // If non-empty, text for the message action button + // Title of the sponsored message + Title string `json:"title"` + // Text for the message action button ButtonText string `json:"button_text"` + // Identifier of the accent color for title, button text and message background + AccentColorId int32 `json:"accent_color_id"` + // Identifier of a custom emoji to be shown on the message background; 0 if none + BackgroundCustomEmojiId JsonInt64 `json:"background_custom_emoji_id"` // If non-empty, additional information about the sponsored message to be shown along with the message AdditionalInfo string `json:"additional_info"` } @@ -11444,7 +11307,10 @@ func (sponsoredMessage *SponsoredMessage) UnmarshalJSON(data []byte) error { CanBeReported bool `json:"can_be_reported"` Content json.RawMessage `json:"content"` Sponsor *MessageSponsor `json:"sponsor"` + Title string `json:"title"` ButtonText string `json:"button_text"` + AccentColorId int32 `json:"accent_color_id"` + BackgroundCustomEmojiId JsonInt64 `json:"background_custom_emoji_id"` AdditionalInfo string `json:"additional_info"` } @@ -11457,7 +11323,10 @@ func (sponsoredMessage *SponsoredMessage) UnmarshalJSON(data []byte) error { sponsoredMessage.IsRecommended = tmp.IsRecommended sponsoredMessage.CanBeReported = tmp.CanBeReported sponsoredMessage.Sponsor = tmp.Sponsor + sponsoredMessage.Title = tmp.Title sponsoredMessage.ButtonText = tmp.ButtonText + sponsoredMessage.AccentColorId = tmp.AccentColorId + sponsoredMessage.BackgroundCustomEmojiId = tmp.BackgroundCustomEmojiId sponsoredMessage.AdditionalInfo = tmp.AdditionalInfo fieldContent, _ := UnmarshalMessageContent(tmp.Content) @@ -11897,6 +11766,135 @@ func (*ScopeNotificationSettings) GetType() string { return TypeScopeNotificationSettings } +// Notifications for reactions are disabled +type ReactionNotificationSourceNone struct{ + meta +} + +func (entity *ReactionNotificationSourceNone) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReactionNotificationSourceNone + + return json.Marshal((*stub)(entity)) +} + +func (*ReactionNotificationSourceNone) GetClass() string { + return ClassReactionNotificationSource +} + +func (*ReactionNotificationSourceNone) GetType() string { + return TypeReactionNotificationSourceNone +} + +func (*ReactionNotificationSourceNone) ReactionNotificationSourceType() string { + return TypeReactionNotificationSourceNone +} + +// Notifications for reactions are shown only for reactions from contacts +type ReactionNotificationSourceContacts struct{ + meta +} + +func (entity *ReactionNotificationSourceContacts) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReactionNotificationSourceContacts + + return json.Marshal((*stub)(entity)) +} + +func (*ReactionNotificationSourceContacts) GetClass() string { + return ClassReactionNotificationSource +} + +func (*ReactionNotificationSourceContacts) GetType() string { + return TypeReactionNotificationSourceContacts +} + +func (*ReactionNotificationSourceContacts) ReactionNotificationSourceType() string { + return TypeReactionNotificationSourceContacts +} + +// Notifications for reactions are shown for all reactions +type ReactionNotificationSourceAll struct{ + meta +} + +func (entity *ReactionNotificationSourceAll) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReactionNotificationSourceAll + + return json.Marshal((*stub)(entity)) +} + +func (*ReactionNotificationSourceAll) GetClass() string { + return ClassReactionNotificationSource +} + +func (*ReactionNotificationSourceAll) GetType() string { + return TypeReactionNotificationSourceAll +} + +func (*ReactionNotificationSourceAll) ReactionNotificationSourceType() string { + return TypeReactionNotificationSourceAll +} + +// Contains information about notification settings for reactions +type ReactionNotificationSettings struct { + meta + // Source of message reactions for which notifications are shown + MessageReactionSource ReactionNotificationSource `json:"message_reaction_source"` + // Source of story reactions for which notifications are shown + StoryReactionSource ReactionNotificationSource `json:"story_reaction_source"` + // Identifier of the notification sound to be played; 0 if sound is disabled + SoundId JsonInt64 `json:"sound_id"` + // True, if reaction sender and emoji must be displayed in notifications + ShowPreview bool `json:"show_preview"` +} + +func (entity *ReactionNotificationSettings) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReactionNotificationSettings + + return json.Marshal((*stub)(entity)) +} + +func (*ReactionNotificationSettings) GetClass() string { + return ClassReactionNotificationSettings +} + +func (*ReactionNotificationSettings) GetType() string { + return TypeReactionNotificationSettings +} + +func (reactionNotificationSettings *ReactionNotificationSettings) UnmarshalJSON(data []byte) error { + var tmp struct { + MessageReactionSource json.RawMessage `json:"message_reaction_source"` + StoryReactionSource json.RawMessage `json:"story_reaction_source"` + SoundId JsonInt64 `json:"sound_id"` + ShowPreview bool `json:"show_preview"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + reactionNotificationSettings.SoundId = tmp.SoundId + reactionNotificationSettings.ShowPreview = tmp.ShowPreview + + fieldMessageReactionSource, _ := UnmarshalReactionNotificationSource(tmp.MessageReactionSource) + reactionNotificationSettings.MessageReactionSource = fieldMessageReactionSource + + fieldStoryReactionSource, _ := UnmarshalReactionNotificationSource(tmp.StoryReactionSource) + reactionNotificationSettings.StoryReactionSource = fieldStoryReactionSource + + return nil +} + // Contains information about a message draft type DraftMessage struct { meta @@ -12543,8 +12541,10 @@ func (chatPosition *ChatPosition) UnmarshalJSON(data []byte) error { } // All reactions are available in the chat -type ChatAvailableReactionsAll struct{ +type ChatAvailableReactionsAll struct { meta + // The maximum allowed number of reactions per message; 1-11 + MaxReactionCount int32 `json:"max_reaction_count"` } func (entity *ChatAvailableReactionsAll) MarshalJSON() ([]byte, error) { @@ -12572,6 +12572,8 @@ type ChatAvailableReactionsSome struct { meta // The list of reactions Reactions []ReactionType `json:"reactions"` + // The maximum allowed number of reactions per message; 1-11 + MaxReactionCount int32 `json:"max_reaction_count"` } func (entity *ChatAvailableReactionsSome) MarshalJSON() ([]byte, error) { @@ -12597,6 +12599,7 @@ func (*ChatAvailableReactionsSome) ChatAvailableReactionsType() string { func (chatAvailableReactionsSome *ChatAvailableReactionsSome) UnmarshalJSON(data []byte) error { var tmp struct { Reactions []json.RawMessage `json:"reactions"` + MaxReactionCount int32 `json:"max_reaction_count"` } err := json.Unmarshal(data, &tmp) @@ -12604,6 +12607,8 @@ func (chatAvailableReactionsSome *ChatAvailableReactionsSome) UnmarshalJSON(data return err } + chatAvailableReactionsSome.MaxReactionCount = tmp.MaxReactionCount + fieldReactions, _ := UnmarshalListOfReactionType(tmp.Reactions) chatAvailableReactionsSome.Reactions = fieldReactions @@ -16970,6 +16975,8 @@ type WebPage struct { StorySenderChatId int64 `json:"story_sender_chat_id"` // The identifier of the previewed story; 0 if none StoryId int32 `json:"story_id"` + // Up to 4 stickers from the sticker set available via the link + Stickers []*Sticker `json:"stickers"` // Version of web page instant view (currently, can be 1 or 2); 0 if none InstantViewVersion int32 `json:"instant_view_version"` } @@ -20637,9 +20644,9 @@ type MessageLocation struct { meta // The location description Location *Location `json:"location"` - // Time relative to the message send date, for which the location can be updated, in seconds + // Time relative to the message send date, for which the location can be updated, in seconds; if 0x7FFFFFFF, then location can be updated forever LivePeriod int32 `json:"live_period"` - // Left time for which the location can be updated, in seconds. updateMessageContent is not sent when this field changes + // Left time for which the location can be updated, in seconds. If 0, then the location can't be updated anymore. The update updateMessageContent is not sent when this field changes ExpiresIn int32 `json:"expires_in"` // For live locations, a direction in which the location moves, in degrees; 1-360. If 0 the direction is unknown Heading int32 `json:"heading"` @@ -20753,9 +20760,9 @@ func (*MessageAnimatedEmoji) MessageContentType() string { // A dice message. The dice value is randomly generated by the server type MessageDice struct { meta - // The animated stickers with the initial dice animation; may be null if unknown. updateMessageContent will be sent when the sticker became known + // The animated stickers with the initial dice animation; may be null if unknown. The update updateMessageContent will be sent when the sticker became known InitialState DiceStickers `json:"initial_state"` - // The animated stickers with the final dice animation; may be null if unknown. updateMessageContent will be sent when the sticker became known + // The animated stickers with the final dice animation; may be null if unknown. The update updateMessageContent will be sent when the sticker became known FinalState DiceStickers `json:"final_state"` // Emoji on which the dice throw animation is based Emoji string `json:"emoji"` @@ -23753,7 +23760,7 @@ func (inputMessageVideoNote *InputMessageVideoNote) UnmarshalJSON(data []byte) e // A voice note message type InputMessageVoiceNote struct { meta - // Voice note to be sent + // Voice note to be sent. The voice note must be encoded with the Opus codec and stored inside an OGG container with a single audio channel, or be in MP3 or M4A format as regular audio VoiceNote InputFile `json:"voice_note"` // Duration of the voice note, in seconds Duration int32 `json:"duration"` @@ -23817,7 +23824,7 @@ type InputMessageLocation struct { meta // Location to be sent Location *Location `json:"location"` - // Period for which the location can be updated, in seconds; must be between 60 and 86400 for a live location and 0 otherwise + // Period for which the location can be updated, in seconds; must be between 60 and 86400 for a temporary live location, 0x7FFFFFFF for permanent live location, and 0 otherwise LivePeriod int32 `json:"live_period"` // For live locations, a direction in which the location moves, in degrees; 1-360. Pass 0 if unknown Heading int32 `json:"heading"` @@ -24048,10 +24055,10 @@ func (inputMessageInvoice *InputMessageInvoice) UnmarshalJSON(data []byte) error // A message with a poll. Polls can't be sent to secret chats. Polls can be sent only to a private chat with a bot type InputMessagePoll struct { meta - // Poll question; 1-255 characters (up to 300 characters for bots) - Question string `json:"question"` - // List of poll answer options, 2-10 strings 1-100 characters each - Options []string `json:"options"` + // Poll question; 1-255 characters (up to 300 characters for bots). Only custom emoji entities are allowed to be added and only by Premium users + Question *FormattedText `json:"question"` + // List of poll answer options, 2-10 strings 1-100 characters each. Only custom emoji entities are allowed to be added and only by Premium users + Options []*FormattedText `json:"options"` // True, if the poll voters are anonymous. Non-anonymous polls can't be sent or forwarded to channels IsAnonymous bool `json:"is_anonymous"` // Type of the poll @@ -24086,8 +24093,8 @@ func (*InputMessagePoll) InputMessageContentType() string { func (inputMessagePoll *InputMessagePoll) UnmarshalJSON(data []byte) error { var tmp struct { - Question string `json:"question"` - Options []string `json:"options"` + Question *FormattedText `json:"question"` + Options []*FormattedText `json:"options"` IsAnonymous bool `json:"is_anonymous"` Type json.RawMessage `json:"type"` OpenPeriod int32 `json:"open_period"` @@ -25485,15 +25492,69 @@ func (*TrendingStickerSets) GetType() string { return TypeTrendingStickerSets } -// Contains a list of similar emoji to search for in getStickers and searchStickers +// The category contains a list of similar emoji to search for in getStickers and searchStickers for stickers, or getInlineQueryResults with the bot getOption("animation_search_bot_username") for animations +type EmojiCategorySourceSearch struct { + meta + // List of emojis for search for + Emojis []string `json:"emojis"` +} + +func (entity *EmojiCategorySourceSearch) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub EmojiCategorySourceSearch + + return json.Marshal((*stub)(entity)) +} + +func (*EmojiCategorySourceSearch) GetClass() string { + return ClassEmojiCategorySource +} + +func (*EmojiCategorySourceSearch) GetType() string { + return TypeEmojiCategorySourceSearch +} + +func (*EmojiCategorySourceSearch) EmojiCategorySourceType() string { + return TypeEmojiCategorySourceSearch +} + +// The category contains Premium stickers that must be found by getPremiumStickers +type EmojiCategorySourcePremium struct{ + meta +} + +func (entity *EmojiCategorySourcePremium) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub EmojiCategorySourcePremium + + return json.Marshal((*stub)(entity)) +} + +func (*EmojiCategorySourcePremium) GetClass() string { + return ClassEmojiCategorySource +} + +func (*EmojiCategorySourcePremium) GetType() string { + return TypeEmojiCategorySourcePremium +} + +func (*EmojiCategorySourcePremium) EmojiCategorySourceType() string { + return TypeEmojiCategorySourcePremium +} + +// Describes an emoji category type EmojiCategory struct { meta // Name of the category Name string `json:"name"` // Custom emoji sticker, which represents icon of the category Icon *Sticker `json:"icon"` - // List of emojis in the category - Emojis []string `json:"emojis"` + // Source of stickers for the emoji category + Source EmojiCategorySource `json:"source"` + // True, if the category must be shown first when choosing a sticker for the start page + IsGreeting bool `json:"is_greeting"` } func (entity *EmojiCategory) MarshalJSON() ([]byte, error) { @@ -25512,6 +25573,29 @@ func (*EmojiCategory) GetType() string { return TypeEmojiCategory } +func (emojiCategory *EmojiCategory) UnmarshalJSON(data []byte) error { + var tmp struct { + Name string `json:"name"` + Icon *Sticker `json:"icon"` + Source json.RawMessage `json:"source"` + IsGreeting bool `json:"is_greeting"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + emojiCategory.Name = tmp.Name + emojiCategory.Icon = tmp.Icon + emojiCategory.IsGreeting = tmp.IsGreeting + + fieldSource, _ := UnmarshalEmojiCategorySource(tmp.Source) + emojiCategory.Source = fieldSource + + return nil +} + // Represents a list of emoji categories type EmojiCategories struct { meta @@ -25535,7 +25619,7 @@ func (*EmojiCategories) GetType() string { return TypeEmojiCategories } -// The category must be used by default +// The category must be used by default (e.g., for custom emoji or animation search) type EmojiCategoryTypeDefault struct{ meta } @@ -25560,6 +25644,31 @@ func (*EmojiCategoryTypeDefault) EmojiCategoryTypeType() string { return TypeEmojiCategoryTypeDefault } +// The category must be used by default for regular sticker selection. It may contain greeting emoji category and Premium stickers +type EmojiCategoryTypeRegularStickers struct{ + meta +} + +func (entity *EmojiCategoryTypeRegularStickers) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub EmojiCategoryTypeRegularStickers + + return json.Marshal((*stub)(entity)) +} + +func (*EmojiCategoryTypeRegularStickers) GetClass() string { + return ClassEmojiCategoryType +} + +func (*EmojiCategoryTypeRegularStickers) GetType() string { + return TypeEmojiCategoryTypeRegularStickers +} + +func (*EmojiCategoryTypeRegularStickers) EmojiCategoryTypeType() string { + return TypeEmojiCategoryTypeRegularStickers +} + // The category must be used for emoji status selection type EmojiCategoryTypeEmojiStatus struct{ meta @@ -26478,7 +26587,7 @@ type Story struct { // True, if the story was edited IsEdited bool `json:"is_edited"` // True, if the story is saved in the sender's profile and will be available there after expiration - IsPinned bool `json:"is_pinned"` + IsPostedToChatPage bool `json:"is_posted_to_chat_page"` // True, if the story is visible only for the current user IsVisibleOnlyForSelf bool `json:"is_visible_only_for_self"` // True, if the story can be deleted @@ -26489,8 +26598,8 @@ type Story struct { CanBeForwarded bool `json:"can_be_forwarded"` // True, if the story can be replied in the chat with the story sender CanBeReplied bool `json:"can_be_replied"` - // True, if the story's is_pinned value can be changed - CanToggleIsPinned bool `json:"can_toggle_is_pinned"` + // True, if the story's is_posted_to_chat_page value can be changed + CanToggleIsPostedToChatPage bool `json:"can_toggle_is_posted_to_chat_page"` // True, if the story statistics are available through getStoryStatistics CanGetStatistics bool `json:"can_get_statistics"` // True, if interactions with the story can be received through getStoryInteractions @@ -26538,13 +26647,13 @@ func (story *Story) UnmarshalJSON(data []byte) error { IsBeingSent bool `json:"is_being_sent"` IsBeingEdited bool `json:"is_being_edited"` IsEdited bool `json:"is_edited"` - IsPinned bool `json:"is_pinned"` + IsPostedToChatPage bool `json:"is_posted_to_chat_page"` IsVisibleOnlyForSelf bool `json:"is_visible_only_for_self"` CanBeDeleted bool `json:"can_be_deleted"` CanBeEdited bool `json:"can_be_edited"` CanBeForwarded bool `json:"can_be_forwarded"` CanBeReplied bool `json:"can_be_replied"` - CanToggleIsPinned bool `json:"can_toggle_is_pinned"` + CanToggleIsPostedToChatPage bool `json:"can_toggle_is_posted_to_chat_page"` CanGetStatistics bool `json:"can_get_statistics"` CanGetInteractions bool `json:"can_get_interactions"` HasExpiredViewers bool `json:"has_expired_viewers"` @@ -26568,13 +26677,13 @@ func (story *Story) UnmarshalJSON(data []byte) error { story.IsBeingSent = tmp.IsBeingSent story.IsBeingEdited = tmp.IsBeingEdited story.IsEdited = tmp.IsEdited - story.IsPinned = tmp.IsPinned + story.IsPostedToChatPage = tmp.IsPostedToChatPage story.IsVisibleOnlyForSelf = tmp.IsVisibleOnlyForSelf story.CanBeDeleted = tmp.CanBeDeleted story.CanBeEdited = tmp.CanBeEdited story.CanBeForwarded = tmp.CanBeForwarded story.CanBeReplied = tmp.CanBeReplied - story.CanToggleIsPinned = tmp.CanToggleIsPinned + story.CanToggleIsPostedToChatPage = tmp.CanToggleIsPostedToChatPage story.CanGetStatistics = tmp.CanGetStatistics story.CanGetInteractions = tmp.CanGetInteractions story.HasExpiredViewers = tmp.HasExpiredViewers @@ -26605,6 +26714,8 @@ type Stories struct { TotalCount int32 `json:"total_count"` // The list of stories Stories []*Story `json:"stories"` + // Identifiers of the pinned stories; returned only in getChatPostedToChatPageStories with from_story_id == 0 + PinnedStoryIds []int32 `json:"pinned_story_ids"` } func (entity *Stories) MarshalJSON() ([]byte, error) { @@ -28807,6 +28918,8 @@ type PhoneNumberAuthenticationSettings struct { AllowMissedCall bool `json:"allow_missed_call"` // Pass true if the authenticated phone number is used on the current device IsCurrentPhoneNumber bool `json:"is_current_phone_number"` + // Pass true if there is a SIM card in the current device, but it is not possible to check whether phone number matches + HasUnknownPhoneNumber bool `json:"has_unknown_phone_number"` // For official applications only. True, if the application can use Android SMS Retriever API (requires Google Play Services >= 10.2) to automatically receive the authentication code from the SMS. See https://developers.google.com/identity/sms-retriever/ for more details AllowSmsRetrieverApi bool `json:"allow_sms_retriever_api"` // For official Android and iOS applications only; pass null otherwise. Settings for Firebase Authentication @@ -28836,6 +28949,7 @@ func (phoneNumberAuthenticationSettings *PhoneNumberAuthenticationSettings) Unma AllowFlashCall bool `json:"allow_flash_call"` AllowMissedCall bool `json:"allow_missed_call"` IsCurrentPhoneNumber bool `json:"is_current_phone_number"` + HasUnknownPhoneNumber bool `json:"has_unknown_phone_number"` AllowSmsRetrieverApi bool `json:"allow_sms_retriever_api"` FirebaseAuthenticationSettings json.RawMessage `json:"firebase_authentication_settings"` AuthenticationTokens []string `json:"authentication_tokens"` @@ -28849,6 +28963,7 @@ func (phoneNumberAuthenticationSettings *PhoneNumberAuthenticationSettings) Unma phoneNumberAuthenticationSettings.AllowFlashCall = tmp.AllowFlashCall phoneNumberAuthenticationSettings.AllowMissedCall = tmp.AllowMissedCall phoneNumberAuthenticationSettings.IsCurrentPhoneNumber = tmp.IsCurrentPhoneNumber + phoneNumberAuthenticationSettings.HasUnknownPhoneNumber = tmp.HasUnknownPhoneNumber phoneNumberAuthenticationSettings.AllowSmsRetrieverApi = tmp.AllowSmsRetrieverApi phoneNumberAuthenticationSettings.AuthenticationTokens = tmp.AuthenticationTokens @@ -35685,7 +35800,7 @@ func (*BackgroundFillGradient) BackgroundFillType() string { // Describes a freeform gradient fill of a background type BackgroundFillFreeformGradient struct { meta - // A list of 3 or 4 colors of the freeform gradients in the RGB24 format + // A list of 3 or 4 colors of the freeform gradient in the RGB24 format Colors []int32 `json:"colors"` } @@ -43687,6 +43802,33 @@ func (*SuggestedActionSetBirthdate) SuggestedActionType() string { return TypeSuggestedActionSetBirthdate } +// Suggests the user to extend their expiring Telegram Premium subscription +type SuggestedActionExtendPremium struct { + meta + // A URL for managing Telegram Premium subscription + ManagePremiumSubscriptionUrl string `json:"manage_premium_subscription_url"` +} + +func (entity *SuggestedActionExtendPremium) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedActionExtendPremium + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedActionExtendPremium) GetClass() string { + return ClassSuggestedAction +} + +func (*SuggestedActionExtendPremium) GetType() string { + return TypeSuggestedActionExtendPremium +} + +func (*SuggestedActionExtendPremium) SuggestedActionType() string { + return TypeSuggestedActionExtendPremium +} + // Contains a counter type Count struct { meta @@ -44674,6 +44816,35 @@ func (chatStatisticsChannel *ChatStatisticsChannel) UnmarshalJSON(data []byte) e return nil } +// Contains information about revenue earned from sponsored messages in a chat +type ChatRevenueAmount struct { + meta + // Cryptocurrency in which revenue is calculated + Cryptocurrency string `json:"cryptocurrency"` + // Total amount of the cryptocurrency earned, in the smallest units of the cryptocurrency + TotalAmount JsonInt64 `json:"total_amount"` + // Amount of the cryptocurrency that isn't withdrawn yet, in the smallest units of the cryptocurrency + BalanceAmount JsonInt64 `json:"balance_amount"` + // Amount of the cryptocurrency available for withdrawal, in the smallest units of the cryptocurrency + AvailableAmount JsonInt64 `json:"available_amount"` +} + +func (entity *ChatRevenueAmount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatRevenueAmount + + return json.Marshal((*stub)(entity)) +} + +func (*ChatRevenueAmount) GetClass() string { + return ClassChatRevenueAmount +} + +func (*ChatRevenueAmount) GetType() string { + return TypeChatRevenueAmount +} + // A detailed statistics about revenue earned from sponsored messages in a chat type ChatRevenueStatistics struct { meta @@ -44681,15 +44852,9 @@ type ChatRevenueStatistics struct { RevenueByHourGraph StatisticalGraph `json:"revenue_by_hour_graph"` // A graph containing amount of revenue RevenueGraph StatisticalGraph `json:"revenue_graph"` - // Cryptocurrency in which revenue is calculated - Cryptocurrency string `json:"cryptocurrency"` - // Total amount of the cryptocurrency earned, in the smallest units of the cryptocurrency - CryptocurrencyTotalAmount JsonInt64 `json:"cryptocurrency_total_amount"` - // Amount of the cryptocurrency that isn't withdrawn yet, in the smallest units of the cryptocurrency - CryptocurrencyBalanceAmount JsonInt64 `json:"cryptocurrency_balance_amount"` - // Amount of the cryptocurrency available for withdrawal, in the smallest units of the cryptocurrency - CryptocurrencyAvailableAmount JsonInt64 `json:"cryptocurrency_available_amount"` - // Current conversion rate of the cryptocurrency to USD + // Amount of earned revenue + RevenueAmount *ChatRevenueAmount `json:"revenue_amount"` + // Current conversion rate of the cryptocurrency in which revenue is calculated to USD UsdRate float64 `json:"usd_rate"` } @@ -44713,10 +44878,7 @@ func (chatRevenueStatistics *ChatRevenueStatistics) UnmarshalJSON(data []byte) e var tmp struct { RevenueByHourGraph json.RawMessage `json:"revenue_by_hour_graph"` RevenueGraph json.RawMessage `json:"revenue_graph"` - Cryptocurrency string `json:"cryptocurrency"` - CryptocurrencyTotalAmount JsonInt64 `json:"cryptocurrency_total_amount"` - CryptocurrencyBalanceAmount JsonInt64 `json:"cryptocurrency_balance_amount"` - CryptocurrencyAvailableAmount JsonInt64 `json:"cryptocurrency_available_amount"` + RevenueAmount *ChatRevenueAmount `json:"revenue_amount"` UsdRate float64 `json:"usd_rate"` } @@ -44725,10 +44887,7 @@ func (chatRevenueStatistics *ChatRevenueStatistics) UnmarshalJSON(data []byte) e return err } - chatRevenueStatistics.Cryptocurrency = tmp.Cryptocurrency - chatRevenueStatistics.CryptocurrencyTotalAmount = tmp.CryptocurrencyTotalAmount - chatRevenueStatistics.CryptocurrencyBalanceAmount = tmp.CryptocurrencyBalanceAmount - chatRevenueStatistics.CryptocurrencyAvailableAmount = tmp.CryptocurrencyAvailableAmount + chatRevenueStatistics.RevenueAmount = tmp.RevenueAmount chatRevenueStatistics.UsdRate = tmp.UsdRate fieldRevenueByHourGraph, _ := UnmarshalStatisticalGraph(tmp.RevenueByHourGraph) @@ -47268,6 +47427,33 @@ func (updateScopeNotificationSettings *UpdateScopeNotificationSettings) Unmarsha return nil } +// Notification settings for reactions were updated +type UpdateReactionNotificationSettings struct { + meta + // The new notification settings + NotificationSettings *ReactionNotificationSettings `json:"notification_settings"` +} + +func (entity *UpdateReactionNotificationSettings) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateReactionNotificationSettings + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateReactionNotificationSettings) GetClass() string { + return ClassUpdate +} + +func (*UpdateReactionNotificationSettings) GetType() string { + return TypeUpdateReactionNotificationSettings +} + +func (*UpdateReactionNotificationSettings) UpdateType() string { + return TypeUpdateReactionNotificationSettings +} + // A notification was changed type UpdateNotification struct { meta @@ -49238,6 +49424,31 @@ func (*UpdateSavedMessagesTags) UpdateType() string { return TypeUpdateSavedMessagesTags } +// The revenue earned from sponsored messages in a chat has changed. If chat revenue screen is opened, then getChatRevenueTransactions may be called to fetch new transactions +type UpdateChatRevenueAmount struct{ + meta +} + +func (entity *UpdateChatRevenueAmount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateChatRevenueAmount + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateChatRevenueAmount) GetClass() string { + return ClassUpdate +} + +func (*UpdateChatRevenueAmount) GetType() string { + return TypeUpdateChatRevenueAmount +} + +func (*UpdateChatRevenueAmount) UpdateType() string { + return TypeUpdateChatRevenueAmount +} + // The parameters of speech recognition without Telegram Premium subscription has changed type UpdateSpeechRecognitionTrial struct { meta @@ -50068,6 +50279,8 @@ type UpdateChatMember struct { Date int32 `json:"date"` // If user has joined the chat using an invite link, the invite link; may be null InviteLink *ChatInviteLink `json:"invite_link"` + // True, if the user has joined the chat after sending a join request and being approved by an administrator + ViaJoinRequest bool `json:"via_join_request"` // True, if the user has joined the chat using an invite link for a chat folder ViaChatFolderInviteLink bool `json:"via_chat_folder_invite_link"` // Previous chat member diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 2f68e92..14f0cba 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -22,6 +22,12 @@ func UnmarshalAuthenticationCodeType(data json.RawMessage) (AuthenticationCodeTy case TypeAuthenticationCodeTypeSms: return UnmarshalAuthenticationCodeTypeSms(data) + case TypeAuthenticationCodeTypeSmsWord: + return UnmarshalAuthenticationCodeTypeSmsWord(data) + + case TypeAuthenticationCodeTypeSmsPhrase: + return UnmarshalAuthenticationCodeTypeSmsPhrase(data) + case TypeAuthenticationCodeTypeCall: return UnmarshalAuthenticationCodeTypeCall(data) @@ -1228,49 +1234,6 @@ func UnmarshalListOfMessageSource(dataList []json.RawMessage) ([]MessageSource, return list, nil } -func UnmarshalMessageSponsorType(data json.RawMessage) (MessageSponsorType, error) { - var meta meta - - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } - - switch meta.Type { - case TypeMessageSponsorTypeBot: - return UnmarshalMessageSponsorTypeBot(data) - - case TypeMessageSponsorTypeWebApp: - return UnmarshalMessageSponsorTypeWebApp(data) - - case TypeMessageSponsorTypePublicChannel: - return UnmarshalMessageSponsorTypePublicChannel(data) - - case TypeMessageSponsorTypePrivateChannel: - return UnmarshalMessageSponsorTypePrivateChannel(data) - - case TypeMessageSponsorTypeWebsite: - return UnmarshalMessageSponsorTypeWebsite(data) - - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } -} - -func UnmarshalListOfMessageSponsorType(dataList []json.RawMessage) ([]MessageSponsorType, error) { - list := []MessageSponsorType{} - - for _, data := range dataList { - entity, err := UnmarshalMessageSponsorType(data) - if err != nil { - return nil, err - } - list = append(list, entity) - } - - return list, nil -} - func UnmarshalReportChatSponsoredMessageResult(data json.RawMessage) (ReportChatSponsoredMessageResult, error) { var meta meta @@ -1351,6 +1314,43 @@ func UnmarshalListOfNotificationSettingsScope(dataList []json.RawMessage) ([]Not return list, nil } +func UnmarshalReactionNotificationSource(data json.RawMessage) (ReactionNotificationSource, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeReactionNotificationSourceNone: + return UnmarshalReactionNotificationSourceNone(data) + + case TypeReactionNotificationSourceContacts: + return UnmarshalReactionNotificationSourceContacts(data) + + case TypeReactionNotificationSourceAll: + return UnmarshalReactionNotificationSourceAll(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfReactionNotificationSource(dataList []json.RawMessage) ([]ReactionNotificationSource, error) { + list := []ReactionNotificationSource{} + + for _, data := range dataList { + entity, err := UnmarshalReactionNotificationSource(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalChatType(data json.RawMessage) (ChatType, error) { var meta meta @@ -3235,6 +3235,40 @@ func UnmarshalListOfUserStatus(dataList []json.RawMessage) ([]UserStatus, error) return list, nil } +func UnmarshalEmojiCategorySource(data json.RawMessage) (EmojiCategorySource, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeEmojiCategorySourceSearch: + return UnmarshalEmojiCategorySourceSearch(data) + + case TypeEmojiCategorySourcePremium: + return UnmarshalEmojiCategorySourcePremium(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfEmojiCategorySource(dataList []json.RawMessage) ([]EmojiCategorySource, error) { + list := []EmojiCategorySource{} + + for _, data := range dataList { + entity, err := UnmarshalEmojiCategorySource(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalEmojiCategoryType(data json.RawMessage) (EmojiCategoryType, error) { var meta meta @@ -3247,6 +3281,9 @@ func UnmarshalEmojiCategoryType(data json.RawMessage) (EmojiCategoryType, error) case TypeEmojiCategoryTypeDefault: return UnmarshalEmojiCategoryTypeDefault(data) + case TypeEmojiCategoryTypeRegularStickers: + return UnmarshalEmojiCategoryTypeRegularStickers(data) + case TypeEmojiCategoryTypeEmojiStatus: return UnmarshalEmojiCategoryTypeEmojiStatus(data) @@ -6473,6 +6510,9 @@ func UnmarshalSuggestedAction(data json.RawMessage) (SuggestedAction, error) { case TypeSuggestedActionSetBirthdate: return UnmarshalSuggestedActionSetBirthdate(data) + case TypeSuggestedActionExtendPremium: + return UnmarshalSuggestedActionExtendPremium(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -7039,6 +7079,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateScopeNotificationSettings: return UnmarshalUpdateScopeNotificationSettings(data) + case TypeUpdateReactionNotificationSettings: + return UnmarshalUpdateReactionNotificationSettings(data) + case TypeUpdateNotification: return UnmarshalUpdateNotification(data) @@ -7213,6 +7256,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateSavedMessagesTags: return UnmarshalUpdateSavedMessagesTags(data) + case TypeUpdateChatRevenueAmount: + return UnmarshalUpdateChatRevenueAmount(data) + case TypeUpdateSpeechRecognitionTrial: return UnmarshalUpdateSpeechRecognitionTrial(data) @@ -7382,6 +7428,22 @@ func UnmarshalAuthenticationCodeTypeSms(data json.RawMessage) (*AuthenticationCo return &resp, err } +func UnmarshalAuthenticationCodeTypeSmsWord(data json.RawMessage) (*AuthenticationCodeTypeSmsWord, error) { + var resp AuthenticationCodeTypeSmsWord + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAuthenticationCodeTypeSmsPhrase(data json.RawMessage) (*AuthenticationCodeTypeSmsPhrase, error) { + var resp AuthenticationCodeTypeSmsPhrase + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalAuthenticationCodeTypeCall(data json.RawMessage) (*AuthenticationCodeTypeCall, error) { var resp AuthenticationCodeTypeCall @@ -9366,46 +9428,6 @@ func UnmarshalMessageSourceOther(data json.RawMessage) (*MessageSourceOther, err return &resp, err } -func UnmarshalMessageSponsorTypeBot(data json.RawMessage) (*MessageSponsorTypeBot, error) { - var resp MessageSponsorTypeBot - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalMessageSponsorTypeWebApp(data json.RawMessage) (*MessageSponsorTypeWebApp, error) { - var resp MessageSponsorTypeWebApp - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalMessageSponsorTypePublicChannel(data json.RawMessage) (*MessageSponsorTypePublicChannel, error) { - var resp MessageSponsorTypePublicChannel - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalMessageSponsorTypePrivateChannel(data json.RawMessage) (*MessageSponsorTypePrivateChannel, error) { - var resp MessageSponsorTypePrivateChannel - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalMessageSponsorTypeWebsite(data json.RawMessage) (*MessageSponsorTypeWebsite, error) { - var resp MessageSponsorTypeWebsite - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - func UnmarshalMessageSponsor(data json.RawMessage) (*MessageSponsor, error) { var resp MessageSponsor @@ -9542,6 +9564,38 @@ func UnmarshalScopeNotificationSettings(data json.RawMessage) (*ScopeNotificatio return &resp, err } +func UnmarshalReactionNotificationSourceNone(data json.RawMessage) (*ReactionNotificationSourceNone, error) { + var resp ReactionNotificationSourceNone + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReactionNotificationSourceContacts(data json.RawMessage) (*ReactionNotificationSourceContacts, error) { + var resp ReactionNotificationSourceContacts + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReactionNotificationSourceAll(data json.RawMessage) (*ReactionNotificationSourceAll, error) { + var resp ReactionNotificationSourceAll + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReactionNotificationSettings(data json.RawMessage) (*ReactionNotificationSettings, error) { + var resp ReactionNotificationSettings + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalDraftMessage(data json.RawMessage) (*DraftMessage, error) { var resp DraftMessage @@ -12806,6 +12860,22 @@ func UnmarshalTrendingStickerSets(data json.RawMessage) (*TrendingStickerSets, e return &resp, err } +func UnmarshalEmojiCategorySourceSearch(data json.RawMessage) (*EmojiCategorySourceSearch, error) { + var resp EmojiCategorySourceSearch + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalEmojiCategorySourcePremium(data json.RawMessage) (*EmojiCategorySourcePremium, error) { + var resp EmojiCategorySourcePremium + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalEmojiCategory(data json.RawMessage) (*EmojiCategory, error) { var resp EmojiCategory @@ -12830,6 +12900,14 @@ func UnmarshalEmojiCategoryTypeDefault(data json.RawMessage) (*EmojiCategoryType return &resp, err } +func UnmarshalEmojiCategoryTypeRegularStickers(data json.RawMessage) (*EmojiCategoryTypeRegularStickers, error) { + var resp EmojiCategoryTypeRegularStickers + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalEmojiCategoryTypeEmojiStatus(data json.RawMessage) (*EmojiCategoryTypeEmojiStatus, error) { var resp EmojiCategoryTypeEmojiStatus @@ -17558,6 +17636,14 @@ func UnmarshalSuggestedActionSetBirthdate(data json.RawMessage) (*SuggestedActio return &resp, err } +func UnmarshalSuggestedActionExtendPremium(data json.RawMessage) (*SuggestedActionExtendPremium, error) { + var resp SuggestedActionExtendPremium + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalCount(data json.RawMessage) (*Count, error) { var resp Count @@ -17766,6 +17852,14 @@ func UnmarshalChatStatisticsChannel(data json.RawMessage) (*ChatStatisticsChanne return &resp, err } +func UnmarshalChatRevenueAmount(data json.RawMessage) (*ChatRevenueAmount, error) { + var resp ChatRevenueAmount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatRevenueStatistics(data json.RawMessage) (*ChatRevenueStatistics, error) { var resp ChatRevenueStatistics @@ -18406,6 +18500,14 @@ func UnmarshalUpdateScopeNotificationSettings(data json.RawMessage) (*UpdateScop return &resp, err } +func UnmarshalUpdateReactionNotificationSettings(data json.RawMessage) (*UpdateReactionNotificationSettings, error) { + var resp UpdateReactionNotificationSettings + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateNotification(data json.RawMessage) (*UpdateNotification, error) { var resp UpdateNotification @@ -18870,6 +18972,14 @@ func UnmarshalUpdateSavedMessagesTags(data json.RawMessage) (*UpdateSavedMessage return &resp, err } +func UnmarshalUpdateChatRevenueAmount(data json.RawMessage) (*UpdateChatRevenueAmount, error) { + var resp UpdateChatRevenueAmount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateSpeechRecognitionTrial(data json.RawMessage) (*UpdateSpeechRecognitionTrial, error) { var resp UpdateSpeechRecognitionTrial @@ -19219,6 +19329,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeAuthenticationCodeTypeSms: return UnmarshalAuthenticationCodeTypeSms(data) + case TypeAuthenticationCodeTypeSmsWord: + return UnmarshalAuthenticationCodeTypeSmsWord(data) + + case TypeAuthenticationCodeTypeSmsPhrase: + return UnmarshalAuthenticationCodeTypeSmsPhrase(data) + case TypeAuthenticationCodeTypeCall: return UnmarshalAuthenticationCodeTypeCall(data) @@ -19963,21 +20079,6 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageSourceOther: return UnmarshalMessageSourceOther(data) - case TypeMessageSponsorTypeBot: - return UnmarshalMessageSponsorTypeBot(data) - - case TypeMessageSponsorTypeWebApp: - return UnmarshalMessageSponsorTypeWebApp(data) - - case TypeMessageSponsorTypePublicChannel: - return UnmarshalMessageSponsorTypePublicChannel(data) - - case TypeMessageSponsorTypePrivateChannel: - return UnmarshalMessageSponsorTypePrivateChannel(data) - - case TypeMessageSponsorTypeWebsite: - return UnmarshalMessageSponsorTypeWebsite(data) - case TypeMessageSponsor: return UnmarshalMessageSponsor(data) @@ -20029,6 +20130,18 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeScopeNotificationSettings: return UnmarshalScopeNotificationSettings(data) + case TypeReactionNotificationSourceNone: + return UnmarshalReactionNotificationSourceNone(data) + + case TypeReactionNotificationSourceContacts: + return UnmarshalReactionNotificationSourceContacts(data) + + case TypeReactionNotificationSourceAll: + return UnmarshalReactionNotificationSourceAll(data) + + case TypeReactionNotificationSettings: + return UnmarshalReactionNotificationSettings(data) + case TypeDraftMessage: return UnmarshalDraftMessage(data) @@ -21253,6 +21366,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeTrendingStickerSets: return UnmarshalTrendingStickerSets(data) + case TypeEmojiCategorySourceSearch: + return UnmarshalEmojiCategorySourceSearch(data) + + case TypeEmojiCategorySourcePremium: + return UnmarshalEmojiCategorySourcePremium(data) + case TypeEmojiCategory: return UnmarshalEmojiCategory(data) @@ -21262,6 +21381,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeEmojiCategoryTypeDefault: return UnmarshalEmojiCategoryTypeDefault(data) + case TypeEmojiCategoryTypeRegularStickers: + return UnmarshalEmojiCategoryTypeRegularStickers(data) + case TypeEmojiCategoryTypeEmojiStatus: return UnmarshalEmojiCategoryTypeEmojiStatus(data) @@ -23035,6 +23157,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSuggestedActionSetBirthdate: return UnmarshalSuggestedActionSetBirthdate(data) + case TypeSuggestedActionExtendPremium: + return UnmarshalSuggestedActionExtendPremium(data) + case TypeCount: return UnmarshalCount(data) @@ -23113,6 +23238,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatStatisticsChannel: return UnmarshalChatStatisticsChannel(data) + case TypeChatRevenueAmount: + return UnmarshalChatRevenueAmount(data) + case TypeChatRevenueStatistics: return UnmarshalChatRevenueStatistics(data) @@ -23353,6 +23481,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateScopeNotificationSettings: return UnmarshalUpdateScopeNotificationSettings(data) + case TypeUpdateReactionNotificationSettings: + return UnmarshalUpdateReactionNotificationSettings(data) + case TypeUpdateNotification: return UnmarshalUpdateNotification(data) @@ -23527,6 +23658,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateSavedMessagesTags: return UnmarshalUpdateSavedMessagesTags(data) + case TypeUpdateChatRevenueAmount: + return UnmarshalUpdateChatRevenueAmount(data) + case TypeUpdateSpeechRecognitionTrial: return UnmarshalUpdateSpeechRecognitionTrial(data) diff --git a/data/td_api.tl b/data/td_api.tl index dabbcea..36760f0 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -24,15 +24,23 @@ ok = Ok; //@class AuthenticationCodeType @description Provides information about the method by which an authentication code is delivered to the user -//@description An authentication code is delivered via a private Telegram message, which can be viewed from another active session +//@description A digit-only authentication code is delivered via a private Telegram message, which can be viewed from another active session //@length Length of the code authenticationCodeTypeTelegramMessage length:int32 = AuthenticationCodeType; -//@description An authentication code is delivered via an SMS message to the specified phone number; applications may not receive this type of code +//@description A digit-only authentication code is delivered via an SMS message to the specified phone number; non-official applications may not receive this type of code //@length Length of the code authenticationCodeTypeSms length:int32 = AuthenticationCodeType; -//@description An authentication code is delivered via a phone call to the specified phone number +//@description An authentication code is a word delivered via an SMS message to the specified phone number; non-official applications may not receive this type of code +//@first_letter The first letters of the word if known +authenticationCodeTypeSmsWord first_letter:string = AuthenticationCodeType; + +//@description An authentication code is a phrase from multiple words delivered via an SMS message to the specified phone number; non-official applications may not receive this type of code +//@first_word The first word of the phrase if known +authenticationCodeTypeSmsPhrase first_word:string = AuthenticationCodeType; + +//@description A digit-only authentication code is delivered via a phone call to the specified phone number //@length Length of the code authenticationCodeTypeCall length:int32 = AuthenticationCodeType; @@ -45,17 +53,17 @@ authenticationCodeTypeFlashCall pattern:string = AuthenticationCodeType; //@length Number of digits in the code, excluding the prefix authenticationCodeTypeMissedCall phone_number_prefix:string length:int32 = AuthenticationCodeType; -//@description An authentication code is delivered to https://fragment.com. The user must be logged in there via a wallet owning the phone number's NFT +//@description A digit-only authentication code is delivered to https://fragment.com. The user must be logged in there via a wallet owning the phone number's NFT //@url URL to open to receive the code //@length Length of the code authenticationCodeTypeFragment url:string length:int32 = AuthenticationCodeType; -//@description An authentication code is delivered via Firebase Authentication to the official Android application +//@description A digit-only authentication code is delivered via Firebase Authentication to the official Android application //@nonce Nonce to pass to the SafetyNet Attestation API //@length Length of the code authenticationCodeTypeFirebaseAndroid nonce:bytes length:int32 = AuthenticationCodeType; -//@description An authentication code is delivered via Firebase Authentication to the official iOS application +//@description A digit-only authentication code is delivered via Firebase Authentication to the official iOS application //@receipt Receipt of successful application token validation to compare with receipt from push notification //@push_timeout Time after the next authentication method is supposed to be used if verification push notification isn't received, in seconds //@length Length of the code @@ -75,7 +83,7 @@ authenticationCodeInfo phone_number:string type:AuthenticationCodeType next_type emailAddressAuthenticationCodeInfo email_address_pattern:string length:int32 = EmailAddressAuthenticationCodeInfo; -//@class EmailAddressAuthentication @description Contains authentication data for a email address +//@class EmailAddressAuthentication @description Contains authentication data for an email address //@description An authentication code delivered to a user's email address @code The code emailAddressAuthenticationCode code:string = EmailAddressAuthentication; @@ -87,7 +95,7 @@ emailAddressAuthenticationAppleId token:string = EmailAddressAuthentication; emailAddressAuthenticationGoogleId token:string = EmailAddressAuthentication; -//@class EmailAddressResetState @description Describes reset state of a email address +//@class EmailAddressResetState @description Describes reset state of an email address //@description Email address can be reset after the given period. Call resetAuthenticationEmailAddress to reset it and allow the user to authorize with a code sent to the user's phone number //@wait_period Time required to wait before the email address can be reset; 0 if the user is subscribed to Telegram Premium @@ -343,12 +351,12 @@ closedVectorPath commands:vector = ClosedVectorPath; //@description Describes one answer option of a poll -//@text Option text; 1-100 characters +//@text Option text; 1-100 characters. Only custom emoji entities are allowed //@voter_count Number of voters for this option, available only for closed or voted polls //@vote_percentage The percentage of votes for this option; 0-100 //@is_chosen True, if the option was chosen by the user //@is_being_chosen True, if the option is being chosen by a pending setPollAnswer request -pollOption text:string voter_count:int32 vote_percentage:int32 is_chosen:Bool is_being_chosen:Bool = PollOption; +pollOption text:formattedText voter_count:int32 vote_percentage:int32 is_chosen:Bool is_being_chosen:Bool = PollOption; //@class PollType @description Describes the type of poll @@ -436,10 +444,10 @@ video duration:int32 width:int32 height:int32 file_name:string mime_type:string //@video File containing the video videoNote duration:int32 waveform:bytes length:int32 minithumbnail:minithumbnail thumbnail:thumbnail speech_recognition_result:SpeechRecognitionResult video:file = VideoNote; -//@description Describes a voice note. The voice note must be encoded with the Opus codec, and stored inside an OGG container. Voice notes can have only a single audio channel +//@description Describes a voice note //@duration Duration of the voice note, in seconds; as defined by the sender //@waveform A waveform representation of the voice note in 5-bit format -//@mime_type MIME type of the file; as defined by the sender +//@mime_type MIME type of the file; as defined by the sender. Usually, one of "audio/ogg" for Opus in an OGG container, "audio/mpeg" for an MP3 audio, or "audio/mp4" for an M4A audio //@speech_recognition_result Result of speech recognition in the voice note; may be null //@voice File containing the voice note voiceNote duration:int32 waveform:bytes mime_type:string speech_recognition_result:SpeechRecognitionResult voice:file = VoiceNote; @@ -495,7 +503,7 @@ webApp short_name:string title:string description:string photo:photo animation:a //@description Describes a poll //@id Unique poll identifier -//@question Poll question; 1-300 characters +//@question Poll question; 1-300 characters. Only custom emoji entities are allowed //@options List of poll answer options //@total_voter_count Total number of voters, participating in the poll //@recent_voter_ids Identifiers of recent voters, if the poll is non-anonymous @@ -504,7 +512,7 @@ webApp short_name:string title:string description:string photo:photo animation:a //@open_period Amount of time the poll will be active after creation, in seconds //@close_date Point in time (Unix timestamp) when the poll will automatically be closed //@is_closed True, if the poll is closed -poll id:int64 question:string options:vector total_voter_count:int32 recent_voter_ids:vector is_anonymous:Bool type:PollType open_period:int32 close_date:int32 is_closed:Bool = Poll; +poll id:int64 question:formattedText options:vector total_voter_count:int32 recent_voter_ids:vector is_anonymous:Bool type:PollType open_period:int32 close_date:int32 is_closed:Bool = Poll; //@description Describes a chat background @@ -644,8 +652,8 @@ businessStartPage title:string message:string sticker:sticker = BusinessStartPag inputBusinessStartPage title:string message:string sticker:InputFile = InputBusinessStartPage; //@description Describes an interval of time when the business is open -//@start_minute The first minute of the interval since start of the week; 0-7*24*60 -//@end_minute The first minute after the end of the interval since start of the week; 1-8*24*60 +//@start_minute The minute's sequence number in a week, starting on Monday, marking the start of the time interval during which the business is open; 0-7*24*60 +//@end_minute The minute's sequence number in a week, starting on Monday, marking the end of the time interval during which the business is open; 1-8*24*60 businessOpeningHoursInterval start_minute:int32 end_minute:int32 = BusinessOpeningHoursInterval; //@description Describes opening hours of a business @time_zone_id Unique time zone identifier @opening_hours Intervals of the time when the business is open @@ -654,10 +662,14 @@ businessOpeningHours time_zone_id:string opening_hours:vector group_in_common_count:int32 business_info:businessInfo bot_info:botInfo = UserFullInfo; +userFullInfo personal_photo:chatPhoto photo:chatPhoto public_photo:chatPhoto block_list:BlockList can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool has_private_forwards:Bool has_restricted_voice_and_video_note_messages:Bool has_posted_to_profile_stories:Bool has_sponsored_messages_enabled:Bool need_phone_number_privacy_exception:Bool set_chat_background:Bool bio:formattedText birthdate:birthdate personal_chat_id:int53 premium_gift_options:vector group_in_common_count:int32 business_info:businessInfo bot_info:botInfo = UserFullInfo; //@description Represents a list of users @total_count Approximate total number of users found @user_ids A list of user identifiers users total_count:int32 user_ids:vector = Users; @@ -1175,9 +1188,9 @@ basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int53 memb //@date Point in time (Unix timestamp) when the current user joined, or the point in time when the supergroup or channel was created, in case the user is not a member //@status Status of the current user in the supergroup or channel; custom title will always be empty //@member_count Number of members in the supergroup or channel; 0 if unknown. Currently, it is guaranteed to be known only if the supergroup or channel was received through -//-getChatSimilarChats, getChatsToSendStories, getCreatedPublicChats, getGroupsInCommon, getInactiveSupergroupChats, getSuitableDiscussionChats, getUserPrivacySettingRules, getVideoChatAvailableParticipants, -//-searchChatsNearby, searchPublicChats, or in chatFolderInviteLinkInfo.missing_chat_ids, or for public chats in which where sent messages and posted stories from publicForwards, -//-or for public chats in which where sent messages from getMessagePublicForwards response +//-getChatSimilarChats, getChatsToSendStories, getCreatedPublicChats, getGroupsInCommon, getInactiveSupergroupChats, getRecommendedChats, getSuitableDiscussionChats, +//-getUserPrivacySettingRules, getVideoChatAvailableParticipants, searchChatsNearby, searchPublicChats, or in chatFolderInviteLinkInfo.missing_chat_ids, or in userFullInfo.personal_chat_id, +//-or for chats with messages or stories from publicForwards //@boost_level Approximate boost level for the chat //@has_linked_chat True, if the channel has a discussion group, or the supergroup is the designated discussion group for a channel //@has_location True, if the supergroup is connected to a location, i.e. the supergroup is a location-based supergroup @@ -1554,29 +1567,11 @@ messageSourceScreenshot = MessageSource; messageSourceOther = MessageSource; -//@class MessageSponsorType @description Describes type of message sponsor - -//@description The sponsor is a bot @bot_user_id User identifier of the bot @link An internal link to be opened when the sponsored message is clicked -messageSponsorTypeBot bot_user_id:int53 link:InternalLinkType = MessageSponsorType; - -//@description The sponsor is a web app @web_app_title Web App title @link An internal link to be opened when the sponsored message is clicked -messageSponsorTypeWebApp web_app_title:string link:InternalLinkType = MessageSponsorType; - -//@description The sponsor is a public channel chat @chat_id Sponsor chat identifier @link An internal link to be opened when the sponsored message is clicked; may be null if the sponsor chat needs to be opened instead -messageSponsorTypePublicChannel chat_id:int53 link:InternalLinkType = MessageSponsorType; - -//@description The sponsor is a private channel chat @title Title of the chat @invite_link Invite link for the channel -messageSponsorTypePrivateChannel title:string invite_link:string = MessageSponsorType; - -//@description The sponsor is a website @url URL of the website @name Name of the website -messageSponsorTypeWebsite url:string name:string = MessageSponsorType; - - //@description Information about the sponsor of a message -//@type Type of the sponsor +//@url URL of the sponsor to be opened when the message is clicked //@photo Photo of the sponsor; may be null if must not be shown //@info Additional optional information about the sponsor to be shown along with the message -messageSponsor type:MessageSponsorType photo:chatPhotoInfo info:string = MessageSponsor; +messageSponsor url:string photo:photo info:string = MessageSponsor; //@description Describes a sponsored message //@message_id Message identifier; unique for the chat to which the sponsored message belongs among both ordinary and sponsored messages @@ -1584,9 +1579,12 @@ messageSponsor type:MessageSponsorType photo:chatPhotoInfo info:string = Message //@can_be_reported True, if the message can be reported to Telegram moderators through reportChatSponsoredMessage //@content Content of the message. Currently, can be only of the type messageText //@sponsor Information about the sponsor of the message -//@button_text If non-empty, text for the message action button +//@title Title of the sponsored message +//@button_text Text for the message action button +//@accent_color_id Identifier of the accent color for title, button text and message background +//@background_custom_emoji_id Identifier of a custom emoji to be shown on the message background; 0 if none //@additional_info If non-empty, additional information about the sponsored message to be shown along with the message -sponsoredMessage message_id:int53 is_recommended:Bool can_be_reported:Bool content:MessageContent sponsor:messageSponsor button_text:string additional_info:string = SponsoredMessage; +sponsoredMessage message_id:int53 is_recommended:Bool can_be_reported:Bool content:MessageContent sponsor:messageSponsor title:string button_text:string accent_color_id:int32 background_custom_emoji_id:int64 additional_info:string = SponsoredMessage; //@description Contains a list of sponsored messages @messages List of sponsored messages @messages_between The minimum number of messages between shown sponsored messages, or 0 if only one sponsored message must be shown after all ordinary messages sponsoredMessages messages:vector messages_between:int32 = SponsoredMessages; @@ -1678,6 +1676,26 @@ chatNotificationSettings use_default_mute_for:Bool mute_for:int32 use_default_so scopeNotificationSettings mute_for:int32 sound_id:int64 show_preview:Bool use_default_mute_stories:Bool mute_stories:Bool story_sound_id:int64 show_story_sender:Bool disable_pinned_message_notifications:Bool disable_mention_notifications:Bool = ScopeNotificationSettings; +//@class ReactionNotificationSource @description Describes sources of reactions for which notifications will be shown + +//@description Notifications for reactions are disabled +reactionNotificationSourceNone = ReactionNotificationSource; + +//@description Notifications for reactions are shown only for reactions from contacts +reactionNotificationSourceContacts = ReactionNotificationSource; + +//@description Notifications for reactions are shown for all reactions +reactionNotificationSourceAll = ReactionNotificationSource; + + +//@description Contains information about notification settings for reactions +//@message_reaction_source Source of message reactions for which notifications are shown +//@story_reaction_source Source of story reactions for which notifications are shown +//@sound_id Identifier of the notification sound to be played; 0 if sound is disabled +//@show_preview True, if reaction sender and emoji must be displayed in notifications +reactionNotificationSettings message_reaction_source:ReactionNotificationSource story_reaction_source:ReactionNotificationSource sound_id:int64 show_preview:Bool = ReactionNotificationSettings; + + //@description Contains information about a message draft //@reply_to Information about the message to be replied; must be of the type inputMessageReplyToMessage; may be null if none //@date Point in time (Unix timestamp) when the draft was created @@ -1793,11 +1811,11 @@ chatPosition list:ChatList order:int64 is_pinned:Bool source:ChatSource = ChatPo //@class ChatAvailableReactions @description Describes reactions available in the chat -//@description All reactions are available in the chat -chatAvailableReactionsAll = ChatAvailableReactions; +//@description All reactions are available in the chat @max_reaction_count The maximum allowed number of reactions per message; 1-11 +chatAvailableReactionsAll max_reaction_count:int32 = ChatAvailableReactions; -//@description Only specific reactions are available in the chat @reactions The list of reactions -chatAvailableReactionsSome reactions:vector = ChatAvailableReactions; +//@description Only specific reactions are available in the chat @reactions The list of reactions @max_reaction_count The maximum allowed number of reactions per message; 1-11 +chatAvailableReactionsSome reactions:vector max_reaction_count:int32 = ChatAvailableReactions; //@description Represents a tag used in Saved Messages or a Saved Messages topic @@ -2446,8 +2464,9 @@ webPageInstantView page_blocks:vector view_count:int32 version:int32 //@voice_note Preview of the content as a voice note, if available; may be null //@story_sender_chat_id The identifier of the sender of the previewed story; 0 if none //@story_id The identifier of the previewed story; 0 if none +//@stickers Up to 4 stickers from the sticker set available via the link //@instant_view_version Version of web page instant view (currently, can be 1 or 2); 0 if none -webPage url:string display_url:string type:string site_name:string title:string description:formattedText photo:photo embed_url:string embed_type:string embed_width:int32 embed_height:int32 duration:int32 author:string has_large_media:Bool show_large_media:Bool skip_confirmation:Bool show_above_text:Bool animation:animation audio:audio document:document sticker:sticker video:video video_note:videoNote voice_note:voiceNote story_sender_chat_id:int53 story_id:int32 instant_view_version:int32 = WebPage; +webPage url:string display_url:string type:string site_name:string title:string description:formattedText photo:photo embed_url:string embed_type:string embed_width:int32 embed_height:int32 duration:int32 author:string has_large_media:Bool show_large_media:Bool skip_confirmation:Bool show_above_text:Bool animation:animation audio:audio document:document sticker:sticker video:video video_note:videoNote voice_note:voiceNote story_sender_chat_id:int53 story_id:int32 stickers:vector instant_view_version:int32 = WebPage; //@description Contains information about a country @@ -3014,8 +3033,8 @@ messageExpiredVoiceNote = MessageContent; //@description A message with a location //@location The location description -//@live_period Time relative to the message send date, for which the location can be updated, in seconds -//@expires_in Left time for which the location can be updated, in seconds. updateMessageContent is not sent when this field changes +//@live_period Time relative to the message send date, for which the location can be updated, in seconds; if 0x7FFFFFFF, then location can be updated forever +//@expires_in Left time for which the location can be updated, in seconds. If 0, then the location can't be updated anymore. The update updateMessageContent is not sent when this field changes //@heading For live locations, a direction in which the location moves, in degrees; 1-360. If 0 the direction is unknown //@proximity_alert_radius For live locations, a maximum distance to another chat member for proximity alerts, in meters (0-100000). 0 if the notification is disabled. Available only to the message sender messageLocation location:location live_period:int32 expires_in:int32 heading:int32 proximity_alert_radius:int32 = MessageContent; @@ -3030,8 +3049,8 @@ messageContact contact:contact = MessageContent; messageAnimatedEmoji animated_emoji:animatedEmoji emoji:string = MessageContent; //@description A dice message. The dice value is randomly generated by the server -//@initial_state The animated stickers with the initial dice animation; may be null if unknown. updateMessageContent will be sent when the sticker became known -//@final_state The animated stickers with the final dice animation; may be null if unknown. updateMessageContent will be sent when the sticker became known +//@initial_state The animated stickers with the initial dice animation; may be null if unknown. The update updateMessageContent will be sent when the sticker became known +//@final_state The animated stickers with the final dice animation; may be null if unknown. The update updateMessageContent will be sent when the sticker became known //@emoji Emoji on which the dice throw animation is based //@value The dice value. If the value is 0, the dice don't have final state yet //@success_animation_frame_number Number of frame after which a success animation like a shower of confetti needs to be shown on updateMessageSendSucceeded @@ -3445,7 +3464,7 @@ inputMessageVideo video:InputFile thumbnail:inputThumbnail added_sticker_file_id inputMessageVideoNote video_note:InputFile thumbnail:inputThumbnail duration:int32 length:int32 self_destruct_type:MessageSelfDestructType = InputMessageContent; //@description A voice note message -//@voice_note Voice note to be sent +//@voice_note Voice note to be sent. The voice note must be encoded with the Opus codec and stored inside an OGG container with a single audio channel, or be in MP3 or M4A format as regular audio //@duration Duration of the voice note, in seconds //@waveform Waveform representation of the voice note in 5-bit format //@caption Voice note caption; may be null if empty; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters @@ -3454,7 +3473,7 @@ inputMessageVoiceNote voice_note:InputFile duration:int32 waveform:bytes caption //@description A message with a location //@location Location to be sent -//@live_period Period for which the location can be updated, in seconds; must be between 60 and 86400 for a live location and 0 otherwise +//@live_period Period for which the location can be updated, in seconds; must be between 60 and 86400 for a temporary live location, 0x7FFFFFFF for permanent live location, and 0 otherwise //@heading For live locations, a direction in which the location moves, in degrees; 1-360. Pass 0 if unknown //@proximity_alert_radius For live locations, a maximum distance to another chat member for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled. Can't be enabled in channels and Saved Messages inputMessageLocation location:location live_period:int32 heading:int32 proximity_alert_radius:int32 = InputMessageContent; @@ -3487,14 +3506,14 @@ inputMessageGame bot_user_id:int53 game_short_name:string = InputMessageContent; inputMessageInvoice invoice:invoice title:string description:string photo_url:string photo_size:int32 photo_width:int32 photo_height:int32 payload:bytes provider_token:string provider_data:string start_parameter:string extended_media_content:InputMessageContent = InputMessageContent; //@description A message with a poll. Polls can't be sent to secret chats. Polls can be sent only to a private chat with a bot -//@question Poll question; 1-255 characters (up to 300 characters for bots) -//@options List of poll answer options, 2-10 strings 1-100 characters each +//@question Poll question; 1-255 characters (up to 300 characters for bots). Only custom emoji entities are allowed to be added and only by Premium users +//@options List of poll answer options, 2-10 strings 1-100 characters each. Only custom emoji entities are allowed to be added and only by Premium users //@is_anonymous True, if the poll voters are anonymous. Non-anonymous polls can't be sent or forwarded to channels //@type Type of the poll //@open_period Amount of time the poll will be active after creation, in seconds; for bots only //@close_date Point in time (Unix timestamp) when the poll will automatically be closed; for bots only //@is_closed True, if the poll needs to be sent already closed; for bots only -inputMessagePoll question:string options:vector is_anonymous:Bool type:PollType open_period:int32 close_date:int32 is_closed:Bool = InputMessageContent; +inputMessagePoll question:formattedText options:vector is_anonymous:Bool type:PollType open_period:int32 close_date:int32 is_closed:Bool = InputMessageContent; //@description A message with a forwarded story. Stories can't be sent to secret chats. A story can be forwarded only if story.can_be_forwarded //@story_sender_chat_id Identifier of the chat that posted the story @@ -3687,11 +3706,23 @@ stickerSets total_count:int32 sets:vector = StickerSets; trendingStickerSets total_count:int32 sets:vector is_premium:Bool = TrendingStickerSets; -//@description Contains a list of similar emoji to search for in getStickers and searchStickers +//@class EmojiCategorySource @description Describes source of stickers for an emoji category + +//@description The category contains a list of similar emoji to search for in getStickers and searchStickers for stickers, +//-or getInlineQueryResults with the bot getOption("animation_search_bot_username") for animations +//@emojis List of emojis for search for +emojiCategorySourceSearch emojis:vector = EmojiCategorySource; + +//@description The category contains Premium stickers that must be found by getPremiumStickers +emojiCategorySourcePremium = EmojiCategorySource; + + +//@description Describes an emoji category //@name Name of the category //@icon Custom emoji sticker, which represents icon of the category -//@emojis List of emojis in the category -emojiCategory name:string icon:sticker emojis:vector = EmojiCategory; +//@source Source of stickers for the emoji category +//@is_greeting True, if the category must be shown first when choosing a sticker for the start page +emojiCategory name:string icon:sticker source:EmojiCategorySource is_greeting:Bool = EmojiCategory; //@description Represents a list of emoji categories @categories List of categories emojiCategories categories:vector = EmojiCategories; @@ -3699,9 +3730,12 @@ emojiCategories categories:vector = EmojiCategories; //@class EmojiCategoryType @description Describes type of emoji category -//@description The category must be used by default +//@description The category must be used by default (e.g., for custom emoji or animation search) emojiCategoryTypeDefault = EmojiCategoryType; +//@description The category must be used by default for regular sticker selection. It may contain greeting emoji category and Premium stickers +emojiCategoryTypeRegularStickers = EmojiCategoryType; + //@description The category must be used for emoji status selection emojiCategoryTypeEmojiStatus = EmojiCategoryType; @@ -3855,13 +3889,13 @@ storyInteractionInfo view_count:int32 forward_count:int32 reaction_count:int32 r //@is_being_sent True, if the story is being sent by the current user //@is_being_edited True, if the story is being edited by the current user //@is_edited True, if the story was edited -//@is_pinned True, if the story is saved in the sender's profile and will be available there after expiration +//@is_posted_to_chat_page True, if the story is saved in the sender's profile and will be available there after expiration //@is_visible_only_for_self True, if the story is visible only for the current user //@can_be_deleted True, if the story can be deleted //@can_be_edited True, if the story can be edited //@can_be_forwarded True, if the story can be forwarded as a message. Otherwise, screenshots and saving of the story content must be also forbidden //@can_be_replied True, if the story can be replied in the chat with the story sender -//@can_toggle_is_pinned True, if the story's is_pinned value can be changed +//@can_toggle_is_posted_to_chat_page True, if the story's is_posted_to_chat_page value can be changed //@can_get_statistics True, if the story statistics are available through getStoryStatistics //@can_get_interactions True, if interactions with the story can be received through getStoryInteractions //@has_expired_viewers True, if users viewed the story can't be received, because the story has expired more than getOption("story_viewers_expiration_delay") seconds ago @@ -3872,10 +3906,13 @@ storyInteractionInfo view_count:int32 forward_count:int32 reaction_count:int32 r //@content Content of the story //@areas Clickable areas to be shown on the story content //@caption Caption of the story -story id:int32 sender_chat_id:int53 sender_id:MessageSender date:int32 is_being_sent:Bool is_being_edited:Bool is_edited:Bool is_pinned:Bool is_visible_only_for_self:Bool can_be_deleted:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied:Bool can_toggle_is_pinned:Bool can_get_statistics:Bool can_get_interactions:Bool has_expired_viewers:Bool repost_info:storyRepostInfo interaction_info:storyInteractionInfo chosen_reaction_type:ReactionType privacy_settings:StoryPrivacySettings content:StoryContent areas:vector caption:formattedText = Story; +story id:int32 sender_chat_id:int53 sender_id:MessageSender date:int32 is_being_sent:Bool is_being_edited:Bool is_edited:Bool is_posted_to_chat_page:Bool is_visible_only_for_self:Bool can_be_deleted:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied:Bool can_toggle_is_posted_to_chat_page:Bool can_get_statistics:Bool can_get_interactions:Bool has_expired_viewers:Bool repost_info:storyRepostInfo interaction_info:storyInteractionInfo chosen_reaction_type:ReactionType privacy_settings:StoryPrivacySettings content:StoryContent areas:vector caption:formattedText = Story; -//@description Represents a list of stories @total_count Approximate total number of stories found @stories The list of stories -stories total_count:int32 stories:vector = Stories; +//@description Represents a list of stories +//@total_count Approximate total number of stories found +//@stories The list of stories +//@pinned_story_ids Identifiers of the pinned stories; returned only in getChatPostedToChatPageStories with from_story_id == 0 +stories total_count:int32 stories:vector pinned_story_ids:vector = Stories; //@description Contains identifier of a story along with identifier of its sender //@sender_chat_id Identifier of the chat that posted the story @@ -4281,10 +4318,11 @@ firebaseAuthenticationSettingsIos device_token:string is_app_sandbox:Bool = Fire //@allow_flash_call Pass true if the authentication code may be sent via a flash call to the specified phone number //@allow_missed_call Pass true if the authentication code may be sent via a missed call to the specified phone number //@is_current_phone_number Pass true if the authenticated phone number is used on the current device +//@has_unknown_phone_number Pass true if there is a SIM card in the current device, but it is not possible to check whether phone number matches //@allow_sms_retriever_api For official applications only. True, if the application can use Android SMS Retriever API (requires Google Play Services >= 10.2) to automatically receive the authentication code from the SMS. See https://developers.google.com/identity/sms-retriever/ for more details //@firebase_authentication_settings For official Android and iOS applications only; pass null otherwise. Settings for Firebase Authentication //@authentication_tokens List of up to 20 authentication tokens, recently received in updateOption("authentication_token") in previously logged out sessions -phoneNumberAuthenticationSettings allow_flash_call:Bool allow_missed_call:Bool is_current_phone_number:Bool allow_sms_retriever_api:Bool firebase_authentication_settings:FirebaseAuthenticationSettings authentication_tokens:vector = PhoneNumberAuthenticationSettings; +phoneNumberAuthenticationSettings allow_flash_call:Bool allow_missed_call:Bool is_current_phone_number:Bool has_unknown_phone_number:Bool allow_sms_retriever_api:Bool firebase_authentication_settings:FirebaseAuthenticationSettings authentication_tokens:vector = PhoneNumberAuthenticationSettings; //@description Represents a reaction applied to a message @@ -5264,7 +5302,7 @@ backgroundFillSolid color:int32 = BackgroundFill; //@rotation_angle Clockwise rotation angle of the gradient, in degrees; 0-359. Must always be divisible by 45 backgroundFillGradient top_color:int32 bottom_color:int32 rotation_angle:int32 = BackgroundFill; -//@description Describes a freeform gradient fill of a background @colors A list of 3 or 4 colors of the freeform gradients in the RGB24 format +//@description Describes a freeform gradient fill of a background @colors A list of 3 or 4 colors of the freeform gradient in the RGB24 format backgroundFillFreeformGradient colors:vector = BackgroundFill; @@ -6474,6 +6512,9 @@ suggestedActionGiftPremiumForChristmas = SuggestedAction; //@description Suggests the user to set birthdate suggestedActionSetBirthdate = SuggestedAction; +//@description Suggests the user to extend their expiring Telegram Premium subscription @manage_premium_subscription_url A URL for managing Telegram Premium subscription +suggestedActionExtendPremium manage_premium_subscription_url:string = SuggestedAction; + //@description Contains a counter @count Count count count:int32 = Count; @@ -6639,15 +6680,19 @@ chatStatisticsSupergroup period:dateRange member_count:statisticalValue message_ chatStatisticsChannel period:dateRange member_count:statisticalValue mean_message_view_count:statisticalValue mean_message_share_count:statisticalValue mean_message_reaction_count:statisticalValue mean_story_view_count:statisticalValue mean_story_share_count:statisticalValue mean_story_reaction_count:statisticalValue enabled_notifications_percentage:double member_count_graph:StatisticalGraph join_graph:StatisticalGraph mute_graph:StatisticalGraph view_count_by_hour_graph:StatisticalGraph view_count_by_source_graph:StatisticalGraph join_by_source_graph:StatisticalGraph language_graph:StatisticalGraph message_interaction_graph:StatisticalGraph message_reaction_graph:StatisticalGraph story_interaction_graph:StatisticalGraph story_reaction_graph:StatisticalGraph instant_view_interaction_graph:StatisticalGraph recent_interactions:vector = ChatStatistics; +//@description Contains information about revenue earned from sponsored messages in a chat +//@cryptocurrency Cryptocurrency in which revenue is calculated +//@total_amount Total amount of the cryptocurrency earned, in the smallest units of the cryptocurrency +//@balance_amount Amount of the cryptocurrency that isn't withdrawn yet, in the smallest units of the cryptocurrency +//@available_amount Amount of the cryptocurrency available for withdrawal, in the smallest units of the cryptocurrency +chatRevenueAmount cryptocurrency:string total_amount:int64 balance_amount:int64 available_amount:int64 = ChatRevenueAmount; + //@description A detailed statistics about revenue earned from sponsored messages in a chat //@revenue_by_hour_graph A graph containing amount of revenue in a given hour //@revenue_graph A graph containing amount of revenue -//@cryptocurrency Cryptocurrency in which revenue is calculated -//@cryptocurrency_total_amount Total amount of the cryptocurrency earned, in the smallest units of the cryptocurrency -//@cryptocurrency_balance_amount Amount of the cryptocurrency that isn't withdrawn yet, in the smallest units of the cryptocurrency -//@cryptocurrency_available_amount Amount of the cryptocurrency available for withdrawal, in the smallest units of the cryptocurrency -//@usd_rate Current conversion rate of the cryptocurrency to USD -chatRevenueStatistics revenue_by_hour_graph:StatisticalGraph revenue_graph:StatisticalGraph cryptocurrency:string cryptocurrency_total_amount:int64 cryptocurrency_balance_amount:int64 cryptocurrency_available_amount:int64 usd_rate:double = ChatRevenueStatistics; +//@revenue_amount Amount of earned revenue +//@usd_rate Current conversion rate of the cryptocurrency in which revenue is calculated to USD +chatRevenueStatistics revenue_by_hour_graph:StatisticalGraph revenue_graph:StatisticalGraph revenue_amount:chatRevenueAmount usd_rate:double = ChatRevenueStatistics; //@description A detailed statistics about a message //@message_interaction_graph A graph containing number of message views and shares @@ -6965,6 +7010,9 @@ updateForumTopicInfo chat_id:int53 info:forumTopicInfo = Update; //@description Notification settings for some type of chats were updated @scope Types of chats for which notification settings were updated @notification_settings The new notification settings updateScopeNotificationSettings scope:NotificationSettingsScope notification_settings:scopeNotificationSettings = Update; +//@description Notification settings for reactions were updated @notification_settings The new notification settings +updateReactionNotificationSettings notification_settings:reactionNotificationSettings = Update; + //@description A notification was changed @notification_group_id Unique notification group identifier @notification Changed notification updateNotification notification_group_id:int32 notification:notification = Update; @@ -7194,6 +7242,9 @@ updateDefaultReactionType reaction_type:ReactionType = Update; //@tags The new tags updateSavedMessagesTags saved_messages_topic_id:int53 tags:savedMessagesTags = Update; +//@description The revenue earned from sponsored messages in a chat has changed. If chat revenue screen is opened, then getChatRevenueTransactions may be called to fetch new transactions +updateChatRevenueAmount = Update; + //@description The parameters of speech recognition without Telegram Premium subscription has changed //@max_media_duration The maximum allowed duration of media for speech recognition without Telegram Premium subscription, in seconds //@weekly_count The total number of allowed speech recognitions per week; 0 if none @@ -7313,10 +7364,11 @@ updatePollAnswer poll_id:int64 voter_id:MessageSender option_ids:vector = //@actor_user_id Identifier of the user, changing the rights //@date Point in time (Unix timestamp) when the user rights were changed //@invite_link If user has joined the chat using an invite link, the invite link; may be null +//@via_join_request True, if the user has joined the chat after sending a join request and being approved by an administrator //@via_chat_folder_invite_link True, if the user has joined the chat using an invite link for a chat folder //@old_chat_member Previous chat member //@new_chat_member New chat member -updateChatMember chat_id:int53 actor_user_id:int53 date:int32 invite_link:chatInviteLink via_chat_folder_invite_link:Bool old_chat_member:chatMember new_chat_member:chatMember = Update; +updateChatMember chat_id:int53 actor_user_id:int53 date:int32 invite_link:chatInviteLink via_join_request:Bool via_chat_folder_invite_link:Bool old_chat_member:chatMember new_chat_member:chatMember = Update; //@description A user sent a join request to a chat; for bots only //@chat_id Chat identifier @@ -7428,7 +7480,7 @@ setAuthenticationEmailAddress email_address:string = Ok; //-or when the current authorization state is authorizationStateWaitEmailCode resendAuthenticationCode = Ok; -//@description Checks the authentication of a email address. Works only when the current authorization state is authorizationStateWaitEmailCode @code Email address authentication to check +//@description Checks the authentication of an email address. Works only when the current authorization state is authorizationStateWaitEmailCode @code Email address authentication to check checkAuthenticationEmailCode code:EmailAddressAuthentication = Ok; //@description Checks the authentication code. Works only when the current authorization state is authorizationStateWaitCode @code Authentication code to check @@ -7468,6 +7520,9 @@ recoverAuthenticationPassword recovery_code:string new_password:string new_hint: //@token SafetyNet Attestation API token for the Android application, or secret from push notification for the iOS application sendAuthenticationFirebaseSms token:string = Ok; +//@description Reports that authentication code wasn't delivered via SMS; for official mobile apps only. Works only when the current authorization state is authorizationStateWaitCode @mobile_network_code Current mobile network code +reportAuthenticationCodeMissing mobile_network_code:string = Ok; + //@description Checks the authentication token of a bot; to log in as a bot. Works only when the current authorization state is authorizationStateWaitPhoneNumber. Can be used instead of setAuthenticationPhoneNumber and checkAuthenticationCode to log in @token The bot token checkAuthenticationBotToken token:string = Ok; @@ -7506,7 +7561,7 @@ getPasswordState = PasswordState; setPassword old_password:string new_password:string new_hint:string set_recovery_email_address:Bool new_recovery_email_address:string = PasswordState; //@description Changes the login email address of the user. The email address can be changed only if the current user already has login email and passwordState.login_email_address_pattern is non-empty. -//-The change will not be applied until the new login email address is confirmed with checkLoginEmailAddressCode. To use Apple ID/Google ID instead of a email address, call checkLoginEmailAddressCode directly +//-The change will not be applied until the new login email address is confirmed with checkLoginEmailAddressCode. To use Apple ID/Google ID instead of an email address, call checkLoginEmailAddressCode directly //@new_login_email_address New login email address setLoginEmailAddress new_login_email_address:string = EmailAddressAuthenticationCodeInfo; @@ -7661,6 +7716,9 @@ searchChatsOnServer query:string limit:int32 = Chats; //@location Current user location searchChatsNearby location:location = ChatsNearby; +//@description Returns a list of channel chats recommended to the current user +getRecommendedChats = Chats; + //@description Returns a list of chats similar to the given chat @chat_id Identifier of the target chat; must be an identifier of a channel chat getChatSimilarChats chat_id:int53 = Chats; @@ -7808,13 +7866,14 @@ searchChatMessages chat_id:int53 query:string sender_id:MessageSender from_messa //@description Searches for messages in all chats except secret chats. Returns the results in reverse chronological order (i.e., in order of decreasing (date, chat_id, message_id)). //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit //@chat_list Chat list in which to search messages; pass null to search in all chats regardless of their chat list. Only Main and Archive chat lists are supported +//@only_in_channels Pass true to search only for messages in channels //@query Query to search for //@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results //@limit The maximum number of messages to be returned; up to 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit //@filter Additional filter for messages to search; pass null to search for all messages. Filters searchMessagesFilterMention, searchMessagesFilterUnreadMention, searchMessagesFilterUnreadReaction, searchMessagesFilterFailedToSend, and searchMessagesFilterPinned are unsupported in this function //@min_date If not 0, the minimum date of the messages to return //@max_date If not 0, the maximum date of the messages to return -searchMessages chat_list:ChatList query:string offset:string limit:int32 filter:SearchMessagesFilter min_date:int32 max_date:int32 = FoundMessages; +searchMessages chat_list:ChatList only_in_channels:Bool query:string offset:string limit:int32 filter:SearchMessagesFilter min_date:int32 max_date:int32 = FoundMessages; //@description Searches for messages in secret chats. Returns the results in reverse chronological order. For optimal performance, the number of returned messages is chosen by TDLib //@chat_id Identifier of the chat in which to search. Specify 0 to search in all secret chats @@ -7961,7 +8020,7 @@ recognizeSpeech chat_id:int53 message_id:int53 = Ok; rateSpeechRecognition chat_id:int53 message_id:int53 is_good:Bool = Ok; -//@description Returns list of message sender identifiers, which can be used to send messages in a chat @chat_id Chat identifier +//@description Returns the list of message sender identifiers, which can be used to send messages in a chat @chat_id Chat identifier getChatAvailableMessageSenders chat_id:int53 = ChatMessageSenders; //@description Selects a message sender to send messages in a chat @chat_id Chat identifier @message_sender_id New message sender for the chat @@ -8062,9 +8121,11 @@ editMessageText chat_id:int53 message_id:int53 reply_markup:ReplyMarkup input_me //@message_id Identifier of the message //@reply_markup The new message reply markup; pass null if none; for bots only //@location New location content of the message; pass null to stop sharing the live location +//@live_period New time relative to the message send date, for which the location can be updated, in seconds. If 0x7FFFFFFF specified, then the location can be updated forever. +//-Otherwise, must not exceed the current live_period by more than a day, and the live location expiration date must remain in the next 90 days. Pass 0 to keep the current live_period //@heading The new direction in which the location moves, in degrees; 1-360. Pass 0 if unknown //@proximity_alert_radius The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled -editMessageLiveLocation chat_id:int53 message_id:int53 reply_markup:ReplyMarkup location:location heading:int32 proximity_alert_radius:int32 = Message; +editMessageLiveLocation chat_id:int53 message_id:int53 reply_markup:ReplyMarkup location:location live_period:int32 heading:int32 proximity_alert_radius:int32 = Message; //@description Edits the content of a message with an animation, an audio, a document, a photo or a video, including message caption. If only the caption needs to be edited, use editMessageCaption instead. //-The media can't be edited if the message was set to self-destruct or to a self-destructing media. The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa. Returns the edited message after the edit is completed on the server side @@ -8097,9 +8158,11 @@ editInlineMessageText inline_message_id:string reply_markup:ReplyMarkup input_me //@inline_message_id Inline message identifier //@reply_markup The new message reply markup; pass null if none //@location New location content of the message; pass null to stop sharing the live location +//@live_period New time relative to the message send date, for which the location can be updated, in seconds. If 0x7FFFFFFF specified, then the location can be updated forever. +//-Otherwise, must not exceed the current live_period by more than a day, and the live location expiration date must remain in the next 90 days. Pass 0 to keep the current live_period //@heading The new direction in which the location moves, in degrees; 1-360. Pass 0 if unknown //@proximity_alert_radius The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled -editInlineMessageLiveLocation inline_message_id:string reply_markup:ReplyMarkup location:location heading:int32 proximity_alert_radius:int32 = Ok; +editInlineMessageLiveLocation inline_message_id:string reply_markup:ReplyMarkup location:location live_period:int32 heading:int32 proximity_alert_radius:int32 = Ok; //@description Edits the content of a message with an animation, an audio, a document, a photo or a video in an inline message sent via a bot; for bots only //@inline_message_id Inline message identifier @@ -8186,6 +8249,13 @@ addQuickReplyShortcutMessage shortcut_name:string reply_to_message_id:int53 inpu //@hide_via_bot Pass true to hide the bot, via which the message is sent. Can be used only for bots getOption("animation_search_bot_username"), getOption("photo_search_bot_username"), and getOption("venue_search_bot_username") addQuickReplyShortcutInlineQueryResultMessage shortcut_name:string reply_to_message_id:int53 query_id:int64 result_id:string hide_via_bot:Bool = QuickReplyMessage; +//@description Adds 2-10 messages grouped together into an album to a quick reply shortcut. Currently, only audio, document, photo and video messages can be grouped into an album. +//-Documents and audio files can be only grouped in an album with messages of the same type. Returns sent messages +//@shortcut_name Name of the target shortcut +//@reply_to_message_id Identifier of a quick reply message in the same shortcut to be replied; pass 0 if none +//@input_message_contents Contents of messages to be sent. At most 10 messages can be added to an album +addQuickReplyShortcutMessageAlbum shortcut_name:string reply_to_message_id:int53 input_message_contents:vector = QuickReplyMessages; + //@description Readds quick reply messages which failed to add. Can be called only for messages for which messageSendingStateFailed.can_retry is true and after specified in messageSendingStateFailed.retry_after time passed. //-If a message is readded, the corresponding failed to send message is deleted. Returns the sent messages in the same order as the message identifiers passed in message_ids. If a message can't be readded, null will be returned instead of the message //@shortcut_name Name of the target shortcut @@ -8200,7 +8270,7 @@ readdQuickReplyShortcutMessages shortcut_name:string message_ids:vector = editQuickReplyMessage shortcut_id:int32 message_id:int53 input_message_content:InputMessageContent = Ok; -//@description Returns list of custom emojis, which can be used as forum topic icon by all users +//@description Returns the list of custom emojis, which can be used as forum topic icon by all users getForumTopicDefaultIcons = Stickers; //@description Creates a topic in a forum supergroup chat; requires can_manage_topics administrator or can_create_topics member right in the supergroup @@ -8391,6 +8461,9 @@ stopPoll chat_id:int53 message_id:int53 reply_markup:ReplyMarkup = Ok; //@description Hides a suggested action @action Suggested action to hide hideSuggestedAction action:SuggestedAction = Ok; +//@description Hides the list of contacts that have close birthdays for 24 hours +hideContactCloseBirthdays = Ok; + //@description Returns information about a business connection by its identifier; for bots only @connection_id Identifier of the business connection to return getBusinessConnection connection_id:string = BusinessConnection; @@ -8913,7 +8986,7 @@ clearAllDraftMessages exclude_secret_chats:Bool = Ok; //@description Returns saved notification sound by its identifier. Returns a 404 error if there is no saved notification sound with the specified identifier @notification_sound_id Identifier of the notification sound getSavedNotificationSound notification_sound_id:int64 = NotificationSounds; -//@description Returns list of saved notification sounds. If a sound isn't in the list, then default sound needs to be used +//@description Returns the list of saved notification sounds. If a sound isn't in the list, then default sound needs to be used getSavedNotificationSounds = NotificationSounds; //@description Adds a new notification sound to the list of saved notification sounds. The new notification sound is added to the top of the list. If it is already in the list, its position isn't changed @sound Notification sound file to add @@ -8923,7 +8996,7 @@ addSavedNotificationSound sound:InputFile = NotificationSound; removeSavedNotificationSound notification_sound_id:int64 = Ok; -//@description Returns list of chats with non-default notification settings for new messages +//@description Returns the list of chats with non-default notification settings for new messages //@scope If specified, only chats from the scope will be returned; pass null to return chats from all scopes //@compare_sound Pass true to include in the response chats with only non-default sound getChatNotificationSettingsExceptions scope:NotificationSettingsScope compare_sound:Bool = Chats; @@ -8934,7 +9007,10 @@ getScopeNotificationSettings scope:NotificationSettingsScope = ScopeNotification //@description Changes notification settings for chats of a given type @scope Types of chats for which to change the notification settings @notification_settings The new notification settings for the given scope setScopeNotificationSettings scope:NotificationSettingsScope notification_settings:scopeNotificationSettings = Ok; -//@description Resets all notification settings to their default values. By default, all chats are unmuted and message previews are shown +//@description Changes notification settings for reactions @notification_settings The new notification settings for reactions +setReactionNotificationSettings notification_settings:reactionNotificationSettings = Ok; + +//@description Resets all chat and scope notification settings to their default values. By default, all chats are unmuted and message previews are shown resetAllNotificationSettings = Ok; @@ -8971,9 +9047,9 @@ canSendStory chat_id:int53 = CanSendStoryResult; //@privacy_settings The privacy settings for the story; ignored for stories sent to supergroup and channel chats //@active_period Period after which the story is moved to archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400 for Telegram Premium users, and 86400 otherwise //@from_story_full_id Full identifier of the original story, which content was used to create the story -//@is_pinned Pass true to keep the story accessible after expiration +//@is_posted_to_chat_page Pass true to keep the story accessible after expiration //@protect_content Pass true if the content of the story must be protected from forwarding and screenshotting -sendStory chat_id:int53 content:InputStoryContent areas:inputStoryAreas caption:formattedText privacy_settings:StoryPrivacySettings active_period:int32 from_story_full_id:storyFullId is_pinned:Bool protect_content:Bool = Story; +sendStory chat_id:int53 content:InputStoryContent areas:inputStoryAreas caption:formattedText privacy_settings:StoryPrivacySettings active_period:int32 from_story_full_id:storyFullId is_posted_to_chat_page:Bool protect_content:Bool = Story; //@description Changes content and caption of a story. Can be called only if story.can_be_edited == true //@story_sender_chat_id Identifier of the chat that posted the story @@ -8988,18 +9064,18 @@ editStory story_sender_chat_id:int53 story_id:int32 content:InputStoryContent ar //@privacy_settings The new privacy settigs for the story setStoryPrivacySettings story_id:int32 privacy_settings:StoryPrivacySettings = Ok; -//@description Toggles whether a story is accessible after expiration. Can be called only if story.can_toggle_is_pinned == true +//@description Toggles whether a story is accessible after expiration. Can be called only if story.can_toggle_is_posted_to_chat_page == true //@story_sender_chat_id Identifier of the chat that posted the story //@story_id Identifier of the story -//@is_pinned Pass true to make the story accessible after expiration; pass false to make it private -toggleStoryIsPinned story_sender_chat_id:int53 story_id:int32 is_pinned:Bool = Ok; +//@is_posted_to_chat_page Pass true to make the story accessible after expiration; pass false to make it private +toggleStoryIsPostedToChatPage story_sender_chat_id:int53 story_id:int32 is_posted_to_chat_page:Bool = Ok; //@description Deletes a previously sent story. Can be called only if story.can_be_deleted == true //@story_sender_chat_id Identifier of the chat that posted the story //@story_id Identifier of the story to delete deleteStory story_sender_chat_id:int53 story_id:int32 = Ok; -//@description Returns list of chats with non-default notification settings for stories +//@description Returns the list of chats with non-default notification settings for stories getStoryNotificationSettingsExceptions = Chats; //@description Loads more active stories from a story list. The loaded stories will be sent through updates. Active stories are sorted by @@ -9013,13 +9089,13 @@ setChatActiveStoriesList chat_id:int53 story_list:StoryList = Ok; //@description Returns the list of active stories posted by the given chat @chat_id Chat identifier getChatActiveStories chat_id:int53 = ChatActiveStories; -//@description Returns the list of pinned stories posted by the given chat. The stories are returned in a reverse chronological order (i.e., in order of decreasing story_id). -//-For optimal performance, the number of returned stories is chosen by TDLib +//@description Returns the list of stories that posted by the given chat to its chat page. If from_story_id == 0, then pinned stories are returned first. +//-Then, stories are returned in a reverse chronological order (i.e., in order of decreasing story_id). For optimal performance, the number of returned stories is chosen by TDLib //@chat_id Chat identifier -//@from_story_id Identifier of the story starting from which stories must be returned; use 0 to get results from the last story +//@from_story_id Identifier of the story starting from which stories must be returned; use 0 to get results from pinned and the newest story //@limit The maximum number of stories to be returned //-For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit -getChatPinnedStories chat_id:int53 from_story_id:int32 limit:int32 = Stories; +getChatPostedToChatPageStories chat_id:int53 from_story_id:int32 limit:int32 = Stories; //@description Returns the list of all stories posted by the given chat; requires can_edit_stories right in the chat. //-The stories are returned in a reverse chronological order (i.e., in order of decreasing story_id). For optimal performance, the number of returned stories is chosen by TDLib @@ -9029,6 +9105,11 @@ getChatPinnedStories chat_id:int53 from_story_id:int32 limit:int32 = Stories; //-For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit getChatArchivedStories chat_id:int53 from_story_id:int32 limit:int32 = Stories; +//@description Changes the list of pinned stories on a chat page; requires can_edit_stories right in the chat +//@chat_id Identifier of the chat that posted the stories +//@story_ids New list of pinned stories. All stories must be posted to the chat page first. There can be up to getOption("pinned_story_count_max") pinned stories on a chat page +setChatPinnedStories chat_id:int53 story_ids:vector = Ok; + //@description Informs TDLib that a story is opened and is being viewed by the user //@story_sender_chat_id The identifier of the sender of the opened story //@story_id The identifier of the story @@ -9088,12 +9169,12 @@ activateStoryStealthMode = Ok; getStoryPublicForwards story_sender_chat_id:int53 story_id:int32 offset:string limit:int32 = PublicForwards; -//@description Returns list of features available on the specific chat boost level; this is an offline request +//@description Returns the list of features available on the specific chat boost level; this is an offline request //@is_channel Pass true to get the list of features for channels; pass false to get the list of features for supergroups //@level Chat boost level getChatBoostLevelFeatures is_channel:Bool level:int32 = ChatBoostLevelFeatures; -//@description Returns list of features available for different chat boost levels; this is an offline request +//@description Returns the list of features available for different chat boost levels; this is an offline request //@is_channel Pass true to get the list of features for channels; pass false to get the list of features for supergroups getChatBoostFeatures is_channel:Bool = ChatBoostFeatures; @@ -9114,14 +9195,14 @@ getChatBoostLink chat_id:int53 = ChatBoostLink; //@description Returns information about a link to boost a chat. Can be called for any internal link of the type internalLinkTypeChatBoost @url The link to boost a chat getChatBoostLinkInfo url:string = ChatBoostLinkInfo; -//@description Returns list of boosts applied to a chat; requires administrator rights in the chat +//@description Returns the list of boosts applied to a chat; requires administrator rights in the chat //@chat_id Identifier of the chat //@only_gift_codes Pass true to receive only boosts received from gift codes and giveaways created by the chat //@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results //@limit The maximum number of boosts to be returned; up to 100. For optimal performance, the number of returned boosts can be smaller than the specified limit getChatBoosts chat_id:int53 only_gift_codes:Bool offset:string limit:int32 = FoundChatBoosts; -//@description Returns list of boosts applied to a chat by a given user; requires administrator rights in the chat; for bots only +//@description Returns the list of boosts applied to a chat by a given user; requires administrator rights in the chat; for bots only //@chat_id Identifier of the chat //@user_id Identifier of the user getUserChatBoosts chat_id:int53 user_id:int53 = FoundChatBoosts; @@ -9177,8 +9258,9 @@ cancelDownloadFile file_id:int32 only_if_pending:Bool = Ok; //@description Returns suggested name for saving a file in a given directory @file_id Identifier of the file @directory Directory in which the file is supposed to be saved getSuggestedFileName file_id:int32 directory:string = Text; -//@description Preliminary uploads a file to the cloud before sending it in a message, which can be useful for uploading of being recorded voice and video notes. Updates updateFile will be used -//-to notify about upload progress and successful completion of the upload. The file will not have a persistent remote identifier until it is sent in a message +//@description Preliminary uploads a file to the cloud before sending it in a message, which can be useful for uploading of being recorded voice and video notes. +//-In all other cases there is no need to preliminary upload a file. Updates updateFile will be used to notify about upload progress. +//-The upload will not be completed until the file is sent in a message //@file File to upload //@file_type File type; pass null if unknown //@priority Priority of the upload (1-32). The higher the priority, the earlier the file will be uploaded. If the priorities of two files are equal, then the first one for which preliminaryUploadFile was called will be uploaded first @@ -9286,7 +9368,7 @@ editChatInviteLink chat_id:int53 invite_link:string name:string expiration_date: //@invite_link Invite link to get getChatInviteLink chat_id:int53 invite_link:string = ChatInviteLink; -//@description Returns list of chat administrators with number of their invite links. Requires owner privileges in the chat @chat_id Chat identifier +//@description Returns the list of chat administrators with number of their invite links. Requires owner privileges in the chat @chat_id Chat identifier getChatInviteLinkCounts chat_id:int53 = ChatInviteLinkCounts; //@description Returns invite links for a chat created by specified administrator. Requires administrator privileges and can_invite_users right in the chat to get own links and owner privileges to get other links @@ -9374,7 +9456,7 @@ sendCallDebugInformation call_id:int32 debug_information:string = Ok; sendCallLog call_id:int32 log_file:InputFile = Ok; -//@description Returns list of participant identifiers, on whose behalf a video chat in the chat can be joined @chat_id Chat identifier +//@description Returns the list of participant identifiers, on whose behalf a video chat in the chat can be joined @chat_id Chat identifier getVideoChatAvailableParticipants chat_id:int53 = MessageSenders; //@description Changes default participant identifier, on whose behalf a video chat in the chat will be joined @chat_id Chat identifier @default_participant_id Default group call participant identifier to join the video chats @@ -9696,10 +9778,12 @@ getEmojiCategories type:EmojiCategoryType = EmojiCategories; //@description Returns an animated emoji corresponding to a given emoji. Returns a 404 error if the emoji has no animated emoji @emoji The emoji getAnimatedEmoji emoji:string = AnimatedEmoji; -//@description Returns an HTTP URL which can be used to automatically log in to the translation platform and suggest new emoji replacements. The URL will be valid for 30 seconds after generation @language_code Language code for which the emoji replacements will be suggested +//@description Returns an HTTP URL which can be used to automatically log in to the translation platform and suggest new emoji replacements. The URL will be valid for 30 seconds after generation +//@language_code Language code for which the emoji replacements will be suggested getEmojiSuggestionsUrl language_code:string = HttpUrl; -//@description Returns list of custom emoji stickers by their identifiers. Stickers are returned in arbitrary order. Only found stickers are returned @custom_emoji_ids Identifiers of custom emoji stickers. At most 200 custom emoji stickers can be received simultaneously +//@description Returns the list of custom emoji stickers by their identifiers. Stickers are returned in arbitrary order. Only found stickers are returned +//@custom_emoji_ids Identifiers of custom emoji stickers. At most 200 custom emoji stickers can be received simultaneously getCustomEmojiStickers custom_emoji_ids:vector = Stickers; //@description Returns default list of custom emoji stickers for placing on a chat photo @@ -9715,7 +9799,8 @@ getDefaultBackgroundCustomEmojiStickers = Stickers; //@description Returns saved animations getSavedAnimations = Animations; -//@description Manually adds a new animation to the list of saved animations. The new animation is added to the beginning of the list. If the animation was already in the list, it is removed first. Only non-secret video animations with MIME type "video/mp4" can be added to the list +//@description Manually adds a new animation to the list of saved animations. The new animation is added to the beginning of the list. If the animation was already in the list, it is removed first. +//-Only non-secret video animations with MIME type "video/mp4" can be added to the list //@animation The animation file to be added. Only animations known to the server (i.e., successfully sent via a message) can be added to the list addSavedAnimation animation:InputFile = Ok; @@ -9791,6 +9876,10 @@ setEmojiStatus emoji_status:emojiStatus = Ok; //@description Changes the location of the current user. Needs to be called if getOption("is_location_visible") is true and location changes for more than 1 kilometer. Must not be called if the user has a business location @location The new location of the user setLocation location:location = Ok; +//@description Toggles whether the current user has sponsored messages enabled. The setting has no effect for users without Telegram Premium for which sponsored messages are always enabled +//@has_sponsored_messages_enabled Pass true to enable sponsored messages for the current user; false to disable them +toggleHasSponsoredMessagesEnabled has_sponsored_messages_enabled:Bool = Ok; + //@description Changes the business location of the current user. Requires Telegram Business subscription @location The new location of the business; pass null to remove the location setBusinessLocation location:businessLocation = Ok; @@ -9818,6 +9907,9 @@ sendPhoneNumberCode phone_number:string settings:phoneNumberAuthenticationSettin //@token SafetyNet Attestation API token for the Android application, or secret from push notification for the iOS application sendPhoneNumberFirebaseSms token:string = Ok; +//@description Reports that authentication code wasn't delivered via SMS to the specified phone number; for official mobile apps only @mobile_network_code Current mobile network code +reportPhoneNumberCodeMissing mobile_network_code:string = Ok; + //@description Resends the authentication code sent to a phone number. Works only if the previously received authenticationCodeInfo next_code_type was not null and the server-specified timeout has passed resendPhoneNumberCode = AuthenticationCodeInfo; @@ -9878,7 +9970,7 @@ setCommands scope:BotCommandScope language_code:string commands:vector Date: Wed, 29 May 2024 17:58:55 +0800 Subject: [PATCH 18/54] Update to TDLib 1.8.30 --- client/function.go | 361 ++++++++++++- client/type.go | 1145 ++++++++++++++++++++++++++++++++++++++--- client/unmarshaler.go | 567 ++++++++++++++++++++ data/td_api.tl | 364 ++++++++++--- 4 files changed, 2272 insertions(+), 165 deletions(-) diff --git a/client/function.go b/client/function.go index 67cdd45..7f73bb1 100755 --- a/client/function.go +++ b/client/function.go @@ -184,13 +184,20 @@ func (client *Client) SetAuthenticationEmailAddress(req *SetAuthenticationEmailA return UnmarshalOk(result.Data) } +type ResendAuthenticationCodeRequest struct { + // Reason of code resending; pass null if unknown + Reason ResendCodeReason `json:"reason"` +} + // Resends an authentication code to the user. Works only when the current authorization state is authorizationStateWaitCode, the next_code_type of the result is not null and the server-specified timeout has passed, or when the current authorization state is authorizationStateWaitEmailCode -func (client *Client) ResendAuthenticationCode() (*Ok, error) { +func (client *Client) ResendAuthenticationCode(req *ResendAuthenticationCodeRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ Type: "resendAuthenticationCode", }, - Data: map[string]interface{}{}, + Data: map[string]interface{}{ + "reason": req.Reason, + }, }) if err != nil { return nil, err @@ -436,7 +443,7 @@ func (client *Client) RecoverAuthenticationPassword(req *RecoverAuthenticationPa } type SendAuthenticationFirebaseSmsRequest struct { - // SafetyNet Attestation API token for the Android application, or secret from push notification for the iOS application + // Play Integrity API or SafetyNet Attestation API token for the Android application, or secret from push notification for the iOS application Token string `json:"token"` } @@ -466,7 +473,7 @@ type ReportAuthenticationCodeMissingRequest struct { MobileNetworkCode string `json:"mobile_network_code"` } -// Reports that authentication code wasn't delivered via SMS; for official mobile apps only. Works only when the current authorization state is authorizationStateWaitCode +// Reports that authentication code wasn't delivered via SMS; for official mobile applications only. Works only when the current authorization state is authorizationStateWaitCode func (client *Client) ReportAuthenticationCodeMissing(req *ReportAuthenticationCodeMissingRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -2870,6 +2877,112 @@ func (client *Client) SearchOutgoingDocumentMessages(req *SearchOutgoingDocument return UnmarshalFoundMessages(result.Data) } +type SearchPublicHashtagMessagesRequest struct { + // Hashtag to search for + Hashtag string `json:"hashtag"` + // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results + Offset string `json:"offset"` + // The maximum number of messages to be returned; up to 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit + Limit int32 `json:"limit"` +} + +// Searches for public channel posts with the given hashtag. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit +func (client *Client) SearchPublicHashtagMessages(req *SearchPublicHashtagMessagesRequest) (*FoundMessages, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchPublicHashtagMessages", + }, + Data: map[string]interface{}{ + "hashtag": req.Hashtag, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFoundMessages(result.Data) +} + +type GetSearchedForHashtagsRequest struct { + // Prefix of hashtags to return + Prefix string `json:"prefix"` + // The maximum number of hashtags to be returned + Limit int32 `json:"limit"` +} + +// Returns recently searched for hashtags by their prefix +func (client *Client) GetSearchedForHashtags(req *GetSearchedForHashtagsRequest) (*Hashtags, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getSearchedForHashtags", + }, + Data: map[string]interface{}{ + "prefix": req.Prefix, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalHashtags(result.Data) +} + +type RemoveSearchedForHashtagRequest struct { + // Hashtag to delete + Hashtag string `json:"hashtag"` +} + +// Removes a hashtag from the list of recently searched for hashtags +func (client *Client) RemoveSearchedForHashtag(req *RemoveSearchedForHashtagRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removeSearchedForHashtag", + }, + Data: map[string]interface{}{ + "hashtag": req.Hashtag, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Clears the list of recently searched for hashtags +func (client *Client) ClearSearchedForHashtags() (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "clearSearchedForHashtags", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type DeleteAllCallMessagesRequest struct { // Pass true to delete the messages for all users Revoke bool `json:"revoke"` @@ -3631,7 +3744,7 @@ type SendMessageAlbumRequest struct { ReplyTo InputMessageReplyTo `json:"reply_to"` // Options to be used to send the messages; pass null to use default options Options *MessageSendOptions `json:"options"` - // Contents of messages to be sent. At most 10 messages can be added to an album + // Contents of messages to be sent. At most 10 messages can be added to an album. All messages must have the same value of show_caption_above_media InputMessageContents []InputMessageContent `json:"input_message_contents"` } @@ -4015,7 +4128,7 @@ type EditMessageTextRequest struct { InputMessageContent InputMessageContent `json:"input_message_content"` } -// Edits the text of a message (or a text of a game message). Returns the edited message after the edit is completed on the server side +// Edits the text of a message (or a text of a game message). Returns the edited message after the edit is completed on the server side. Can be used only if message.can_be_edited == true func (client *Client) EditMessageText(req *EditMessageTextRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -4056,7 +4169,7 @@ type EditMessageLiveLocationRequest struct { ProximityAlertRadius int32 `json:"proximity_alert_radius"` } -// Edits the message content of a live location. Messages can be edited for a limited period of time specified in the live location. Returns the edited message after the edit is completed on the server side +// Edits the message content of a live location. Messages can be edited for a limited period of time specified in the live location. Returns the edited message after the edit is completed on the server side. Can be used only if message.can_be_edited == true func (client *Client) EditMessageLiveLocation(req *EditMessageLiveLocationRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -4094,7 +4207,7 @@ type EditMessageMediaRequest struct { InputMessageContent InputMessageContent `json:"input_message_content"` } -// Edits the content of a message with an animation, an audio, a document, a photo or a video, including message caption. If only the caption needs to be edited, use editMessageCaption instead. The media can't be edited if the message was set to self-destruct or to a self-destructing media. The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa. Returns the edited message after the edit is completed on the server side +// Edits the content of a message with an animation, an audio, a document, a photo or a video, including message caption. If only the caption needs to be edited, use editMessageCaption instead. The media can't be edited if the message was set to self-destruct or to a self-destructing media. The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa. Returns the edited message after the edit is completed on the server side. Can be used only if message.can_be_edited == true func (client *Client) EditMessageMedia(req *EditMessageMediaRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -4127,9 +4240,11 @@ type EditMessageCaptionRequest struct { ReplyMarkup ReplyMarkup `json:"reply_markup"` // New message content caption; 0-getOption("message_caption_length_max") characters; pass null to remove caption Caption *FormattedText `json:"caption"` + // Pass true to show the caption above the media; otherwise, caption will be shown below the media. Can be true only for animation, photo, and video messages + ShowCaptionAboveMedia bool `json:"show_caption_above_media"` } -// Edits the message content caption. Returns the edited message after the edit is completed on the server side +// Edits the message content caption. Returns the edited message after the edit is completed on the server side. Can be used only if message.can_be_edited == true func (client *Client) EditMessageCaption(req *EditMessageCaptionRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -4140,6 +4255,7 @@ func (client *Client) EditMessageCaption(req *EditMessageCaptionRequest) (*Messa "message_id": req.MessageId, "reply_markup": req.ReplyMarkup, "caption": req.Caption, + "show_caption_above_media": req.ShowCaptionAboveMedia, }, }) if err != nil { @@ -4162,7 +4278,7 @@ type EditMessageReplyMarkupRequest struct { ReplyMarkup ReplyMarkup `json:"reply_markup"` } -// Edits the message reply markup; for bots only. Returns the edited message after the edit is completed on the server side +// Edits the message reply markup; for bots only. Returns the edited message after the edit is completed on the server side. Can be used only if message.can_be_edited == true func (client *Client) EditMessageReplyMarkup(req *EditMessageReplyMarkupRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -4297,6 +4413,8 @@ type EditInlineMessageCaptionRequest struct { ReplyMarkup ReplyMarkup `json:"reply_markup"` // New message content caption; pass null to remove caption; 0-getOption("message_caption_length_max") characters Caption *FormattedText `json:"caption"` + // Pass true to show the caption above the media; otherwise, caption will be shown below the media. Can be true only for animation, photo, and video messages + ShowCaptionAboveMedia bool `json:"show_caption_above_media"` } // Edits the caption of an inline message sent via a bot; for bots only @@ -4309,6 +4427,7 @@ func (client *Client) EditInlineMessageCaption(req *EditInlineMessageCaptionRequ "inline_message_id": req.InlineMessageId, "reply_markup": req.ReplyMarkup, "caption": req.Caption, + "show_caption_above_media": req.ShowCaptionAboveMedia, }, }) if err != nil { @@ -4383,6 +4502,38 @@ func (client *Client) EditMessageSchedulingState(req *EditMessageSchedulingState return UnmarshalOk(result.Data) } +type SetMessageFactCheckRequest struct { + // The channel chat the message belongs to + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` + // New text of the fact-check; 0-getOption("fact_check_length_max") characters; pass null to remove it. Only Bold, Italic, and TextUrl entities with https://t.me/ links are supported + Text *FormattedText `json:"text"` +} + +// Changes the fact-check of a message. Can be only used if getOption("can_edit_fact_check") == true +func (client *Client) SetMessageFactCheck(req *SetMessageFactCheckRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setMessageFactCheck", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "text": req.Text, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type SendBusinessMessageRequest struct { // Unique identifier of business connection on behalf of which to send the request BusinessConnectionId string `json:"business_connection_id"` @@ -4394,6 +4545,8 @@ type SendBusinessMessageRequest struct { DisableNotification bool `json:"disable_notification"` // Pass true if the content of the message must be protected from forwarding and saving ProtectContent bool `json:"protect_content"` + // Identifier of the effect to apply to the message + EffectId JsonInt64 `json:"effect_id"` // Markup for replying to the message; pass null if none ReplyMarkup ReplyMarkup `json:"reply_markup"` // The content of the message to be sent @@ -4412,6 +4565,7 @@ func (client *Client) SendBusinessMessage(req *SendBusinessMessageRequest) (*Bus "reply_to": req.ReplyTo, "disable_notification": req.DisableNotification, "protect_content": req.ProtectContent, + "effect_id": req.EffectId, "reply_markup": req.ReplyMarkup, "input_message_content": req.InputMessageContent, }, @@ -4438,7 +4592,9 @@ type SendBusinessMessageAlbumRequest struct { DisableNotification bool `json:"disable_notification"` // Pass true if the content of the message must be protected from forwarding and saving ProtectContent bool `json:"protect_content"` - // Contents of messages to be sent. At most 10 messages can be added to an album + // Identifier of the effect to apply to the message + EffectId JsonInt64 `json:"effect_id"` + // Contents of messages to be sent. At most 10 messages can be added to an album. All messages must have the same value of show_caption_above_media InputMessageContents []InputMessageContent `json:"input_message_contents"` } @@ -4454,6 +4610,7 @@ func (client *Client) SendBusinessMessageAlbum(req *SendBusinessMessageAlbumRequ "reply_to": req.ReplyTo, "disable_notification": req.DisableNotification, "protect_content": req.ProtectContent, + "effect_id": req.EffectId, "input_message_contents": req.InputMessageContents, }, }) @@ -4729,7 +4886,7 @@ type AddQuickReplyShortcutMessageAlbumRequest struct { ShortcutName string `json:"shortcut_name"` // Identifier of a quick reply message in the same shortcut to be replied; pass 0 if none ReplyToMessageId int64 `json:"reply_to_message_id"` - // Contents of messages to be sent. At most 10 messages can be added to an album + // Contents of messages to be sent. At most 10 messages can be added to an album. All messages must have the same value of show_caption_above_media InputMessageContents []InputMessageContent `json:"input_message_contents"` } @@ -5508,6 +5665,32 @@ func (client *Client) SetSavedMessagesTagLabel(req *SetSavedMessagesTagLabelRequ return UnmarshalOk(result.Data) } +type GetMessageEffectRequest struct { + // Unique identifier of the effect + EffectId JsonInt64 `json:"effect_id"` +} + +// Returns information about a message effect. Returns a 404 error if the effect is not found +func (client *Client) GetMessageEffect(req *GetMessageEffectRequest) (*MessageEffect, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getMessageEffect", + }, + Data: map[string]interface{}{ + "effect_id": req.EffectId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessageEffect(result.Data) +} + type SearchQuoteRequest struct { // Text in which to search for the quote Text *FormattedText `json:"text"` @@ -5583,7 +5766,7 @@ type ParseTextEntitiesRequest struct { ParseMode TextParseMode `json:"parse_mode"` } -// Parses Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, BlockQuote, Code, Pre, PreCode, TextUrl and MentionName entities from a marked-up text. Can be called synchronously +// Parses Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, BlockQuote, ExpandableBlockQuote, Code, Pre, PreCode, TextUrl and MentionName entities from a marked-up text. Can be called synchronously func ParseTextEntities(req *ParseTextEntitiesRequest) (*FormattedText, error) { result, err := Execute(Request{ meta: meta{ @@ -5606,7 +5789,7 @@ func ParseTextEntities(req *ParseTextEntitiesRequest) (*FormattedText, error) { } // deprecated -// Parses Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, BlockQuote, Code, Pre, PreCode, TextUrl and MentionName entities from a marked-up text. Can be called synchronously +// Parses Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, BlockQuote, ExpandableBlockQuote, Code, Pre, PreCode, TextUrl and MentionName entities from a marked-up text. Can be called synchronously func (client *Client) ParseTextEntities(req *ParseTextEntitiesRequest) (*FormattedText, error) { return ParseTextEntities(req)} @@ -11515,6 +11698,35 @@ func (client *Client) SearchFileDownloads(req *SearchFileDownloadsRequest) (*Fou return UnmarshalFoundFileDownloads(result.Data) } +type SetApplicationVerificationTokenRequest struct { + // Unique identifier for the verification process as received from updateApplicationVerificationRequired + VerificationId int64 `json:"verification_id"` + // Play Integrity API token for the Android application, or secret from push notification for the iOS application; pass an empty string to abort verification and receive error VERIFICATION_FAILED for the request + Token string `json:"token"` +} + +// Application verification has been completed. Can be called before authorization +func (client *Client) SetApplicationVerificationToken(req *SetApplicationVerificationTokenRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setApplicationVerificationToken", + }, + Data: map[string]interface{}{ + "verification_id": req.VerificationId, + "token": req.Token, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type GetMessageFileTypeRequest struct { // Beginning of the message file; up to 100 first lines MessageFileHead string `json:"message_file_head"` @@ -13592,6 +13804,8 @@ func (client *Client) SuggestUserProfilePhoto(req *SuggestUserProfilePhotoReques type SearchUserByPhoneNumberRequest struct { // Phone number to search for PhoneNumber string `json:"phone_number"` + // Pass true to get only locally available information without sending network requests + OnlyLocal bool `json:"only_local"` } // Searches a user by their phone number. Returns a 404 error if the user can't be found @@ -13602,6 +13816,7 @@ func (client *Client) SearchUserByPhoneNumber(req *SearchUserByPhoneNumberReques }, Data: map[string]interface{}{ "phone_number": req.PhoneNumber, + "only_local": req.OnlyLocal, }, }) if err != nil { @@ -15307,7 +15522,7 @@ func (client *Client) SendPhoneNumberCode(req *SendPhoneNumberCodeRequest) (*Aut } type SendPhoneNumberFirebaseSmsRequest struct { - // SafetyNet Attestation API token for the Android application, or secret from push notification for the iOS application + // Play Integrity API or SafetyNet Attestation API token for the Android application, or secret from push notification for the iOS application Token string `json:"token"` } @@ -15337,7 +15552,7 @@ type ReportPhoneNumberCodeMissingRequest struct { MobileNetworkCode string `json:"mobile_network_code"` } -// Reports that authentication code wasn't delivered via SMS to the specified phone number; for official mobile apps only +// Reports that authentication code wasn't delivered via SMS to the specified phone number; for official mobile applications only func (client *Client) ReportPhoneNumberCodeMissing(req *ReportPhoneNumberCodeMissingRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -15358,13 +15573,20 @@ func (client *Client) ReportPhoneNumberCodeMissing(req *ReportPhoneNumberCodeMis return UnmarshalOk(result.Data) } +type ResendPhoneNumberCodeRequest struct { + // Reason of code resending; pass null if unknown + Reason ResendCodeReason `json:"reason"` +} + // Resends the authentication code sent to a phone number. Works only if the previously received authenticationCodeInfo next_code_type was not null and the server-specified timeout has passed -func (client *Client) ResendPhoneNumberCode() (*AuthenticationCodeInfo, error) { +func (client *Client) ResendPhoneNumberCode(req *ResendPhoneNumberCodeRequest) (*AuthenticationCodeInfo, error) { result, err := client.Send(Request{ meta: meta{ Type: "resendPhoneNumberCode", }, - Data: map[string]interface{}{}, + Data: map[string]interface{}{ + "reason": req.Reason, + }, }) if err != nil { return nil, err @@ -16725,7 +16947,7 @@ func (client *Client) ToggleSupergroupSignMessages(req *ToggleSupergroupSignMess } type ToggleSupergroupJoinToSendMessagesRequest struct { - // Identifier of the supergroup + // Identifier of the supergroup that isn't a broadcast group SupergroupId int64 `json:"supergroup_id"` // New value of join_to_send_messages JoinToSendMessages bool `json:"join_to_send_messages"` @@ -16754,7 +16976,7 @@ func (client *Client) ToggleSupergroupJoinToSendMessages(req *ToggleSupergroupJo } type ToggleSupergroupJoinByRequestRequest struct { - // Identifier of the channel + // Identifier of the supergroup that isn't a broadcast group SupergroupId int64 `json:"supergroup_id"` // New value of join_by_request JoinByRequest bool `json:"join_by_request"` @@ -17202,7 +17424,7 @@ type SendPaymentFormRequest struct { OrderInfoId string `json:"order_info_id"` // Identifier of a chosen shipping option, if applicable ShippingOptionId string `json:"shipping_option_id"` - // The credentials chosen by user for payment + // The credentials chosen by user for payment; pass null for a payment in Telegram stars Credentials InputCredentials `json:"credentials"` // Chosen by the user amount of tip in the smallest units of the currency TipAmount int64 `json:"tip_amount"` @@ -17346,6 +17568,35 @@ func (client *Client) CreateInvoiceLink(req *CreateInvoiceLinkRequest) (*HttpUrl return UnmarshalHttpUrl(result.Data) } +type RefundStarPaymentRequest struct { + // Identifier of the user that did the payment + UserId int64 `json:"user_id"` + // Telegram payment identifier + TelegramPaymentChargeId string `json:"telegram_payment_charge_id"` +} + +// Refunds a previously done payment in Telegram Stars +func (client *Client) RefundStarPayment(req *RefundStarPaymentRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "refundStarPayment", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "telegram_payment_charge_id": req.TelegramPaymentChargeId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + // Returns a user that can be contacted to get support func (client *Client) GetSupportUser() (*User, error) { result, err := client.Send(Request{ @@ -20295,16 +20546,64 @@ func (client *Client) GetPremiumGiveawayInfo(req *GetPremiumGiveawayInfoRequest) } } -type CanPurchasePremiumRequest struct { +// Returns available options for Telegram stars purchase +func (client *Client) GetStarPaymentOptions() (*StarPaymentOptions, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getStarPaymentOptions", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStarPaymentOptions(result.Data) +} + +type GetStarTransactionsRequest struct { + // Offset of the first transaction to return as received from the previous request; use empty string to get the first chunk of results + Offset string `json:"offset"` + // Direction of the transactions to receive; pass null to get all transactions + Direction StarTransactionDirection `json:"direction"` +} + +// Returns the list of Telegram star transactions for the current user +func (client *Client) GetStarTransactions(req *GetStarTransactionsRequest) (*StarTransactions, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getStarTransactions", + }, + Data: map[string]interface{}{ + "offset": req.Offset, + "direction": req.Direction, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStarTransactions(result.Data) +} + +type CanPurchaseFromStoreRequest struct { // Transaction purpose Purpose StorePaymentPurpose `json:"purpose"` } -// Checks whether Telegram Premium purchase is possible. Must be called before in-store Premium purchase -func (client *Client) CanPurchasePremium(req *CanPurchasePremiumRequest) (*Ok, error) { +// Checks whether an in-store purchase is possible. Must be called before any in-store purchase +func (client *Client) CanPurchaseFromStore(req *CanPurchaseFromStoreRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "canPurchasePremium", + Type: "canPurchaseFromStore", }, Data: map[string]interface{}{ "purpose": req.Purpose, @@ -21666,6 +21965,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateMessageUnreadReactions: return UnmarshalUpdateMessageUnreadReactions(result.Data) + case TypeUpdateMessageFactCheck: + return UnmarshalUpdateMessageFactCheck(result.Data) + case TypeUpdateMessageLiveLocationViewed: return UnmarshalUpdateMessageLiveLocationViewed(result.Data) @@ -21867,6 +22169,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateFileRemovedFromDownloads: return UnmarshalUpdateFileRemovedFromDownloads(result.Data) + case TypeUpdateApplicationVerificationRequired: + return UnmarshalUpdateApplicationVerificationRequired(result.Data) + case TypeUpdateCall: return UnmarshalUpdateCall(result.Data) @@ -21969,12 +22274,18 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateActiveEmojiReactions: return UnmarshalUpdateActiveEmojiReactions(result.Data) + case TypeUpdateAvailableMessageEffects: + return UnmarshalUpdateAvailableMessageEffects(result.Data) + case TypeUpdateDefaultReactionType: return UnmarshalUpdateDefaultReactionType(result.Data) case TypeUpdateSavedMessagesTags: return UnmarshalUpdateSavedMessagesTags(result.Data) + case TypeUpdateOwnedStarCount: + return UnmarshalUpdateOwnedStarCount(result.Data) + case TypeUpdateChatRevenueAmount: return UnmarshalUpdateChatRevenueAmount(result.Data) diff --git a/client/type.go b/client/type.go index 6b44089..ea9fc14 100755 --- a/client/type.go +++ b/client/type.go @@ -22,6 +22,8 @@ const ( ClassBusinessAwayMessageSchedule = "BusinessAwayMessageSchedule" ClassChatPhotoStickerType = "ChatPhotoStickerType" ClassInputChatPhoto = "InputChatPhoto" + ClassStarTransactionDirection = "StarTransactionDirection" + ClassStarTransactionSource = "StarTransactionSource" ClassPremiumGiveawayParticipantStatus = "PremiumGiveawayParticipantStatus" ClassPremiumGiveawayInfo = "PremiumGiveawayInfo" ClassChatMemberStatus = "ChatMemberStatus" @@ -33,6 +35,7 @@ const ( ClassMessageReadDate = "MessageReadDate" ClassMessageOrigin = "MessageOrigin" ClassReactionType = "ReactionType" + ClassMessageEffectType = "MessageEffectType" ClassMessageSendingState = "MessageSendingState" ClassMessageReplyTo = "MessageReplyTo" ClassInputMessageReplyTo = "InputMessageReplyTo" @@ -58,6 +61,8 @@ const ( ClassCollectibleItemType = "CollectibleItemType" ClassInputCredentials = "InputCredentials" ClassPaymentProvider = "PaymentProvider" + ClassPaymentFormType = "PaymentFormType" + ClassPaymentReceiptType = "PaymentReceiptType" ClassInputInvoice = "InputInvoice" ClassMessageExtendedMedia = "MessageExtendedMedia" ClassPassportElementType = "PassportElementType" @@ -84,6 +89,7 @@ const ( ClassStoryInteractionType = "StoryInteractionType" ClassPublicForward = "PublicForward" ClassChatBoostSource = "ChatBoostSource" + ClassResendCodeReason = "ResendCodeReason" ClassCallDiscardReason = "CallDiscardReason" ClassCallServerType = "CallServerType" ClassCallState = "CallState" @@ -217,11 +223,16 @@ const ( ClassChatPhotos = "ChatPhotos" ClassChatPermissions = "ChatPermissions" ClassChatAdministratorRights = "ChatAdministratorRights" + ClassProductInfo = "ProductInfo" ClassPremiumPaymentOption = "PremiumPaymentOption" ClassPremiumStatePaymentOption = "PremiumStatePaymentOption" ClassPremiumGiftCodePaymentOption = "PremiumGiftCodePaymentOption" ClassPremiumGiftCodePaymentOptions = "PremiumGiftCodePaymentOptions" ClassPremiumGiftCodeInfo = "PremiumGiftCodeInfo" + ClassStarPaymentOption = "StarPaymentOption" + ClassStarPaymentOptions = "StarPaymentOptions" + ClassStarTransaction = "StarTransaction" + ClassStarTransactions = "StarTransactions" ClassAccentColor = "AccentColor" ClassProfileAccentColors = "ProfileAccentColors" ClassProfileAccentColor = "ProfileAccentColor" @@ -264,8 +275,10 @@ const ( ClassMessageReactions = "MessageReactions" ClassMessageInteractionInfo = "MessageInteractionInfo" ClassUnreadReaction = "UnreadReaction" + ClassMessageEffect = "MessageEffect" ClassTextQuote = "TextQuote" ClassInputTextQuote = "InputTextQuote" + ClassFactCheck = "FactCheck" ClassMessage = "Message" ClassMessages = "Messages" ClassFoundMessages = "FoundMessages" @@ -656,11 +669,24 @@ const ( TypeInputChatPhotoSticker = "inputChatPhotoSticker" TypeChatPermissions = "chatPermissions" TypeChatAdministratorRights = "chatAdministratorRights" + TypeProductInfo = "productInfo" TypePremiumPaymentOption = "premiumPaymentOption" TypePremiumStatePaymentOption = "premiumStatePaymentOption" TypePremiumGiftCodePaymentOption = "premiumGiftCodePaymentOption" TypePremiumGiftCodePaymentOptions = "premiumGiftCodePaymentOptions" TypePremiumGiftCodeInfo = "premiumGiftCodeInfo" + TypeStarPaymentOption = "starPaymentOption" + TypeStarPaymentOptions = "starPaymentOptions" + TypeStarTransactionDirectionIncoming = "starTransactionDirectionIncoming" + TypeStarTransactionDirectionOutgoing = "starTransactionDirectionOutgoing" + TypeStarTransactionSourceTelegram = "starTransactionSourceTelegram" + TypeStarTransactionSourceAppStore = "starTransactionSourceAppStore" + TypeStarTransactionSourceGooglePlay = "starTransactionSourceGooglePlay" + TypeStarTransactionSourceFragment = "starTransactionSourceFragment" + TypeStarTransactionSourceUser = "starTransactionSourceUser" + TypeStarTransactionSourceUnsupported = "starTransactionSourceUnsupported" + TypeStarTransaction = "starTransaction" + TypeStarTransactions = "starTransactions" TypePremiumGiveawayParticipantStatusEligible = "premiumGiveawayParticipantStatusEligible" TypePremiumGiveawayParticipantStatusParticipating = "premiumGiveawayParticipantStatusParticipating" TypePremiumGiveawayParticipantStatusAlreadyWasMember = "premiumGiveawayParticipantStatusAlreadyWasMember" @@ -750,6 +776,9 @@ const ( TypeMessageReactions = "messageReactions" TypeMessageInteractionInfo = "messageInteractionInfo" TypeUnreadReaction = "unreadReaction" + TypeMessageEffectTypeEmojiReaction = "messageEffectTypeEmojiReaction" + TypeMessageEffectTypePremiumSticker = "messageEffectTypePremiumSticker" + TypeMessageEffect = "messageEffect" TypeMessageSendingStatePending = "messageSendingStatePending" TypeMessageSendingStateFailed = "messageSendingStateFailed" TypeTextQuote = "textQuote" @@ -758,6 +787,7 @@ const ( TypeMessageReplyToStory = "messageReplyToStory" TypeInputMessageReplyToMessage = "inputMessageReplyToMessage" TypeInputMessageReplyToStory = "inputMessageReplyToStory" + TypeFactCheck = "factCheck" TypeMessage = "message" TypeMessages = "messages" TypeFoundMessages = "foundMessages" @@ -961,9 +991,13 @@ const ( TypePaymentProviderStripe = "paymentProviderStripe" TypePaymentProviderOther = "paymentProviderOther" TypePaymentOption = "paymentOption" + TypePaymentFormTypeRegular = "paymentFormTypeRegular" + TypePaymentFormTypeStars = "paymentFormTypeStars" TypePaymentForm = "paymentForm" TypeValidatedOrderInfo = "validatedOrderInfo" TypePaymentResult = "paymentResult" + TypePaymentReceiptTypeRegular = "paymentReceiptTypeRegular" + TypePaymentReceiptTypeStars = "paymentReceiptTypeStars" TypePaymentReceipt = "paymentReceipt" TypeInputInvoiceMessage = "inputInvoiceMessage" TypeInputInvoiceName = "inputInvoiceName" @@ -1132,6 +1166,7 @@ const ( TypeTextEntityTypePre = "textEntityTypePre" TypeTextEntityTypePreCode = "textEntityTypePreCode" TypeTextEntityTypeBlockQuote = "textEntityTypeBlockQuote" + TypeTextEntityTypeExpandableBlockQuote = "textEntityTypeExpandableBlockQuote" TypeTextEntityTypeTextUrl = "textEntityTypeTextUrl" TypeTextEntityTypeMentionName = "textEntityTypeMentionName" TypeTextEntityTypeCustomEmoji = "textEntityTypeCustomEmoji" @@ -1267,6 +1302,8 @@ const ( TypeFoundChatBoosts = "foundChatBoosts" TypeChatBoostSlot = "chatBoostSlot" TypeChatBoostSlots = "chatBoostSlots" + TypeResendCodeReasonUserRequest = "resendCodeReasonUserRequest" + TypeResendCodeReasonVerificationFailed = "resendCodeReasonVerificationFailed" TypeCallDiscardReasonEmpty = "callDiscardReasonEmpty" TypeCallDiscardReasonMissed = "callDiscardReasonMissed" TypeCallDiscardReasonDeclined = "callDiscardReasonDeclined" @@ -1502,8 +1539,10 @@ const ( TypeStorePaymentPurposeGiftedPremium = "storePaymentPurposeGiftedPremium" TypeStorePaymentPurposePremiumGiftCodes = "storePaymentPurposePremiumGiftCodes" TypeStorePaymentPurposePremiumGiveaway = "storePaymentPurposePremiumGiveaway" + TypeStorePaymentPurposeStars = "storePaymentPurposeStars" TypeTelegramPaymentPurposePremiumGiftCodes = "telegramPaymentPurposePremiumGiftCodes" TypeTelegramPaymentPurposePremiumGiveaway = "telegramPaymentPurposePremiumGiveaway" + TypeTelegramPaymentPurposeStars = "telegramPaymentPurposeStars" TypeDeviceTokenFirebaseCloudMessaging = "deviceTokenFirebaseCloudMessaging" TypeDeviceTokenApplePush = "deviceTokenApplePush" TypeDeviceTokenApplePushVoIP = "deviceTokenApplePushVoIP" @@ -1868,6 +1907,7 @@ const ( TypeUpdateMessageContentOpened = "updateMessageContentOpened" TypeUpdateMessageMentionRead = "updateMessageMentionRead" TypeUpdateMessageUnreadReactions = "updateMessageUnreadReactions" + TypeUpdateMessageFactCheck = "updateMessageFactCheck" TypeUpdateMessageLiveLocationViewed = "updateMessageLiveLocationViewed" TypeUpdateNewChat = "updateNewChat" TypeUpdateChatTitle = "updateChatTitle" @@ -1935,6 +1975,7 @@ const ( TypeUpdateFileAddedToDownloads = "updateFileAddedToDownloads" TypeUpdateFileDownload = "updateFileDownload" TypeUpdateFileRemovedFromDownloads = "updateFileRemovedFromDownloads" + TypeUpdateApplicationVerificationRequired = "updateApplicationVerificationRequired" TypeUpdateCall = "updateCall" TypeUpdateGroupCall = "updateGroupCall" TypeUpdateGroupCallParticipant = "updateGroupCallParticipant" @@ -1969,8 +2010,10 @@ const ( TypeUpdateAttachmentMenuBots = "updateAttachmentMenuBots" TypeUpdateWebAppMessageSent = "updateWebAppMessageSent" TypeUpdateActiveEmojiReactions = "updateActiveEmojiReactions" + TypeUpdateAvailableMessageEffects = "updateAvailableMessageEffects" TypeUpdateDefaultReactionType = "updateDefaultReactionType" TypeUpdateSavedMessagesTags = "updateSavedMessagesTags" + TypeUpdateOwnedStarCount = "updateOwnedStarCount" TypeUpdateChatRevenueAmount = "updateChatRevenueAmount" TypeUpdateSpeechRecognitionTrial = "updateSpeechRecognitionTrial" TypeUpdateDiceEmojis = "updateDiceEmojis" @@ -2090,6 +2133,16 @@ type InputChatPhoto interface { InputChatPhotoType() string } +// Describes direction of a transaction with Telegram stars +type StarTransactionDirection interface { + StarTransactionDirectionType() string +} + +// Describes source or recipient of a transaction with Telegram stars +type StarTransactionSource interface { + StarTransactionSourceType() string +} + // Contains information about status of a user in a Telegram Premium giveaway type PremiumGiveawayParticipantStatus interface { PremiumGiveawayParticipantStatusType() string @@ -2145,6 +2198,11 @@ type ReactionType interface { ReactionTypeType() string } +// Describes type of emoji effect +type MessageEffectType interface { + MessageEffectTypeType() string +} + // Contains information about the sending state of the message type MessageSendingState interface { MessageSendingStateType() string @@ -2200,7 +2258,7 @@ type ChatAvailableReactions interface { ChatAvailableReactionsType() string } -// Describes a type of public chats +// Describes type of public chat type PublicChatType interface { PublicChatTypeType() string } @@ -2270,6 +2328,16 @@ type PaymentProvider interface { PaymentProviderType() string } +// Describes type of payment form +type PaymentFormType interface { + PaymentFormTypeType() string +} + +// Describes type of successful payment +type PaymentReceiptType interface { + PaymentReceiptTypeType() string +} + // Describes an invoice to process type InputInvoice interface { InputInvoiceType() string @@ -2400,6 +2468,11 @@ type ChatBoostSource interface { ChatBoostSourceType() string } +// Describes the reason why a code needs to be re-sent +type ResendCodeReason interface { + ResendCodeReasonType() string +} + // Describes the reason why a call was discarded type CallDiscardReason interface { CallDiscardReasonType() string @@ -2460,7 +2533,7 @@ type InlineQueryResult interface { InlineQueryResultType() string } -// Represents a type of button in results of inline query +// Represents type of button in results of inline query type InlineQueryResultsButtonType interface { InlineQueryResultsButtonTypeType() string } @@ -2630,7 +2703,7 @@ type InternalLinkType interface { InternalLinkTypeType() string } -// Describes a type of block list +// Describes type of block list type BlockList interface { BlockListType() string } @@ -3004,7 +3077,9 @@ func (*AuthenticationCodeTypeFragment) AuthenticationCodeTypeType() string { // A digit-only authentication code is delivered via Firebase Authentication to the official Android application type AuthenticationCodeTypeFirebaseAndroid struct { meta - // Nonce to pass to the SafetyNet Attestation API + // True, if Play Integrity API must be used for device verification. Otherwise, SafetyNet Attestation API must be used + UsePlayIntegrity bool `json:"use_play_integrity"` + // Nonce to pass to the Play Integrity API or the SafetyNet Attestation API Nonce []byte `json:"nonce"` // Length of the code Length int32 `json:"length"` @@ -6868,6 +6943,33 @@ func (*ChatAdministratorRights) GetType() string { return TypeChatAdministratorRights } +// Contains information about a product that can be paid with invoice +type ProductInfo struct { + meta + // Product title + Title string `json:"title"` + // Product description + Description *FormattedText `json:"description"` + // Product photo; may be null + Photo *Photo `json:"photo"` +} + +func (entity *ProductInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProductInfo + + return json.Marshal((*stub)(entity)) +} + +func (*ProductInfo) GetClass() string { + return ClassProductInfo +} + +func (*ProductInfo) GetType() string { + return TypeProductInfo +} + // Describes an option for buying Telegram Premium to a user type PremiumPaymentOption struct { meta @@ -7077,6 +7179,347 @@ func (premiumGiftCodeInfo *PremiumGiftCodeInfo) UnmarshalJSON(data []byte) error return nil } +// Describes an option for buying Telegram stars +type StarPaymentOption struct { + meta + // ISO 4217 currency code for the payment + Currency string `json:"currency"` + // The amount to pay, in the smallest units of the currency + Amount int64 `json:"amount"` + // Number of stars that will be purchased + StarCount int64 `json:"star_count"` + // Identifier of the store product associated with the option; may be empty if none + StoreProductId string `json:"store_product_id"` + // True, if the option must be shown only in the full list of payment options + IsAdditional bool `json:"is_additional"` +} + +func (entity *StarPaymentOption) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarPaymentOption + + return json.Marshal((*stub)(entity)) +} + +func (*StarPaymentOption) GetClass() string { + return ClassStarPaymentOption +} + +func (*StarPaymentOption) GetType() string { + return TypeStarPaymentOption +} + +// Contains a list of options for buying Telegram stars +type StarPaymentOptions struct { + meta + // The list of options + Options []*StarPaymentOption `json:"options"` +} + +func (entity *StarPaymentOptions) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarPaymentOptions + + return json.Marshal((*stub)(entity)) +} + +func (*StarPaymentOptions) GetClass() string { + return ClassStarPaymentOptions +} + +func (*StarPaymentOptions) GetType() string { + return TypeStarPaymentOptions +} + +// The transaction is incoming and increases the number of owned Telegram stars +type StarTransactionDirectionIncoming struct{ + meta +} + +func (entity *StarTransactionDirectionIncoming) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionDirectionIncoming + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionDirectionIncoming) GetClass() string { + return ClassStarTransactionDirection +} + +func (*StarTransactionDirectionIncoming) GetType() string { + return TypeStarTransactionDirectionIncoming +} + +func (*StarTransactionDirectionIncoming) StarTransactionDirectionType() string { + return TypeStarTransactionDirectionIncoming +} + +// The transaction is outgoing and decreases the number of owned Telegram stars +type StarTransactionDirectionOutgoing struct{ + meta +} + +func (entity *StarTransactionDirectionOutgoing) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionDirectionOutgoing + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionDirectionOutgoing) GetClass() string { + return ClassStarTransactionDirection +} + +func (*StarTransactionDirectionOutgoing) GetType() string { + return TypeStarTransactionDirectionOutgoing +} + +func (*StarTransactionDirectionOutgoing) StarTransactionDirectionType() string { + return TypeStarTransactionDirectionOutgoing +} + +// The transaction is a transaction with Telegram through a bot +type StarTransactionSourceTelegram struct{ + meta +} + +func (entity *StarTransactionSourceTelegram) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionSourceTelegram + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionSourceTelegram) GetClass() string { + return ClassStarTransactionSource +} + +func (*StarTransactionSourceTelegram) GetType() string { + return TypeStarTransactionSourceTelegram +} + +func (*StarTransactionSourceTelegram) StarTransactionSourceType() string { + return TypeStarTransactionSourceTelegram +} + +// The transaction is a transaction with App Store +type StarTransactionSourceAppStore struct{ + meta +} + +func (entity *StarTransactionSourceAppStore) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionSourceAppStore + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionSourceAppStore) GetClass() string { + return ClassStarTransactionSource +} + +func (*StarTransactionSourceAppStore) GetType() string { + return TypeStarTransactionSourceAppStore +} + +func (*StarTransactionSourceAppStore) StarTransactionSourceType() string { + return TypeStarTransactionSourceAppStore +} + +// The transaction is a transaction with Google Play +type StarTransactionSourceGooglePlay struct{ + meta +} + +func (entity *StarTransactionSourceGooglePlay) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionSourceGooglePlay + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionSourceGooglePlay) GetClass() string { + return ClassStarTransactionSource +} + +func (*StarTransactionSourceGooglePlay) GetType() string { + return TypeStarTransactionSourceGooglePlay +} + +func (*StarTransactionSourceGooglePlay) StarTransactionSourceType() string { + return TypeStarTransactionSourceGooglePlay +} + +// The transaction is a transaction with Fragment +type StarTransactionSourceFragment struct{ + meta +} + +func (entity *StarTransactionSourceFragment) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionSourceFragment + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionSourceFragment) GetClass() string { + return ClassStarTransactionSource +} + +func (*StarTransactionSourceFragment) GetType() string { + return TypeStarTransactionSourceFragment +} + +func (*StarTransactionSourceFragment) StarTransactionSourceType() string { + return TypeStarTransactionSourceFragment +} + +// The transaction is a transaction with another user +type StarTransactionSourceUser struct { + meta + // Identifier of the user + UserId int64 `json:"user_id"` + // Information about the bought product; may be null if none + ProductInfo *ProductInfo `json:"product_info"` +} + +func (entity *StarTransactionSourceUser) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionSourceUser + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionSourceUser) GetClass() string { + return ClassStarTransactionSource +} + +func (*StarTransactionSourceUser) GetType() string { + return TypeStarTransactionSourceUser +} + +func (*StarTransactionSourceUser) StarTransactionSourceType() string { + return TypeStarTransactionSourceUser +} + +// The transaction is a transaction with unknown source +type StarTransactionSourceUnsupported struct{ + meta +} + +func (entity *StarTransactionSourceUnsupported) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionSourceUnsupported + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionSourceUnsupported) GetClass() string { + return ClassStarTransactionSource +} + +func (*StarTransactionSourceUnsupported) GetType() string { + return TypeStarTransactionSourceUnsupported +} + +func (*StarTransactionSourceUnsupported) StarTransactionSourceType() string { + return TypeStarTransactionSourceUnsupported +} + +// Represents a transaction changing the amount of owned Telegram stars +type StarTransaction struct { + meta + // Unique identifier of the transaction + Id string `json:"id"` + // The amount of added owned Telegram stars; negative for outgoing transactions + StarCount int64 `json:"star_count"` + // True, if the transaction is a refund of a previous transaction + IsRefund bool `json:"is_refund"` + // Point in time (Unix timestamp) when the transaction was completed + Date int32 `json:"date"` + // Source of the transaction, or its recipient for outgoing transactions + Source StarTransactionSource `json:"source"` +} + +func (entity *StarTransaction) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransaction + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransaction) GetClass() string { + return ClassStarTransaction +} + +func (*StarTransaction) GetType() string { + return TypeStarTransaction +} + +func (starTransaction *StarTransaction) UnmarshalJSON(data []byte) error { + var tmp struct { + Id string `json:"id"` + StarCount int64 `json:"star_count"` + IsRefund bool `json:"is_refund"` + Date int32 `json:"date"` + Source json.RawMessage `json:"source"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + starTransaction.Id = tmp.Id + starTransaction.StarCount = tmp.StarCount + starTransaction.IsRefund = tmp.IsRefund + starTransaction.Date = tmp.Date + + fieldSource, _ := UnmarshalStarTransactionSource(tmp.Source) + starTransaction.Source = fieldSource + + return nil +} + +// Represents a list of Telegram star transactions +type StarTransactions struct { + meta + // The amount of owned Telegram stars + StarCount int64 `json:"star_count"` + // List of transactions with Telegram stars + Transactions []*StarTransaction `json:"transactions"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` +} + +func (entity *StarTransactions) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactions + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactions) GetClass() string { + return ClassStarTransactions +} + +func (*StarTransactions) GetType() string { + return TypeStarTransactions +} + // The user is eligible for the giveaway type PremiumGiveawayParticipantStatusEligible struct{ meta @@ -10254,6 +10697,118 @@ func (unreadReaction *UnreadReaction) UnmarshalJSON(data []byte) error { return nil } +// An effect from an emoji reaction +type MessageEffectTypeEmojiReaction struct { + meta + // Select animation for the effect in TGS format + SelectAnimation *Sticker `json:"select_animation"` + // Effect animation for the effect in TGS format + EffectAnimation *Sticker `json:"effect_animation"` +} + +func (entity *MessageEffectTypeEmojiReaction) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageEffectTypeEmojiReaction + + return json.Marshal((*stub)(entity)) +} + +func (*MessageEffectTypeEmojiReaction) GetClass() string { + return ClassMessageEffectType +} + +func (*MessageEffectTypeEmojiReaction) GetType() string { + return TypeMessageEffectTypeEmojiReaction +} + +func (*MessageEffectTypeEmojiReaction) MessageEffectTypeType() string { + return TypeMessageEffectTypeEmojiReaction +} + +// An effect from a premium sticker +type MessageEffectTypePremiumSticker struct { + meta + // The premium sticker. The effect can be found at sticker.full_type.premium_animation + Sticker *Sticker `json:"sticker"` +} + +func (entity *MessageEffectTypePremiumSticker) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageEffectTypePremiumSticker + + return json.Marshal((*stub)(entity)) +} + +func (*MessageEffectTypePremiumSticker) GetClass() string { + return ClassMessageEffectType +} + +func (*MessageEffectTypePremiumSticker) GetType() string { + return TypeMessageEffectTypePremiumSticker +} + +func (*MessageEffectTypePremiumSticker) MessageEffectTypeType() string { + return TypeMessageEffectTypePremiumSticker +} + +// Contains information about an effect added to a message +type MessageEffect struct { + meta + // Unique identifier of the effect + Id JsonInt64 `json:"id"` + // Static icon for the effect in WEBP format; may be null if none + StaticIcon *Sticker `json:"static_icon"` + // Emoji corresponding to the effect that can be used if static icon isn't available + Emoji string `json:"emoji"` + // True, if Telegram Premium subscription is required to use the effect + IsPremium bool `json:"is_premium"` + // Type of the effect + Type MessageEffectType `json:"type"` +} + +func (entity *MessageEffect) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageEffect + + return json.Marshal((*stub)(entity)) +} + +func (*MessageEffect) GetClass() string { + return ClassMessageEffect +} + +func (*MessageEffect) GetType() string { + return TypeMessageEffect +} + +func (messageEffect *MessageEffect) UnmarshalJSON(data []byte) error { + var tmp struct { + Id JsonInt64 `json:"id"` + StaticIcon *Sticker `json:"static_icon"` + Emoji string `json:"emoji"` + IsPremium bool `json:"is_premium"` + Type json.RawMessage `json:"type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageEffect.Id = tmp.Id + messageEffect.StaticIcon = tmp.StaticIcon + messageEffect.Emoji = tmp.Emoji + messageEffect.IsPremium = tmp.IsPremium + + fieldType, _ := UnmarshalMessageEffectType(tmp.Type) + messageEffect.Type = fieldType + + return nil +} + // The message is being sent now, but has not yet been delivered to the server type MessageSendingStatePending struct { meta @@ -10525,6 +11080,31 @@ func (*InputMessageReplyToStory) InputMessageReplyToType() string { return TypeInputMessageReplyToStory } +// Describes a fact-check added to the message by an independent checker +type FactCheck struct { + meta + // Text of the fact-check + Text *FormattedText `json:"text"` + // A two-letter ISO 3166-1 alpha-2 country code of the country for which the fact-check is shown + CountryCode string `json:"country_code"` +} + +func (entity *FactCheck) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FactCheck + + return json.Marshal((*stub)(entity)) +} + +func (*FactCheck) GetClass() string { + return ClassFactCheck +} + +func (*FactCheck) GetType() string { + return TypeFactCheck +} + // Describes a message type Message struct { meta @@ -10590,6 +11170,8 @@ type Message struct { InteractionInfo *MessageInteractionInfo `json:"interaction_info"` // Information about unread reactions added to the message UnreadReactions []*UnreadReaction `json:"unread_reactions"` + // Information about fact-check added to the message; may be null if none + FactCheck *FactCheck `json:"fact_check"` // Information about the message or the story this message is replying to; may be null if none ReplyTo MessageReplyTo `json:"reply_to"` // If non-zero, the identifier of the message thread the message belongs to; unique within the chat to which the message belongs @@ -10612,6 +11194,8 @@ type Message struct { AuthorSignature string `json:"author_signature"` // Unique identifier of an album this message belongs to; 0 if none. Only audios, documents, photos and videos can be grouped together in albums MediaAlbumId JsonInt64 `json:"media_album_id"` + // Unique identifier of the effect added to the message; 0 if none + EffectId JsonInt64 `json:"effect_id"` // If non-empty, contains a human-readable description of the reason why access to this message must be restricted RestrictionReason string `json:"restriction_reason"` // Content of the message @@ -10669,6 +11253,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { ImportInfo *MessageImportInfo `json:"import_info"` InteractionInfo *MessageInteractionInfo `json:"interaction_info"` UnreadReactions []*UnreadReaction `json:"unread_reactions"` + FactCheck *FactCheck `json:"fact_check"` ReplyTo json.RawMessage `json:"reply_to"` MessageThreadId int64 `json:"message_thread_id"` SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` @@ -10680,6 +11265,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { SenderBoostCount int32 `json:"sender_boost_count"` AuthorSignature string `json:"author_signature"` MediaAlbumId JsonInt64 `json:"media_album_id"` + EffectId JsonInt64 `json:"effect_id"` RestrictionReason string `json:"restriction_reason"` Content json.RawMessage `json:"content"` ReplyMarkup json.RawMessage `json:"reply_markup"` @@ -10718,6 +11304,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { message.ImportInfo = tmp.ImportInfo message.InteractionInfo = tmp.InteractionInfo message.UnreadReactions = tmp.UnreadReactions + message.FactCheck = tmp.FactCheck message.MessageThreadId = tmp.MessageThreadId message.SavedMessagesTopicId = tmp.SavedMessagesTopicId message.SelfDestructIn = tmp.SelfDestructIn @@ -10727,6 +11314,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { message.SenderBoostCount = tmp.SenderBoostCount message.AuthorSignature = tmp.AuthorSignature message.MediaAlbumId = tmp.MediaAlbumId + message.EffectId = tmp.EffectId message.RestrictionReason = tmp.RestrictionReason fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) @@ -17676,15 +18264,11 @@ func (*PaymentOption) GetType() string { return TypePaymentOption } -// Contains information about an invoice payment form -type PaymentForm struct { +// The payment form is for a regular payment +type PaymentFormTypeRegular struct { meta - // The payment form identifier - Id JsonInt64 `json:"id"` // Full information about the invoice Invoice *Invoice `json:"invoice"` - // User identifier of the seller bot - SellerBotUserId int64 `json:"seller_bot_user_id"` // User identifier of the payment provider bot PaymentProviderUserId int64 `json:"payment_provider_user_id"` // Information about the payment provider @@ -17699,12 +18283,97 @@ type PaymentForm struct { CanSaveCredentials bool `json:"can_save_credentials"` // True, if the user will be able to save credentials, if sets up a 2-step verification password NeedPassword bool `json:"need_password"` - // Product title - ProductTitle string `json:"product_title"` - // Product description - ProductDescription *FormattedText `json:"product_description"` - // Product photo; may be null - ProductPhoto *Photo `json:"product_photo"` +} + +func (entity *PaymentFormTypeRegular) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PaymentFormTypeRegular + + return json.Marshal((*stub)(entity)) +} + +func (*PaymentFormTypeRegular) GetClass() string { + return ClassPaymentFormType +} + +func (*PaymentFormTypeRegular) GetType() string { + return TypePaymentFormTypeRegular +} + +func (*PaymentFormTypeRegular) PaymentFormTypeType() string { + return TypePaymentFormTypeRegular +} + +func (paymentFormTypeRegular *PaymentFormTypeRegular) UnmarshalJSON(data []byte) error { + var tmp struct { + Invoice *Invoice `json:"invoice"` + PaymentProviderUserId int64 `json:"payment_provider_user_id"` + PaymentProvider json.RawMessage `json:"payment_provider"` + AdditionalPaymentOptions []*PaymentOption `json:"additional_payment_options"` + SavedOrderInfo *OrderInfo `json:"saved_order_info"` + SavedCredentials []*SavedCredentials `json:"saved_credentials"` + CanSaveCredentials bool `json:"can_save_credentials"` + NeedPassword bool `json:"need_password"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + paymentFormTypeRegular.Invoice = tmp.Invoice + paymentFormTypeRegular.PaymentProviderUserId = tmp.PaymentProviderUserId + paymentFormTypeRegular.AdditionalPaymentOptions = tmp.AdditionalPaymentOptions + paymentFormTypeRegular.SavedOrderInfo = tmp.SavedOrderInfo + paymentFormTypeRegular.SavedCredentials = tmp.SavedCredentials + paymentFormTypeRegular.CanSaveCredentials = tmp.CanSaveCredentials + paymentFormTypeRegular.NeedPassword = tmp.NeedPassword + + fieldPaymentProvider, _ := UnmarshalPaymentProvider(tmp.PaymentProvider) + paymentFormTypeRegular.PaymentProvider = fieldPaymentProvider + + return nil +} + +// The payment form is for a payment in Telegram stars +type PaymentFormTypeStars struct { + meta + // Number of stars that will be paid + StarCount int64 `json:"star_count"` +} + +func (entity *PaymentFormTypeStars) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PaymentFormTypeStars + + return json.Marshal((*stub)(entity)) +} + +func (*PaymentFormTypeStars) GetClass() string { + return ClassPaymentFormType +} + +func (*PaymentFormTypeStars) GetType() string { + return TypePaymentFormTypeStars +} + +func (*PaymentFormTypeStars) PaymentFormTypeType() string { + return TypePaymentFormTypeStars +} + +// Contains information about an invoice payment form +type PaymentForm struct { + meta + // The payment form identifier + Id JsonInt64 `json:"id"` + // Type of the payment form + Type PaymentFormType `json:"type"` + // User identifier of the seller bot + SellerBotUserId int64 `json:"seller_bot_user_id"` + // Information about the product + ProductInfo *ProductInfo `json:"product_info"` } func (entity *PaymentForm) MarshalJSON() ([]byte, error) { @@ -17726,18 +18395,9 @@ func (*PaymentForm) GetType() string { func (paymentForm *PaymentForm) UnmarshalJSON(data []byte) error { var tmp struct { Id JsonInt64 `json:"id"` - Invoice *Invoice `json:"invoice"` + Type json.RawMessage `json:"type"` SellerBotUserId int64 `json:"seller_bot_user_id"` - PaymentProviderUserId int64 `json:"payment_provider_user_id"` - PaymentProvider json.RawMessage `json:"payment_provider"` - AdditionalPaymentOptions []*PaymentOption `json:"additional_payment_options"` - SavedOrderInfo *OrderInfo `json:"saved_order_info"` - SavedCredentials []*SavedCredentials `json:"saved_credentials"` - CanSaveCredentials bool `json:"can_save_credentials"` - NeedPassword bool `json:"need_password"` - ProductTitle string `json:"product_title"` - ProductDescription *FormattedText `json:"product_description"` - ProductPhoto *Photo `json:"product_photo"` + ProductInfo *ProductInfo `json:"product_info"` } err := json.Unmarshal(data, &tmp) @@ -17746,20 +18406,11 @@ func (paymentForm *PaymentForm) UnmarshalJSON(data []byte) error { } paymentForm.Id = tmp.Id - paymentForm.Invoice = tmp.Invoice paymentForm.SellerBotUserId = tmp.SellerBotUserId - paymentForm.PaymentProviderUserId = tmp.PaymentProviderUserId - paymentForm.AdditionalPaymentOptions = tmp.AdditionalPaymentOptions - paymentForm.SavedOrderInfo = tmp.SavedOrderInfo - paymentForm.SavedCredentials = tmp.SavedCredentials - paymentForm.CanSaveCredentials = tmp.CanSaveCredentials - paymentForm.NeedPassword = tmp.NeedPassword - paymentForm.ProductTitle = tmp.ProductTitle - paymentForm.ProductDescription = tmp.ProductDescription - paymentForm.ProductPhoto = tmp.ProductPhoto + paymentForm.ProductInfo = tmp.ProductInfo - fieldPaymentProvider, _ := UnmarshalPaymentProvider(tmp.PaymentProvider) - paymentForm.PaymentProvider = fieldPaymentProvider + fieldType, _ := UnmarshalPaymentFormType(tmp.Type) + paymentForm.Type = fieldType return nil } @@ -17814,19 +18465,9 @@ func (*PaymentResult) GetType() string { return TypePaymentResult } -// Contains information about a successful payment -type PaymentReceipt struct { +// The payment was done using a third-party payment provider +type PaymentReceiptTypeRegular struct { meta - // Product title - Title string `json:"title"` - // Product description - Description *FormattedText `json:"description"` - // Product photo; may be null - Photo *Photo `json:"photo"` - // Point in time (Unix timestamp) when the payment was made - Date int32 `json:"date"` - // User identifier of the seller bot - SellerBotUserId int64 `json:"seller_bot_user_id"` // User identifier of the payment provider bot PaymentProviderUserId int64 `json:"payment_provider_user_id"` // Information about the invoice @@ -17841,6 +18482,68 @@ type PaymentReceipt struct { TipAmount int64 `json:"tip_amount"` } +func (entity *PaymentReceiptTypeRegular) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PaymentReceiptTypeRegular + + return json.Marshal((*stub)(entity)) +} + +func (*PaymentReceiptTypeRegular) GetClass() string { + return ClassPaymentReceiptType +} + +func (*PaymentReceiptTypeRegular) GetType() string { + return TypePaymentReceiptTypeRegular +} + +func (*PaymentReceiptTypeRegular) PaymentReceiptTypeType() string { + return TypePaymentReceiptTypeRegular +} + +// The payment was done using Telegram stars +type PaymentReceiptTypeStars struct { + meta + // Number of stars that were paid + StarCount int64 `json:"star_count"` + // Unique identifier of the transaction that can be used to dispute it + TransactionId string `json:"transaction_id"` +} + +func (entity *PaymentReceiptTypeStars) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PaymentReceiptTypeStars + + return json.Marshal((*stub)(entity)) +} + +func (*PaymentReceiptTypeStars) GetClass() string { + return ClassPaymentReceiptType +} + +func (*PaymentReceiptTypeStars) GetType() string { + return TypePaymentReceiptTypeStars +} + +func (*PaymentReceiptTypeStars) PaymentReceiptTypeType() string { + return TypePaymentReceiptTypeStars +} + +// Contains information about a successful payment +type PaymentReceipt struct { + meta + // Information about the product + ProductInfo *ProductInfo `json:"product_info"` + // Point in time (Unix timestamp) when the payment was made + Date int32 `json:"date"` + // User identifier of the seller bot + SellerBotUserId int64 `json:"seller_bot_user_id"` + // Type of the payment receipt + Type PaymentReceiptType `json:"type"` +} + func (entity *PaymentReceipt) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() @@ -17857,6 +18560,29 @@ func (*PaymentReceipt) GetType() string { return TypePaymentReceipt } +func (paymentReceipt *PaymentReceipt) UnmarshalJSON(data []byte) error { + var tmp struct { + ProductInfo *ProductInfo `json:"product_info"` + Date int32 `json:"date"` + SellerBotUserId int64 `json:"seller_bot_user_id"` + Type json.RawMessage `json:"type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + paymentReceipt.ProductInfo = tmp.ProductInfo + paymentReceipt.Date = tmp.Date + paymentReceipt.SellerBotUserId = tmp.SellerBotUserId + + fieldType, _ := UnmarshalPaymentReceiptType(tmp.Type) + paymentReceipt.Type = fieldType + + return nil +} + // An invoice from a message of the type messageInvoice type InputInvoiceMessage struct { meta @@ -20298,6 +21024,8 @@ type MessageAnimation struct { Animation *Animation `json:"animation"` // Animation caption Caption *FormattedText `json:"caption"` + // True, if caption must be shown above the animation; otherwise, caption must be shown below the animation + ShowCaptionAboveMedia bool `json:"show_caption_above_media"` // True, if the animation preview must be covered by a spoiler animation HasSpoiler bool `json:"has_spoiler"` // True, if the animation thumbnail must be blurred and the animation must be shown only while tapped @@ -20389,6 +21117,8 @@ type MessagePhoto struct { Photo *Photo `json:"photo"` // Photo caption Caption *FormattedText `json:"caption"` + // True, if caption must be shown above the photo; otherwise, caption must be shown below the photo + ShowCaptionAboveMedia bool `json:"show_caption_above_media"` // True, if the photo preview must be covered by a spoiler animation HasSpoiler bool `json:"has_spoiler"` // True, if the photo must be blurred and must be shown only while tapped @@ -20451,6 +21181,8 @@ type MessageVideo struct { Video *Video `json:"video"` // Video caption Caption *FormattedText `json:"caption"` + // True, if caption must be shown above the video; otherwise, caption must be shown below the video + ShowCaptionAboveMedia bool `json:"show_caption_above_media"` // True, if the video preview must be covered by a spoiler animation HasSpoiler bool `json:"has_spoiler"` // True, if the video thumbnail must be blurred and the video must be shown only while tapped @@ -20907,12 +21639,8 @@ func (*MessageStory) MessageContentType() string { // A message with an invoice from a bot. Use getInternalLink with internalLinkTypeBotStart to share the invoice type MessageInvoice struct { meta - // Product title - Title string `json:"title"` - // Product description - Description *FormattedText `json:"description"` - // Product photo; may be null - Photo *Photo `json:"photo"` + // Information about the product + ProductInfo *ProductInfo `json:"product_info"` // Currency for the product price Currency string `json:"currency"` // Product total price in the smallest units of the currency @@ -20951,9 +21679,7 @@ func (*MessageInvoice) MessageContentType() string { func (messageInvoice *MessageInvoice) UnmarshalJSON(data []byte) error { var tmp struct { - Title string `json:"title"` - Description *FormattedText `json:"description"` - Photo *Photo `json:"photo"` + ProductInfo *ProductInfo `json:"product_info"` Currency string `json:"currency"` TotalAmount int64 `json:"total_amount"` StartParameter string `json:"start_parameter"` @@ -20968,9 +21694,7 @@ func (messageInvoice *MessageInvoice) UnmarshalJSON(data []byte) error { return err } - messageInvoice.Title = tmp.Title - messageInvoice.Description = tmp.Description - messageInvoice.Photo = tmp.Photo + messageInvoice.ProductInfo = tmp.ProductInfo messageInvoice.Currency = tmp.Currency messageInvoice.TotalAmount = tmp.TotalAmount messageInvoice.StartParameter = tmp.StartParameter @@ -22880,7 +23604,7 @@ func (*TextEntityTypePreCode) TextEntityTypeType() string { return TypeTextEntityTypePreCode } -// Text that must be formatted as if inside a blockquote HTML tag +// Text that must be formatted as if inside a blockquote HTML tag; not supported in secret chats type TextEntityTypeBlockQuote struct{ meta } @@ -22905,6 +23629,31 @@ func (*TextEntityTypeBlockQuote) TextEntityTypeType() string { return TypeTextEntityTypeBlockQuote } +// Text that must be formatted as if inside a blockquote HTML tag and collapsed by default to 3 lines with the ability to show full text; not supported in secret chats +type TextEntityTypeExpandableBlockQuote struct{ + meta +} + +func (entity *TextEntityTypeExpandableBlockQuote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TextEntityTypeExpandableBlockQuote + + return json.Marshal((*stub)(entity)) +} + +func (*TextEntityTypeExpandableBlockQuote) GetClass() string { + return ClassTextEntityType +} + +func (*TextEntityTypeExpandableBlockQuote) GetType() string { + return TypeTextEntityTypeExpandableBlockQuote +} + +func (*TextEntityTypeExpandableBlockQuote) TextEntityTypeType() string { + return TypeTextEntityTypeExpandableBlockQuote +} + // A text description shown instead of a raw URL type TextEntityTypeTextUrl struct { meta @@ -23178,6 +23927,8 @@ type MessageSendOptions struct { UpdateOrderOfInstalledStickerSets bool `json:"update_order_of_installed_sticker_sets"` // Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, live location messages and self-destructing messages can't be scheduled SchedulingState MessageSchedulingState `json:"scheduling_state"` + // Identifier of the effect to apply to the message; applicable only to sendMessage and sendMessageAlbum in private chats + EffectId JsonInt64 `json:"effect_id"` // Non-persistent identifier, which will be returned back in messageSendingStatePending object and can be used to match sent messages and corresponding updateNewMessage updates SendingId int32 `json:"sending_id"` // Pass true to get a fake message instead of actually sending them @@ -23207,6 +23958,7 @@ func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { ProtectContent bool `json:"protect_content"` UpdateOrderOfInstalledStickerSets bool `json:"update_order_of_installed_sticker_sets"` SchedulingState json.RawMessage `json:"scheduling_state"` + EffectId JsonInt64 `json:"effect_id"` SendingId int32 `json:"sending_id"` OnlyPreview bool `json:"only_preview"` } @@ -23220,6 +23972,7 @@ func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { messageSendOptions.FromBackground = tmp.FromBackground messageSendOptions.ProtectContent = tmp.ProtectContent messageSendOptions.UpdateOrderOfInstalledStickerSets = tmp.UpdateOrderOfInstalledStickerSets + messageSendOptions.EffectId = tmp.EffectId messageSendOptions.SendingId = tmp.SendingId messageSendOptions.OnlyPreview = tmp.OnlyPreview @@ -23238,6 +23991,8 @@ type MessageCopyOptions struct { ReplaceCaption bool `json:"replace_caption"` // New message caption; pass null to copy message without caption. Ignored if replace_caption is false NewCaption *FormattedText `json:"new_caption"` + // True, if new caption must be shown above the animation; otherwise, new caption must be shown below the animation; not supported in secret chats. Ignored if replace_caption is false + NewShowCaptionAboveMedia bool `json:"new_show_caption_above_media"` } func (entity *MessageCopyOptions) MarshalJSON() ([]byte, error) { @@ -23259,7 +24014,7 @@ func (*MessageCopyOptions) GetType() string { // A text message type InputMessageText struct { meta - // Formatted text to be sent; 0-getOption("message_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, BlockQuote, Code, Pre, PreCode, TextUrl and MentionName entities are allowed to be specified manually + // Formatted text to be sent; 0-getOption("message_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, BlockQuote, ExpandableBlockQuote, Code, Pre, PreCode, TextUrl and MentionName entities are allowed to be specified manually Text *FormattedText `json:"text"` // Options to be used for generation of a link preview; may be null if none; pass null to use default link preview options LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options"` @@ -23304,6 +24059,8 @@ type InputMessageAnimation struct { Height int32 `json:"height"` // Animation caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters Caption *FormattedText `json:"caption"` + // True, if caption must be shown above the animation; otherwise, caption must be shown below the animation; not supported in secret chats + ShowCaptionAboveMedia bool `json:"show_caption_above_media"` // True, if the animation preview must be covered by a spoiler animation; not supported in secret chats HasSpoiler bool `json:"has_spoiler"` } @@ -23337,6 +24094,7 @@ func (inputMessageAnimation *InputMessageAnimation) UnmarshalJSON(data []byte) e Width int32 `json:"width"` Height int32 `json:"height"` Caption *FormattedText `json:"caption"` + ShowCaptionAboveMedia bool `json:"show_caption_above_media"` HasSpoiler bool `json:"has_spoiler"` } @@ -23351,6 +24109,7 @@ func (inputMessageAnimation *InputMessageAnimation) UnmarshalJSON(data []byte) e inputMessageAnimation.Width = tmp.Width inputMessageAnimation.Height = tmp.Height inputMessageAnimation.Caption = tmp.Caption + inputMessageAnimation.ShowCaptionAboveMedia = tmp.ShowCaptionAboveMedia inputMessageAnimation.HasSpoiler = tmp.HasSpoiler fieldAnimation, _ := UnmarshalInputFile(tmp.Animation) @@ -23494,6 +24253,8 @@ type InputMessagePhoto struct { Height int32 `json:"height"` // Photo caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters Caption *FormattedText `json:"caption"` + // True, if caption must be shown above the photo; otherwise, caption must be shown below the photo; not supported in secret chats + ShowCaptionAboveMedia bool `json:"show_caption_above_media"` // Photo self-destruct type; pass null if none; private chats only SelfDestructType MessageSelfDestructType `json:"self_destruct_type"` // True, if the photo preview must be covered by a spoiler animation; not supported in secret chats @@ -23528,6 +24289,7 @@ func (inputMessagePhoto *InputMessagePhoto) UnmarshalJSON(data []byte) error { Width int32 `json:"width"` Height int32 `json:"height"` Caption *FormattedText `json:"caption"` + ShowCaptionAboveMedia bool `json:"show_caption_above_media"` SelfDestructType json.RawMessage `json:"self_destruct_type"` HasSpoiler bool `json:"has_spoiler"` } @@ -23542,6 +24304,7 @@ func (inputMessagePhoto *InputMessagePhoto) UnmarshalJSON(data []byte) error { inputMessagePhoto.Width = tmp.Width inputMessagePhoto.Height = tmp.Height inputMessagePhoto.Caption = tmp.Caption + inputMessagePhoto.ShowCaptionAboveMedia = tmp.ShowCaptionAboveMedia inputMessagePhoto.HasSpoiler = tmp.HasSpoiler fieldPhoto, _ := UnmarshalInputFile(tmp.Photo) @@ -23632,6 +24395,8 @@ type InputMessageVideo struct { SupportsStreaming bool `json:"supports_streaming"` // Video caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters Caption *FormattedText `json:"caption"` + // True, if caption must be shown above the video; otherwise, caption must be shown below the video; not supported in secret chats + ShowCaptionAboveMedia bool `json:"show_caption_above_media"` // Video self-destruct type; pass null if none; private chats only SelfDestructType MessageSelfDestructType `json:"self_destruct_type"` // True, if the video preview must be covered by a spoiler animation; not supported in secret chats @@ -23668,6 +24433,7 @@ func (inputMessageVideo *InputMessageVideo) UnmarshalJSON(data []byte) error { Height int32 `json:"height"` SupportsStreaming bool `json:"supports_streaming"` Caption *FormattedText `json:"caption"` + ShowCaptionAboveMedia bool `json:"show_caption_above_media"` SelfDestructType json.RawMessage `json:"self_destruct_type"` HasSpoiler bool `json:"has_spoiler"` } @@ -23684,6 +24450,7 @@ func (inputMessageVideo *InputMessageVideo) UnmarshalJSON(data []byte) error { inputMessageVideo.Height = tmp.Height inputMessageVideo.SupportsStreaming = tmp.SupportsStreaming inputMessageVideo.Caption = tmp.Caption + inputMessageVideo.ShowCaptionAboveMedia = tmp.ShowCaptionAboveMedia inputMessageVideo.HasSpoiler = tmp.HasSpoiler fieldVideo, _ := UnmarshalInputFile(tmp.Video) @@ -23983,7 +24750,7 @@ type InputMessageInvoice struct { PhotoHeight int32 `json:"photo_height"` // The invoice payload Payload []byte `json:"payload"` - // Payment provider token + // Payment provider token; may be empty for payments in Telegram Stars ProviderToken string `json:"provider_token"` // JSON-encoded data about the invoice, which will be shared with the payment provider ProviderData string `json:"provider_data"` @@ -25519,7 +26286,7 @@ func (*EmojiCategorySourceSearch) EmojiCategorySourceType() string { return TypeEmojiCategorySourceSearch } -// The category contains Premium stickers that must be found by getPremiumStickers +// The category contains premium stickers that must be found by getPremiumStickers type EmojiCategorySourcePremium struct{ meta } @@ -25644,7 +26411,7 @@ func (*EmojiCategoryTypeDefault) EmojiCategoryTypeType() string { return TypeEmojiCategoryTypeDefault } -// The category must be used by default for regular sticker selection. It may contain greeting emoji category and Premium stickers +// The category must be used by default for regular sticker selection. It may contain greeting emoji category and premium stickers type EmojiCategoryTypeRegularStickers struct{ meta } @@ -27636,6 +28403,58 @@ func (*ChatBoostSlots) GetType() string { return TypeChatBoostSlots } +// The user requested to resend the code +type ResendCodeReasonUserRequest struct{ + meta +} + +func (entity *ResendCodeReasonUserRequest) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ResendCodeReasonUserRequest + + return json.Marshal((*stub)(entity)) +} + +func (*ResendCodeReasonUserRequest) GetClass() string { + return ClassResendCodeReason +} + +func (*ResendCodeReasonUserRequest) GetType() string { + return TypeResendCodeReasonUserRequest +} + +func (*ResendCodeReasonUserRequest) ResendCodeReasonType() string { + return TypeResendCodeReasonUserRequest +} + +// The code is re-sent, because device verification has failed +type ResendCodeReasonVerificationFailed struct { + meta + // Cause of the verification failure, for example, PLAY_SERVICES_NOT_AVAILABLE, APNS_RECEIVE_TIMEOUT, APNS_INIT_FAILED, etc. + ErrorMessage string `json:"error_message"` +} + +func (entity *ResendCodeReasonVerificationFailed) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ResendCodeReasonVerificationFailed + + return json.Marshal((*stub)(entity)) +} + +func (*ResendCodeReasonVerificationFailed) GetClass() string { + return ClassResendCodeReason +} + +func (*ResendCodeReasonVerificationFailed) GetType() string { + return TypeResendCodeReasonVerificationFailed +} + +func (*ResendCodeReasonVerificationFailed) ResendCodeReasonType() string { + return TypeResendCodeReasonVerificationFailed +} + // The call wasn't discarded, or the reason is unknown type CallDiscardReasonEmpty struct{ meta @@ -35308,6 +36127,37 @@ func (*StorePaymentPurposePremiumGiveaway) StorePaymentPurposeType() string { return TypeStorePaymentPurposePremiumGiveaway } +// The user buying Telegram stars +type StorePaymentPurposeStars struct { + meta + // ISO 4217 currency code of the payment currency + Currency string `json:"currency"` + // Paid amount, in the smallest units of the currency + Amount int64 `json:"amount"` + // Number of bought stars + StarCount int64 `json:"star_count"` +} + +func (entity *StorePaymentPurposeStars) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StorePaymentPurposeStars + + return json.Marshal((*stub)(entity)) +} + +func (*StorePaymentPurposeStars) GetClass() string { + return ClassStorePaymentPurpose +} + +func (*StorePaymentPurposeStars) GetType() string { + return TypeStorePaymentPurposeStars +} + +func (*StorePaymentPurposeStars) StorePaymentPurposeType() string { + return TypeStorePaymentPurposeStars +} + // The user creating Telegram Premium gift codes for other users type TelegramPaymentPurposePremiumGiftCodes struct { meta @@ -35378,6 +36228,37 @@ func (*TelegramPaymentPurposePremiumGiveaway) TelegramPaymentPurposeType() strin return TypeTelegramPaymentPurposePremiumGiveaway } +// The user buying Telegram stars +type TelegramPaymentPurposeStars struct { + meta + // ISO 4217 currency code of the payment currency + Currency string `json:"currency"` + // Paid amount, in the smallest units of the currency + Amount int64 `json:"amount"` + // Number of bought stars + StarCount int64 `json:"star_count"` +} + +func (entity *TelegramPaymentPurposeStars) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TelegramPaymentPurposeStars + + return json.Marshal((*stub)(entity)) +} + +func (*TelegramPaymentPurposeStars) GetClass() string { + return ClassTelegramPaymentPurpose +} + +func (*TelegramPaymentPurposeStars) GetType() string { + return TypeTelegramPaymentPurposeStars +} + +func (*TelegramPaymentPurposeStars) TelegramPaymentPurposeType() string { + return TypeTelegramPaymentPurposeStars +} + // A token for Firebase Cloud Messaging type DeviceTokenFirebaseCloudMessaging struct { meta @@ -41241,7 +42122,7 @@ func (internalLinkTypeProxy *InternalLinkTypeProxy) UnmarshalJSON(data []byte) e return nil } -// The link is a link to a chat by its username. Call searchPublicChat with the given chat username to process the link If the chat is found, open its profile information screen or the chat itself. If draft text isn't empty and the chat is a private chat, then put the draft text in the input field +// The link is a link to a chat by its username. Call searchPublicChat with the given chat username to process the link If the chat is found, open its profile information screen or the chat itself. If draft text isn't empty and the chat is a private chat with a regular user, then put the draft text in the input field type InternalLinkTypePublicChat struct { meta // Username of the chat @@ -45517,7 +46398,7 @@ func (*BotCommandScopeChatMember) BotCommandScopeType() string { return TypeBotCommandScopeChatMember } -// Checks ownership of a new phone number to change the user's authentication phone number; for official Android and iOS applications only. +// Checks ownership of a new phone number to change the user's authentication phone number; for official Android and iOS applications only type PhoneNumberCodeTypeChange struct{ meta } @@ -46016,6 +46897,37 @@ func (*UpdateMessageUnreadReactions) UpdateType() string { return TypeUpdateMessageUnreadReactions } +// A fact-check added to a message was changed +type UpdateMessageFactCheck struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // Message identifier + MessageId int64 `json:"message_id"` + // The new fact-check + FactCheck *FactCheck `json:"fact_check"` +} + +func (entity *UpdateMessageFactCheck) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateMessageFactCheck + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateMessageFactCheck) GetClass() string { + return ClassUpdate +} + +func (*UpdateMessageFactCheck) GetType() string { + return TypeUpdateMessageFactCheck +} + +func (*UpdateMessageFactCheck) UpdateType() string { + return TypeUpdateMessageFactCheck +} + // A message with a live location was viewed. When the update is received, the application is supposed to update the live location type UpdateMessageLiveLocationViewed struct { meta @@ -48202,6 +49114,35 @@ func (*UpdateFileRemovedFromDownloads) UpdateType() string { return TypeUpdateFileRemovedFromDownloads } +// A request can't be completed unless application verification is performed; for official mobile applications only. The method setApplicationVerificationToken must be called once the verification is completed or failed +type UpdateApplicationVerificationRequired struct { + meta + // Unique identifier for the verification process + VerificationId int64 `json:"verification_id"` + // Unique nonce for the classic Play Integrity verification (https://developer.android.com/google/play/integrity/classic) for Android, or a unique string to compare with verify_nonce field from a push notification for iOS + Nonce string `json:"nonce"` +} + +func (entity *UpdateApplicationVerificationRequired) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateApplicationVerificationRequired + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateApplicationVerificationRequired) GetClass() string { + return ClassUpdate +} + +func (*UpdateApplicationVerificationRequired) GetType() string { + return TypeUpdateApplicationVerificationRequired +} + +func (*UpdateApplicationVerificationRequired) UpdateType() string { + return TypeUpdateApplicationVerificationRequired +} + // New call was created or information about a call was updated type UpdateCall struct { meta @@ -49352,6 +50293,35 @@ func (*UpdateActiveEmojiReactions) UpdateType() string { return TypeUpdateActiveEmojiReactions } +// The list of available message effects has changed +type UpdateAvailableMessageEffects struct { + meta + // The new list of available message effects from emoji reactions + ReactionEffectIds []JsonInt64 `json:"reaction_effect_ids"` + // The new list of available message effects from Premium stickers + StickerEffectIds []JsonInt64 `json:"sticker_effect_ids"` +} + +func (entity *UpdateAvailableMessageEffects) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateAvailableMessageEffects + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateAvailableMessageEffects) GetClass() string { + return ClassUpdate +} + +func (*UpdateAvailableMessageEffects) GetType() string { + return TypeUpdateAvailableMessageEffects +} + +func (*UpdateAvailableMessageEffects) UpdateType() string { + return TypeUpdateAvailableMessageEffects +} + // The type of default reaction has changed type UpdateDefaultReactionType struct { meta @@ -49424,9 +50394,40 @@ func (*UpdateSavedMessagesTags) UpdateType() string { return TypeUpdateSavedMessagesTags } -// The revenue earned from sponsored messages in a chat has changed. If chat revenue screen is opened, then getChatRevenueTransactions may be called to fetch new transactions -type UpdateChatRevenueAmount struct{ +// The number of Telegram stars owned by the current user has changed +type UpdateOwnedStarCount struct { meta + // The new number of Telegram stars owned + StarCount int64 `json:"star_count"` +} + +func (entity *UpdateOwnedStarCount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateOwnedStarCount + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateOwnedStarCount) GetClass() string { + return ClassUpdate +} + +func (*UpdateOwnedStarCount) GetType() string { + return TypeUpdateOwnedStarCount +} + +func (*UpdateOwnedStarCount) UpdateType() string { + return TypeUpdateOwnedStarCount +} + +// The revenue earned from sponsored messages in a chat has changed. If chat revenue screen is opened, then getChatRevenueTransactions may be called to fetch new transactions +type UpdateChatRevenueAmount struct { + meta + // Identifier of the chat + ChatId int64 `json:"chat_id"` + // New amount of earned revenue + RevenueAmount *ChatRevenueAmount `json:"revenue_amount"` } func (entity *UpdateChatRevenueAmount) MarshalJSON() ([]byte, error) { diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 14f0cba..ac3d1bc 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -625,6 +625,86 @@ func UnmarshalListOfInputChatPhoto(dataList []json.RawMessage) ([]InputChatPhoto return list, nil } +func UnmarshalStarTransactionDirection(data json.RawMessage) (StarTransactionDirection, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeStarTransactionDirectionIncoming: + return UnmarshalStarTransactionDirectionIncoming(data) + + case TypeStarTransactionDirectionOutgoing: + return UnmarshalStarTransactionDirectionOutgoing(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfStarTransactionDirection(dataList []json.RawMessage) ([]StarTransactionDirection, error) { + list := []StarTransactionDirection{} + + for _, data := range dataList { + entity, err := UnmarshalStarTransactionDirection(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalStarTransactionSource(data json.RawMessage) (StarTransactionSource, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeStarTransactionSourceTelegram: + return UnmarshalStarTransactionSourceTelegram(data) + + case TypeStarTransactionSourceAppStore: + return UnmarshalStarTransactionSourceAppStore(data) + + case TypeStarTransactionSourceGooglePlay: + return UnmarshalStarTransactionSourceGooglePlay(data) + + case TypeStarTransactionSourceFragment: + return UnmarshalStarTransactionSourceFragment(data) + + case TypeStarTransactionSourceUser: + return UnmarshalStarTransactionSourceUser(data) + + case TypeStarTransactionSourceUnsupported: + return UnmarshalStarTransactionSourceUnsupported(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfStarTransactionSource(dataList []json.RawMessage) ([]StarTransactionSource, error) { + list := []StarTransactionSource{} + + for _, data := range dataList { + entity, err := UnmarshalStarTransactionSource(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalPremiumGiveawayParticipantStatus(data json.RawMessage) (PremiumGiveawayParticipantStatus, error) { var meta meta @@ -1074,6 +1154,40 @@ func UnmarshalListOfReactionType(dataList []json.RawMessage) ([]ReactionType, er return list, nil } +func UnmarshalMessageEffectType(data json.RawMessage) (MessageEffectType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeMessageEffectTypeEmojiReaction: + return UnmarshalMessageEffectTypeEmojiReaction(data) + + case TypeMessageEffectTypePremiumSticker: + return UnmarshalMessageEffectTypePremiumSticker(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfMessageEffectType(dataList []json.RawMessage) ([]MessageEffectType, error) { + list := []MessageEffectType{} + + for _, data := range dataList { + entity, err := UnmarshalMessageEffectType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalMessageSendingState(data json.RawMessage) (MessageSendingState, error) { var meta meta @@ -2173,6 +2287,74 @@ func UnmarshalListOfPaymentProvider(dataList []json.RawMessage) ([]PaymentProvid return list, nil } +func UnmarshalPaymentFormType(data json.RawMessage) (PaymentFormType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypePaymentFormTypeRegular: + return UnmarshalPaymentFormTypeRegular(data) + + case TypePaymentFormTypeStars: + return UnmarshalPaymentFormTypeStars(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfPaymentFormType(dataList []json.RawMessage) ([]PaymentFormType, error) { + list := []PaymentFormType{} + + for _, data := range dataList { + entity, err := UnmarshalPaymentFormType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalPaymentReceiptType(data json.RawMessage) (PaymentReceiptType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypePaymentReceiptTypeRegular: + return UnmarshalPaymentReceiptTypeRegular(data) + + case TypePaymentReceiptTypeStars: + return UnmarshalPaymentReceiptTypeStars(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfPaymentReceiptType(dataList []json.RawMessage) ([]PaymentReceiptType, error) { + list := []PaymentReceiptType{} + + for _, data := range dataList { + entity, err := UnmarshalPaymentReceiptType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalInputInvoice(data json.RawMessage) (InputInvoice, error) { var meta meta @@ -2856,6 +3038,9 @@ func UnmarshalTextEntityType(data json.RawMessage) (TextEntityType, error) { case TypeTextEntityTypeBlockQuote: return UnmarshalTextEntityTypeBlockQuote(data) + case TypeTextEntityTypeExpandableBlockQuote: + return UnmarshalTextEntityTypeExpandableBlockQuote(data) + case TypeTextEntityTypeTextUrl: return UnmarshalTextEntityTypeTextUrl(data) @@ -3639,6 +3824,40 @@ func UnmarshalListOfChatBoostSource(dataList []json.RawMessage) ([]ChatBoostSour return list, nil } +func UnmarshalResendCodeReason(data json.RawMessage) (ResendCodeReason, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeResendCodeReasonUserRequest: + return UnmarshalResendCodeReasonUserRequest(data) + + case TypeResendCodeReasonVerificationFailed: + return UnmarshalResendCodeReasonVerificationFailed(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfResendCodeReason(dataList []json.RawMessage) ([]ResendCodeReason, error) { + list := []ResendCodeReason{} + + for _, data := range dataList { + entity, err := UnmarshalResendCodeReason(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalCallDiscardReason(data json.RawMessage) (CallDiscardReason, error) { var meta meta @@ -4803,6 +5022,9 @@ func UnmarshalStorePaymentPurpose(data json.RawMessage) (StorePaymentPurpose, er case TypeStorePaymentPurposePremiumGiveaway: return UnmarshalStorePaymentPurposePremiumGiveaway(data) + case TypeStorePaymentPurposeStars: + return UnmarshalStorePaymentPurposeStars(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -4837,6 +5059,9 @@ func UnmarshalTelegramPaymentPurpose(data json.RawMessage) (TelegramPaymentPurpo case TypeTelegramPaymentPurposePremiumGiveaway: return UnmarshalTelegramPaymentPurposePremiumGiveaway(data) + case TypeTelegramPaymentPurposeStars: + return UnmarshalTelegramPaymentPurposeStars(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -6947,6 +7172,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateMessageUnreadReactions: return UnmarshalUpdateMessageUnreadReactions(data) + case TypeUpdateMessageFactCheck: + return UnmarshalUpdateMessageFactCheck(data) + case TypeUpdateMessageLiveLocationViewed: return UnmarshalUpdateMessageLiveLocationViewed(data) @@ -7148,6 +7376,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateFileRemovedFromDownloads: return UnmarshalUpdateFileRemovedFromDownloads(data) + case TypeUpdateApplicationVerificationRequired: + return UnmarshalUpdateApplicationVerificationRequired(data) + case TypeUpdateCall: return UnmarshalUpdateCall(data) @@ -7250,12 +7481,18 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateActiveEmojiReactions: return UnmarshalUpdateActiveEmojiReactions(data) + case TypeUpdateAvailableMessageEffects: + return UnmarshalUpdateAvailableMessageEffects(data) + case TypeUpdateDefaultReactionType: return UnmarshalUpdateDefaultReactionType(data) case TypeUpdateSavedMessagesTags: return UnmarshalUpdateSavedMessagesTags(data) + case TypeUpdateOwnedStarCount: + return UnmarshalUpdateOwnedStarCount(data) + case TypeUpdateChatRevenueAmount: return UnmarshalUpdateChatRevenueAmount(data) @@ -8452,6 +8689,14 @@ func UnmarshalChatAdministratorRights(data json.RawMessage) (*ChatAdministratorR return &resp, err } +func UnmarshalProductInfo(data json.RawMessage) (*ProductInfo, error) { + var resp ProductInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPremiumPaymentOption(data json.RawMessage) (*PremiumPaymentOption, error) { var resp PremiumPaymentOption @@ -8492,6 +8737,102 @@ func UnmarshalPremiumGiftCodeInfo(data json.RawMessage) (*PremiumGiftCodeInfo, e return &resp, err } +func UnmarshalStarPaymentOption(data json.RawMessage) (*StarPaymentOption, error) { + var resp StarPaymentOption + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarPaymentOptions(data json.RawMessage) (*StarPaymentOptions, error) { + var resp StarPaymentOptions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionDirectionIncoming(data json.RawMessage) (*StarTransactionDirectionIncoming, error) { + var resp StarTransactionDirectionIncoming + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionDirectionOutgoing(data json.RawMessage) (*StarTransactionDirectionOutgoing, error) { + var resp StarTransactionDirectionOutgoing + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionSourceTelegram(data json.RawMessage) (*StarTransactionSourceTelegram, error) { + var resp StarTransactionSourceTelegram + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionSourceAppStore(data json.RawMessage) (*StarTransactionSourceAppStore, error) { + var resp StarTransactionSourceAppStore + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionSourceGooglePlay(data json.RawMessage) (*StarTransactionSourceGooglePlay, error) { + var resp StarTransactionSourceGooglePlay + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionSourceFragment(data json.RawMessage) (*StarTransactionSourceFragment, error) { + var resp StarTransactionSourceFragment + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionSourceUser(data json.RawMessage) (*StarTransactionSourceUser, error) { + var resp StarTransactionSourceUser + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionSourceUnsupported(data json.RawMessage) (*StarTransactionSourceUnsupported, error) { + var resp StarTransactionSourceUnsupported + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransaction(data json.RawMessage) (*StarTransaction, error) { + var resp StarTransaction + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactions(data json.RawMessage) (*StarTransactions, error) { + var resp StarTransactions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPremiumGiveawayParticipantStatusEligible(data json.RawMessage) (*PremiumGiveawayParticipantStatusEligible, error) { var resp PremiumGiveawayParticipantStatusEligible @@ -9204,6 +9545,30 @@ func UnmarshalUnreadReaction(data json.RawMessage) (*UnreadReaction, error) { return &resp, err } +func UnmarshalMessageEffectTypeEmojiReaction(data json.RawMessage) (*MessageEffectTypeEmojiReaction, error) { + var resp MessageEffectTypeEmojiReaction + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageEffectTypePremiumSticker(data json.RawMessage) (*MessageEffectTypePremiumSticker, error) { + var resp MessageEffectTypePremiumSticker + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageEffect(data json.RawMessage) (*MessageEffect, error) { + var resp MessageEffect + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageSendingStatePending(data json.RawMessage) (*MessageSendingStatePending, error) { var resp MessageSendingStatePending @@ -9268,6 +9633,14 @@ func UnmarshalInputMessageReplyToStory(data json.RawMessage) (*InputMessageReply return &resp, err } +func UnmarshalFactCheck(data json.RawMessage) (*FactCheck, error) { + var resp FactCheck + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessage(data json.RawMessage) (*Message, error) { var resp Message @@ -10892,6 +11265,22 @@ func UnmarshalPaymentOption(data json.RawMessage) (*PaymentOption, error) { return &resp, err } +func UnmarshalPaymentFormTypeRegular(data json.RawMessage) (*PaymentFormTypeRegular, error) { + var resp PaymentFormTypeRegular + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPaymentFormTypeStars(data json.RawMessage) (*PaymentFormTypeStars, error) { + var resp PaymentFormTypeStars + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPaymentForm(data json.RawMessage) (*PaymentForm, error) { var resp PaymentForm @@ -10916,6 +11305,22 @@ func UnmarshalPaymentResult(data json.RawMessage) (*PaymentResult, error) { return &resp, err } +func UnmarshalPaymentReceiptTypeRegular(data json.RawMessage) (*PaymentReceiptTypeRegular, error) { + var resp PaymentReceiptTypeRegular + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPaymentReceiptTypeStars(data json.RawMessage) (*PaymentReceiptTypeStars, error) { + var resp PaymentReceiptTypeStars + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPaymentReceipt(data json.RawMessage) (*PaymentReceipt, error) { var resp PaymentReceipt @@ -12260,6 +12665,14 @@ func UnmarshalTextEntityTypeBlockQuote(data json.RawMessage) (*TextEntityTypeBlo return &resp, err } +func UnmarshalTextEntityTypeExpandableBlockQuote(data json.RawMessage) (*TextEntityTypeExpandableBlockQuote, error) { + var resp TextEntityTypeExpandableBlockQuote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalTextEntityTypeTextUrl(data json.RawMessage) (*TextEntityTypeTextUrl, error) { var resp TextEntityTypeTextUrl @@ -13340,6 +13753,22 @@ func UnmarshalChatBoostSlots(data json.RawMessage) (*ChatBoostSlots, error) { return &resp, err } +func UnmarshalResendCodeReasonUserRequest(data json.RawMessage) (*ResendCodeReasonUserRequest, error) { + var resp ResendCodeReasonUserRequest + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalResendCodeReasonVerificationFailed(data json.RawMessage) (*ResendCodeReasonVerificationFailed, error) { + var resp ResendCodeReasonVerificationFailed + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalCallDiscardReasonEmpty(data json.RawMessage) (*CallDiscardReasonEmpty, error) { var resp CallDiscardReasonEmpty @@ -15220,6 +15649,14 @@ func UnmarshalStorePaymentPurposePremiumGiveaway(data json.RawMessage) (*StorePa return &resp, err } +func UnmarshalStorePaymentPurposeStars(data json.RawMessage) (*StorePaymentPurposeStars, error) { + var resp StorePaymentPurposeStars + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalTelegramPaymentPurposePremiumGiftCodes(data json.RawMessage) (*TelegramPaymentPurposePremiumGiftCodes, error) { var resp TelegramPaymentPurposePremiumGiftCodes @@ -15236,6 +15673,14 @@ func UnmarshalTelegramPaymentPurposePremiumGiveaway(data json.RawMessage) (*Tele return &resp, err } +func UnmarshalTelegramPaymentPurposeStars(data json.RawMessage) (*TelegramPaymentPurposeStars, error) { + var resp TelegramPaymentPurposeStars + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalDeviceTokenFirebaseCloudMessaging(data json.RawMessage) (*DeviceTokenFirebaseCloudMessaging, error) { var resp DeviceTokenFirebaseCloudMessaging @@ -18148,6 +18593,14 @@ func UnmarshalUpdateMessageUnreadReactions(data json.RawMessage) (*UpdateMessage return &resp, err } +func UnmarshalUpdateMessageFactCheck(data json.RawMessage) (*UpdateMessageFactCheck, error) { + var resp UpdateMessageFactCheck + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateMessageLiveLocationViewed(data json.RawMessage) (*UpdateMessageLiveLocationViewed, error) { var resp UpdateMessageLiveLocationViewed @@ -18684,6 +19137,14 @@ func UnmarshalUpdateFileRemovedFromDownloads(data json.RawMessage) (*UpdateFileR return &resp, err } +func UnmarshalUpdateApplicationVerificationRequired(data json.RawMessage) (*UpdateApplicationVerificationRequired, error) { + var resp UpdateApplicationVerificationRequired + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateCall(data json.RawMessage) (*UpdateCall, error) { var resp UpdateCall @@ -18956,6 +19417,14 @@ func UnmarshalUpdateActiveEmojiReactions(data json.RawMessage) (*UpdateActiveEmo return &resp, err } +func UnmarshalUpdateAvailableMessageEffects(data json.RawMessage) (*UpdateAvailableMessageEffects, error) { + var resp UpdateAvailableMessageEffects + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateDefaultReactionType(data json.RawMessage) (*UpdateDefaultReactionType, error) { var resp UpdateDefaultReactionType @@ -18972,6 +19441,14 @@ func UnmarshalUpdateSavedMessagesTags(data json.RawMessage) (*UpdateSavedMessage return &resp, err } +func UnmarshalUpdateOwnedStarCount(data json.RawMessage) (*UpdateOwnedStarCount, error) { + var resp UpdateOwnedStarCount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateChatRevenueAmount(data json.RawMessage) (*UpdateChatRevenueAmount, error) { var resp UpdateChatRevenueAmount @@ -19713,6 +20190,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatAdministratorRights: return UnmarshalChatAdministratorRights(data) + case TypeProductInfo: + return UnmarshalProductInfo(data) + case TypePremiumPaymentOption: return UnmarshalPremiumPaymentOption(data) @@ -19728,6 +20208,42 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePremiumGiftCodeInfo: return UnmarshalPremiumGiftCodeInfo(data) + case TypeStarPaymentOption: + return UnmarshalStarPaymentOption(data) + + case TypeStarPaymentOptions: + return UnmarshalStarPaymentOptions(data) + + case TypeStarTransactionDirectionIncoming: + return UnmarshalStarTransactionDirectionIncoming(data) + + case TypeStarTransactionDirectionOutgoing: + return UnmarshalStarTransactionDirectionOutgoing(data) + + case TypeStarTransactionSourceTelegram: + return UnmarshalStarTransactionSourceTelegram(data) + + case TypeStarTransactionSourceAppStore: + return UnmarshalStarTransactionSourceAppStore(data) + + case TypeStarTransactionSourceGooglePlay: + return UnmarshalStarTransactionSourceGooglePlay(data) + + case TypeStarTransactionSourceFragment: + return UnmarshalStarTransactionSourceFragment(data) + + case TypeStarTransactionSourceUser: + return UnmarshalStarTransactionSourceUser(data) + + case TypeStarTransactionSourceUnsupported: + return UnmarshalStarTransactionSourceUnsupported(data) + + case TypeStarTransaction: + return UnmarshalStarTransaction(data) + + case TypeStarTransactions: + return UnmarshalStarTransactions(data) + case TypePremiumGiveawayParticipantStatusEligible: return UnmarshalPremiumGiveawayParticipantStatusEligible(data) @@ -19995,6 +20511,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUnreadReaction: return UnmarshalUnreadReaction(data) + case TypeMessageEffectTypeEmojiReaction: + return UnmarshalMessageEffectTypeEmojiReaction(data) + + case TypeMessageEffectTypePremiumSticker: + return UnmarshalMessageEffectTypePremiumSticker(data) + + case TypeMessageEffect: + return UnmarshalMessageEffect(data) + case TypeMessageSendingStatePending: return UnmarshalMessageSendingStatePending(data) @@ -20019,6 +20544,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInputMessageReplyToStory: return UnmarshalInputMessageReplyToStory(data) + case TypeFactCheck: + return UnmarshalFactCheck(data) + case TypeMessage: return UnmarshalMessage(data) @@ -20628,6 +21156,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePaymentOption: return UnmarshalPaymentOption(data) + case TypePaymentFormTypeRegular: + return UnmarshalPaymentFormTypeRegular(data) + + case TypePaymentFormTypeStars: + return UnmarshalPaymentFormTypeStars(data) + case TypePaymentForm: return UnmarshalPaymentForm(data) @@ -20637,6 +21171,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePaymentResult: return UnmarshalPaymentResult(data) + case TypePaymentReceiptTypeRegular: + return UnmarshalPaymentReceiptTypeRegular(data) + + case TypePaymentReceiptTypeStars: + return UnmarshalPaymentReceiptTypeStars(data) + case TypePaymentReceipt: return UnmarshalPaymentReceipt(data) @@ -21141,6 +21681,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeTextEntityTypeBlockQuote: return UnmarshalTextEntityTypeBlockQuote(data) + case TypeTextEntityTypeExpandableBlockQuote: + return UnmarshalTextEntityTypeExpandableBlockQuote(data) + case TypeTextEntityTypeTextUrl: return UnmarshalTextEntityTypeTextUrl(data) @@ -21546,6 +22089,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatBoostSlots: return UnmarshalChatBoostSlots(data) + case TypeResendCodeReasonUserRequest: + return UnmarshalResendCodeReasonUserRequest(data) + + case TypeResendCodeReasonVerificationFailed: + return UnmarshalResendCodeReasonVerificationFailed(data) + case TypeCallDiscardReasonEmpty: return UnmarshalCallDiscardReasonEmpty(data) @@ -22251,12 +22800,18 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStorePaymentPurposePremiumGiveaway: return UnmarshalStorePaymentPurposePremiumGiveaway(data) + case TypeStorePaymentPurposeStars: + return UnmarshalStorePaymentPurposeStars(data) + case TypeTelegramPaymentPurposePremiumGiftCodes: return UnmarshalTelegramPaymentPurposePremiumGiftCodes(data) case TypeTelegramPaymentPurposePremiumGiveaway: return UnmarshalTelegramPaymentPurposePremiumGiveaway(data) + case TypeTelegramPaymentPurposeStars: + return UnmarshalTelegramPaymentPurposeStars(data) + case TypeDeviceTokenFirebaseCloudMessaging: return UnmarshalDeviceTokenFirebaseCloudMessaging(data) @@ -23349,6 +23904,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateMessageUnreadReactions: return UnmarshalUpdateMessageUnreadReactions(data) + case TypeUpdateMessageFactCheck: + return UnmarshalUpdateMessageFactCheck(data) + case TypeUpdateMessageLiveLocationViewed: return UnmarshalUpdateMessageLiveLocationViewed(data) @@ -23550,6 +24108,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateFileRemovedFromDownloads: return UnmarshalUpdateFileRemovedFromDownloads(data) + case TypeUpdateApplicationVerificationRequired: + return UnmarshalUpdateApplicationVerificationRequired(data) + case TypeUpdateCall: return UnmarshalUpdateCall(data) @@ -23652,12 +24213,18 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateActiveEmojiReactions: return UnmarshalUpdateActiveEmojiReactions(data) + case TypeUpdateAvailableMessageEffects: + return UnmarshalUpdateAvailableMessageEffects(data) + case TypeUpdateDefaultReactionType: return UnmarshalUpdateDefaultReactionType(data) case TypeUpdateSavedMessagesTags: return UnmarshalUpdateSavedMessagesTags(data) + case TypeUpdateOwnedStarCount: + return UnmarshalUpdateOwnedStarCount(data) + case TypeUpdateChatRevenueAmount: return UnmarshalUpdateChatRevenueAmount(data) diff --git a/data/td_api.tl b/data/td_api.tl index 36760f0..dae79c7 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -59,9 +59,10 @@ authenticationCodeTypeMissedCall phone_number_prefix:string length:int32 = Authe authenticationCodeTypeFragment url:string length:int32 = AuthenticationCodeType; //@description A digit-only authentication code is delivered via Firebase Authentication to the official Android application -//@nonce Nonce to pass to the SafetyNet Attestation API +//@use_play_integrity True, if Play Integrity API must be used for device verification. Otherwise, SafetyNet Attestation API must be used +//@nonce Nonce to pass to the Play Integrity API or the SafetyNet Attestation API //@length Length of the code -authenticationCodeTypeFirebaseAndroid nonce:bytes length:int32 = AuthenticationCodeType; +authenticationCodeTypeFirebaseAndroid use_play_integrity:Bool nonce:bytes length:int32 = AuthenticationCodeType; //@description A digit-only authentication code is delivered via Firebase Authentication to the official iOS application //@receipt Receipt of successful application token validation to compare with receipt from push notification @@ -787,6 +788,13 @@ chatPermissions can_send_basic_messages:Bool can_send_audios:Bool can_send_docum chatAdministratorRights can_manage_chat:Bool can_change_info:Bool can_post_messages:Bool can_edit_messages:Bool can_delete_messages:Bool can_invite_users:Bool can_restrict_members:Bool can_pin_messages:Bool can_manage_topics:Bool can_promote_members:Bool can_manage_video_chats:Bool can_post_stories:Bool can_edit_stories:Bool can_delete_stories:Bool is_anonymous:Bool = ChatAdministratorRights; +//@description Contains information about a product that can be paid with invoice +//@title Product title +//@param_description Product description +//@photo Product photo; may be null +productInfo title:string description:formattedText photo:photo = ProductInfo; + + //@description Describes an option for buying Telegram Premium to a user //@currency ISO 4217 currency code for Telegram Premium subscription payment //@amount The amount to pay, in the smallest units of the currency @@ -825,6 +833,62 @@ premiumGiftCodePaymentOptions options:vector = Pre //@use_date Point in time (Unix timestamp) when the code was activated; 0 if none premiumGiftCodeInfo creator_id:MessageSender creation_date:int32 is_from_giveaway:Bool giveaway_message_id:int53 month_count:int32 user_id:int53 use_date:int32 = PremiumGiftCodeInfo; +//@description Describes an option for buying Telegram stars +//@currency ISO 4217 currency code for the payment +//@amount The amount to pay, in the smallest units of the currency +//@star_count Number of stars that will be purchased +//@store_product_id Identifier of the store product associated with the option; may be empty if none +//@is_additional True, if the option must be shown only in the full list of payment options +starPaymentOption currency:string amount:int53 star_count:int53 store_product_id:string is_additional:Bool = StarPaymentOption; + +//@description Contains a list of options for buying Telegram stars @options The list of options +starPaymentOptions options:vector = StarPaymentOptions; + + +//@class StarTransactionDirection @description Describes direction of a transaction with Telegram stars + +//@description The transaction is incoming and increases the number of owned Telegram stars +starTransactionDirectionIncoming = StarTransactionDirection; + +//@description The transaction is outgoing and decreases the number of owned Telegram stars +starTransactionDirectionOutgoing = StarTransactionDirection; + + +//@class StarTransactionSource @description Describes source or recipient of a transaction with Telegram stars + +//@description The transaction is a transaction with Telegram through a bot +starTransactionSourceTelegram = StarTransactionSource; + +//@description The transaction is a transaction with App Store +starTransactionSourceAppStore = StarTransactionSource; + +//@description The transaction is a transaction with Google Play +starTransactionSourceGooglePlay = StarTransactionSource; + +//@description The transaction is a transaction with Fragment +starTransactionSourceFragment = StarTransactionSource; + +//@description The transaction is a transaction with another user @user_id Identifier of the user @product_info Information about the bought product; may be null if none +starTransactionSourceUser user_id:int53 product_info:productInfo = StarTransactionSource; + +//@description The transaction is a transaction with unknown source +starTransactionSourceUnsupported = StarTransactionSource; + + +//@description Represents a transaction changing the amount of owned Telegram stars +//@id Unique identifier of the transaction +//@star_count The amount of added owned Telegram stars; negative for outgoing transactions +//@is_refund True, if the transaction is a refund of a previous transaction +//@date Point in time (Unix timestamp) when the transaction was completed +//@source Source of the transaction, or its recipient for outgoing transactions +starTransaction id:string star_count:int53 is_refund:Bool date:int32 source:StarTransactionSource = StarTransaction; + +//@description Represents a list of Telegram star transactions +//@star_count The amount of owned Telegram stars +//@transactions List of transactions with Telegram stars +//@next_offset The offset for the next request. If empty, then there are no more results +starTransactions star_count:int53 transactions:vector next_offset:string = StarTransactions; + //@class PremiumGiveawayParticipantStatus @description Contains information about status of a user in a Telegram Premium giveaway @@ -1398,6 +1462,24 @@ messageInteractionInfo view_count:int32 forward_count:int32 reply_info:messageRe unreadReaction type:ReactionType sender_id:MessageSender is_big:Bool = UnreadReaction; +//@class MessageEffectType @description Describes type of emoji effect + +//@description An effect from an emoji reaction @select_animation Select animation for the effect in TGS format @effect_animation Effect animation for the effect in TGS format +messageEffectTypeEmojiReaction select_animation:sticker effect_animation:sticker = MessageEffectType; + +//@description An effect from a premium sticker @sticker The premium sticker. The effect can be found at sticker.full_type.premium_animation +messageEffectTypePremiumSticker sticker:sticker = MessageEffectType; + + +//@description Contains information about an effect added to a message +//@id Unique identifier of the effect +//@static_icon Static icon for the effect in WEBP format; may be null if none +//@emoji Emoji corresponding to the effect that can be used if static icon isn't available +//@is_premium True, if Telegram Premium subscription is required to use the effect +//@type Type of the effect +messageEffect id:int64 static_icon:sticker emoji:string is_premium:Bool type:MessageEffectType = MessageEffect; + + //@class MessageSendingState @description Contains information about the sending state of the message //@description The message is being sent now, but has not yet been delivered to the server @sending_id Non-persistent message sending identifier, specified by the application @@ -1457,6 +1539,12 @@ inputMessageReplyToMessage chat_id:int53 message_id:int53 quote:inputTextQuote = inputMessageReplyToStory story_sender_chat_id:int53 story_id:int32 = InputMessageReplyTo; +//@description Describes a fact-check added to the message by an independent checker +//@text Text of the fact-check +//@country_code A two-letter ISO 3166-1 alpha-2 country code of the country for which the fact-check is shown +factCheck text:formattedText country_code:string = FactCheck; + + //@description Describes a message //@id Message identifier; unique for the chat to which the message belongs //@sender_id Identifier of the sender of the message @@ -1489,6 +1577,7 @@ inputMessageReplyToStory story_sender_chat_id:int53 story_id:int32 = InputMessag //@import_info Information about the initial message for messages created with importMessages; may be null if the message isn't imported //@interaction_info Information about interactions with the message; may be null if none //@unread_reactions Information about unread reactions added to the message +//@fact_check Information about fact-check added to the message; may be null if none //@reply_to Information about the message or the story this message is replying to; may be null if none //@message_thread_id If non-zero, the identifier of the message thread the message belongs to; unique within the chat to which the message belongs //@saved_messages_topic_id Identifier of the Saved Messages topic for the message; 0 for messages not from Saved Messages @@ -1500,10 +1589,11 @@ inputMessageReplyToStory story_sender_chat_id:int53 story_id:int32 = InputMessag //@sender_boost_count Number of times the sender of the message boosted the supergroup at the time the message was sent; 0 if none or unknown. For messages sent by the current user, supergroupFullInfo.my_boost_count must be used instead //@author_signature For channel posts and anonymous group messages, optional author signature //@media_album_id Unique identifier of an album this message belongs to; 0 if none. Only audios, documents, photos and videos can be grouped together in albums +//@effect_id Unique identifier of the effect added to the message; 0 if none //@restriction_reason If non-empty, contains a human-readable description of the reason why access to this message must be restricted //@content Content of the message //@reply_markup Reply markup for the message; may be null if none -message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool is_from_offline:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_get_added_reactions:Bool can_get_statistics:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_viewers:Bool can_get_media_timestamp_links:Bool can_report_reactions:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector reply_to:MessageReplyTo message_thread_id:int53 saved_messages_topic_id:int53 self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 sender_business_bot_user_id:int53 sender_boost_count:int32 author_signature:string media_album_id:int64 restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; +message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool is_from_offline:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_get_added_reactions:Bool can_get_statistics:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_viewers:Bool can_get_media_timestamp_links:Bool can_report_reactions:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector fact_check:factCheck reply_to:MessageReplyTo message_thread_id:int53 saved_messages_topic_id:int53 self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 sender_business_bot_user_id:int53 sender_boost_count:int32 author_signature:string media_album_id:int64 effect_id:int64 restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; //@description Contains a list of messages @total_count Approximate total number of messages found @messages List of messages; messages may be null messages total_count:int32 messages:vector = Messages; @@ -1912,7 +2002,7 @@ chatNearby chat_id:int53 distance:int32 = ChatNearby; chatsNearby users_nearby:vector supergroups_nearby:vector = ChatsNearby; -//@class PublicChatType @description Describes a type of public chats +//@class PublicChatType @description Describes type of public chat //@description The chat is public, because it has an active username publicChatTypeHasUsername = PublicChatType; @@ -2613,10 +2703,10 @@ paymentProviderOther url:string = PaymentProvider; paymentOption title:string url:string = PaymentOption; -//@description Contains information about an invoice payment form -//@id The payment form identifier +//@class PaymentFormType @description Describes type of payment form + +//@description The payment form is for a regular payment //@invoice Full information about the invoice -//@seller_bot_user_id User identifier of the seller bot //@payment_provider_user_id User identifier of the payment provider bot //@payment_provider Information about the payment provider //@additional_payment_options The list of additional payment options @@ -2624,10 +2714,18 @@ paymentOption title:string url:string = PaymentOption; //@saved_credentials The list of saved payment credentials //@can_save_credentials True, if the user can choose to save credentials //@need_password True, if the user will be able to save credentials, if sets up a 2-step verification password -//@product_title Product title -//@product_description Product description -//@product_photo Product photo; may be null -paymentForm id:int64 invoice:invoice seller_bot_user_id:int53 payment_provider_user_id:int53 payment_provider:PaymentProvider additional_payment_options:vector saved_order_info:orderInfo saved_credentials:vector can_save_credentials:Bool need_password:Bool product_title:string product_description:formattedText product_photo:photo = PaymentForm; +paymentFormTypeRegular invoice:invoice payment_provider_user_id:int53 payment_provider:PaymentProvider additional_payment_options:vector saved_order_info:orderInfo saved_credentials:vector can_save_credentials:Bool need_password:Bool = PaymentFormType; + +//@description The payment form is for a payment in Telegram stars @star_count Number of stars that will be paid +paymentFormTypeStars star_count:int53 = PaymentFormType; + + +//@description Contains information about an invoice payment form +//@id The payment form identifier +//@type Type of the payment form +//@seller_bot_user_id User identifier of the seller bot +//@product_info Information about the product +paymentForm id:int64 type:PaymentFormType seller_bot_user_id:int53 product_info:productInfo = PaymentForm; //@description Contains a temporary identifier of validated order information, which is stored for one hour, and the available shipping options @order_info_id Temporary identifier of the order information @shipping_options Available shipping options validatedOrderInfo order_info_id:string shipping_options:vector = ValidatedOrderInfo; @@ -2635,19 +2733,30 @@ validatedOrderInfo order_info_id:string shipping_options:vector //@description Contains the result of a payment request @success True, if the payment request was successful; otherwise, the verification_url will be non-empty @verification_url URL for additional payment credentials verification paymentResult success:Bool verification_url:string = PaymentResult; -//@description Contains information about a successful payment -//@title Product title -//@param_description Product description -//@photo Product photo; may be null -//@date Point in time (Unix timestamp) when the payment was made -//@seller_bot_user_id User identifier of the seller bot + +//@class PaymentReceiptType @description Describes type of successful payment + +//@description The payment was done using a third-party payment provider //@payment_provider_user_id User identifier of the payment provider bot //@invoice Information about the invoice //@order_info Order information; may be null //@shipping_option Chosen shipping option; may be null //@credentials_title Title of the saved credentials chosen by the buyer //@tip_amount The amount of tip chosen by the buyer in the smallest units of the currency -paymentReceipt title:string description:formattedText photo:photo date:int32 seller_bot_user_id:int53 payment_provider_user_id:int53 invoice:invoice order_info:orderInfo shipping_option:shippingOption credentials_title:string tip_amount:int53 = PaymentReceipt; +paymentReceiptTypeRegular payment_provider_user_id:int53 invoice:invoice order_info:orderInfo shipping_option:shippingOption credentials_title:string tip_amount:int53 = PaymentReceiptType; + +//@description The payment was done using Telegram stars +//@star_count Number of stars that were paid +//@transaction_id Unique identifier of the transaction that can be used to dispute it +paymentReceiptTypeStars star_count:int53 transaction_id:string = PaymentReceiptType; + + +//@description Contains information about a successful payment +//@product_info Information about the product +//@date Point in time (Unix timestamp) when the payment was made +//@seller_bot_user_id User identifier of the seller bot +//@type Type of the payment receipt +paymentReceipt product_info:productInfo date:int32 seller_bot_user_id:int53 type:PaymentReceiptType = PaymentReceipt; //@class InputInvoice @description Describes an invoice to process @@ -2986,9 +3095,10 @@ messageText text:formattedText web_page:webPage link_preview_options:linkPreview //@description An animation message (GIF-style). //@animation The animation description //@caption Animation caption +//@show_caption_above_media True, if caption must be shown above the animation; otherwise, caption must be shown below the animation //@has_spoiler True, if the animation preview must be covered by a spoiler animation //@is_secret True, if the animation thumbnail must be blurred and the animation must be shown only while tapped -messageAnimation animation:animation caption:formattedText has_spoiler:Bool is_secret:Bool = MessageContent; +messageAnimation animation:animation caption:formattedText show_caption_above_media:Bool has_spoiler:Bool is_secret:Bool = MessageContent; //@description An audio message @audio The audio description @caption Audio caption messageAudio audio:audio caption:formattedText = MessageContent; @@ -2999,9 +3109,10 @@ messageDocument document:document caption:formattedText = MessageContent; //@description A photo message //@photo The photo //@caption Photo caption +//@show_caption_above_media True, if caption must be shown above the photo; otherwise, caption must be shown below the photo //@has_spoiler True, if the photo preview must be covered by a spoiler animation //@is_secret True, if the photo must be blurred and must be shown only while tapped -messagePhoto photo:photo caption:formattedText has_spoiler:Bool is_secret:Bool = MessageContent; +messagePhoto photo:photo caption:formattedText show_caption_above_media:Bool has_spoiler:Bool is_secret:Bool = MessageContent; //@description A sticker message @sticker The sticker description @is_premium True, if premium animation of the sticker must be played messageSticker sticker:sticker is_premium:Bool = MessageContent; @@ -3009,9 +3120,10 @@ messageSticker sticker:sticker is_premium:Bool = MessageContent; //@description A video message //@video The video description //@caption Video caption +//@show_caption_above_media True, if caption must be shown above the video; otherwise, caption must be shown below the video //@has_spoiler True, if the video preview must be covered by a spoiler animation //@is_secret True, if the video thumbnail must be blurred and the video must be shown only while tapped -messageVideo video:video caption:formattedText has_spoiler:Bool is_secret:Bool = MessageContent; +messageVideo video:video caption:formattedText show_caption_above_media:Bool has_spoiler:Bool is_secret:Bool = MessageContent; //@description A video note message @video_note The video note description @is_viewed True, if at least one of the recipients has viewed the video note @is_secret True, if the video note thumbnail must be blurred and the video note must be shown only while tapped messageVideoNote video_note:videoNote is_viewed:Bool is_secret:Bool = MessageContent; @@ -3069,9 +3181,7 @@ messagePoll poll:poll = MessageContent; messageStory story_sender_chat_id:int53 story_id:int32 via_mention:Bool = MessageContent; //@description A message with an invoice from a bot. Use getInternalLink with internalLinkTypeBotStart to share the invoice -//@title Product title -//@param_description Product description -//@photo Product photo; may be null +//@product_info Information about the product //@currency Currency for the product price //@total_amount Product total price in the smallest units of the currency //@start_parameter Unique invoice bot start_parameter to be passed to getInternalLink @@ -3079,7 +3189,7 @@ messageStory story_sender_chat_id:int53 story_id:int32 via_mention:Bool = Messag //@need_shipping_address True, if the shipping address must be specified //@receipt_message_id The identifier of the message with the receipt, after the product has been purchased //@extended_media Extended media attached to the invoice; may be null -messageInvoice title:string description:formattedText photo:photo currency:string total_amount:int53 start_parameter:string is_test:Bool need_shipping_address:Bool receipt_message_id:int53 extended_media:MessageExtendedMedia = MessageContent; +messageInvoice product_info:productInfo currency:string total_amount:int53 start_parameter:string is_test:Bool need_shipping_address:Bool receipt_message_id:int53 extended_media:MessageExtendedMedia = MessageContent; //@description A message with information about an ended call @is_video True, if the call was a video call @discard_reason Reason why the call was discarded @duration Call duration, in seconds messageCall is_video:Bool discard_reason:CallDiscardReason duration:int32 = MessageContent; @@ -3330,9 +3440,12 @@ textEntityTypePre = TextEntityType; //@description Text that must be formatted as if inside pre, and code HTML tags @language Programming language of the code; as defined by the sender textEntityTypePreCode language:string = TextEntityType; -//@description Text that must be formatted as if inside a blockquote HTML tag +//@description Text that must be formatted as if inside a blockquote HTML tag; not supported in secret chats textEntityTypeBlockQuote = TextEntityType; +//@description Text that must be formatted as if inside a blockquote HTML tag and collapsed by default to 3 lines with the ability to show full text; not supported in secret chats +textEntityTypeExpandableBlockQuote = TextEntityType; + //@description A text description shown instead of a raw URL @url HTTP or tg:// URL to be opened when the link is clicked textEntityTypeTextUrl url:string = TextEntityType; @@ -3377,21 +3490,24 @@ messageSelfDestructTypeImmediately = MessageSelfDestructType; //@protect_content Pass true if the content of the message must be protected from forwarding and saving; for bots only //@update_order_of_installed_sticker_sets Pass true if the user explicitly chosen a sticker or a custom emoji from an installed sticker set; applicable only to sendMessage and sendMessageAlbum //@scheduling_state Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, live location messages and self-destructing messages can't be scheduled +//@effect_id Identifier of the effect to apply to the message; applicable only to sendMessage and sendMessageAlbum in private chats //@sending_id Non-persistent identifier, which will be returned back in messageSendingStatePending object and can be used to match sent messages and corresponding updateNewMessage updates //@only_preview Pass true to get a fake message instead of actually sending them -messageSendOptions disable_notification:Bool from_background:Bool protect_content:Bool update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState sending_id:int32 only_preview:Bool = MessageSendOptions; +messageSendOptions disable_notification:Bool from_background:Bool protect_content:Bool update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState effect_id:int64 sending_id:int32 only_preview:Bool = MessageSendOptions; //@description Options to be used when a message content is copied without reference to the original sender. Service messages, messages with messageInvoice, messagePremiumGiveaway, or messagePremiumGiveawayWinners content can't be copied //@send_copy True, if content of the message needs to be copied without reference to the original sender. Always true if the message is forwarded to a secret chat or is local //@replace_caption True, if media caption of the message copy needs to be replaced. Ignored if send_copy is false //@new_caption New message caption; pass null to copy message without caption. Ignored if replace_caption is false -messageCopyOptions send_copy:Bool replace_caption:Bool new_caption:formattedText = MessageCopyOptions; +//@new_show_caption_above_media True, if new caption must be shown above the animation; otherwise, new caption must be shown below the animation; not supported in secret chats. Ignored if replace_caption is false +messageCopyOptions send_copy:Bool replace_caption:Bool new_caption:formattedText new_show_caption_above_media:Bool = MessageCopyOptions; //@class InputMessageContent @description The content of a message to send //@description A text message -//@text Formatted text to be sent; 0-getOption("message_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, BlockQuote, Code, Pre, PreCode, TextUrl and MentionName entities are allowed to be specified manually +//@text Formatted text to be sent; 0-getOption("message_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, BlockQuote, ExpandableBlockQuote, +//-Code, Pre, PreCode, TextUrl and MentionName entities are allowed to be specified manually //@link_preview_options Options to be used for generation of a link preview; may be null if none; pass null to use default link preview options //@clear_draft True, if a chat message draft must be deleted inputMessageText text:formattedText link_preview_options:linkPreviewOptions clear_draft:Bool = InputMessageContent; @@ -3404,8 +3520,9 @@ inputMessageText text:formattedText link_preview_options:linkPreviewOptions clea //@width Width of the animation; may be replaced by the server //@height Height of the animation; may be replaced by the server //@caption Animation caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters +//@show_caption_above_media True, if caption must be shown above the animation; otherwise, caption must be shown below the animation; not supported in secret chats //@has_spoiler True, if the animation preview must be covered by a spoiler animation; not supported in secret chats -inputMessageAnimation animation:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector duration:int32 width:int32 height:int32 caption:formattedText has_spoiler:Bool = InputMessageContent; +inputMessageAnimation animation:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector duration:int32 width:int32 height:int32 caption:formattedText show_caption_above_media:Bool has_spoiler:Bool = InputMessageContent; //@description An audio message //@audio Audio file to be sent @@ -3430,9 +3547,10 @@ inputMessageDocument document:InputFile thumbnail:inputThumbnail disable_content //@width Photo width //@height Photo height //@caption Photo caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters +//@show_caption_above_media True, if caption must be shown above the photo; otherwise, caption must be shown below the photo; not supported in secret chats //@self_destruct_type Photo self-destruct type; pass null if none; private chats only //@has_spoiler True, if the photo preview must be covered by a spoiler animation; not supported in secret chats -inputMessagePhoto photo:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector width:int32 height:int32 caption:formattedText self_destruct_type:MessageSelfDestructType has_spoiler:Bool = InputMessageContent; +inputMessagePhoto photo:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector width:int32 height:int32 caption:formattedText show_caption_above_media:Bool self_destruct_type:MessageSelfDestructType has_spoiler:Bool = InputMessageContent; //@description A sticker message //@sticker Sticker to be sent @@ -3451,9 +3569,10 @@ inputMessageSticker sticker:InputFile thumbnail:inputThumbnail width:int32 heigh //@height Video height //@supports_streaming True, if the video is supposed to be streamed //@caption Video caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters +//@show_caption_above_media True, if caption must be shown above the video; otherwise, caption must be shown below the video; not supported in secret chats //@self_destruct_type Video self-destruct type; pass null if none; private chats only //@has_spoiler True, if the video preview must be covered by a spoiler animation; not supported in secret chats -inputMessageVideo video:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector duration:int32 width:int32 height:int32 supports_streaming:Bool caption:formattedText self_destruct_type:MessageSelfDestructType has_spoiler:Bool = InputMessageContent; +inputMessageVideo video:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector duration:int32 width:int32 height:int32 supports_streaming:Bool caption:formattedText show_caption_above_media:Bool self_destruct_type:MessageSelfDestructType has_spoiler:Bool = InputMessageContent; //@description A video note message //@video_note Video note to be sent @@ -3499,7 +3618,7 @@ inputMessageGame bot_user_id:int53 game_short_name:string = InputMessageContent; //@photo_width Product photo width //@photo_height Product photo height //@payload The invoice payload -//@provider_token Payment provider token +//@provider_token Payment provider token; may be empty for payments in Telegram Stars //@provider_data JSON-encoded data about the invoice, which will be shared with the payment provider //@start_parameter Unique invoice bot deep link parameter for the generation of this invoice. If empty, it would be possible to pay directly from forwards of the invoice message //@extended_media_content The content of extended media attached to the invoice. The content of the message to be sent. Must be one of the following types: inputMessagePhoto, inputMessageVideo @@ -3713,7 +3832,7 @@ trendingStickerSets total_count:int32 sets:vector is_premium:Boo //@emojis List of emojis for search for emojiCategorySourceSearch emojis:vector = EmojiCategorySource; -//@description The category contains Premium stickers that must be found by getPremiumStickers +//@description The category contains premium stickers that must be found by getPremiumStickers emojiCategorySourcePremium = EmojiCategorySource; @@ -3733,7 +3852,7 @@ emojiCategories categories:vector = EmojiCategories; //@description The category must be used by default (e.g., for custom emoji or animation search) emojiCategoryTypeDefault = EmojiCategoryType; -//@description The category must be used by default for regular sticker selection. It may contain greeting emoji category and Premium stickers +//@description The category must be used by default for regular sticker selection. It may contain greeting emoji category and premium stickers emojiCategoryTypeRegularStickers = EmojiCategoryType; //@description The category must be used for emoji status selection @@ -4095,6 +4214,16 @@ chatBoostSlot slot_id:int32 currently_boosted_chat_id:int53 start_date:int32 exp chatBoostSlots slots:vector = ChatBoostSlots; +//@class ResendCodeReason @description Describes the reason why a code needs to be re-sent + +//@description The user requested to resend the code +resendCodeReasonUserRequest = ResendCodeReason; + +//@description The code is re-sent, because device verification has failed +//@error_message Cause of the verification failure, for example, PLAY_SERVICES_NOT_AVAILABLE, APNS_RECEIVE_TIMEOUT, APNS_INIT_FAILED, etc. +resendCodeReasonVerificationFailed error_message:string = ResendCodeReason; + + //@class CallDiscardReason @description Describes the reason why a call was discarded //@description The call wasn't discarded, or the reason is unknown @@ -4687,7 +4816,7 @@ inlineQueryResultVideo id:string video:video title:string description:string = I inlineQueryResultVoiceNote id:string voice_note:voiceNote title:string = InlineQueryResult; -//@class InlineQueryResultsButtonType @description Represents a type of button in results of inline query +//@class InlineQueryResultsButtonType @description Represents type of button in results of inline query //@description Describes the button that opens a private chat with the bot and sends a start message to the bot with the given parameter @parameter The parameter for the bot start message inlineQueryResultsButtonTypeStartBot parameter:string = InlineQueryResultsButtonType; @@ -5225,6 +5354,12 @@ storePaymentPurposePremiumGiftCodes boosted_chat_id:int53 currency:string amount //@amount Paid amount, in the smallest units of the currency storePaymentPurposePremiumGiveaway parameters:premiumGiveawayParameters currency:string amount:int53 = StorePaymentPurpose; +//@description The user buying Telegram stars +//@currency ISO 4217 currency code of the payment currency +//@amount Paid amount, in the smallest units of the currency +//@star_count Number of bought stars +storePaymentPurposeStars currency:string amount:int53 star_count:int53 = StorePaymentPurpose; + //@class TelegramPaymentPurpose @description Describes a purpose of a payment toward Telegram @@ -5244,6 +5379,12 @@ telegramPaymentPurposePremiumGiftCodes boosted_chat_id:int53 currency:string amo //@month_count Number of months the Telegram Premium subscription will be active for the users telegramPaymentPurposePremiumGiveaway parameters:premiumGiveawayParameters currency:string amount:int53 winner_count:int32 month_count:int32 = TelegramPaymentPurpose; +//@description The user buying Telegram stars +//@currency ISO 4217 currency code of the payment currency +//@amount Paid amount, in the smallest units of the currency +//@star_count Number of bought stars +telegramPaymentPurposeStars currency:string amount:int53 star_count:int53 = TelegramPaymentPurpose; + //@class DeviceToken @description Represents a data needed to subscribe for push notifications through registerDevice method. To use specific push notification service, the correct application platform must be specified and a valid server authentication data must be uploaded at https://my.telegram.org @@ -6115,7 +6256,7 @@ internalLinkTypeProxy server:string port:int32 type:ProxyType = InternalLinkType //@description The link is a link to a chat by its username. Call searchPublicChat with the given chat username to process the link //-If the chat is found, open its profile information screen or the chat itself. -//-If draft text isn't empty and the chat is a private chat, then put the draft text in the input field +//-If draft text isn't empty and the chat is a private chat with a regular user, then put the draft text in the input field //@chat_username Username of the chat //@draft_text Draft text for message to send in the chat internalLinkTypePublicChat chat_username:string draft_text:string = InternalLinkType; @@ -6210,7 +6351,7 @@ chatBoostLink link:string is_public:Bool = ChatBoostLink; chatBoostLinkInfo is_public:Bool chat_id:int53 = ChatBoostLinkInfo; -//@class BlockList @description Describes a type of block list +//@class BlockList @description Describes type of block list //@description The main block list that disallows writing messages to the current user, receiving their status and photo, viewing of stories, and some other actions blockListMain = BlockList; @@ -6786,7 +6927,7 @@ botCommandScopeChatMember chat_id:int53 user_id:int53 = BotCommandScope; //@class PhoneNumberCodeType @description Describes type of the request for which a code is sent to a phone number -//@description Checks ownership of a new phone number to change the user's authentication phone number; for official Android and iOS applications only. +//@description Checks ownership of a new phone number to change the user's authentication phone number; for official Android and iOS applications only phoneNumberCodeTypeChange = PhoneNumberCodeType; //@description Verifies ownership of a phone number to be added to the user's Telegram Passport @@ -6849,6 +6990,12 @@ updateMessageMentionRead chat_id:int53 message_id:int53 unread_mention_count:int //@unread_reaction_count The new number of messages with unread reactions left in the chat updateMessageUnreadReactions chat_id:int53 message_id:int53 unread_reactions:vector unread_reaction_count:int32 = Update; +//@description A fact-check added to a message was changed +//@chat_id Chat identifier +//@message_id Message identifier +//@fact_check The new fact-check +updateMessageFactCheck chat_id:int53 message_id:int53 fact_check:factCheck = Update; + //@description A message with a live location was viewed. When the update is received, the application is supposed to update the live location //@chat_id Identifier of the chat with the live location message //@message_id Identifier of the message with live location @@ -7110,6 +7257,13 @@ updateFileDownload file_id:int32 complete_date:int32 is_paused:Bool counts:downl //@description A file was removed from the file download list. This update is sent only after file download list is loaded for the first time @file_id File identifier @counts New number of being downloaded and recently downloaded files found updateFileRemovedFromDownloads file_id:int32 counts:downloadedFileCounts = Update; +//@description A request can't be completed unless application verification is performed; for official mobile applications only. +//-The method setApplicationVerificationToken must be called once the verification is completed or failed +//@verification_id Unique identifier for the verification process +//@nonce Unique nonce for the classic Play Integrity verification (https://developer.android.com/google/play/integrity/classic) for Android, +//-or a unique string to compare with verify_nonce field from a push notification for iOS +updateApplicationVerificationRequired verification_id:int53 nonce:string = Update; + //@description New call was created or information about a call was updated @call New data about a call updateCall call:call = Update; @@ -7234,6 +7388,11 @@ updateWebAppMessageSent web_app_launch_id:int64 = Update; //@description The list of active emoji reactions has changed @emojis The new list of active emoji reactions updateActiveEmojiReactions emojis:vector = Update; +//@description The list of available message effects has changed +//@reaction_effect_ids The new list of available message effects from emoji reactions +//@sticker_effect_ids The new list of available message effects from Premium stickers +updateAvailableMessageEffects reaction_effect_ids:vector sticker_effect_ids:vector = Update; + //@description The type of default reaction has changed @reaction_type The new type of the default reaction updateDefaultReactionType reaction_type:ReactionType = Update; @@ -7242,8 +7401,13 @@ updateDefaultReactionType reaction_type:ReactionType = Update; //@tags The new tags updateSavedMessagesTags saved_messages_topic_id:int53 tags:savedMessagesTags = Update; +//@description The number of Telegram stars owned by the current user has changed @star_count The new number of Telegram stars owned +updateOwnedStarCount star_count:int53 = Update; + //@description The revenue earned from sponsored messages in a chat has changed. If chat revenue screen is opened, then getChatRevenueTransactions may be called to fetch new transactions -updateChatRevenueAmount = Update; +//@chat_id Identifier of the chat +//@revenue_amount New amount of earned revenue +updateChatRevenueAmount chat_id:int53 revenue_amount:chatRevenueAmount = Update; //@description The parameters of speech recognition without Telegram Premium subscription has changed //@max_media_duration The maximum allowed duration of media for speech recognition without Telegram Premium subscription, in seconds @@ -7476,9 +7640,10 @@ setAuthenticationPhoneNumber phone_number:string settings:phoneNumberAuthenticat //@description Sets the email address of the user and sends an authentication code to the email address. Works only when the current authorization state is authorizationStateWaitEmailAddress @email_address The email address of the user setAuthenticationEmailAddress email_address:string = Ok; -//@description Resends an authentication code to the user. Works only when the current authorization state is authorizationStateWaitCode, the next_code_type of the result is not null and the server-specified timeout has passed, -//-or when the current authorization state is authorizationStateWaitEmailCode -resendAuthenticationCode = Ok; +//@description Resends an authentication code to the user. Works only when the current authorization state is authorizationStateWaitCode, the next_code_type of the result is not null +//-and the server-specified timeout has passed, or when the current authorization state is authorizationStateWaitEmailCode +//@reason Reason of code resending; pass null if unknown +resendAuthenticationCode reason:ResendCodeReason = Ok; //@description Checks the authentication of an email address. Works only when the current authorization state is authorizationStateWaitEmailCode @code Email address authentication to check checkAuthenticationEmailCode code:EmailAddressAuthentication = Ok; @@ -7517,10 +7682,10 @@ checkAuthenticationPasswordRecoveryCode recovery_code:string = Ok; recoverAuthenticationPassword recovery_code:string new_password:string new_hint:string = Ok; //@description Sends Firebase Authentication SMS to the phone number of the user. Works only when the current authorization state is authorizationStateWaitCode and the server returned code of the type authenticationCodeTypeFirebaseAndroid or authenticationCodeTypeFirebaseIos -//@token SafetyNet Attestation API token for the Android application, or secret from push notification for the iOS application +//@token Play Integrity API or SafetyNet Attestation API token for the Android application, or secret from push notification for the iOS application sendAuthenticationFirebaseSms token:string = Ok; -//@description Reports that authentication code wasn't delivered via SMS; for official mobile apps only. Works only when the current authorization state is authorizationStateWaitCode @mobile_network_code Current mobile network code +//@description Reports that authentication code wasn't delivered via SMS; for official mobile applications only. Works only when the current authorization state is authorizationStateWaitCode @mobile_network_code Current mobile network code reportAuthenticationCodeMissing mobile_network_code:string = Ok; //@description Checks the authentication token of a bot; to log in as a bot. Works only when the current authorization state is authorizationStateWaitPhoneNumber. Can be used instead of setAuthenticationPhoneNumber and checkAuthenticationCode to log in @token The bot token @@ -7906,6 +8071,21 @@ searchCallMessages offset:string limit:int32 only_missed:Bool = FoundMessages; //@limit The maximum number of messages to be returned; up to 100 searchOutgoingDocumentMessages query:string limit:int32 = FoundMessages; +//@description Searches for public channel posts with the given hashtag. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit +//@hashtag Hashtag to search for +//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results +//@limit The maximum number of messages to be returned; up to 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit +searchPublicHashtagMessages hashtag:string offset:string limit:int32 = FoundMessages; + +//@description Returns recently searched for hashtags by their prefix @prefix Prefix of hashtags to return @limit The maximum number of hashtags to be returned +getSearchedForHashtags prefix:string limit:int32 = Hashtags; + +//@description Removes a hashtag from the list of recently searched for hashtags @hashtag Hashtag to delete +removeSearchedForHashtag hashtag:string = Ok; + +//@description Clears the list of recently searched for hashtags +clearSearchedForHashtags = Ok; + //@description Deletes all call messages @revoke Pass true to delete the messages for all users deleteAllCallMessages revoke:Bool = Ok; @@ -8041,7 +8221,7 @@ sendMessage chat_id:int53 message_thread_id:int53 reply_to:InputMessageReplyTo o //@message_thread_id If not 0, the message thread identifier in which the messages will be sent //@reply_to Information about the message or story to be replied; pass null if none //@options Options to be used to send the messages; pass null to use default options -//@input_message_contents Contents of messages to be sent. At most 10 messages can be added to an album +//@input_message_contents Contents of messages to be sent. At most 10 messages can be added to an album. All messages must have the same value of show_caption_above_media sendMessageAlbum chat_id:int53 message_thread_id:int53 reply_to:InputMessageReplyTo options:messageSendOptions input_message_contents:vector = Messages; //@description Invites a bot to a chat (if it is not yet a member) and sends it the /start command; requires can_invite_users member right. Bots can't be invited to a private chat other than the chat with the bot. @@ -8109,14 +8289,16 @@ deleteChatMessagesBySender chat_id:int53 sender_id:MessageSender = Ok; deleteChatMessagesByDate chat_id:int53 min_date:int32 max_date:int32 revoke:Bool = Ok; -//@description Edits the text of a message (or a text of a game message). Returns the edited message after the edit is completed on the server side +//@description Edits the text of a message (or a text of a game message). Returns the edited message after the edit is completed on the server side. +//-Can be used only if message.can_be_edited == true //@chat_id The chat the message belongs to //@message_id Identifier of the message //@reply_markup The new message reply markup; pass null if none; for bots only //@input_message_content New text content of the message. Must be of type inputMessageText editMessageText chat_id:int53 message_id:int53 reply_markup:ReplyMarkup input_message_content:InputMessageContent = Message; -//@description Edits the message content of a live location. Messages can be edited for a limited period of time specified in the live location. Returns the edited message after the edit is completed on the server side +//@description Edits the message content of a live location. Messages can be edited for a limited period of time specified in the live location. +//-Returns the edited message after the edit is completed on the server side. Can be used only if message.can_be_edited == true //@chat_id The chat the message belongs to //@message_id Identifier of the message //@reply_markup The new message reply markup; pass null if none; for bots only @@ -8128,21 +8310,25 @@ editMessageText chat_id:int53 message_id:int53 reply_markup:ReplyMarkup input_me editMessageLiveLocation chat_id:int53 message_id:int53 reply_markup:ReplyMarkup location:location live_period:int32 heading:int32 proximity_alert_radius:int32 = Message; //@description Edits the content of a message with an animation, an audio, a document, a photo or a video, including message caption. If only the caption needs to be edited, use editMessageCaption instead. -//-The media can't be edited if the message was set to self-destruct or to a self-destructing media. The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa. Returns the edited message after the edit is completed on the server side +//-The media can't be edited if the message was set to self-destruct or to a self-destructing media. The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa. +//-Returns the edited message after the edit is completed on the server side. Can be used only if message.can_be_edited == true //@chat_id The chat the message belongs to //@message_id Identifier of the message //@reply_markup The new message reply markup; pass null if none; for bots only //@input_message_content New content of the message. Must be one of the following types: inputMessageAnimation, inputMessageAudio, inputMessageDocument, inputMessagePhoto or inputMessageVideo editMessageMedia chat_id:int53 message_id:int53 reply_markup:ReplyMarkup input_message_content:InputMessageContent = Message; -//@description Edits the message content caption. Returns the edited message after the edit is completed on the server side +//@description Edits the message content caption. Returns the edited message after the edit is completed on the server side. +//-Can be used only if message.can_be_edited == true //@chat_id The chat the message belongs to //@message_id Identifier of the message //@reply_markup The new message reply markup; pass null if none; for bots only //@caption New message content caption; 0-getOption("message_caption_length_max") characters; pass null to remove caption -editMessageCaption chat_id:int53 message_id:int53 reply_markup:ReplyMarkup caption:formattedText = Message; +//@show_caption_above_media Pass true to show the caption above the media; otherwise, caption will be shown below the media. Can be true only for animation, photo, and video messages +editMessageCaption chat_id:int53 message_id:int53 reply_markup:ReplyMarkup caption:formattedText show_caption_above_media:Bool = Message; -//@description Edits the message reply markup; for bots only. Returns the edited message after the edit is completed on the server side +//@description Edits the message reply markup; for bots only. Returns the edited message after the edit is completed on the server side. +//-Can be used only if message.can_be_edited == true //@chat_id The chat the message belongs to //@message_id Identifier of the message //@reply_markup The new message reply markup; pass null if none @@ -8174,7 +8360,8 @@ editInlineMessageMedia inline_message_id:string reply_markup:ReplyMarkup input_m //@inline_message_id Inline message identifier //@reply_markup The new message reply markup; pass null if none //@caption New message content caption; pass null to remove caption; 0-getOption("message_caption_length_max") characters -editInlineMessageCaption inline_message_id:string reply_markup:ReplyMarkup caption:formattedText = Ok; +//@show_caption_above_media Pass true to show the caption above the media; otherwise, caption will be shown below the media. Can be true only for animation, photo, and video messages +editInlineMessageCaption inline_message_id:string reply_markup:ReplyMarkup caption:formattedText show_caption_above_media:Bool = Ok; //@description Edits the reply markup of an inline message sent via a bot; for bots only //@inline_message_id Inline message identifier @@ -8187,6 +8374,12 @@ editInlineMessageReplyMarkup inline_message_id:string reply_markup:ReplyMarkup = //@scheduling_state The new message scheduling state; pass null to send the message immediately editMessageSchedulingState chat_id:int53 message_id:int53 scheduling_state:MessageSchedulingState = Ok; +//@description Changes the fact-check of a message. Can be only used if getOption("can_edit_fact_check") == true +//@chat_id The channel chat the message belongs to +//@message_id Identifier of the message +//@text New text of the fact-check; 0-getOption("fact_check_length_max") characters; pass null to remove it. Only Bold, Italic, and TextUrl entities with https://t.me/ links are supported +setMessageFactCheck chat_id:int53 message_id:int53 text:formattedText = Ok; + //@description Sends a message on behalf of a business account; for bots only. Returns the message after it was sent //@business_connection_id Unique identifier of business connection on behalf of which to send the request @@ -8194,9 +8387,10 @@ editMessageSchedulingState chat_id:int53 message_id:int53 scheduling_state:Messa //@reply_to Information about the message to be replied; pass null if none //@disable_notification Pass true to disable notification for the message //@protect_content Pass true if the content of the message must be protected from forwarding and saving +//@effect_id Identifier of the effect to apply to the message //@reply_markup Markup for replying to the message; pass null if none //@input_message_content The content of the message to be sent -sendBusinessMessage business_connection_id:string chat_id:int53 reply_to:InputMessageReplyTo disable_notification:Bool protect_content:Bool reply_markup:ReplyMarkup input_message_content:InputMessageContent = BusinessMessage; +sendBusinessMessage business_connection_id:string chat_id:int53 reply_to:InputMessageReplyTo disable_notification:Bool protect_content:Bool effect_id:int64 reply_markup:ReplyMarkup input_message_content:InputMessageContent = BusinessMessage; //@description Sends 2-10 messages grouped together into an album on behalf of a business account; for bots only. Currently, only audio, document, photo and video messages can be grouped into an album. //-Documents and audio files can be only grouped in an album with messages of the same type. Returns sent messages @@ -8205,8 +8399,9 @@ sendBusinessMessage business_connection_id:string chat_id:int53 reply_to:InputMe //@reply_to Information about the message to be replied; pass null if none //@disable_notification Pass true to disable notification for the message //@protect_content Pass true if the content of the message must be protected from forwarding and saving -//@input_message_contents Contents of messages to be sent. At most 10 messages can be added to an album -sendBusinessMessageAlbum business_connection_id:string chat_id:int53 reply_to:InputMessageReplyTo disable_notification:Bool protect_content:Bool input_message_contents:vector = BusinessMessages; +//@effect_id Identifier of the effect to apply to the message +//@input_message_contents Contents of messages to be sent. At most 10 messages can be added to an album. All messages must have the same value of show_caption_above_media +sendBusinessMessageAlbum business_connection_id:string chat_id:int53 reply_to:InputMessageReplyTo disable_notification:Bool protect_content:Bool effect_id:int64 input_message_contents:vector = BusinessMessages; //@description Checks validness of a name for a quick reply shortcut. Can be called synchronously @name The name of the shortcut; 1-32 characters @@ -8253,7 +8448,7 @@ addQuickReplyShortcutInlineQueryResultMessage shortcut_name:string reply_to_mess //-Documents and audio files can be only grouped in an album with messages of the same type. Returns sent messages //@shortcut_name Name of the target shortcut //@reply_to_message_id Identifier of a quick reply message in the same shortcut to be replied; pass 0 if none -//@input_message_contents Contents of messages to be sent. At most 10 messages can be added to an album +//@input_message_contents Contents of messages to be sent. At most 10 messages can be added to an album. All messages must have the same value of show_caption_above_media addQuickReplyShortcutMessageAlbum shortcut_name:string reply_to_message_id:int53 input_message_contents:vector = QuickReplyMessages; //@description Readds quick reply messages which failed to add. Can be called only for messages for which messageSendingStateFailed.can_retry is true and after specified in messageSendingStateFailed.retry_after time passed. @@ -8388,6 +8583,9 @@ getSavedMessagesTags saved_messages_topic_id:int53 = SavedMessagesTags; //@description Changes label of a Saved Messages tag; for Telegram Premium users only @tag The tag which label will be changed @label New label for the tag; 0-12 characters setSavedMessagesTagLabel tag:ReactionType label:string = Ok; +//@description Returns information about a message effect. Returns a 404 error if the effect is not found @effect_id Unique identifier of the effect +getMessageEffect effect_id:int64 = MessageEffect; + //@description Searches for a given quote in a text. Returns found quote start position in UTF-16 code units. Returns a 404 error if the quote is not found. Can be called synchronously //@text Text in which to search for the quote @@ -8398,7 +8596,10 @@ searchQuote text:formattedText quote:formattedText quote_position:int32 = FoundP //@description Returns all entities (mentions, hashtags, cashtags, bot commands, bank card numbers, URLs, and email addresses) found in the text. Can be called synchronously @text The text in which to look for entities getTextEntities text:string = TextEntities; -//@description Parses Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, BlockQuote, Code, Pre, PreCode, TextUrl and MentionName entities from a marked-up text. Can be called synchronously @text The text to parse @parse_mode Text parse mode +//@description Parses Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, BlockQuote, ExpandableBlockQuote, Code, Pre, PreCode, TextUrl +//-and MentionName entities from a marked-up text. Can be called synchronously +//@text The text to parse +//@parse_mode Text parse mode parseTextEntities text:string parse_mode:TextParseMode = FormattedText; //@description Parses Markdown entities in a human-friendly format, ignoring markup errors. Can be called synchronously @@ -9329,6 +9530,13 @@ removeAllFilesFromDownloads only_active:Bool only_completed:Bool delete_from_cac searchFileDownloads query:string only_active:Bool only_completed:Bool offset:string limit:int32 = FoundFileDownloads; +//@description Application verification has been completed. Can be called before authorization +//@verification_id Unique identifier for the verification process as received from updateApplicationVerificationRequired +//@token Play Integrity API token for the Android application, or secret from push notification for the iOS application; +//-pass an empty string to abort verification and receive error VERIFICATION_FAILED for the request +setApplicationVerificationToken verification_id:int53 token:string = Ok; + + //@description Returns information about a file with messages exported from another application @message_file_head Beginning of the message file; up to 100 first lines getMessageFileType message_file_head:string = MessageFileType; @@ -9655,8 +9863,10 @@ setUserPersonalProfilePhoto user_id:int53 photo:InputChatPhoto = Ok; suggestUserProfilePhoto user_id:int53 photo:InputChatPhoto = Ok; -//@description Searches a user by their phone number. Returns a 404 error if the user can't be found @phone_number Phone number to search for -searchUserByPhoneNumber phone_number:string = User; +//@description Searches a user by their phone number. Returns a 404 error if the user can't be found +//@phone_number Phone number to search for +//@only_local Pass true to get only locally available information without sending network requests +searchUserByPhoneNumber phone_number:string only_local:Bool = User; //@description Shares the phone number of the current user with a mutual contact. Supposed to be called when the user clicks on chatActionBarSharePhoneNumber @user_id Identifier of the user with whom to share the phone number. The user must be a mutual contact sharePhoneNumber user_id:int53 = Ok; @@ -9904,14 +10114,15 @@ setBusinessStartPage start_page:inputBusinessStartPage = Ok; sendPhoneNumberCode phone_number:string settings:phoneNumberAuthenticationSettings type:PhoneNumberCodeType = AuthenticationCodeInfo; //@description Sends Firebase Authentication SMS to the specified phone number. Works only when received a code of the type authenticationCodeTypeFirebaseAndroid or authenticationCodeTypeFirebaseIos -//@token SafetyNet Attestation API token for the Android application, or secret from push notification for the iOS application +//@token Play Integrity API or SafetyNet Attestation API token for the Android application, or secret from push notification for the iOS application sendPhoneNumberFirebaseSms token:string = Ok; -//@description Reports that authentication code wasn't delivered via SMS to the specified phone number; for official mobile apps only @mobile_network_code Current mobile network code +//@description Reports that authentication code wasn't delivered via SMS to the specified phone number; for official mobile applications only @mobile_network_code Current mobile network code reportPhoneNumberCodeMissing mobile_network_code:string = Ok; //@description Resends the authentication code sent to a phone number. Works only if the previously received authenticationCodeInfo next_code_type was not null and the server-specified timeout has passed -resendPhoneNumberCode = AuthenticationCodeInfo; +//@reason Reason of code resending; pass null if unknown +resendPhoneNumberCode reason:ResendCodeReason = AuthenticationCodeInfo; //@description Check the authentication code and completes the request for which the code was sent if appropriate @code Authentication code to check checkPhoneNumberCode code:string = Ok; @@ -10117,10 +10328,14 @@ setSupergroupUnrestrictBoostCount supergroup_id:int53 unrestrict_boost_count:int //@description Toggles whether sender signature is added to sent messages in a channel; requires can_change_info member right @supergroup_id Identifier of the channel @sign_messages New value of sign_messages toggleSupergroupSignMessages supergroup_id:int53 sign_messages:Bool = Ok; -//@description Toggles whether joining is mandatory to send messages to a discussion supergroup; requires can_restrict_members administrator right @supergroup_id Identifier of the supergroup @join_to_send_messages New value of join_to_send_messages +//@description Toggles whether joining is mandatory to send messages to a discussion supergroup; requires can_restrict_members administrator right +//@supergroup_id Identifier of the supergroup that isn't a broadcast group +//@join_to_send_messages New value of join_to_send_messages toggleSupergroupJoinToSendMessages supergroup_id:int53 join_to_send_messages:Bool = Ok; -//@description Toggles whether all users directly joining the supergroup need to be approved by supergroup administrators; requires can_restrict_members administrator right @supergroup_id Identifier of the channel @join_by_request New value of join_by_request +//@description Toggles whether all users directly joining the supergroup need to be approved by supergroup administrators; requires can_restrict_members administrator right +//@supergroup_id Identifier of the supergroup that isn't a broadcast group +//@join_by_request New value of join_by_request toggleSupergroupJoinByRequest supergroup_id:int53 join_by_request:Bool = Ok; //@description Toggles whether the message history of a supergroup is available to new members; requires can_change_info member right @supergroup_id The identifier of the supergroup @is_all_history_available The new value of is_all_history_available @@ -10197,7 +10412,7 @@ validateOrderInfo input_invoice:InputInvoice order_info:orderInfo allow_save:Boo //@payment_form_id Payment form identifier returned by getPaymentForm //@order_info_id Identifier returned by validateOrderInfo, or an empty string //@shipping_option_id Identifier of a chosen shipping option, if applicable -//@credentials The credentials chosen by user for payment +//@credentials The credentials chosen by user for payment; pass null for a payment in Telegram stars //@tip_amount Chosen by the user amount of tip in the smallest units of the currency sendPaymentForm input_invoice:InputInvoice payment_form_id:int64 order_info_id:string shipping_option_id:string credentials:InputCredentials tip_amount:int53 = PaymentResult; @@ -10217,6 +10432,11 @@ deleteSavedCredentials = Ok; //@description Creates a link for the given invoice; for bots only @invoice Information about the invoice of the type inputMessageInvoice createInvoiceLink invoice:InputMessageContent = HttpUrl; +//@description Refunds a previously done payment in Telegram Stars +//@user_id Identifier of the user that did the payment +//@telegram_payment_charge_id Telegram payment identifier +refundStarPayment user_id:int53 telegram_payment_charge_id:string = Ok; + //@description Returns a user that can be contacted to get support getSupportUser = User; @@ -10655,8 +10875,16 @@ launchPrepaidPremiumGiveaway giveaway_id:int64 parameters:premiumGiveawayParamet //@message_id Identifier of the giveaway or a giveaway winners message in the chat getPremiumGiveawayInfo chat_id:int53 message_id:int53 = PremiumGiveawayInfo; -//@description Checks whether Telegram Premium purchase is possible. Must be called before in-store Premium purchase @purpose Transaction purpose -canPurchasePremium purpose:StorePaymentPurpose = Ok; +//@description Returns available options for Telegram stars purchase +getStarPaymentOptions = StarPaymentOptions; + +//@description Returns the list of Telegram star transactions for the current user +//@offset Offset of the first transaction to return as received from the previous request; use empty string to get the first chunk of results +//@direction Direction of the transactions to receive; pass null to get all transactions +getStarTransactions offset:string direction:StarTransactionDirection = StarTransactions; + +//@description Checks whether an in-store purchase is possible. Must be called before any in-store purchase @purpose Transaction purpose +canPurchaseFromStore purpose:StorePaymentPurpose = Ok; //@description Informs server about a purchase through App Store. For official applications only @receipt App Store receipt @purpose Transaction purpose assignAppStoreTransaction receipt:bytes purpose:StorePaymentPurpose = Ok; From b75bf70673d81847fd6bd4cb75ade41b3dce85ef Mon Sep 17 00:00:00 2001 From: c0re100 Date: Mon, 3 Jun 2024 02:28:25 +0800 Subject: [PATCH 19/54] Fix LDFLAGS --- client/tdlib.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/tdlib.go b/client/tdlib.go index 9e4fd63..adf0a0d 100644 --- a/client/tdlib.go +++ b/client/tdlib.go @@ -3,8 +3,8 @@ package client //#cgo linux CFLAGS: -I/usr/local/include //#cgo darwin CFLAGS: -I/usr/local/include //#cgo windows CFLAGS: -IE:/src/tdlib -IE:/src/tdlib/build -//#cgo linux LDFLAGS: -L/usr/local/lib -ltdjson_static -ltdjson_private -ltdclient -ltdcore -ltdapi -ltdactor -ltddb -ltdsqlite -ltdnet -ltdutils -lstdc++ -lssl -lcrypto -ldl -lz -lm -//#cgo darwin LDFLAGS: -L/usr/local/lib -L/usr/local/opt/openssl/lib -ltdjson_static -ltdjson_private -ltdclient -ltdcore -ltdapi -ltdactor -ltddb -ltdsqlite -ltdnet -ltdutils -lstdc++ -lssl -lcrypto -ldl -lz -lm +//#cgo linux LDFLAGS: -L/usr/local/lib -ltdjson_static -ltdjson_private -ltdclient -ltdcore -ltdapi -ltdactor -ltddb -ltdsqlite -ltdmtproto -ltdnet -ltdutils -lstdc++ -lssl -lcrypto -ldl -lz -lm +//#cgo darwin LDFLAGS: -L/usr/local/lib -L/usr/local/opt/openssl/lib -ltdjson_static -ltdjson_private -ltdclient -ltdcore -ltdapi -ltdactor -ltddb -ltdsqlite -ltdmtproto -ltdnet -ltdutils -lstdc++ -lssl -lcrypto -ldl -lz -lm //#cgo windows LDFLAGS: -LE:/src/tdlib/build/Release -ltdjson //#include //#include From fefab36108c5eb73c6947b8c4166f353f6466e8c Mon Sep 17 00:00:00 2001 From: c0re100 Date: Wed, 19 Jun 2024 14:42:06 +0800 Subject: [PATCH 20/54] Update to TDLib 1.8.31 --- client/function.go | 485 +++++++++++++++++++-- client/type.go | 649 +++++++++++++++++++++++------ client/unmarshaler.go | 252 ++++++++--- data/td_api.tl | 261 +++++++++--- example/bot/Bot.go | 1 - example/command/ReplyCommand.go | 2 - example/event/CustomEventFilter.go | 28 +- example/media/Photo_or_Album.go | 2 - example/pending/PendingUpdate.go | 1 - 9 files changed, 1378 insertions(+), 303 deletions(-) diff --git a/client/function.go b/client/function.go index 7f73bb1..8ccd60b 100755 --- a/client/function.go +++ b/client/function.go @@ -2877,23 +2877,23 @@ func (client *Client) SearchOutgoingDocumentMessages(req *SearchOutgoingDocument return UnmarshalFoundMessages(result.Data) } -type SearchPublicHashtagMessagesRequest struct { - // Hashtag to search for - Hashtag string `json:"hashtag"` +type SearchPublicMessagesByTagRequest struct { + // Hashtag or cashtag to search for + Tag string `json:"tag"` // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results Offset string `json:"offset"` // The maximum number of messages to be returned; up to 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit Limit int32 `json:"limit"` } -// Searches for public channel posts with the given hashtag. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit -func (client *Client) SearchPublicHashtagMessages(req *SearchPublicHashtagMessagesRequest) (*FoundMessages, error) { +// Searches for public channel posts containing the given hashtag or cashtag. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit +func (client *Client) SearchPublicMessagesByTag(req *SearchPublicMessagesByTagRequest) (*FoundMessages, error) { result, err := client.Send(Request{ meta: meta{ - Type: "searchPublicHashtagMessages", + Type: "searchPublicMessagesByTag", }, Data: map[string]interface{}{ - "hashtag": req.Hashtag, + "tag": req.Tag, "offset": req.Offset, "limit": req.Limit, }, @@ -2909,21 +2909,120 @@ func (client *Client) SearchPublicHashtagMessages(req *SearchPublicHashtagMessag return UnmarshalFoundMessages(result.Data) } -type GetSearchedForHashtagsRequest struct { - // Prefix of hashtags to return - Prefix string `json:"prefix"` - // The maximum number of hashtags to be returned +type SearchPublicStoriesByTagRequest struct { + // Hashtag or cashtag to search for + Tag string `json:"tag"` + // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results + Offset string `json:"offset"` + // The maximum number of stories to be returned; up to 100. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit Limit int32 `json:"limit"` } -// Returns recently searched for hashtags by their prefix -func (client *Client) GetSearchedForHashtags(req *GetSearchedForHashtagsRequest) (*Hashtags, error) { +// Searches for public stories containing the given hashtag or cashtag. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit +func (client *Client) SearchPublicStoriesByTag(req *SearchPublicStoriesByTagRequest) (*FoundStories, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getSearchedForHashtags", + Type: "searchPublicStoriesByTag", }, Data: map[string]interface{}{ - "prefix": req.Prefix, + "tag": req.Tag, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFoundStories(result.Data) +} + +type SearchPublicStoriesByLocationRequest struct { + // Address of the location + Address *LocationAddress `json:"address"` + // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results + Offset string `json:"offset"` + // The maximum number of stories to be returned; up to 100. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit + Limit int32 `json:"limit"` +} + +// Searches for public stories by the given address location. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit +func (client *Client) SearchPublicStoriesByLocation(req *SearchPublicStoriesByLocationRequest) (*FoundStories, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchPublicStoriesByLocation", + }, + Data: map[string]interface{}{ + "address": req.Address, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFoundStories(result.Data) +} + +type SearchPublicStoriesByVenueRequest struct { + // Provider of the venue + VenueProvider string `json:"venue_provider"` + // Identifier of the venue in the provider database + VenueId string `json:"venue_id"` + // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results + Offset string `json:"offset"` + // The maximum number of stories to be returned; up to 100. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit + Limit int32 `json:"limit"` +} + +// Searches for public stories from the given venue. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit +func (client *Client) SearchPublicStoriesByVenue(req *SearchPublicStoriesByVenueRequest) (*FoundStories, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchPublicStoriesByVenue", + }, + Data: map[string]interface{}{ + "venue_provider": req.VenueProvider, + "venue_id": req.VenueId, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFoundStories(result.Data) +} + +type GetSearchedForTagsRequest struct { + // Prefix of hashtags or cashtags to return + TagPrefix string `json:"tag_prefix"` + // The maximum number of items to be returned + Limit int32 `json:"limit"` +} + +// Returns recently searched for hashtags or cashtags by their prefix +func (client *Client) GetSearchedForTags(req *GetSearchedForTagsRequest) (*Hashtags, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getSearchedForTags", + }, + Data: map[string]interface{}{ + "tag_prefix": req.TagPrefix, "limit": req.Limit, }, }) @@ -2938,19 +3037,19 @@ func (client *Client) GetSearchedForHashtags(req *GetSearchedForHashtagsRequest) return UnmarshalHashtags(result.Data) } -type RemoveSearchedForHashtagRequest struct { - // Hashtag to delete - Hashtag string `json:"hashtag"` +type RemoveSearchedForTagRequest struct { + // Hashtag or cashtag to delete + Tag string `json:"tag"` } -// Removes a hashtag from the list of recently searched for hashtags -func (client *Client) RemoveSearchedForHashtag(req *RemoveSearchedForHashtagRequest) (*Ok, error) { +// Removes a hashtag or a cashtag from the list of recently searched for hashtags or cashtags +func (client *Client) RemoveSearchedForTag(req *RemoveSearchedForTagRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "removeSearchedForHashtag", + Type: "removeSearchedForTag", }, Data: map[string]interface{}{ - "hashtag": req.Hashtag, + "tag": req.Tag, }, }) if err != nil { @@ -2964,13 +3063,20 @@ func (client *Client) RemoveSearchedForHashtag(req *RemoveSearchedForHashtagRequ return UnmarshalOk(result.Data) } -// Clears the list of recently searched for hashtags -func (client *Client) ClearSearchedForHashtags() (*Ok, error) { +type ClearSearchedForTagsRequest struct { + // Pass true to clear the list of recently searched for cashtags; otherwise, the list of recently searched for hashtags will be cleared + ClearCashtags bool `json:"clear_cashtags"` +} + +// Clears the list of recently searched for hashtags or cashtags +func (client *Client) ClearSearchedForTags(req *ClearSearchedForTagsRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "clearSearchedForHashtags", + Type: "clearSearchedForTags", + }, + Data: map[string]interface{}{ + "clear_cashtags": req.ClearCashtags, }, - Data: map[string]interface{}{}, }) if err != nil { return nil, err @@ -4505,7 +4611,7 @@ func (client *Client) EditMessageSchedulingState(req *EditMessageSchedulingState type SetMessageFactCheckRequest struct { // The channel chat the message belongs to ChatId int64 `json:"chat_id"` - // Identifier of the message + // Identifier of the message. The message must be one of the following types: messageAnimation, messageAudio, messageDocument, messagePhoto, messageText, messageVideo MessageId int64 `json:"message_id"` // New text of the fact-check; 0-getOption("fact_check_length_max") characters; pass null to remove it. Only Bold, Italic, and TextUrl entities with https://t.me/ links are supported Text *FormattedText `json:"text"` @@ -4625,6 +4731,240 @@ func (client *Client) SendBusinessMessageAlbum(req *SendBusinessMessageAlbumRequ return UnmarshalBusinessMessages(result.Data) } +type EditBusinessMessageTextRequest struct { + // Unique identifier of business connection on behalf of which the message was sent + BusinessConnectionId string `json:"business_connection_id"` + // The chat the message belongs to + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` + // The new message reply markup; pass null if none + ReplyMarkup ReplyMarkup `json:"reply_markup"` + // New text content of the message. Must be of type inputMessageText + InputMessageContent InputMessageContent `json:"input_message_content"` +} + +// Edits the text of a text or game message sent on behalf of a business account; for bots only +func (client *Client) EditBusinessMessageText(req *EditBusinessMessageTextRequest) (*BusinessMessage, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editBusinessMessageText", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "chat_id": req.ChatId, + "message_id": req.MessageId, + "reply_markup": req.ReplyMarkup, + "input_message_content": req.InputMessageContent, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBusinessMessage(result.Data) +} + +type EditBusinessMessageLiveLocationRequest struct { + // Unique identifier of business connection on behalf of which the message was sent + BusinessConnectionId string `json:"business_connection_id"` + // The chat the message belongs to + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` + // The new message reply markup; pass null if none + ReplyMarkup ReplyMarkup `json:"reply_markup"` + // New location content of the message; pass null to stop sharing the live location + Location *Location `json:"location"` + // New time relative to the message send date, for which the location can be updated, in seconds. If 0x7FFFFFFF specified, then the location can be updated forever. Otherwise, must not exceed the current live_period by more than a day, and the live location expiration date must remain in the next 90 days. Pass 0 to keep the current live_period + LivePeriod int32 `json:"live_period"` + // The new direction in which the location moves, in degrees; 1-360. Pass 0 if unknown + Heading int32 `json:"heading"` + // The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled + ProximityAlertRadius int32 `json:"proximity_alert_radius"` +} + +// Edits the content of a live location in a message sent on behalf of a business account; for bots only +func (client *Client) EditBusinessMessageLiveLocation(req *EditBusinessMessageLiveLocationRequest) (*BusinessMessage, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editBusinessMessageLiveLocation", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "chat_id": req.ChatId, + "message_id": req.MessageId, + "reply_markup": req.ReplyMarkup, + "location": req.Location, + "live_period": req.LivePeriod, + "heading": req.Heading, + "proximity_alert_radius": req.ProximityAlertRadius, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBusinessMessage(result.Data) +} + +type EditBusinessMessageMediaRequest struct { + // Unique identifier of business connection on behalf of which the message was sent + BusinessConnectionId string `json:"business_connection_id"` + // The chat the message belongs to + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` + // The new message reply markup; pass null if none; for bots only + ReplyMarkup ReplyMarkup `json:"reply_markup"` + // New content of the message. Must be one of the following types: inputMessageAnimation, inputMessageAudio, inputMessageDocument, inputMessagePhoto or inputMessageVideo + InputMessageContent InputMessageContent `json:"input_message_content"` +} + +// Edits the content of a message with an animation, an audio, a document, a photo or a video in a message sent on behalf of a business account; for bots only +func (client *Client) EditBusinessMessageMedia(req *EditBusinessMessageMediaRequest) (*BusinessMessage, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editBusinessMessageMedia", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "chat_id": req.ChatId, + "message_id": req.MessageId, + "reply_markup": req.ReplyMarkup, + "input_message_content": req.InputMessageContent, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBusinessMessage(result.Data) +} + +type EditBusinessMessageCaptionRequest struct { + // Unique identifier of business connection on behalf of which the message was sent + BusinessConnectionId string `json:"business_connection_id"` + // The chat the message belongs to + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` + // The new message reply markup; pass null if none + ReplyMarkup ReplyMarkup `json:"reply_markup"` + // New message content caption; pass null to remove caption; 0-getOption("message_caption_length_max") characters + Caption *FormattedText `json:"caption"` + // Pass true to show the caption above the media; otherwise, caption will be shown below the media. Can be true only for animation, photo, and video messages + ShowCaptionAboveMedia bool `json:"show_caption_above_media"` +} + +// Edits the caption of a message sent on behalf of a business account; for bots only +func (client *Client) EditBusinessMessageCaption(req *EditBusinessMessageCaptionRequest) (*BusinessMessage, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editBusinessMessageCaption", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "chat_id": req.ChatId, + "message_id": req.MessageId, + "reply_markup": req.ReplyMarkup, + "caption": req.Caption, + "show_caption_above_media": req.ShowCaptionAboveMedia, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBusinessMessage(result.Data) +} + +type EditBusinessMessageReplyMarkupRequest struct { + // Unique identifier of business connection on behalf of which the message was sent + BusinessConnectionId string `json:"business_connection_id"` + // The chat the message belongs to + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` + // The new message reply markup; pass null if none + ReplyMarkup ReplyMarkup `json:"reply_markup"` +} + +// Edits the reply markup of a message sent on behalf of a business account; for bots only +func (client *Client) EditBusinessMessageReplyMarkup(req *EditBusinessMessageReplyMarkupRequest) (*BusinessMessage, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editBusinessMessageReplyMarkup", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "chat_id": req.ChatId, + "message_id": req.MessageId, + "reply_markup": req.ReplyMarkup, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBusinessMessage(result.Data) +} + +type StopBusinessPollRequest struct { + // Unique identifier of business connection on behalf of which the message with the poll was sent + BusinessConnectionId string `json:"business_connection_id"` + // The chat the message belongs to + ChatId int64 `json:"chat_id"` + // Identifier of the message containing the poll + MessageId int64 `json:"message_id"` + // The new message reply markup; pass null if none + ReplyMarkup ReplyMarkup `json:"reply_markup"` +} + +// Stops a poll sent on behalf of a business account; for bots only +func (client *Client) StopBusinessPoll(req *StopBusinessPollRequest) (*BusinessMessage, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "stopBusinessPoll", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "chat_id": req.ChatId, + "message_id": req.MessageId, + "reply_markup": req.ReplyMarkup, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBusinessMessage(result.Data) +} + type CheckQuickReplyShortcutNameRequest struct { // The name of the shortcut; 1-32 characters Name string `json:"name"` @@ -4974,7 +5314,7 @@ func (client *Client) EditQuickReplyMessage(req *EditQuickReplyMessageRequest) ( return UnmarshalOk(result.Data) } -// Returns the list of custom emojis, which can be used as forum topic icon by all users +// Returns the list of custom emoji, which can be used as forum topic icon by all users func (client *Client) GetForumTopicDefaultIcons() (*Stickers, error) { result, err := client.Send(Request{ meta: meta{ @@ -13891,7 +14231,7 @@ func (client *Client) GetUserProfilePhotos(req *GetUserProfilePhotosRequest) (*C type GetStickersRequest struct { // Type of the stickers to return StickerType StickerType `json:"sticker_type"` - // Search query; a space-separated list of emoji or a keyword prefix. If empty, returns all known installed stickers + // Search query; a space-separated list of emojis or a keyword prefix. If empty, returns all known installed stickers Query string `json:"query"` // The maximum number of stickers to be returned Limit int32 `json:"limit"` @@ -13961,7 +14301,7 @@ func (client *Client) GetAllStickerEmojis(req *GetAllStickerEmojisRequest) (*Emo type SearchStickersRequest struct { // Type of the stickers to return StickerType StickerType `json:"sticker_type"` - // Space-separated list of emoji to search for; must be non-empty + // Space-separated list of emojis to search for; must be non-empty Emojis string `json:"emojis"` // The maximum number of stickers to be returned; 0-100 Limit int32 `json:"limit"` @@ -14621,7 +14961,7 @@ type GetEmojiCategoriesRequest struct { Type EmojiCategoryType `json:"type"` } -// Returns available emojis categories +// Returns available emoji categories func (client *Client) GetEmojiCategories(req *GetEmojiCategoriesRequest) (*EmojiCategories, error) { result, err := client.Send(Request{ meta: meta{ @@ -18753,6 +19093,67 @@ func (client *Client) GetChatRevenueTransactions(req *GetChatRevenueTransactions return UnmarshalChatRevenueTransactions(result.Data) } +type GetStarRevenueStatisticsRequest struct { + // Identifier of the owner of the Telegram stars; can be identifier of an owned bot, or identifier of a channel chat with supergroupFullInfo.can_get_revenue_statistics == true + OwnerId MessageSender `json:"owner_id"` + // Pass true if a dark theme is used by the application + IsDark bool `json:"is_dark"` +} + +// Returns detailed Telegram star revenue statistics +func (client *Client) GetStarRevenueStatistics(req *GetStarRevenueStatisticsRequest) (*StarRevenueStatistics, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getStarRevenueStatistics", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "is_dark": req.IsDark, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStarRevenueStatistics(result.Data) +} + +type GetStarWithdrawalUrlRequest struct { + // Identifier of the owner of the Telegram stars; can be identifier of an owned bot, or identifier of a channel chat with supergroupFullInfo.can_get_revenue_statistics == true + OwnerId MessageSender `json:"owner_id"` + // The number of Telegram stars to withdraw. Must be at least getOption("star_withdrawal_count_min") + StarCount int64 `json:"star_count"` + // The 2-step verification password of the current user + Password string `json:"password"` +} + +// Returns URL for Telegram star withdrawal +func (client *Client) GetStarWithdrawalUrl(req *GetStarWithdrawalUrlRequest) (*HttpUrl, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getStarWithdrawalUrl", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "star_count": req.StarCount, + "password": req.Password, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalHttpUrl(result.Data) +} + type GetChatStatisticsRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -20116,7 +20517,7 @@ type SetStickerEmojisRequest struct { Emojis string `json:"emojis"` } -// Changes the list of emoji corresponding to a sticker. The sticker must belong to a regular or custom emoji sticker set that is owned by the current user +// Changes the list of emojis corresponding to a sticker. The sticker must belong to a regular or custom emoji sticker set that is owned by the current user func (client *Client) SetStickerEmojis(req *SetStickerEmojisRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -20566,21 +20967,27 @@ func (client *Client) GetStarPaymentOptions() (*StarPaymentOptions, error) { } type GetStarTransactionsRequest struct { - // Offset of the first transaction to return as received from the previous request; use empty string to get the first chunk of results - Offset string `json:"offset"` + // Identifier of the owner of the Telegram stars; can be the identifier of the current user, identifier of an owned bot, or identifier of a channel chat with supergroupFullInfo.can_get_revenue_statistics == true + OwnerId MessageSender `json:"owner_id"` // Direction of the transactions to receive; pass null to get all transactions Direction StarTransactionDirection `json:"direction"` + // Offset of the first transaction to return as received from the previous request; use empty string to get the first chunk of results + Offset string `json:"offset"` + // The maximum number of transactions to return + Limit int32 `json:"limit"` } -// Returns the list of Telegram star transactions for the current user +// Returns the list of Telegram star transactions for the specified owner func (client *Client) GetStarTransactions(req *GetStarTransactionsRequest) (*StarTransactions, error) { result, err := client.Send(Request{ meta: meta{ Type: "getStarTransactions", }, Data: map[string]interface{}{ - "offset": req.Offset, + "owner_id": req.OwnerId, "direction": req.Direction, + "offset": req.Offset, + "limit": req.Limit, }, }) if err != nil { @@ -22289,6 +22696,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateChatRevenueAmount: return UnmarshalUpdateChatRevenueAmount(result.Data) + case TypeUpdateStarRevenueStatus: + return UnmarshalUpdateStarRevenueStatus(result.Data) + case TypeUpdateSpeechRecognitionTrial: return UnmarshalUpdateSpeechRecognitionTrial(result.Data) @@ -22337,6 +22747,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateNewInlineCallbackQuery: return UnmarshalUpdateNewInlineCallbackQuery(result.Data) + case TypeUpdateNewBusinessCallbackQuery: + return UnmarshalUpdateNewBusinessCallbackQuery(result.Data) + case TypeUpdateNewShippingQuery: return UnmarshalUpdateNewShippingQuery(result.Data) diff --git a/client/type.go b/client/type.go index ea9fc14..76c7306 100755 --- a/client/type.go +++ b/client/type.go @@ -23,7 +23,7 @@ const ( ClassChatPhotoStickerType = "ChatPhotoStickerType" ClassInputChatPhoto = "InputChatPhoto" ClassStarTransactionDirection = "StarTransactionDirection" - ClassStarTransactionSource = "StarTransactionSource" + ClassStarTransactionPartner = "StarTransactionPartner" ClassPremiumGiveawayParticipantStatus = "PremiumGiveawayParticipantStatus" ClassPremiumGiveawayInfo = "PremiumGiveawayInfo" ClassChatMemberStatus = "ChatMemberStatus" @@ -150,7 +150,7 @@ const ( ClassStatisticalGraph = "StatisticalGraph" ClassChatStatisticsObjectType = "ChatStatisticsObjectType" ClassChatStatistics = "ChatStatistics" - ClassChatRevenueWithdrawalState = "ChatRevenueWithdrawalState" + ClassRevenueWithdrawalState = "RevenueWithdrawalState" ClassChatRevenueTransactionType = "ChatRevenueTransactionType" ClassVectorPathCommand = "VectorPathCommand" ClassBotCommandScope = "BotCommandScope" @@ -348,6 +348,7 @@ const ( ClassBankCardActionOpenUrl = "BankCardActionOpenUrl" ClassBankCardInfo = "BankCardInfo" ClassAddress = "Address" + ClassLocationAddress = "LocationAddress" ClassThemeParameters = "ThemeParameters" ClassLabeledPricePart = "LabeledPricePart" ClassInvoice = "Invoice" @@ -398,6 +399,7 @@ const ( ClassStoryInteractionInfo = "StoryInteractionInfo" ClassStory = "Story" ClassStories = "Stories" + ClassFoundStories = "FoundStories" ClassStoryFullId = "StoryFullId" ClassStoryInfo = "StoryInfo" ClassChatActiveStories = "ChatActiveStories" @@ -522,6 +524,8 @@ const ( ClassStoryStatistics = "StoryStatistics" ClassChatRevenueTransaction = "ChatRevenueTransaction" ClassChatRevenueTransactions = "ChatRevenueTransactions" + ClassStarRevenueStatus = "StarRevenueStatus" + ClassStarRevenueStatistics = "StarRevenueStatistics" ClassPoint = "Point" ClassUpdates = "Updates" ClassLogVerbosityLevel = "LogVerbosityLevel" @@ -679,12 +683,13 @@ const ( TypeStarPaymentOptions = "starPaymentOptions" TypeStarTransactionDirectionIncoming = "starTransactionDirectionIncoming" TypeStarTransactionDirectionOutgoing = "starTransactionDirectionOutgoing" - TypeStarTransactionSourceTelegram = "starTransactionSourceTelegram" - TypeStarTransactionSourceAppStore = "starTransactionSourceAppStore" - TypeStarTransactionSourceGooglePlay = "starTransactionSourceGooglePlay" - TypeStarTransactionSourceFragment = "starTransactionSourceFragment" - TypeStarTransactionSourceUser = "starTransactionSourceUser" - TypeStarTransactionSourceUnsupported = "starTransactionSourceUnsupported" + TypeStarTransactionPartnerTelegram = "starTransactionPartnerTelegram" + TypeStarTransactionPartnerAppStore = "starTransactionPartnerAppStore" + TypeStarTransactionPartnerGooglePlay = "starTransactionPartnerGooglePlay" + TypeStarTransactionPartnerFragment = "starTransactionPartnerFragment" + TypeStarTransactionPartnerUser = "starTransactionPartnerUser" + TypeStarTransactionPartnerChannel = "starTransactionPartnerChannel" + TypeStarTransactionPartnerUnsupported = "starTransactionPartnerUnsupported" TypeStarTransaction = "starTransaction" TypeStarTransactions = "starTransactions" TypePremiumGiveawayParticipantStatusEligible = "premiumGiveawayParticipantStatusEligible" @@ -786,6 +791,7 @@ const ( TypeMessageReplyToMessage = "messageReplyToMessage" TypeMessageReplyToStory = "messageReplyToStory" TypeInputMessageReplyToMessage = "inputMessageReplyToMessage" + TypeInputMessageReplyToExternalMessage = "inputMessageReplyToExternalMessage" TypeInputMessageReplyToStory = "inputMessageReplyToStory" TypeFactCheck = "factCheck" TypeMessage = "message" @@ -977,6 +983,7 @@ const ( TypeBankCardActionOpenUrl = "bankCardActionOpenUrl" TypeBankCardInfo = "bankCardInfo" TypeAddress = "address" + TypeLocationAddress = "locationAddress" TypeThemeParameters = "themeParameters" TypeLabeledPricePart = "labeledPricePart" TypeInvoice = "invoice" @@ -1255,12 +1262,14 @@ const ( TypeStoryAreaTypeVenue = "storyAreaTypeVenue" TypeStoryAreaTypeSuggestedReaction = "storyAreaTypeSuggestedReaction" TypeStoryAreaTypeMessage = "storyAreaTypeMessage" + TypeStoryAreaTypeLink = "storyAreaTypeLink" TypeStoryArea = "storyArea" TypeInputStoryAreaTypeLocation = "inputStoryAreaTypeLocation" TypeInputStoryAreaTypeFoundVenue = "inputStoryAreaTypeFoundVenue" TypeInputStoryAreaTypePreviousVenue = "inputStoryAreaTypePreviousVenue" TypeInputStoryAreaTypeSuggestedReaction = "inputStoryAreaTypeSuggestedReaction" TypeInputStoryAreaTypeMessage = "inputStoryAreaTypeMessage" + TypeInputStoryAreaTypeLink = "inputStoryAreaTypeLink" TypeInputStoryArea = "inputStoryArea" TypeInputStoryAreas = "inputStoryAreas" TypeStoryVideo = "storyVideo" @@ -1277,6 +1286,7 @@ const ( TypeStoryInteractionInfo = "storyInteractionInfo" TypeStory = "story" TypeStories = "stories" + TypeFoundStories = "foundStories" TypeStoryFullId = "storyFullId" TypeStoryInfo = "storyInfo" TypeChatActiveStories = "chatActiveStories" @@ -1874,14 +1884,16 @@ const ( TypeChatRevenueStatistics = "chatRevenueStatistics" TypeMessageStatistics = "messageStatistics" TypeStoryStatistics = "storyStatistics" - TypeChatRevenueWithdrawalStatePending = "chatRevenueWithdrawalStatePending" - TypeChatRevenueWithdrawalStateCompleted = "chatRevenueWithdrawalStateCompleted" - TypeChatRevenueWithdrawalStateFailed = "chatRevenueWithdrawalStateFailed" + TypeRevenueWithdrawalStatePending = "revenueWithdrawalStatePending" + TypeRevenueWithdrawalStateSucceeded = "revenueWithdrawalStateSucceeded" + TypeRevenueWithdrawalStateFailed = "revenueWithdrawalStateFailed" TypeChatRevenueTransactionTypeEarnings = "chatRevenueTransactionTypeEarnings" TypeChatRevenueTransactionTypeWithdrawal = "chatRevenueTransactionTypeWithdrawal" TypeChatRevenueTransactionTypeRefund = "chatRevenueTransactionTypeRefund" TypeChatRevenueTransaction = "chatRevenueTransaction" TypeChatRevenueTransactions = "chatRevenueTransactions" + TypeStarRevenueStatus = "starRevenueStatus" + TypeStarRevenueStatistics = "starRevenueStatistics" TypePoint = "point" TypeVectorPathCommandLine = "vectorPathCommandLine" TypeVectorPathCommandCubicBezierCurve = "vectorPathCommandCubicBezierCurve" @@ -2015,6 +2027,7 @@ const ( TypeUpdateSavedMessagesTags = "updateSavedMessagesTags" TypeUpdateOwnedStarCount = "updateOwnedStarCount" TypeUpdateChatRevenueAmount = "updateChatRevenueAmount" + TypeUpdateStarRevenueStatus = "updateStarRevenueStatus" TypeUpdateSpeechRecognitionTrial = "updateSpeechRecognitionTrial" TypeUpdateDiceEmojis = "updateDiceEmojis" TypeUpdateAnimatedEmojiMessageClicked = "updateAnimatedEmojiMessageClicked" @@ -2031,6 +2044,7 @@ const ( TypeUpdateNewChosenInlineResult = "updateNewChosenInlineResult" TypeUpdateNewCallbackQuery = "updateNewCallbackQuery" TypeUpdateNewInlineCallbackQuery = "updateNewInlineCallbackQuery" + TypeUpdateNewBusinessCallbackQuery = "updateNewBusinessCallbackQuery" TypeUpdateNewShippingQuery = "updateNewShippingQuery" TypeUpdateNewPreCheckoutQuery = "updateNewPreCheckoutQuery" TypeUpdateNewCustomEvent = "updateNewCustomEvent" @@ -2139,8 +2153,8 @@ type StarTransactionDirection interface { } // Describes source or recipient of a transaction with Telegram stars -type StarTransactionSource interface { - StarTransactionSourceType() string +type StarTransactionPartner interface { + StarTransactionPartnerType() string } // Contains information about status of a user in a Telegram Premium giveaway @@ -2773,9 +2787,9 @@ type ChatStatistics interface { ChatStatisticsType() string } -// Describes state of a chat revenue withdrawal -type ChatRevenueWithdrawalState interface { - ChatRevenueWithdrawalStateType() string +// Describes state of a revenue withdrawal +type RevenueWithdrawalState interface { + RevenueWithdrawalStateType() string } // Describes type of transaction for revenue earned from sponsored messages in a chat @@ -7186,7 +7200,7 @@ type StarPaymentOption struct { Currency string `json:"currency"` // The amount to pay, in the smallest units of the currency Amount int64 `json:"amount"` - // Number of stars that will be purchased + // Number of Telegram stars that will be purchased StarCount int64 `json:"star_count"` // Identifier of the store product associated with the option; may be empty if none StoreProductId string `json:"store_product_id"` @@ -7284,107 +7298,125 @@ func (*StarTransactionDirectionOutgoing) StarTransactionDirectionType() string { } // The transaction is a transaction with Telegram through a bot -type StarTransactionSourceTelegram struct{ +type StarTransactionPartnerTelegram struct{ meta } -func (entity *StarTransactionSourceTelegram) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionPartnerTelegram) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub StarTransactionSourceTelegram + type stub StarTransactionPartnerTelegram return json.Marshal((*stub)(entity)) } -func (*StarTransactionSourceTelegram) GetClass() string { - return ClassStarTransactionSource +func (*StarTransactionPartnerTelegram) GetClass() string { + return ClassStarTransactionPartner } -func (*StarTransactionSourceTelegram) GetType() string { - return TypeStarTransactionSourceTelegram +func (*StarTransactionPartnerTelegram) GetType() string { + return TypeStarTransactionPartnerTelegram } -func (*StarTransactionSourceTelegram) StarTransactionSourceType() string { - return TypeStarTransactionSourceTelegram +func (*StarTransactionPartnerTelegram) StarTransactionPartnerType() string { + return TypeStarTransactionPartnerTelegram } // The transaction is a transaction with App Store -type StarTransactionSourceAppStore struct{ +type StarTransactionPartnerAppStore struct{ meta } -func (entity *StarTransactionSourceAppStore) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionPartnerAppStore) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub StarTransactionSourceAppStore + type stub StarTransactionPartnerAppStore return json.Marshal((*stub)(entity)) } -func (*StarTransactionSourceAppStore) GetClass() string { - return ClassStarTransactionSource +func (*StarTransactionPartnerAppStore) GetClass() string { + return ClassStarTransactionPartner } -func (*StarTransactionSourceAppStore) GetType() string { - return TypeStarTransactionSourceAppStore +func (*StarTransactionPartnerAppStore) GetType() string { + return TypeStarTransactionPartnerAppStore } -func (*StarTransactionSourceAppStore) StarTransactionSourceType() string { - return TypeStarTransactionSourceAppStore +func (*StarTransactionPartnerAppStore) StarTransactionPartnerType() string { + return TypeStarTransactionPartnerAppStore } // The transaction is a transaction with Google Play -type StarTransactionSourceGooglePlay struct{ +type StarTransactionPartnerGooglePlay struct{ meta } -func (entity *StarTransactionSourceGooglePlay) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionPartnerGooglePlay) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub StarTransactionSourceGooglePlay + type stub StarTransactionPartnerGooglePlay return json.Marshal((*stub)(entity)) } -func (*StarTransactionSourceGooglePlay) GetClass() string { - return ClassStarTransactionSource +func (*StarTransactionPartnerGooglePlay) GetClass() string { + return ClassStarTransactionPartner } -func (*StarTransactionSourceGooglePlay) GetType() string { - return TypeStarTransactionSourceGooglePlay +func (*StarTransactionPartnerGooglePlay) GetType() string { + return TypeStarTransactionPartnerGooglePlay } -func (*StarTransactionSourceGooglePlay) StarTransactionSourceType() string { - return TypeStarTransactionSourceGooglePlay +func (*StarTransactionPartnerGooglePlay) StarTransactionPartnerType() string { + return TypeStarTransactionPartnerGooglePlay } // The transaction is a transaction with Fragment -type StarTransactionSourceFragment struct{ +type StarTransactionPartnerFragment struct { meta + // State of the withdrawal; may be null for refunds from Fragment + WithdrawalState RevenueWithdrawalState `json:"withdrawal_state"` } -func (entity *StarTransactionSourceFragment) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionPartnerFragment) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub StarTransactionSourceFragment + type stub StarTransactionPartnerFragment return json.Marshal((*stub)(entity)) } -func (*StarTransactionSourceFragment) GetClass() string { - return ClassStarTransactionSource +func (*StarTransactionPartnerFragment) GetClass() string { + return ClassStarTransactionPartner } -func (*StarTransactionSourceFragment) GetType() string { - return TypeStarTransactionSourceFragment +func (*StarTransactionPartnerFragment) GetType() string { + return TypeStarTransactionPartnerFragment } -func (*StarTransactionSourceFragment) StarTransactionSourceType() string { - return TypeStarTransactionSourceFragment +func (*StarTransactionPartnerFragment) StarTransactionPartnerType() string { + return TypeStarTransactionPartnerFragment +} + +func (starTransactionPartnerFragment *StarTransactionPartnerFragment) UnmarshalJSON(data []byte) error { + var tmp struct { + WithdrawalState json.RawMessage `json:"withdrawal_state"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldWithdrawalState, _ := UnmarshalRevenueWithdrawalState(tmp.WithdrawalState) + starTransactionPartnerFragment.WithdrawalState = fieldWithdrawalState + + return nil } // The transaction is a transaction with another user -type StarTransactionSourceUser struct { +type StarTransactionPartnerUser struct { meta // Identifier of the user UserId int64 `json:"user_id"` @@ -7392,49 +7424,76 @@ type StarTransactionSourceUser struct { ProductInfo *ProductInfo `json:"product_info"` } -func (entity *StarTransactionSourceUser) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionPartnerUser) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub StarTransactionSourceUser + type stub StarTransactionPartnerUser return json.Marshal((*stub)(entity)) } -func (*StarTransactionSourceUser) GetClass() string { - return ClassStarTransactionSource +func (*StarTransactionPartnerUser) GetClass() string { + return ClassStarTransactionPartner } -func (*StarTransactionSourceUser) GetType() string { - return TypeStarTransactionSourceUser +func (*StarTransactionPartnerUser) GetType() string { + return TypeStarTransactionPartnerUser } -func (*StarTransactionSourceUser) StarTransactionSourceType() string { - return TypeStarTransactionSourceUser +func (*StarTransactionPartnerUser) StarTransactionPartnerType() string { + return TypeStarTransactionPartnerUser } -// The transaction is a transaction with unknown source -type StarTransactionSourceUnsupported struct{ +// The transaction is a transaction with a channel chat +type StarTransactionPartnerChannel struct { + meta + // Identifier of the chat + ChatId int64 `json:"chat_id"` +} + +func (entity *StarTransactionPartnerChannel) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionPartnerChannel + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionPartnerChannel) GetClass() string { + return ClassStarTransactionPartner +} + +func (*StarTransactionPartnerChannel) GetType() string { + return TypeStarTransactionPartnerChannel +} + +func (*StarTransactionPartnerChannel) StarTransactionPartnerType() string { + return TypeStarTransactionPartnerChannel +} + +// The transaction is a transaction with unknown partner +type StarTransactionPartnerUnsupported struct{ meta } -func (entity *StarTransactionSourceUnsupported) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionPartnerUnsupported) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub StarTransactionSourceUnsupported + type stub StarTransactionPartnerUnsupported return json.Marshal((*stub)(entity)) } -func (*StarTransactionSourceUnsupported) GetClass() string { - return ClassStarTransactionSource +func (*StarTransactionPartnerUnsupported) GetClass() string { + return ClassStarTransactionPartner } -func (*StarTransactionSourceUnsupported) GetType() string { - return TypeStarTransactionSourceUnsupported +func (*StarTransactionPartnerUnsupported) GetType() string { + return TypeStarTransactionPartnerUnsupported } -func (*StarTransactionSourceUnsupported) StarTransactionSourceType() string { - return TypeStarTransactionSourceUnsupported +func (*StarTransactionPartnerUnsupported) StarTransactionPartnerType() string { + return TypeStarTransactionPartnerUnsupported } // Represents a transaction changing the amount of owned Telegram stars @@ -7448,8 +7507,8 @@ type StarTransaction struct { IsRefund bool `json:"is_refund"` // Point in time (Unix timestamp) when the transaction was completed Date int32 `json:"date"` - // Source of the transaction, or its recipient for outgoing transactions - Source StarTransactionSource `json:"source"` + // Source of the incoming transaction, or its recipient for outgoing transactions + Partner StarTransactionPartner `json:"partner"` } func (entity *StarTransaction) MarshalJSON() ([]byte, error) { @@ -7474,7 +7533,7 @@ func (starTransaction *StarTransaction) UnmarshalJSON(data []byte) error { StarCount int64 `json:"star_count"` IsRefund bool `json:"is_refund"` Date int32 `json:"date"` - Source json.RawMessage `json:"source"` + Partner json.RawMessage `json:"partner"` } err := json.Unmarshal(data, &tmp) @@ -7487,8 +7546,8 @@ func (starTransaction *StarTransaction) UnmarshalJSON(data []byte) error { starTransaction.IsRefund = tmp.IsRefund starTransaction.Date = tmp.Date - fieldSource, _ := UnmarshalStarTransactionSource(tmp.Source) - starTransaction.Source = fieldSource + fieldPartner, _ := UnmarshalStarTransactionPartner(tmp.Partner) + starTransaction.Partner = fieldPartner return nil } @@ -8342,7 +8401,7 @@ func (*ChatAdministrators) GetType() string { // The user is the owner of the chat and has all the administrator privileges type ChatMemberStatusCreator struct { meta - // A custom title of the owner; 0-16 characters without emojis; applicable to supergroups only + // A custom title of the owner; 0-16 characters without emoji; applicable to supergroups only CustomTitle string `json:"custom_title"` // True, if the creator isn't shown in the chat member list and sends messages anonymously; applicable to supergroups only IsAnonymous bool `json:"is_anonymous"` @@ -8373,7 +8432,7 @@ func (*ChatMemberStatusCreator) ChatMemberStatusType() string { // The user is a member of the chat and has some additional privileges. In basic groups, administrators can edit and delete messages sent by others, add new members, ban unprivileged members, and manage video chats. In supergroups and channels, there are more detailed options for administrator privileges type ChatMemberStatusAdministrator struct { meta - // A custom title of the administrator; 0-16 characters without emojis; applicable to supergroups only + // A custom title of the administrator; 0-16 characters without emoji; applicable to supergroups only CustomTitle string `json:"custom_title"` // True, if the current user can edit the administrator privileges for the called user CanBeEdited bool `json:"can_be_edited"` @@ -11020,12 +11079,10 @@ func (*MessageReplyToStory) MessageReplyToType() string { return TypeMessageReplyToStory } -// Describes a message to be replied +// Describes a message to be replied in the same chat and forum topic type InputMessageReplyToMessage struct { meta - // The identifier of the chat to which the message to be replied belongs; pass 0 if the message to be replied is in the same chat. Must always be 0 for replies in secret chats. A message can be replied in another chat or topic only if message.can_be_replied_in_another_chat - ChatId int64 `json:"chat_id"` - // The identifier of the message to be replied in the same or the specified chat + // The identifier of the message to be replied in the same chat and forum topic MessageId int64 `json:"message_id"` // Quote from the message to be replied; pass null if none. Must always be null for replies in secret chats Quote *InputTextQuote `json:"quote"` @@ -11051,6 +11108,37 @@ func (*InputMessageReplyToMessage) InputMessageReplyToType() string { return TypeInputMessageReplyToMessage } +// Describes a message to be replied that is from a different chat or a forum topic; not supported in secret chats +type InputMessageReplyToExternalMessage struct { + meta + // The identifier of the chat to which the message to be replied belongs + ChatId int64 `json:"chat_id"` + // The identifier of the message to be replied in the specified chat. A message can be replied in another chat or topic only if message.can_be_replied_in_another_chat + MessageId int64 `json:"message_id"` + // Quote from the message to be replied; pass null if none + Quote *InputTextQuote `json:"quote"` +} + +func (entity *InputMessageReplyToExternalMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputMessageReplyToExternalMessage + + return json.Marshal((*stub)(entity)) +} + +func (*InputMessageReplyToExternalMessage) GetClass() string { + return ClassInputMessageReplyTo +} + +func (*InputMessageReplyToExternalMessage) GetType() string { + return TypeInputMessageReplyToExternalMessage +} + +func (*InputMessageReplyToExternalMessage) InputMessageReplyToType() string { + return TypeInputMessageReplyToExternalMessage +} + // Describes a story to be replied type InputMessageReplyToStory struct { meta @@ -12492,6 +12580,8 @@ type DraftMessage struct { Date int32 `json:"date"` // Content of the message draft; must be of the type inputMessageText, inputMessageVideoNote, or inputMessageVoiceNote InputMessageText InputMessageContent `json:"input_message_text"` + // Identifier of the effect to apply to the message when it is sent; 0 if none + EffectId JsonInt64 `json:"effect_id"` } func (entity *DraftMessage) MarshalJSON() ([]byte, error) { @@ -12515,6 +12605,7 @@ func (draftMessage *DraftMessage) UnmarshalJSON(data []byte) error { ReplyTo json.RawMessage `json:"reply_to"` Date int32 `json:"date"` InputMessageText json.RawMessage `json:"input_message_text"` + EffectId JsonInt64 `json:"effect_id"` } err := json.Unmarshal(data, &tmp) @@ -12523,6 +12614,7 @@ func (draftMessage *DraftMessage) UnmarshalJSON(data []byte) error { } draftMessage.Date = tmp.Date + draftMessage.EffectId = tmp.EffectId fieldReplyTo, _ := UnmarshalInputMessageReplyTo(tmp.ReplyTo) draftMessage.ReplyTo = fieldReplyTo @@ -17838,6 +17930,35 @@ func (*Address) GetType() string { return TypeAddress } +// Describes an address of a location +type LocationAddress struct { + meta + // A two-letter ISO 3166-1 alpha-2 country code + CountryCode string `json:"country_code"` + // State, if applicable; empty if unknown + State string `json:"state"` + // City; empty if unknown + City string `json:"city"` + // The address; empty if unknown + Street string `json:"street"` +} + +func (entity *LocationAddress) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LocationAddress + + return json.Marshal((*stub)(entity)) +} + +func (*LocationAddress) GetClass() string { + return ClassLocationAddress +} + +func (*LocationAddress) GetType() string { + return TypeLocationAddress +} + // Contains parameters of the application theme type ThemeParameters struct { meta @@ -18339,7 +18460,7 @@ func (paymentFormTypeRegular *PaymentFormTypeRegular) UnmarshalJSON(data []byte) // The payment form is for a payment in Telegram stars type PaymentFormTypeStars struct { meta - // Number of stars that will be paid + // Number of Telegram stars that will be paid StarCount int64 `json:"star_count"` } @@ -18505,7 +18626,7 @@ func (*PaymentReceiptTypeRegular) PaymentReceiptTypeType() string { // The payment was done using Telegram stars type PaymentReceiptTypeStars struct { meta - // Number of stars that were paid + // Number of Telegram stars that were paid StarCount int64 `json:"star_count"` // Unique identifier of the transaction that can be used to dispute it TransactionId string `json:"transaction_id"` @@ -23927,7 +24048,7 @@ type MessageSendOptions struct { UpdateOrderOfInstalledStickerSets bool `json:"update_order_of_installed_sticker_sets"` // Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, live location messages and self-destructing messages can't be scheduled SchedulingState MessageSchedulingState `json:"scheduling_state"` - // Identifier of the effect to apply to the message; applicable only to sendMessage and sendMessageAlbum in private chats + // Identifier of the effect to apply to the message; pass 0 if none; applicable only to sendMessage and sendMessageAlbum in private chats EffectId JsonInt64 `json:"effect_id"` // Non-persistent identifier, which will be returned back in messageSendingStatePending object and can be used to match sent messages and corresponding updateNewMessage updates SendingId int32 `json:"sending_id"` @@ -25946,10 +26067,10 @@ func (*EmojiKeyword) GetType() string { return TypeEmojiKeyword } -// Represents a list of emoji with their keywords +// Represents a list of emojis with their keywords type EmojiKeywords struct { meta - // List of emoji with their keywords + // List of emojis with their keywords EmojiKeywords []*EmojiKeyword `json:"emoji_keywords"` } @@ -25992,7 +26113,7 @@ func (*Stickers) GetType() string { return TypeStickers } -// Represents a list of emoji +// Represents a list of emojis type Emojis struct { meta // List of emojis @@ -26046,7 +26167,7 @@ type StickerSet struct { IsViewed bool `json:"is_viewed"` // List of stickers in this set Stickers []*Sticker `json:"stickers"` - // A list of emoji corresponding to the stickers in the same order. The list is only for informational purposes, because a sticker is always sent with a fixed emoji from the corresponding Sticker object + // A list of emojis corresponding to the stickers in the same order. The list is only for informational purposes, because a sticker is always sent with a fixed emoji from the corresponding Sticker object Emojis []*Emojis `json:"emojis"` } @@ -26262,7 +26383,7 @@ func (*TrendingStickerSets) GetType() string { // The category contains a list of similar emoji to search for in getStickers and searchStickers for stickers, or getInlineQueryResults with the bot getOption("animation_search_bot_username") for animations type EmojiCategorySourceSearch struct { meta - // List of emojis for search for + // List of emojis to search for Emojis []string `json:"emojis"` } @@ -26499,6 +26620,8 @@ type StoryAreaPosition struct { HeightPercentage float64 `json:"height_percentage"` // Clockwise rotation angle of the rectangle, in degrees; 0-360 RotationAngle float64 `json:"rotation_angle"` + // The radius of the rectangle corner rounding, as a percentage of the media width + CornerRadiusPercentage float64 `json:"corner_radius_percentage"` } func (entity *StoryAreaPosition) MarshalJSON() ([]byte, error) { @@ -26522,6 +26645,8 @@ type StoryAreaTypeLocation struct { meta // The location Location *Location `json:"location"` + // Address of the location; may be null if unknown + Address *LocationAddress `json:"address"` } func (entity *StoryAreaTypeLocation) MarshalJSON() ([]byte, error) { @@ -26656,6 +26781,33 @@ func (*StoryAreaTypeMessage) StoryAreaTypeType() string { return TypeStoryAreaTypeMessage } +// An area pointing to a HTTP or tg:// link +type StoryAreaTypeLink struct { + meta + // HTTP or tg:// URL to be opened when the area is clicked + Url string `json:"url"` +} + +func (entity *StoryAreaTypeLink) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryAreaTypeLink + + return json.Marshal((*stub)(entity)) +} + +func (*StoryAreaTypeLink) GetClass() string { + return ClassStoryAreaType +} + +func (*StoryAreaTypeLink) GetType() string { + return TypeStoryAreaTypeLink +} + +func (*StoryAreaTypeLink) StoryAreaTypeType() string { + return TypeStoryAreaTypeLink +} + // Describes a clickable rectangle area on a story media type StoryArea struct { meta @@ -26705,6 +26857,8 @@ type InputStoryAreaTypeLocation struct { meta // The location Location *Location `json:"location"` + // Address of the location; pass null if unknown + Address *LocationAddress `json:"address"` } func (entity *InputStoryAreaTypeLocation) MarshalJSON() ([]byte, error) { @@ -26866,6 +27020,33 @@ func (*InputStoryAreaTypeMessage) InputStoryAreaTypeType() string { return TypeInputStoryAreaTypeMessage } +// An area pointing to a HTTP or tg:// link +type InputStoryAreaTypeLink struct { + meta + // HTTP or tg:// URL to be opened when the area is clicked + Url string `json:"url"` +} + +func (entity *InputStoryAreaTypeLink) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputStoryAreaTypeLink + + return json.Marshal((*stub)(entity)) +} + +func (*InputStoryAreaTypeLink) GetClass() string { + return ClassInputStoryAreaType +} + +func (*InputStoryAreaTypeLink) GetType() string { + return TypeInputStoryAreaTypeLink +} + +func (*InputStoryAreaTypeLink) InputStoryAreaTypeType() string { + return TypeInputStoryAreaTypeLink +} + // Describes a clickable rectangle area on a story media to be added type InputStoryArea struct { meta @@ -26913,7 +27094,7 @@ func (inputStoryArea *InputStoryArea) UnmarshalJSON(data []byte) error { // Contains a list of story areas to be added type InputStoryAreas struct { meta - // List of input story areas. Currently, a story can have up to 10 inputStoryAreaTypeLocation, inputStoryAreaTypeFoundVenue, and inputStoryAreaTypePreviousVenue areas, up to getOption("story_suggested_reaction_area_count_max") inputStoryAreaTypeSuggestedReaction areas, and up to 1 inputStoryAreaTypeMessage area + // List of input story areas. Currently, a story can have up to 10 inputStoryAreaTypeLocation, inputStoryAreaTypeFoundVenue, and inputStoryAreaTypePreviousVenue areas, up to getOption("story_suggested_reaction_area_count_max") inputStoryAreaTypeSuggestedReaction areas, up to 1 inputStoryAreaTypeMessage area, and up to getOption("story_link_area_count_max") inputStoryAreaTypeLink areas if the current user is a Telegram Premium user Areas []*InputStoryArea `json:"areas"` } @@ -27501,6 +27682,33 @@ func (*Stories) GetType() string { return TypeStories } +// Contains a list of stories found by a search +type FoundStories struct { + meta + // Approximate total number of stories found + TotalCount int32 `json:"total_count"` + // List of stories + Stories []*Story `json:"stories"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` +} + +func (entity *FoundStories) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FoundStories + + return json.Marshal((*stub)(entity)) +} + +func (*FoundStories) GetClass() string { + return ClassFoundStories +} + +func (*FoundStories) GetType() string { + return TypeFoundStories +} + // Contains identifier of a story along with identifier of its sender type StoryFullId struct { meta @@ -28840,7 +29048,7 @@ type CallStateReady struct { Config string `json:"config"` // Call encryption key EncryptionKey []byte `json:"encryption_key"` - // Encryption key emojis fingerprint + // Encryption key fingerprint represented as 4 emoji Emojis []string `json:"emojis"` // True, if peer-to-peer connection is allowed by users privacy settings AllowP2p bool `json:"allow_p2p"` @@ -35475,7 +35683,7 @@ func (*PremiumStoryFeatureSaveStories) PremiumStoryFeatureType() string { return TypePremiumStoryFeatureSaveStories } -// The ability to use links and formatting in story caption +// The ability to use links and formatting in story caption, and use inputStoryAreaTypeLink areas type PremiumStoryFeatureLinksAndFormatting struct{ meta } @@ -45871,32 +46079,32 @@ func (storyStatistics *StoryStatistics) UnmarshalJSON(data []byte) error { } // Withdrawal is pending -type ChatRevenueWithdrawalStatePending struct{ +type RevenueWithdrawalStatePending struct{ meta } -func (entity *ChatRevenueWithdrawalStatePending) MarshalJSON() ([]byte, error) { +func (entity *RevenueWithdrawalStatePending) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ChatRevenueWithdrawalStatePending + type stub RevenueWithdrawalStatePending return json.Marshal((*stub)(entity)) } -func (*ChatRevenueWithdrawalStatePending) GetClass() string { - return ClassChatRevenueWithdrawalState +func (*RevenueWithdrawalStatePending) GetClass() string { + return ClassRevenueWithdrawalState } -func (*ChatRevenueWithdrawalStatePending) GetType() string { - return TypeChatRevenueWithdrawalStatePending +func (*RevenueWithdrawalStatePending) GetType() string { + return TypeRevenueWithdrawalStatePending } -func (*ChatRevenueWithdrawalStatePending) ChatRevenueWithdrawalStateType() string { - return TypeChatRevenueWithdrawalStatePending +func (*RevenueWithdrawalStatePending) RevenueWithdrawalStateType() string { + return TypeRevenueWithdrawalStatePending } -// Withdrawal was completed -type ChatRevenueWithdrawalStateCompleted struct { +// Withdrawal succeeded +type RevenueWithdrawalStateSucceeded struct { meta // Point in time (Unix timestamp) when the withdrawal was completed Date int32 `json:"date"` @@ -45904,49 +46112,49 @@ type ChatRevenueWithdrawalStateCompleted struct { Url string `json:"url"` } -func (entity *ChatRevenueWithdrawalStateCompleted) MarshalJSON() ([]byte, error) { +func (entity *RevenueWithdrawalStateSucceeded) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ChatRevenueWithdrawalStateCompleted + type stub RevenueWithdrawalStateSucceeded return json.Marshal((*stub)(entity)) } -func (*ChatRevenueWithdrawalStateCompleted) GetClass() string { - return ClassChatRevenueWithdrawalState +func (*RevenueWithdrawalStateSucceeded) GetClass() string { + return ClassRevenueWithdrawalState } -func (*ChatRevenueWithdrawalStateCompleted) GetType() string { - return TypeChatRevenueWithdrawalStateCompleted +func (*RevenueWithdrawalStateSucceeded) GetType() string { + return TypeRevenueWithdrawalStateSucceeded } -func (*ChatRevenueWithdrawalStateCompleted) ChatRevenueWithdrawalStateType() string { - return TypeChatRevenueWithdrawalStateCompleted +func (*RevenueWithdrawalStateSucceeded) RevenueWithdrawalStateType() string { + return TypeRevenueWithdrawalStateSucceeded } -// Withdrawal has_failed -type ChatRevenueWithdrawalStateFailed struct{ +// Withdrawal failed +type RevenueWithdrawalStateFailed struct{ meta } -func (entity *ChatRevenueWithdrawalStateFailed) MarshalJSON() ([]byte, error) { +func (entity *RevenueWithdrawalStateFailed) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ChatRevenueWithdrawalStateFailed + type stub RevenueWithdrawalStateFailed return json.Marshal((*stub)(entity)) } -func (*ChatRevenueWithdrawalStateFailed) GetClass() string { - return ClassChatRevenueWithdrawalState +func (*RevenueWithdrawalStateFailed) GetClass() string { + return ClassRevenueWithdrawalState } -func (*ChatRevenueWithdrawalStateFailed) GetType() string { - return TypeChatRevenueWithdrawalStateFailed +func (*RevenueWithdrawalStateFailed) GetType() string { + return TypeRevenueWithdrawalStateFailed } -func (*ChatRevenueWithdrawalStateFailed) ChatRevenueWithdrawalStateType() string { - return TypeChatRevenueWithdrawalStateFailed +func (*RevenueWithdrawalStateFailed) RevenueWithdrawalStateType() string { + return TypeRevenueWithdrawalStateFailed } // Describes earnings from sponsored messages in a chat in some time frame @@ -45986,7 +46194,7 @@ type ChatRevenueTransactionTypeWithdrawal struct { // Name of the payment provider Provider string `json:"provider"` // State of the withdrawal - State ChatRevenueWithdrawalState `json:"state"` + State RevenueWithdrawalState `json:"state"` } func (entity *ChatRevenueTransactionTypeWithdrawal) MarshalJSON() ([]byte, error) { @@ -46024,7 +46232,7 @@ func (chatRevenueTransactionTypeWithdrawal *ChatRevenueTransactionTypeWithdrawal chatRevenueTransactionTypeWithdrawal.WithdrawalDate = tmp.WithdrawalDate chatRevenueTransactionTypeWithdrawal.Provider = tmp.Provider - fieldState, _ := UnmarshalChatRevenueWithdrawalState(tmp.State) + fieldState, _ := UnmarshalRevenueWithdrawalState(tmp.State) chatRevenueTransactionTypeWithdrawal.State = fieldState return nil @@ -46132,6 +46340,85 @@ func (*ChatRevenueTransactions) GetType() string { return TypeChatRevenueTransactions } +// Contains information about Telegram stars earned by a bot or a chat +type StarRevenueStatus struct { + meta + // Total number of the stars earned + TotalCount int64 `json:"total_count"` + // The number of Telegram stars that aren't withdrawn yet + CurrentCount int64 `json:"current_count"` + // The number of Telegram stars that are available for withdrawal + AvailableCount int64 `json:"available_count"` + // True, if Telegram stars can be withdrawn now or later + WithdrawalEnabled bool `json:"withdrawal_enabled"` + // Time left before the next withdrawal can be started, in seconds; 0 if withdrawal can be started now + NextWithdrawalIn int32 `json:"next_withdrawal_in"` +} + +func (entity *StarRevenueStatus) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarRevenueStatus + + return json.Marshal((*stub)(entity)) +} + +func (*StarRevenueStatus) GetClass() string { + return ClassStarRevenueStatus +} + +func (*StarRevenueStatus) GetType() string { + return TypeStarRevenueStatus +} + +// A detailed statistics about Telegram stars earned by a bot or a chat +type StarRevenueStatistics struct { + meta + // A graph containing amount of revenue in a given day + RevenueByDayGraph StatisticalGraph `json:"revenue_by_day_graph"` + // Telegram star revenue status + Status *StarRevenueStatus `json:"status"` + // Current conversion rate of a Telegram star to USD + UsdRate float64 `json:"usd_rate"` +} + +func (entity *StarRevenueStatistics) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarRevenueStatistics + + return json.Marshal((*stub)(entity)) +} + +func (*StarRevenueStatistics) GetClass() string { + return ClassStarRevenueStatistics +} + +func (*StarRevenueStatistics) GetType() string { + return TypeStarRevenueStatistics +} + +func (starRevenueStatistics *StarRevenueStatistics) UnmarshalJSON(data []byte) error { + var tmp struct { + RevenueByDayGraph json.RawMessage `json:"revenue_by_day_graph"` + Status *StarRevenueStatus `json:"status"` + UsdRate float64 `json:"usd_rate"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + starRevenueStatistics.Status = tmp.Status + starRevenueStatistics.UsdRate = tmp.UsdRate + + fieldRevenueByDayGraph, _ := UnmarshalStatisticalGraph(tmp.RevenueByDayGraph) + starRevenueStatistics.RevenueByDayGraph = fieldRevenueByDayGraph + + return nil +} + // A point on a Cartesian plane type Point struct { meta @@ -50450,6 +50737,54 @@ func (*UpdateChatRevenueAmount) UpdateType() string { return TypeUpdateChatRevenueAmount } +// The Telegram star revenue earned by a bot or a chat has changed. If star transactions screen of the chat is opened, then getStarTransactions may be called to fetch new transactions +type UpdateStarRevenueStatus struct { + meta + // Identifier of the owner of the Telegram stars + OwnerId MessageSender `json:"owner_id"` + // New Telegram star revenue status + Status *StarRevenueStatus `json:"status"` +} + +func (entity *UpdateStarRevenueStatus) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateStarRevenueStatus + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateStarRevenueStatus) GetClass() string { + return ClassUpdate +} + +func (*UpdateStarRevenueStatus) GetType() string { + return TypeUpdateStarRevenueStatus +} + +func (*UpdateStarRevenueStatus) UpdateType() string { + return TypeUpdateStarRevenueStatus +} + +func (updateStarRevenueStatus *UpdateStarRevenueStatus) UnmarshalJSON(data []byte) error { + var tmp struct { + OwnerId json.RawMessage `json:"owner_id"` + Status *StarRevenueStatus `json:"status"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + updateStarRevenueStatus.Status = tmp.Status + + fieldOwnerId, _ := UnmarshalMessageSender(tmp.OwnerId) + updateStarRevenueStatus.OwnerId = fieldOwnerId + + return nil +} + // The parameters of speech recognition without Telegram Premium subscription has changed type UpdateSpeechRecognitionTrial struct { meta @@ -51060,6 +51395,70 @@ func (updateNewInlineCallbackQuery *UpdateNewInlineCallbackQuery) UnmarshalJSON( return nil } +// A new incoming callback query from a business message; for bots only +type UpdateNewBusinessCallbackQuery struct { + meta + // Unique query identifier + Id JsonInt64 `json:"id"` + // Identifier of the user who sent the query + SenderUserId int64 `json:"sender_user_id"` + // Unique identifier of the business connection + ConnectionId string `json:"connection_id"` + // The message from the business account from which the query originated + Message *BusinessMessage `json:"message"` + // An identifier uniquely corresponding to the chat a message was sent to + ChatInstance JsonInt64 `json:"chat_instance"` + // Query payload + Payload CallbackQueryPayload `json:"payload"` +} + +func (entity *UpdateNewBusinessCallbackQuery) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateNewBusinessCallbackQuery + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateNewBusinessCallbackQuery) GetClass() string { + return ClassUpdate +} + +func (*UpdateNewBusinessCallbackQuery) GetType() string { + return TypeUpdateNewBusinessCallbackQuery +} + +func (*UpdateNewBusinessCallbackQuery) UpdateType() string { + return TypeUpdateNewBusinessCallbackQuery +} + +func (updateNewBusinessCallbackQuery *UpdateNewBusinessCallbackQuery) UnmarshalJSON(data []byte) error { + var tmp struct { + Id JsonInt64 `json:"id"` + SenderUserId int64 `json:"sender_user_id"` + ConnectionId string `json:"connection_id"` + Message *BusinessMessage `json:"message"` + ChatInstance JsonInt64 `json:"chat_instance"` + Payload json.RawMessage `json:"payload"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + updateNewBusinessCallbackQuery.Id = tmp.Id + updateNewBusinessCallbackQuery.SenderUserId = tmp.SenderUserId + updateNewBusinessCallbackQuery.ConnectionId = tmp.ConnectionId + updateNewBusinessCallbackQuery.Message = tmp.Message + updateNewBusinessCallbackQuery.ChatInstance = tmp.ChatInstance + + fieldPayload, _ := UnmarshalCallbackQueryPayload(tmp.Payload) + updateNewBusinessCallbackQuery.Payload = fieldPayload + + return nil +} + // A new incoming shipping query; for bots only. Only for invoices with flexible price type UpdateNewShippingQuery struct { meta diff --git a/client/unmarshaler.go b/client/unmarshaler.go index ac3d1bc..945db86 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -659,7 +659,7 @@ func UnmarshalListOfStarTransactionDirection(dataList []json.RawMessage) ([]Star return list, nil } -func UnmarshalStarTransactionSource(data json.RawMessage) (StarTransactionSource, error) { +func UnmarshalStarTransactionPartner(data json.RawMessage) (StarTransactionPartner, error) { var meta meta err := json.Unmarshal(data, &meta) @@ -668,34 +668,37 @@ func UnmarshalStarTransactionSource(data json.RawMessage) (StarTransactionSource } switch meta.Type { - case TypeStarTransactionSourceTelegram: - return UnmarshalStarTransactionSourceTelegram(data) + case TypeStarTransactionPartnerTelegram: + return UnmarshalStarTransactionPartnerTelegram(data) - case TypeStarTransactionSourceAppStore: - return UnmarshalStarTransactionSourceAppStore(data) + case TypeStarTransactionPartnerAppStore: + return UnmarshalStarTransactionPartnerAppStore(data) - case TypeStarTransactionSourceGooglePlay: - return UnmarshalStarTransactionSourceGooglePlay(data) + case TypeStarTransactionPartnerGooglePlay: + return UnmarshalStarTransactionPartnerGooglePlay(data) - case TypeStarTransactionSourceFragment: - return UnmarshalStarTransactionSourceFragment(data) + case TypeStarTransactionPartnerFragment: + return UnmarshalStarTransactionPartnerFragment(data) - case TypeStarTransactionSourceUser: - return UnmarshalStarTransactionSourceUser(data) + case TypeStarTransactionPartnerUser: + return UnmarshalStarTransactionPartnerUser(data) - case TypeStarTransactionSourceUnsupported: - return UnmarshalStarTransactionSourceUnsupported(data) + case TypeStarTransactionPartnerChannel: + return UnmarshalStarTransactionPartnerChannel(data) + + case TypeStarTransactionPartnerUnsupported: + return UnmarshalStarTransactionPartnerUnsupported(data) default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } } -func UnmarshalListOfStarTransactionSource(dataList []json.RawMessage) ([]StarTransactionSource, error) { - list := []StarTransactionSource{} +func UnmarshalListOfStarTransactionPartner(dataList []json.RawMessage) ([]StarTransactionPartner, error) { + list := []StarTransactionPartner{} for _, data := range dataList { - entity, err := UnmarshalStarTransactionSource(data) + entity, err := UnmarshalStarTransactionPartner(data) if err != nil { return nil, err } @@ -1268,6 +1271,9 @@ func UnmarshalInputMessageReplyTo(data json.RawMessage) (InputMessageReplyTo, er case TypeInputMessageReplyToMessage: return UnmarshalInputMessageReplyToMessage(data) + case TypeInputMessageReplyToExternalMessage: + return UnmarshalInputMessageReplyToExternalMessage(data) + case TypeInputMessageReplyToStory: return UnmarshalInputMessageReplyToStory(data) @@ -3515,6 +3521,9 @@ func UnmarshalStoryAreaType(data json.RawMessage) (StoryAreaType, error) { case TypeStoryAreaTypeMessage: return UnmarshalStoryAreaTypeMessage(data) + case TypeStoryAreaTypeLink: + return UnmarshalStoryAreaTypeLink(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -3558,6 +3567,9 @@ func UnmarshalInputStoryAreaType(data json.RawMessage) (InputStoryAreaType, erro case TypeInputStoryAreaTypeMessage: return UnmarshalInputStoryAreaTypeMessage(data) + case TypeInputStoryAreaTypeLink: + return UnmarshalInputStoryAreaTypeLink(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -6933,7 +6945,7 @@ func UnmarshalListOfChatStatistics(dataList []json.RawMessage) ([]ChatStatistics return list, nil } -func UnmarshalChatRevenueWithdrawalState(data json.RawMessage) (ChatRevenueWithdrawalState, error) { +func UnmarshalRevenueWithdrawalState(data json.RawMessage) (RevenueWithdrawalState, error) { var meta meta err := json.Unmarshal(data, &meta) @@ -6942,25 +6954,25 @@ func UnmarshalChatRevenueWithdrawalState(data json.RawMessage) (ChatRevenueWithd } switch meta.Type { - case TypeChatRevenueWithdrawalStatePending: - return UnmarshalChatRevenueWithdrawalStatePending(data) + case TypeRevenueWithdrawalStatePending: + return UnmarshalRevenueWithdrawalStatePending(data) - case TypeChatRevenueWithdrawalStateCompleted: - return UnmarshalChatRevenueWithdrawalStateCompleted(data) + case TypeRevenueWithdrawalStateSucceeded: + return UnmarshalRevenueWithdrawalStateSucceeded(data) - case TypeChatRevenueWithdrawalStateFailed: - return UnmarshalChatRevenueWithdrawalStateFailed(data) + case TypeRevenueWithdrawalStateFailed: + return UnmarshalRevenueWithdrawalStateFailed(data) default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } } -func UnmarshalListOfChatRevenueWithdrawalState(dataList []json.RawMessage) ([]ChatRevenueWithdrawalState, error) { - list := []ChatRevenueWithdrawalState{} +func UnmarshalListOfRevenueWithdrawalState(dataList []json.RawMessage) ([]RevenueWithdrawalState, error) { + list := []RevenueWithdrawalState{} for _, data := range dataList { - entity, err := UnmarshalChatRevenueWithdrawalState(data) + entity, err := UnmarshalRevenueWithdrawalState(data) if err != nil { return nil, err } @@ -7496,6 +7508,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateChatRevenueAmount: return UnmarshalUpdateChatRevenueAmount(data) + case TypeUpdateStarRevenueStatus: + return UnmarshalUpdateStarRevenueStatus(data) + case TypeUpdateSpeechRecognitionTrial: return UnmarshalUpdateSpeechRecognitionTrial(data) @@ -7544,6 +7559,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateNewInlineCallbackQuery: return UnmarshalUpdateNewInlineCallbackQuery(data) + case TypeUpdateNewBusinessCallbackQuery: + return UnmarshalUpdateNewBusinessCallbackQuery(data) + case TypeUpdateNewShippingQuery: return UnmarshalUpdateNewShippingQuery(data) @@ -8769,48 +8787,56 @@ func UnmarshalStarTransactionDirectionOutgoing(data json.RawMessage) (*StarTrans return &resp, err } -func UnmarshalStarTransactionSourceTelegram(data json.RawMessage) (*StarTransactionSourceTelegram, error) { - var resp StarTransactionSourceTelegram +func UnmarshalStarTransactionPartnerTelegram(data json.RawMessage) (*StarTransactionPartnerTelegram, error) { + var resp StarTransactionPartnerTelegram err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionSourceAppStore(data json.RawMessage) (*StarTransactionSourceAppStore, error) { - var resp StarTransactionSourceAppStore +func UnmarshalStarTransactionPartnerAppStore(data json.RawMessage) (*StarTransactionPartnerAppStore, error) { + var resp StarTransactionPartnerAppStore err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionSourceGooglePlay(data json.RawMessage) (*StarTransactionSourceGooglePlay, error) { - var resp StarTransactionSourceGooglePlay +func UnmarshalStarTransactionPartnerGooglePlay(data json.RawMessage) (*StarTransactionPartnerGooglePlay, error) { + var resp StarTransactionPartnerGooglePlay err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionSourceFragment(data json.RawMessage) (*StarTransactionSourceFragment, error) { - var resp StarTransactionSourceFragment +func UnmarshalStarTransactionPartnerFragment(data json.RawMessage) (*StarTransactionPartnerFragment, error) { + var resp StarTransactionPartnerFragment err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionSourceUser(data json.RawMessage) (*StarTransactionSourceUser, error) { - var resp StarTransactionSourceUser +func UnmarshalStarTransactionPartnerUser(data json.RawMessage) (*StarTransactionPartnerUser, error) { + var resp StarTransactionPartnerUser err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionSourceUnsupported(data json.RawMessage) (*StarTransactionSourceUnsupported, error) { - var resp StarTransactionSourceUnsupported +func UnmarshalStarTransactionPartnerChannel(data json.RawMessage) (*StarTransactionPartnerChannel, error) { + var resp StarTransactionPartnerChannel + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionPartnerUnsupported(data json.RawMessage) (*StarTransactionPartnerUnsupported, error) { + var resp StarTransactionPartnerUnsupported err := json.Unmarshal(data, &resp) @@ -9625,6 +9651,14 @@ func UnmarshalInputMessageReplyToMessage(data json.RawMessage) (*InputMessageRep return &resp, err } +func UnmarshalInputMessageReplyToExternalMessage(data json.RawMessage) (*InputMessageReplyToExternalMessage, error) { + var resp InputMessageReplyToExternalMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInputMessageReplyToStory(data json.RawMessage) (*InputMessageReplyToStory, error) { var resp InputMessageReplyToStory @@ -11153,6 +11187,14 @@ func UnmarshalAddress(data json.RawMessage) (*Address, error) { return &resp, err } +func UnmarshalLocationAddress(data json.RawMessage) (*LocationAddress, error) { + var resp LocationAddress + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalThemeParameters(data json.RawMessage) (*ThemeParameters, error) { var resp ThemeParameters @@ -13377,6 +13419,14 @@ func UnmarshalStoryAreaTypeMessage(data json.RawMessage) (*StoryAreaTypeMessage, return &resp, err } +func UnmarshalStoryAreaTypeLink(data json.RawMessage) (*StoryAreaTypeLink, error) { + var resp StoryAreaTypeLink + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStoryArea(data json.RawMessage) (*StoryArea, error) { var resp StoryArea @@ -13425,6 +13475,14 @@ func UnmarshalInputStoryAreaTypeMessage(data json.RawMessage) (*InputStoryAreaTy return &resp, err } +func UnmarshalInputStoryAreaTypeLink(data json.RawMessage) (*InputStoryAreaTypeLink, error) { + var resp InputStoryAreaTypeLink + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInputStoryArea(data json.RawMessage) (*InputStoryArea, error) { var resp InputStoryArea @@ -13553,6 +13611,14 @@ func UnmarshalStories(data json.RawMessage) (*Stories, error) { return &resp, err } +func UnmarshalFoundStories(data json.RawMessage) (*FoundStories, error) { + var resp FoundStories + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStoryFullId(data json.RawMessage) (*StoryFullId, error) { var resp StoryFullId @@ -18329,24 +18395,24 @@ func UnmarshalStoryStatistics(data json.RawMessage) (*StoryStatistics, error) { return &resp, err } -func UnmarshalChatRevenueWithdrawalStatePending(data json.RawMessage) (*ChatRevenueWithdrawalStatePending, error) { - var resp ChatRevenueWithdrawalStatePending +func UnmarshalRevenueWithdrawalStatePending(data json.RawMessage) (*RevenueWithdrawalStatePending, error) { + var resp RevenueWithdrawalStatePending err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalChatRevenueWithdrawalStateCompleted(data json.RawMessage) (*ChatRevenueWithdrawalStateCompleted, error) { - var resp ChatRevenueWithdrawalStateCompleted +func UnmarshalRevenueWithdrawalStateSucceeded(data json.RawMessage) (*RevenueWithdrawalStateSucceeded, error) { + var resp RevenueWithdrawalStateSucceeded err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalChatRevenueWithdrawalStateFailed(data json.RawMessage) (*ChatRevenueWithdrawalStateFailed, error) { - var resp ChatRevenueWithdrawalStateFailed +func UnmarshalRevenueWithdrawalStateFailed(data json.RawMessage) (*RevenueWithdrawalStateFailed, error) { + var resp RevenueWithdrawalStateFailed err := json.Unmarshal(data, &resp) @@ -18393,6 +18459,22 @@ func UnmarshalChatRevenueTransactions(data json.RawMessage) (*ChatRevenueTransac return &resp, err } +func UnmarshalStarRevenueStatus(data json.RawMessage) (*StarRevenueStatus, error) { + var resp StarRevenueStatus + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarRevenueStatistics(data json.RawMessage) (*StarRevenueStatistics, error) { + var resp StarRevenueStatistics + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPoint(data json.RawMessage) (*Point, error) { var resp Point @@ -19457,6 +19539,14 @@ func UnmarshalUpdateChatRevenueAmount(data json.RawMessage) (*UpdateChatRevenueA return &resp, err } +func UnmarshalUpdateStarRevenueStatus(data json.RawMessage) (*UpdateStarRevenueStatus, error) { + var resp UpdateStarRevenueStatus + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateSpeechRecognitionTrial(data json.RawMessage) (*UpdateSpeechRecognitionTrial, error) { var resp UpdateSpeechRecognitionTrial @@ -19585,6 +19675,14 @@ func UnmarshalUpdateNewInlineCallbackQuery(data json.RawMessage) (*UpdateNewInli return &resp, err } +func UnmarshalUpdateNewBusinessCallbackQuery(data json.RawMessage) (*UpdateNewBusinessCallbackQuery, error) { + var resp UpdateNewBusinessCallbackQuery + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateNewShippingQuery(data json.RawMessage) (*UpdateNewShippingQuery, error) { var resp UpdateNewShippingQuery @@ -20220,23 +20318,26 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarTransactionDirectionOutgoing: return UnmarshalStarTransactionDirectionOutgoing(data) - case TypeStarTransactionSourceTelegram: - return UnmarshalStarTransactionSourceTelegram(data) + case TypeStarTransactionPartnerTelegram: + return UnmarshalStarTransactionPartnerTelegram(data) - case TypeStarTransactionSourceAppStore: - return UnmarshalStarTransactionSourceAppStore(data) + case TypeStarTransactionPartnerAppStore: + return UnmarshalStarTransactionPartnerAppStore(data) - case TypeStarTransactionSourceGooglePlay: - return UnmarshalStarTransactionSourceGooglePlay(data) + case TypeStarTransactionPartnerGooglePlay: + return UnmarshalStarTransactionPartnerGooglePlay(data) - case TypeStarTransactionSourceFragment: - return UnmarshalStarTransactionSourceFragment(data) + case TypeStarTransactionPartnerFragment: + return UnmarshalStarTransactionPartnerFragment(data) - case TypeStarTransactionSourceUser: - return UnmarshalStarTransactionSourceUser(data) + case TypeStarTransactionPartnerUser: + return UnmarshalStarTransactionPartnerUser(data) - case TypeStarTransactionSourceUnsupported: - return UnmarshalStarTransactionSourceUnsupported(data) + case TypeStarTransactionPartnerChannel: + return UnmarshalStarTransactionPartnerChannel(data) + + case TypeStarTransactionPartnerUnsupported: + return UnmarshalStarTransactionPartnerUnsupported(data) case TypeStarTransaction: return UnmarshalStarTransaction(data) @@ -20541,6 +20642,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInputMessageReplyToMessage: return UnmarshalInputMessageReplyToMessage(data) + case TypeInputMessageReplyToExternalMessage: + return UnmarshalInputMessageReplyToExternalMessage(data) + case TypeInputMessageReplyToStory: return UnmarshalInputMessageReplyToStory(data) @@ -21114,6 +21218,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeAddress: return UnmarshalAddress(data) + case TypeLocationAddress: + return UnmarshalLocationAddress(data) + case TypeThemeParameters: return UnmarshalThemeParameters(data) @@ -21948,6 +22055,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStoryAreaTypeMessage: return UnmarshalStoryAreaTypeMessage(data) + case TypeStoryAreaTypeLink: + return UnmarshalStoryAreaTypeLink(data) + case TypeStoryArea: return UnmarshalStoryArea(data) @@ -21966,6 +22076,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInputStoryAreaTypeMessage: return UnmarshalInputStoryAreaTypeMessage(data) + case TypeInputStoryAreaTypeLink: + return UnmarshalInputStoryAreaTypeLink(data) + case TypeInputStoryArea: return UnmarshalInputStoryArea(data) @@ -22014,6 +22127,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStories: return UnmarshalStories(data) + case TypeFoundStories: + return UnmarshalFoundStories(data) + case TypeStoryFullId: return UnmarshalStoryFullId(data) @@ -23805,14 +23921,14 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStoryStatistics: return UnmarshalStoryStatistics(data) - case TypeChatRevenueWithdrawalStatePending: - return UnmarshalChatRevenueWithdrawalStatePending(data) + case TypeRevenueWithdrawalStatePending: + return UnmarshalRevenueWithdrawalStatePending(data) - case TypeChatRevenueWithdrawalStateCompleted: - return UnmarshalChatRevenueWithdrawalStateCompleted(data) + case TypeRevenueWithdrawalStateSucceeded: + return UnmarshalRevenueWithdrawalStateSucceeded(data) - case TypeChatRevenueWithdrawalStateFailed: - return UnmarshalChatRevenueWithdrawalStateFailed(data) + case TypeRevenueWithdrawalStateFailed: + return UnmarshalRevenueWithdrawalStateFailed(data) case TypeChatRevenueTransactionTypeEarnings: return UnmarshalChatRevenueTransactionTypeEarnings(data) @@ -23829,6 +23945,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatRevenueTransactions: return UnmarshalChatRevenueTransactions(data) + case TypeStarRevenueStatus: + return UnmarshalStarRevenueStatus(data) + + case TypeStarRevenueStatistics: + return UnmarshalStarRevenueStatistics(data) + case TypePoint: return UnmarshalPoint(data) @@ -24228,6 +24350,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateChatRevenueAmount: return UnmarshalUpdateChatRevenueAmount(data) + case TypeUpdateStarRevenueStatus: + return UnmarshalUpdateStarRevenueStatus(data) + case TypeUpdateSpeechRecognitionTrial: return UnmarshalUpdateSpeechRecognitionTrial(data) @@ -24276,6 +24401,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateNewInlineCallbackQuery: return UnmarshalUpdateNewInlineCallbackQuery(data) + case TypeUpdateNewBusinessCallbackQuery: + return UnmarshalUpdateNewBusinessCallbackQuery(data) + case TypeUpdateNewShippingQuery: return UnmarshalUpdateNewShippingQuery(data) diff --git a/data/td_api.tl b/data/td_api.tl index dae79c7..14fb6f4 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -836,7 +836,7 @@ premiumGiftCodeInfo creator_id:MessageSender creation_date:int32 is_from_giveawa //@description Describes an option for buying Telegram stars //@currency ISO 4217 currency code for the payment //@amount The amount to pay, in the smallest units of the currency -//@star_count Number of stars that will be purchased +//@star_count Number of Telegram stars that will be purchased //@store_product_id Identifier of the store product associated with the option; may be empty if none //@is_additional True, if the option must be shown only in the full list of payment options starPaymentOption currency:string amount:int53 star_count:int53 store_product_id:string is_additional:Bool = StarPaymentOption; @@ -854,25 +854,28 @@ starTransactionDirectionIncoming = StarTransactionDirection; starTransactionDirectionOutgoing = StarTransactionDirection; -//@class StarTransactionSource @description Describes source or recipient of a transaction with Telegram stars +//@class StarTransactionPartner @description Describes source or recipient of a transaction with Telegram stars //@description The transaction is a transaction with Telegram through a bot -starTransactionSourceTelegram = StarTransactionSource; +starTransactionPartnerTelegram = StarTransactionPartner; //@description The transaction is a transaction with App Store -starTransactionSourceAppStore = StarTransactionSource; +starTransactionPartnerAppStore = StarTransactionPartner; //@description The transaction is a transaction with Google Play -starTransactionSourceGooglePlay = StarTransactionSource; +starTransactionPartnerGooglePlay = StarTransactionPartner; -//@description The transaction is a transaction with Fragment -starTransactionSourceFragment = StarTransactionSource; +//@description The transaction is a transaction with Fragment @withdrawal_state State of the withdrawal; may be null for refunds from Fragment +starTransactionPartnerFragment withdrawal_state:RevenueWithdrawalState = StarTransactionPartner; //@description The transaction is a transaction with another user @user_id Identifier of the user @product_info Information about the bought product; may be null if none -starTransactionSourceUser user_id:int53 product_info:productInfo = StarTransactionSource; +starTransactionPartnerUser user_id:int53 product_info:productInfo = StarTransactionPartner; -//@description The transaction is a transaction with unknown source -starTransactionSourceUnsupported = StarTransactionSource; +//@description The transaction is a transaction with a channel chat @chat_id Identifier of the chat +starTransactionPartnerChannel chat_id:int53 = StarTransactionPartner; + +//@description The transaction is a transaction with unknown partner +starTransactionPartnerUnsupported = StarTransactionPartner; //@description Represents a transaction changing the amount of owned Telegram stars @@ -880,8 +883,8 @@ starTransactionSourceUnsupported = StarTransactionSource; //@star_count The amount of added owned Telegram stars; negative for outgoing transactions //@is_refund True, if the transaction is a refund of a previous transaction //@date Point in time (Unix timestamp) when the transaction was completed -//@source Source of the transaction, or its recipient for outgoing transactions -starTransaction id:string star_count:int53 is_refund:Bool date:int32 source:StarTransactionSource = StarTransaction; +//@partner Source of the incoming transaction, or its recipient for outgoing transactions +starTransaction id:string star_count:int53 is_refund:Bool date:int32 partner:StarTransactionPartner = StarTransaction; //@description Represents a list of Telegram star transactions //@star_count The amount of owned Telegram stars @@ -1053,14 +1056,14 @@ chatAdministrators administrators:vector = ChatAdministrators //@class ChatMemberStatus @description Provides information about the status of a member in a chat //@description The user is the owner of the chat and has all the administrator privileges -//@custom_title A custom title of the owner; 0-16 characters without emojis; applicable to supergroups only +//@custom_title A custom title of the owner; 0-16 characters without emoji; applicable to supergroups only //@is_anonymous True, if the creator isn't shown in the chat member list and sends messages anonymously; applicable to supergroups only //@is_member True, if the user is a member of the chat chatMemberStatusCreator custom_title:string is_anonymous:Bool is_member:Bool = ChatMemberStatus; //@description The user is a member of the chat and has some additional privileges. In basic groups, administrators can edit and delete messages sent by others, add new members, ban unprivileged members, and manage video chats. //-In supergroups and channels, there are more detailed options for administrator privileges -//@custom_title A custom title of the administrator; 0-16 characters without emojis; applicable to supergroups only +//@custom_title A custom title of the administrator; 0-16 characters without emoji; applicable to supergroups only //@can_be_edited True, if the current user can edit the administrator privileges for the called user //@rights Rights of the administrator chatMemberStatusAdministrator custom_title:string can_be_edited:Bool rights:chatAdministratorRights = ChatMemberStatus; @@ -1527,11 +1530,16 @@ messageReplyToStory story_sender_chat_id:int53 story_id:int32 = MessageReplyTo; //@class InputMessageReplyTo @description Contains information about the message or the story to be replied -//@description Describes a message to be replied -//@chat_id The identifier of the chat to which the message to be replied belongs; pass 0 if the message to be replied is in the same chat. Must always be 0 for replies in secret chats. A message can be replied in another chat or topic only if message.can_be_replied_in_another_chat -//@message_id The identifier of the message to be replied in the same or the specified chat +//@description Describes a message to be replied in the same chat and forum topic +//@message_id The identifier of the message to be replied in the same chat and forum topic //@quote Quote from the message to be replied; pass null if none. Must always be null for replies in secret chats -inputMessageReplyToMessage chat_id:int53 message_id:int53 quote:inputTextQuote = InputMessageReplyTo; +inputMessageReplyToMessage message_id:int53 quote:inputTextQuote = InputMessageReplyTo; + +//@description Describes a message to be replied that is from a different chat or a forum topic; not supported in secret chats +//@chat_id The identifier of the chat to which the message to be replied belongs +//@message_id The identifier of the message to be replied in the specified chat. A message can be replied in another chat or topic only if message.can_be_replied_in_another_chat +//@quote Quote from the message to be replied; pass null if none +inputMessageReplyToExternalMessage chat_id:int53 message_id:int53 quote:inputTextQuote = InputMessageReplyTo; //@description Describes a story to be replied //@story_sender_chat_id The identifier of the sender of the story. Currently, stories can be replied only in the sender's chat and channel stories can't be replied @@ -1790,7 +1798,8 @@ reactionNotificationSettings message_reaction_source:ReactionNotificationSource //@reply_to Information about the message to be replied; must be of the type inputMessageReplyToMessage; may be null if none //@date Point in time (Unix timestamp) when the draft was created //@input_message_text Content of the message draft; must be of the type inputMessageText, inputMessageVideoNote, or inputMessageVoiceNote -draftMessage reply_to:InputMessageReplyTo date:int32 input_message_text:InputMessageContent = DraftMessage; +//@effect_id Identifier of the effect to apply to the message when it is sent; 0 if none +draftMessage reply_to:InputMessageReplyTo date:int32 input_message_text:InputMessageContent effect_id:int64 = DraftMessage; //@class ChatType @description Describes the type of chat @@ -2613,6 +2622,13 @@ bankCardInfo title:string actions:vector = BankCardInfo; //@postal_code Address postal code address country_code:string state:string city:string street_line1:string street_line2:string postal_code:string = Address; +//@description Describes an address of a location +//@country_code A two-letter ISO 3166-1 alpha-2 country code +//@state State, if applicable; empty if unknown +//@city City; empty if unknown +//@street The address; empty if unknown +locationAddress country_code:string state:string city:string street:string = LocationAddress; + //@description Contains parameters of the application theme //@background_color A color of the background in the RGB24 format @@ -2716,7 +2732,7 @@ paymentOption title:string url:string = PaymentOption; //@need_password True, if the user will be able to save credentials, if sets up a 2-step verification password paymentFormTypeRegular invoice:invoice payment_provider_user_id:int53 payment_provider:PaymentProvider additional_payment_options:vector saved_order_info:orderInfo saved_credentials:vector can_save_credentials:Bool need_password:Bool = PaymentFormType; -//@description The payment form is for a payment in Telegram stars @star_count Number of stars that will be paid +//@description The payment form is for a payment in Telegram stars @star_count Number of Telegram stars that will be paid paymentFormTypeStars star_count:int53 = PaymentFormType; @@ -2746,7 +2762,7 @@ paymentResult success:Bool verification_url:string = PaymentResult; paymentReceiptTypeRegular payment_provider_user_id:int53 invoice:invoice order_info:orderInfo shipping_option:shippingOption credentials_title:string tip_amount:int53 = PaymentReceiptType; //@description The payment was done using Telegram stars -//@star_count Number of stars that were paid +//@star_count Number of Telegram stars that were paid //@transaction_id Unique identifier of the transaction that can be used to dispute it paymentReceiptTypeStars star_count:int53 transaction_id:string = PaymentReceiptType; @@ -3490,7 +3506,7 @@ messageSelfDestructTypeImmediately = MessageSelfDestructType; //@protect_content Pass true if the content of the message must be protected from forwarding and saving; for bots only //@update_order_of_installed_sticker_sets Pass true if the user explicitly chosen a sticker or a custom emoji from an installed sticker set; applicable only to sendMessage and sendMessageAlbum //@scheduling_state Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, live location messages and self-destructing messages can't be scheduled -//@effect_id Identifier of the effect to apply to the message; applicable only to sendMessage and sendMessageAlbum in private chats +//@effect_id Identifier of the effect to apply to the message; pass 0 if none; applicable only to sendMessage and sendMessageAlbum in private chats //@sending_id Non-persistent identifier, which will be returned back in messageSendingStatePending object and can be used to match sent messages and corresponding updateNewMessage updates //@only_preview Pass true to get a fake message instead of actually sending them messageSendOptions disable_notification:Bool from_background:Bool protect_content:Bool update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState effect_id:int64 sending_id:int32 only_preview:Bool = MessageSendOptions; @@ -3773,13 +3789,13 @@ userStatusLastMonth by_my_privacy_settings:Bool = UserStatus; //@description Represents an emoji with its keyword @emoji The emoji @keyword The keyword emojiKeyword emoji:string keyword:string = EmojiKeyword; -//@description Represents a list of emoji with their keywords @emoji_keywords List of emoji with their keywords +//@description Represents a list of emojis with their keywords @emoji_keywords List of emojis with their keywords emojiKeywords emoji_keywords:vector = EmojiKeywords; //@description Represents a list of stickers @stickers List of stickers stickers stickers:vector = Stickers; -//@description Represents a list of emoji @emojis List of emojis +//@description Represents a list of emojis @emojis List of emojis emojis emojis:vector = Emojis; //@description Represents a sticker set @@ -3797,7 +3813,7 @@ emojis emojis:vector = Emojis; //@is_allowed_as_chat_emoji_status True, if stickers in the sticker set are custom emoji that can be used as chat emoji status; for custom emoji sticker sets only //@is_viewed True for already viewed trending sticker sets //@stickers List of stickers in this set -//@emojis A list of emoji corresponding to the stickers in the same order. The list is only for informational purposes, because a sticker is always sent with a fixed emoji from the corresponding Sticker object +//@emojis A list of emojis corresponding to the stickers in the same order. The list is only for informational purposes, because a sticker is always sent with a fixed emoji from the corresponding Sticker object stickerSet id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:vector is_owned:Bool is_installed:Bool is_archived:Bool is_official:Bool sticker_type:StickerType needs_repainting:Bool is_allowed_as_chat_emoji_status:Bool is_viewed:Bool stickers:vector emojis:vector = StickerSet; //@description Represents short information about a sticker set @@ -3829,7 +3845,7 @@ trendingStickerSets total_count:int32 sets:vector is_premium:Boo //@description The category contains a list of similar emoji to search for in getStickers and searchStickers for stickers, //-or getInlineQueryResults with the bot getOption("animation_search_bot_username") for animations -//@emojis List of emojis for search for +//@emojis List of emojis to search for emojiCategorySourceSearch emojis:vector = EmojiCategorySource; //@description The category contains premium stickers that must be found by getPremiumStickers @@ -3868,13 +3884,14 @@ emojiCategoryTypeChatPhoto = EmojiCategoryType; //@width_percentage The width of the rectangle, as a percentage of the media width //@height_percentage The height of the rectangle, as a percentage of the media height //@rotation_angle Clockwise rotation angle of the rectangle, in degrees; 0-360 -storyAreaPosition x_percentage:double y_percentage:double width_percentage:double height_percentage:double rotation_angle:double = StoryAreaPosition; +//@corner_radius_percentage The radius of the rectangle corner rounding, as a percentage of the media width +storyAreaPosition x_percentage:double y_percentage:double width_percentage:double height_percentage:double rotation_angle:double corner_radius_percentage:double = StoryAreaPosition; //@class StoryAreaType @description Describes type of clickable rectangle area on a story media -//@description An area pointing to a location @location The location -storyAreaTypeLocation location:location = StoryAreaType; +//@description An area pointing to a location @location The location @address Address of the location; may be null if unknown +storyAreaTypeLocation location:location address:locationAddress = StoryAreaType; //@description An area pointing to a venue @venue Information about the venue storyAreaTypeVenue venue:venue = StoryAreaType; @@ -3889,6 +3906,9 @@ storyAreaTypeSuggestedReaction reaction_type:ReactionType total_count:int32 is_d //@description An area pointing to a message @chat_id Identifier of the chat with the message @message_id Identifier of the message storyAreaTypeMessage chat_id:int53 message_id:int53 = StoryAreaType; +//@description An area pointing to a HTTP or tg:// link @url HTTP or tg:// URL to be opened when the area is clicked +storyAreaTypeLink url:string = StoryAreaType; + //@description Describes a clickable rectangle area on a story media @position Position of the area @type Type of the area storyArea position:storyAreaPosition type:StoryAreaType = StoryArea; @@ -3896,8 +3916,8 @@ storyArea position:storyAreaPosition type:StoryAreaType = StoryArea; //@class InputStoryAreaType @description Describes type of clickable rectangle area on a story media to be added -//@description An area pointing to a location @location The location -inputStoryAreaTypeLocation location:location = InputStoryAreaType; +//@description An area pointing to a location @location The location @address Address of the location; pass null if unknown +inputStoryAreaTypeLocation location:location address:locationAddress = InputStoryAreaType; //@description An area pointing to a venue found by the bot getOption("venue_search_bot_username") //@query_id Identifier of the inline query, used to found the venue @@ -3920,13 +3940,19 @@ inputStoryAreaTypeSuggestedReaction reaction_type:ReactionType is_dark:Bool is_f //@message_id Identifier of the message. Only successfully sent non-scheduled messages can be specified inputStoryAreaTypeMessage chat_id:int53 message_id:int53 = InputStoryAreaType; +//@description An area pointing to a HTTP or tg:// link +//@url HTTP or tg:// URL to be opened when the area is clicked +inputStoryAreaTypeLink url:string = InputStoryAreaType; + //@description Describes a clickable rectangle area on a story media to be added @position Position of the area @type Type of the area inputStoryArea position:storyAreaPosition type:InputStoryAreaType = InputStoryArea; //@description Contains a list of story areas to be added @areas List of input story areas. Currently, a story can have //-up to 10 inputStoryAreaTypeLocation, inputStoryAreaTypeFoundVenue, and inputStoryAreaTypePreviousVenue areas, -//-up to getOption("story_suggested_reaction_area_count_max") inputStoryAreaTypeSuggestedReaction areas, and up to 1 inputStoryAreaTypeMessage area +//-up to getOption("story_suggested_reaction_area_count_max") inputStoryAreaTypeSuggestedReaction areas, +//-up to 1 inputStoryAreaTypeMessage area, and +//-up to getOption("story_link_area_count_max") inputStoryAreaTypeLink areas if the current user is a Telegram Premium user inputStoryAreas areas:vector = InputStoryAreas; @@ -4033,6 +4059,9 @@ story id:int32 sender_chat_id:int53 sender_id:MessageSender date:int32 is_being_ //@pinned_story_ids Identifiers of the pinned stories; returned only in getChatPostedToChatPageStories with from_story_id == 0 stories total_count:int32 stories:vector pinned_story_ids:vector = Stories; +//@description Contains a list of stories found by a search @total_count Approximate total number of stories found @stories List of stories @next_offset The offset for the next request. If empty, then there are no more results +foundStories total_count:int32 stories:vector next_offset:string = FoundStories; + //@description Contains identifier of a story along with identifier of its sender //@sender_chat_id Identifier of the chat that posted the story //@story_id Unique story identifier among stories of the given sender @@ -4293,7 +4322,7 @@ callStateExchangingKeys = CallState; //@servers List of available call servers //@config A JSON-encoded call config //@encryption_key Call encryption key -//@emojis Encryption key emojis fingerprint +//@emojis Encryption key fingerprint represented as 4 emoji //@allow_p2p True, if peer-to-peer connection is allowed by users privacy settings //@custom_parameters Custom JSON-encoded call parameters to be passed to tgcalls callStateReady protocol:callProtocol servers:vector config:string encryption_key:bytes emojis:vector allow_p2p:Bool custom_parameters:string = CallState; @@ -5278,7 +5307,7 @@ premiumStoryFeatureCustomExpirationDuration = PremiumStoryFeature; //@description The ability to save other's unprotected stories premiumStoryFeatureSaveStories = PremiumStoryFeature; -//@description The ability to use links and formatting in story caption +//@description The ability to use links and formatting in story caption, and use inputStoryAreaTypeLink areas premiumStoryFeatureLinksAndFormatting = PremiumStoryFeature; //@description The ability to choose better quality for viewed stories @@ -6846,18 +6875,18 @@ messageStatistics message_interaction_graph:StatisticalGraph message_reaction_gr storyStatistics story_interaction_graph:StatisticalGraph story_reaction_graph:StatisticalGraph = StoryStatistics; -//@class ChatRevenueWithdrawalState @description Describes state of a chat revenue withdrawal +//@class RevenueWithdrawalState @description Describes state of a revenue withdrawal //@description Withdrawal is pending -chatRevenueWithdrawalStatePending = ChatRevenueWithdrawalState; +revenueWithdrawalStatePending = RevenueWithdrawalState; -//@description Withdrawal was completed +//@description Withdrawal succeeded //@date Point in time (Unix timestamp) when the withdrawal was completed //@url The URL where the withdrawal transaction can be viewed -chatRevenueWithdrawalStateCompleted date:int32 url:string = ChatRevenueWithdrawalState; +revenueWithdrawalStateSucceeded date:int32 url:string = RevenueWithdrawalState; -//@description Withdrawal has_failed -chatRevenueWithdrawalStateFailed = ChatRevenueWithdrawalState; +//@description Withdrawal failed +revenueWithdrawalStateFailed = RevenueWithdrawalState; //@class ChatRevenueTransactionType @description Describes type of transaction for revenue earned from sponsored messages in a chat @@ -6871,7 +6900,7 @@ chatRevenueTransactionTypeEarnings start_date:int32 end_date:int32 = ChatRevenue //@withdrawal_date Point in time (Unix timestamp) when the earnings withdrawal started //@provider Name of the payment provider //@state State of the withdrawal -chatRevenueTransactionTypeWithdrawal withdrawal_date:int32 provider:string state:ChatRevenueWithdrawalState = ChatRevenueTransactionType; +chatRevenueTransactionTypeWithdrawal withdrawal_date:int32 provider:string state:RevenueWithdrawalState = ChatRevenueTransactionType; //@description Describes a refund for failed withdrawal of earnings //@refund_date Point in time (Unix timestamp) when the transaction was refunded @@ -6888,6 +6917,21 @@ chatRevenueTransaction cryptocurrency:string cryptocurrency_amount:int64 type:Ch chatRevenueTransactions total_count:int32 transactions:vector = ChatRevenueTransactions; +//@description Contains information about Telegram stars earned by a bot or a chat +//@total_count Total number of the stars earned +//@current_count The number of Telegram stars that aren't withdrawn yet +//@available_count The number of Telegram stars that are available for withdrawal +//@withdrawal_enabled True, if Telegram stars can be withdrawn now or later +//@next_withdrawal_in Time left before the next withdrawal can be started, in seconds; 0 if withdrawal can be started now +starRevenueStatus total_count:int53 current_count:int53 available_count:int53 withdrawal_enabled:Bool next_withdrawal_in:int32 = StarRevenueStatus; + +//@description A detailed statistics about Telegram stars earned by a bot or a chat +//@revenue_by_day_graph A graph containing amount of revenue in a given day +//@status Telegram star revenue status +//@usd_rate Current conversion rate of a Telegram star to USD +starRevenueStatistics revenue_by_day_graph:StatisticalGraph status:starRevenueStatus usd_rate:double = StarRevenueStatistics; + + //@description A point on a Cartesian plane @x The point's first coordinate @y The point's second coordinate point x:double y:double = Point; @@ -7409,6 +7453,11 @@ updateOwnedStarCount star_count:int53 = Update; //@revenue_amount New amount of earned revenue updateChatRevenueAmount chat_id:int53 revenue_amount:chatRevenueAmount = Update; +//@description The Telegram star revenue earned by a bot or a chat has changed. If star transactions screen of the chat is opened, then getStarTransactions may be called to fetch new transactions +//@owner_id Identifier of the owner of the Telegram stars +//@status New Telegram star revenue status +updateStarRevenueStatus owner_id:MessageSender status:starRevenueStatus = Update; + //@description The parameters of speech recognition without Telegram Premium subscription has changed //@max_media_duration The maximum allowed duration of media for speech recognition without Telegram Premium subscription, in seconds //@weekly_count The total number of allowed speech recognitions per week; 0 if none @@ -7491,6 +7540,15 @@ updateNewCallbackQuery id:int64 sender_user_id:int53 chat_id:int53 message_id:in //@payload Query payload updateNewInlineCallbackQuery id:int64 sender_user_id:int53 inline_message_id:string chat_instance:int64 payload:CallbackQueryPayload = Update; +//@description A new incoming callback query from a business message; for bots only +//@id Unique query identifier +//@sender_user_id Identifier of the user who sent the query +//@connection_id Unique identifier of the business connection +//@message The message from the business account from which the query originated +//@chat_instance An identifier uniquely corresponding to the chat a message was sent to +//@payload Query payload +updateNewBusinessCallbackQuery id:int64 sender_user_id:int53 connection_id:string message:businessMessage chat_instance:int64 payload:CallbackQueryPayload = Update; + //@description A new incoming shipping query; for bots only. Only for invoices with flexible price //@id Unique query identifier //@sender_user_id Identifier of the user who sent the query @@ -8071,20 +8129,39 @@ searchCallMessages offset:string limit:int32 only_missed:Bool = FoundMessages; //@limit The maximum number of messages to be returned; up to 100 searchOutgoingDocumentMessages query:string limit:int32 = FoundMessages; -//@description Searches for public channel posts with the given hashtag. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit -//@hashtag Hashtag to search for +//@description Searches for public channel posts containing the given hashtag or cashtag. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit +//@tag Hashtag or cashtag to search for //@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results //@limit The maximum number of messages to be returned; up to 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit -searchPublicHashtagMessages hashtag:string offset:string limit:int32 = FoundMessages; +searchPublicMessagesByTag tag:string offset:string limit:int32 = FoundMessages; -//@description Returns recently searched for hashtags by their prefix @prefix Prefix of hashtags to return @limit The maximum number of hashtags to be returned -getSearchedForHashtags prefix:string limit:int32 = Hashtags; +//@description Searches for public stories containing the given hashtag or cashtag. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit +//@tag Hashtag or cashtag to search for +//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results +//@limit The maximum number of stories to be returned; up to 100. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit +searchPublicStoriesByTag tag:string offset:string limit:int32 = FoundStories; -//@description Removes a hashtag from the list of recently searched for hashtags @hashtag Hashtag to delete -removeSearchedForHashtag hashtag:string = Ok; +//@description Searches for public stories by the given address location. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit +//@address Address of the location +//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results +//@limit The maximum number of stories to be returned; up to 100. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit +searchPublicStoriesByLocation address:locationAddress offset:string limit:int32 = FoundStories; -//@description Clears the list of recently searched for hashtags -clearSearchedForHashtags = Ok; +//@description Searches for public stories from the given venue. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit +//@venue_provider Provider of the venue +//@venue_id Identifier of the venue in the provider database +//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results +//@limit The maximum number of stories to be returned; up to 100. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit +searchPublicStoriesByVenue venue_provider:string venue_id:string offset:string limit:int32 = FoundStories; + +//@description Returns recently searched for hashtags or cashtags by their prefix @tag_prefix Prefix of hashtags or cashtags to return @limit The maximum number of items to be returned +getSearchedForTags tag_prefix:string limit:int32 = Hashtags; + +//@description Removes a hashtag or a cashtag from the list of recently searched for hashtags or cashtags @tag Hashtag or cashtag to delete +removeSearchedForTag tag:string = Ok; + +//@description Clears the list of recently searched for hashtags or cashtags @clear_cashtags Pass true to clear the list of recently searched for cashtags; otherwise, the list of recently searched for hashtags will be cleared +clearSearchedForTags clear_cashtags:Bool = Ok; //@description Deletes all call messages @revoke Pass true to delete the messages for all users deleteAllCallMessages revoke:Bool = Ok; @@ -8376,7 +8453,7 @@ editMessageSchedulingState chat_id:int53 message_id:int53 scheduling_state:Messa //@description Changes the fact-check of a message. Can be only used if getOption("can_edit_fact_check") == true //@chat_id The channel chat the message belongs to -//@message_id Identifier of the message +//@message_id Identifier of the message. The message must be one of the following types: messageAnimation, messageAudio, messageDocument, messagePhoto, messageText, messageVideo //@text New text of the fact-check; 0-getOption("fact_check_length_max") characters; pass null to remove it. Only Bold, Italic, and TextUrl entities with https://t.me/ links are supported setMessageFactCheck chat_id:int53 message_id:int53 text:formattedText = Ok; @@ -8403,6 +8480,57 @@ sendBusinessMessage business_connection_id:string chat_id:int53 reply_to:InputMe //@input_message_contents Contents of messages to be sent. At most 10 messages can be added to an album. All messages must have the same value of show_caption_above_media sendBusinessMessageAlbum business_connection_id:string chat_id:int53 reply_to:InputMessageReplyTo disable_notification:Bool protect_content:Bool effect_id:int64 input_message_contents:vector = BusinessMessages; +//@description Edits the text of a text or game message sent on behalf of a business account; for bots only +//@business_connection_id Unique identifier of business connection on behalf of which the message was sent +//@chat_id The chat the message belongs to +//@message_id Identifier of the message +//@reply_markup The new message reply markup; pass null if none +//@input_message_content New text content of the message. Must be of type inputMessageText +editBusinessMessageText business_connection_id:string chat_id:int53 message_id:int53 reply_markup:ReplyMarkup input_message_content:InputMessageContent = BusinessMessage; + +//@description Edits the content of a live location in a message sent on behalf of a business account; for bots only +//@business_connection_id Unique identifier of business connection on behalf of which the message was sent +//@chat_id The chat the message belongs to +//@message_id Identifier of the message +//@reply_markup The new message reply markup; pass null if none +//@location New location content of the message; pass null to stop sharing the live location +//@live_period New time relative to the message send date, for which the location can be updated, in seconds. If 0x7FFFFFFF specified, then the location can be updated forever. +//-Otherwise, must not exceed the current live_period by more than a day, and the live location expiration date must remain in the next 90 days. Pass 0 to keep the current live_period +//@heading The new direction in which the location moves, in degrees; 1-360. Pass 0 if unknown +//@proximity_alert_radius The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled +editBusinessMessageLiveLocation business_connection_id:string chat_id:int53 message_id:int53 reply_markup:ReplyMarkup location:location live_period:int32 heading:int32 proximity_alert_radius:int32 = BusinessMessage; + +//@description Edits the content of a message with an animation, an audio, a document, a photo or a video in a message sent on behalf of a business account; for bots only +//@business_connection_id Unique identifier of business connection on behalf of which the message was sent +//@chat_id The chat the message belongs to +//@message_id Identifier of the message +//@reply_markup The new message reply markup; pass null if none; for bots only +//@input_message_content New content of the message. Must be one of the following types: inputMessageAnimation, inputMessageAudio, inputMessageDocument, inputMessagePhoto or inputMessageVideo +editBusinessMessageMedia business_connection_id:string chat_id:int53 message_id:int53 reply_markup:ReplyMarkup input_message_content:InputMessageContent = BusinessMessage; + +//@description Edits the caption of a message sent on behalf of a business account; for bots only +//@business_connection_id Unique identifier of business connection on behalf of which the message was sent +//@chat_id The chat the message belongs to +//@message_id Identifier of the message +//@reply_markup The new message reply markup; pass null if none +//@caption New message content caption; pass null to remove caption; 0-getOption("message_caption_length_max") characters +//@show_caption_above_media Pass true to show the caption above the media; otherwise, caption will be shown below the media. Can be true only for animation, photo, and video messages +editBusinessMessageCaption business_connection_id:string chat_id:int53 message_id:int53 reply_markup:ReplyMarkup caption:formattedText show_caption_above_media:Bool = BusinessMessage; + +//@description Edits the reply markup of a message sent on behalf of a business account; for bots only +//@business_connection_id Unique identifier of business connection on behalf of which the message was sent +//@chat_id The chat the message belongs to +//@message_id Identifier of the message +//@reply_markup The new message reply markup; pass null if none +editBusinessMessageReplyMarkup business_connection_id:string chat_id:int53 message_id:int53 reply_markup:ReplyMarkup = BusinessMessage; + +//@description Stops a poll sent on behalf of a business account; for bots only +//@business_connection_id Unique identifier of business connection on behalf of which the message with the poll was sent +//@chat_id The chat the message belongs to +//@message_id Identifier of the message containing the poll +//@reply_markup The new message reply markup; pass null if none +stopBusinessPoll business_connection_id:string chat_id:int53 message_id:int53 reply_markup:ReplyMarkup = BusinessMessage; + //@description Checks validness of a name for a quick reply shortcut. Can be called synchronously @name The name of the shortcut; 1-32 characters checkQuickReplyShortcutName name:string = Ok; @@ -8465,7 +8593,7 @@ readdQuickReplyShortcutMessages shortcut_name:string message_ids:vector = editQuickReplyMessage shortcut_id:int32 message_id:int53 input_message_content:InputMessageContent = Ok; -//@description Returns the list of custom emojis, which can be used as forum topic icon by all users +//@description Returns the list of custom emoji, which can be used as forum topic icon by all users getForumTopicDefaultIcons = Stickers; //@description Creates a topic in a forum supergroup chat; requires can_manage_topics administrator or can_create_topics member right in the supergroup @@ -9878,7 +10006,7 @@ getUserProfilePhotos user_id:int53 offset:int32 limit:int32 = ChatPhotos; //@description Returns stickers from the installed sticker sets that correspond to any of the given emoji or can be found by sticker-specific keywords. If the query is non-empty, then favorite, recently used or trending stickers may also be returned //@sticker_type Type of the stickers to return -//@query Search query; a space-separated list of emoji or a keyword prefix. If empty, returns all known installed stickers +//@query Search query; a space-separated list of emojis or a keyword prefix. If empty, returns all known installed stickers //@limit The maximum number of stickers to be returned //@chat_id Chat identifier for which to return stickers. Available custom emoji stickers may be different for different chats getStickers sticker_type:StickerType query:string limit:int32 chat_id:int53 = Stickers; @@ -9892,7 +10020,7 @@ getAllStickerEmojis sticker_type:StickerType query:string chat_id:int53 return_o //@description Searches for stickers from public sticker sets that correspond to any of the given emoji //@sticker_type Type of the stickers to return -//@emojis Space-separated list of emoji to search for; must be non-empty +//@emojis Space-separated list of emojis to search for; must be non-empty //@limit The maximum number of stickers to be returned; 0-100 searchStickers sticker_type:StickerType emojis:string limit:int32 = Stickers; @@ -9982,7 +10110,7 @@ searchEmojis text:string input_language_codes:vector = EmojiKeywords; //@input_language_codes List of possible IETF language tags of the user's input language; may be empty if unknown getKeywordEmojis text:string input_language_codes:vector = Emojis; -//@description Returns available emojis categories @type Type of emoji categories to return; pass null to get default emoji categories +//@description Returns available emoji categories @type Type of emoji categories to return; pass null to get default emoji categories getEmojiCategories type:EmojiCategoryType = EmojiCategories; //@description Returns an animated emoji corresponding to a given emoji. Returns a 404 error if the emoji has no animated emoji @emoji The emoji @@ -10612,6 +10740,18 @@ getChatRevenueWithdrawalUrl chat_id:int53 password:string = HttpUrl; getChatRevenueTransactions chat_id:int53 offset:int32 limit:int32 = ChatRevenueTransactions; +//@description Returns detailed Telegram star revenue statistics +//@owner_id Identifier of the owner of the Telegram stars; can be identifier of an owned bot, or identifier of a channel chat with supergroupFullInfo.can_get_revenue_statistics == true +//@is_dark Pass true if a dark theme is used by the application +getStarRevenueStatistics owner_id:MessageSender is_dark:Bool = StarRevenueStatistics; + +//@description Returns URL for Telegram star withdrawal +//@owner_id Identifier of the owner of the Telegram stars; can be identifier of an owned bot, or identifier of a channel chat with supergroupFullInfo.can_get_revenue_statistics == true +//@star_count The number of Telegram stars to withdraw. Must be at least getOption("star_withdrawal_count_min") +//@password The 2-step verification password of the current user +getStarWithdrawalUrl owner_id:MessageSender star_count:int53 password:string = HttpUrl; + + //@description Returns detailed statistics about a chat. Currently, this method can be used only for supergroups and channels. Can be used only if supergroupFullInfo.can_get_statistics == true @chat_id Chat identifier @is_dark Pass true if a dark theme is used by the application getChatStatistics chat_id:int53 is_dark:Bool = ChatStatistics; @@ -10806,7 +10946,7 @@ setStickerPositionInSet sticker:InputFile position:int32 = Ok; //@description Removes a sticker from the set to which it belongs. The sticker set must be owned by the current user @sticker Sticker to remove from the set removeStickerFromSet sticker:InputFile = Ok; -//@description Changes the list of emoji corresponding to a sticker. The sticker must belong to a regular or custom emoji sticker set that is owned by the current user +//@description Changes the list of emojis corresponding to a sticker. The sticker must belong to a regular or custom emoji sticker set that is owned by the current user //@sticker Sticker //@emojis New string with 1-20 emoji corresponding to the sticker setStickerEmojis sticker:InputFile emojis:string = Ok; @@ -10878,10 +11018,13 @@ getPremiumGiveawayInfo chat_id:int53 message_id:int53 = PremiumGiveawayInfo; //@description Returns available options for Telegram stars purchase getStarPaymentOptions = StarPaymentOptions; -//@description Returns the list of Telegram star transactions for the current user -//@offset Offset of the first transaction to return as received from the previous request; use empty string to get the first chunk of results +//@description Returns the list of Telegram star transactions for the specified owner +//@owner_id Identifier of the owner of the Telegram stars; can be the identifier of the current user, identifier of an owned bot, +//-or identifier of a channel chat with supergroupFullInfo.can_get_revenue_statistics == true //@direction Direction of the transactions to receive; pass null to get all transactions -getStarTransactions offset:string direction:StarTransactionDirection = StarTransactions; +//@offset Offset of the first transaction to return as received from the previous request; use empty string to get the first chunk of results +//@limit The maximum number of transactions to return +getStarTransactions owner_id:MessageSender direction:StarTransactionDirection offset:string limit:int32 = StarTransactions; //@description Checks whether an in-store purchase is possible. Must be called before any in-store purchase @purpose Transaction purpose canPurchaseFromStore purpose:StorePaymentPurpose = Ok; diff --git a/example/bot/Bot.go b/example/bot/Bot.go index 4471dea..81e413c 100644 --- a/example/bot/Bot.go +++ b/example/bot/Bot.go @@ -86,7 +86,6 @@ func main() { m, err := client.SendMessage(&tdlib.SendMessageRequest{ ChatId: chatId, ReplyTo: &tdlib.InputMessageReplyToMessage{ - ChatId: chatId, MessageId: msgId, }, InputMessageContent: &tdlib.InputMessageText{ diff --git a/example/command/ReplyCommand.go b/example/command/ReplyCommand.go index 80015d3..bd118f2 100644 --- a/example/command/ReplyCommand.go +++ b/example/command/ReplyCommand.go @@ -97,7 +97,6 @@ func main() { m, err := client.SendMessage(&tdlib.SendMessageRequest{ ChatId: chatId, ReplyTo: &tdlib.InputMessageReplyToMessage{ - ChatId: chatId, MessageId: msgId, }, InputMessageContent: &tdlib.InputMessageText{ @@ -112,7 +111,6 @@ func main() { m, err := client.SendMessage(&tdlib.SendMessageRequest{ ChatId: chatId, ReplyTo: &tdlib.InputMessageReplyToMessage{ - ChatId: chatId, MessageId: msgId, }, InputMessageContent: &tdlib.InputMessageText{ diff --git a/example/event/CustomEventFilter.go b/example/event/CustomEventFilter.go index 1333934..72302ac 100644 --- a/example/event/CustomEventFilter.go +++ b/example/event/CustomEventFilter.go @@ -19,21 +19,19 @@ func GetSenderId(sender tdlib.MessageSender) int64 { func GetTdParameters() *tdlib.SetTdlibParametersRequest { return &tdlib.SetTdlibParametersRequest{ - UseTestDc: false, - DatabaseDirectory: "./tdlib-db", - FilesDirectory: "./tdlib-files", - UseFileDatabase: true, - UseChatInfoDatabase: true, - UseMessageDatabase: true, - UseSecretChats: false, - ApiId: 132712, - ApiHash: "e82c07ad653399a37baca8d1e498e472", - SystemLanguageCode: "en", - DeviceModel: "HuskyNG", - SystemVersion: "3.0", - ApplicationVersion: "3.0", - EnableStorageOptimizer: true, - IgnoreFileNames: false, + UseTestDc: false, + DatabaseDirectory: "./tdlib-db", + FilesDirectory: "./tdlib-files", + UseFileDatabase: true, + UseChatInfoDatabase: true, + UseMessageDatabase: true, + UseSecretChats: false, + ApiId: 132712, + ApiHash: "e82c07ad653399a37baca8d1e498e472", + SystemLanguageCode: "en", + DeviceModel: "HuskyNG", + SystemVersion: "3.0", + ApplicationVersion: "3.0", } } diff --git a/example/media/Photo_or_Album.go b/example/media/Photo_or_Album.go index 4caad1d..0b7138d 100644 --- a/example/media/Photo_or_Album.go +++ b/example/media/Photo_or_Album.go @@ -97,7 +97,6 @@ func main() { m, err := client.SendMessage(&tdlib.SendMessageRequest{ ChatId: chatId, ReplyTo: &tdlib.InputMessageReplyToMessage{ - ChatId: chatId, MessageId: msgId, }, InputMessageContent: &tdlib.InputMessagePhoto{ @@ -119,7 +118,6 @@ func main() { m, err := client.SendMessageAlbum(&tdlib.SendMessageAlbumRequest{ ChatId: chatId, ReplyTo: &tdlib.InputMessageReplyToMessage{ - ChatId: chatId, MessageId: msgId, }, InputMessageContents: []tdlib.InputMessageContent{ diff --git a/example/pending/PendingUpdate.go b/example/pending/PendingUpdate.go index c314659..63d703a 100644 --- a/example/pending/PendingUpdate.go +++ b/example/pending/PendingUpdate.go @@ -91,7 +91,6 @@ func main() { m, err := client.SendMessage(&tdlib.SendMessageRequest{ ChatId: chatId, ReplyTo: &tdlib.InputMessageReplyToMessage{ - ChatId: chatId, MessageId: msgId, }, InputMessageContent: &tdlib.InputMessageText{ From 1f84ff6e1589b86cabfa943ba3498815df92fe76 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Tue, 2 Jul 2024 01:51:28 +0800 Subject: [PATCH 21/54] Update to TDLib 1.8.32 --- client/function.go | 42 ++- client/type.go | 646 +++++++++++++++++++++++++++++++++--------- client/unmarshaler.go | 261 ++++++++++++++--- data/td_api.tl | 180 ++++++++---- 4 files changed, 899 insertions(+), 230 deletions(-) diff --git a/client/function.go b/client/function.go index 8ccd60b..356fb63 100755 --- a/client/function.go +++ b/client/function.go @@ -4346,7 +4346,7 @@ type EditMessageCaptionRequest struct { ReplyMarkup ReplyMarkup `json:"reply_markup"` // New message content caption; 0-getOption("message_caption_length_max") characters; pass null to remove caption Caption *FormattedText `json:"caption"` - // Pass true to show the caption above the media; otherwise, caption will be shown below the media. Can be true only for animation, photo, and video messages + // Pass true to show the caption above the media; otherwise, the caption will be shown below the media. Can be true only for animation, photo, and video messages ShowCaptionAboveMedia bool `json:"show_caption_above_media"` } @@ -4519,7 +4519,7 @@ type EditInlineMessageCaptionRequest struct { ReplyMarkup ReplyMarkup `json:"reply_markup"` // New message content caption; pass null to remove caption; 0-getOption("message_caption_length_max") characters Caption *FormattedText `json:"caption"` - // Pass true to show the caption above the media; otherwise, caption will be shown below the media. Can be true only for animation, photo, and video messages + // Pass true to show the caption above the media; otherwise, the caption will be shown below the media. Can be true only for animation, photo, and video messages ShowCaptionAboveMedia bool `json:"show_caption_above_media"` } @@ -4865,7 +4865,7 @@ type EditBusinessMessageCaptionRequest struct { ReplyMarkup ReplyMarkup `json:"reply_markup"` // New message content caption; pass null to remove caption; 0-getOption("message_caption_length_max") characters Caption *FormattedText `json:"caption"` - // Pass true to show the caption above the media; otherwise, caption will be shown below the media. Can be true only for animation, photo, and video messages + // Pass true to show the caption above the media; otherwise, the caption will be shown below the media. Can be true only for animation, photo, and video messages ShowCaptionAboveMedia bool `json:"show_caption_above_media"` } @@ -17701,7 +17701,7 @@ type GetPaymentFormRequest struct { Theme *ThemeParameters `json:"theme"` } -// Returns an invoice payment form. This method must be called when the user presses inline button of the type inlineKeyboardButtonTypeBuy +// Returns an invoice payment form. This method must be called when the user presses inline button of the type inlineKeyboardButtonTypeBuy, or wants to buy access to media in a messagePaidMedia message func (client *Client) GetPaymentForm(req *GetPaymentFormRequest) (*PaymentForm, error) { result, err := client.Send(Request{ meta: meta{ @@ -19039,7 +19039,7 @@ type GetChatRevenueWithdrawalUrlRequest struct { Password string `json:"password"` } -// Returns URL for chat revenue withdrawal; requires owner privileges in the chat. Currently, this method can be used only for channels if supergroupFullInfo.can_get_revenue_statistics == true and getOption("can_withdraw_chat_revenue") +// Returns a URL for chat revenue withdrawal; requires owner privileges in the chat. Currently, this method can be used only for channels if supergroupFullInfo.can_get_revenue_statistics == true and getOption("can_withdraw_chat_revenue") func (client *Client) GetChatRevenueWithdrawalUrl(req *GetChatRevenueWithdrawalUrlRequest) (*HttpUrl, error) { result, err := client.Send(Request{ meta: meta{ @@ -19094,7 +19094,7 @@ func (client *Client) GetChatRevenueTransactions(req *GetChatRevenueTransactions } type GetStarRevenueStatisticsRequest struct { - // Identifier of the owner of the Telegram stars; can be identifier of an owned bot, or identifier of a channel chat with supergroupFullInfo.can_get_revenue_statistics == true + // Identifier of the owner of the Telegram stars; can be identifier of an owned bot, or identifier of an owned channel chat OwnerId MessageSender `json:"owner_id"` // Pass true if a dark theme is used by the application IsDark bool `json:"is_dark"` @@ -19123,7 +19123,7 @@ func (client *Client) GetStarRevenueStatistics(req *GetStarRevenueStatisticsRequ } type GetStarWithdrawalUrlRequest struct { - // Identifier of the owner of the Telegram stars; can be identifier of an owned bot, or identifier of a channel chat with supergroupFullInfo.can_get_revenue_statistics == true + // Identifier of the owner of the Telegram stars; can be identifier of an owned bot, or identifier of an owned channel chat OwnerId MessageSender `json:"owner_id"` // The number of Telegram stars to withdraw. Must be at least getOption("star_withdrawal_count_min") StarCount int64 `json:"star_count"` @@ -19131,7 +19131,7 @@ type GetStarWithdrawalUrlRequest struct { Password string `json:"password"` } -// Returns URL for Telegram star withdrawal +// Returns a URL for Telegram star withdrawal func (client *Client) GetStarWithdrawalUrl(req *GetStarWithdrawalUrlRequest) (*HttpUrl, error) { result, err := client.Send(Request{ meta: meta{ @@ -19154,6 +19154,32 @@ func (client *Client) GetStarWithdrawalUrl(req *GetStarWithdrawalUrlRequest) (*H return UnmarshalHttpUrl(result.Data) } +type GetStarAdAccountUrlRequest struct { + // Identifier of the owner of the Telegram stars; can be identifier of an owned bot, or identifier of an owned channel chat + OwnerId MessageSender `json:"owner_id"` +} + +// Returns a URL for a Telegram Ad platform account that can be used to set up advertisments for the chat paid in the owned Telegram stars +func (client *Client) GetStarAdAccountUrl(req *GetStarAdAccountUrlRequest) (*HttpUrl, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getStarAdAccountUrl", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalHttpUrl(result.Data) +} + type GetChatStatisticsRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` diff --git a/client/type.go b/client/type.go index 76c7306..df140c3 100755 --- a/client/type.go +++ b/client/type.go @@ -11,6 +11,7 @@ const ( ClassEmailAddressAuthentication = "EmailAddressAuthentication" ClassEmailAddressResetState = "EmailAddressResetState" ClassAuthorizationState = "AuthorizationState" + ClassFirebaseDeviceVerificationParameters = "FirebaseDeviceVerificationParameters" ClassInputFile = "InputFile" ClassThumbnailFormat = "ThumbnailFormat" ClassMaskPoint = "MaskPoint" @@ -64,7 +65,7 @@ const ( ClassPaymentFormType = "PaymentFormType" ClassPaymentReceiptType = "PaymentReceiptType" ClassInputInvoice = "InputInvoice" - ClassMessageExtendedMedia = "MessageExtendedMedia" + ClassPaidMedia = "PaidMedia" ClassPassportElementType = "PassportElementType" ClassPassportElement = "PassportElement" ClassInputPassportElement = "InputPassportElement" @@ -72,6 +73,7 @@ const ( ClassInputPassportElementErrorSource = "InputPassportElementErrorSource" ClassMessageContent = "MessageContent" ClassTextEntityType = "TextEntityType" + ClassInputPaidMediaType = "InputPaidMediaType" ClassMessageSchedulingState = "MessageSchedulingState" ClassMessageSelfDestructType = "MessageSelfDestructType" ClassInputMessageContent = "InputMessageContent" @@ -378,6 +380,7 @@ const ( ClassEncryptedPassportElement = "EncryptedPassportElement" ClassInputPassportElementError = "InputPassportElementError" ClassInputThumbnail = "InputThumbnail" + ClassInputPaidMedia = "InputPaidMedia" ClassMessageSendOptions = "MessageSendOptions" ClassMessageCopyOptions = "MessageCopyOptions" ClassEmojiKeyword = "EmojiKeyword" @@ -576,6 +579,8 @@ const ( TypeAuthorizationStateLoggingOut = "authorizationStateLoggingOut" TypeAuthorizationStateClosing = "authorizationStateClosing" TypeAuthorizationStateClosed = "authorizationStateClosed" + TypeFirebaseDeviceVerificationParametersSafetyNet = "firebaseDeviceVerificationParametersSafetyNet" + TypeFirebaseDeviceVerificationParametersPlayIntegrity = "firebaseDeviceVerificationParametersPlayIntegrity" TypePasswordState = "passwordState" TypeRecoveryEmailAddress = "recoveryEmailAddress" TypeTemporaryPasswordState = "temporaryPasswordState" @@ -687,7 +692,8 @@ const ( TypeStarTransactionPartnerAppStore = "starTransactionPartnerAppStore" TypeStarTransactionPartnerGooglePlay = "starTransactionPartnerGooglePlay" TypeStarTransactionPartnerFragment = "starTransactionPartnerFragment" - TypeStarTransactionPartnerUser = "starTransactionPartnerUser" + TypeStarTransactionPartnerTelegramAds = "starTransactionPartnerTelegramAds" + TypeStarTransactionPartnerBot = "starTransactionPartnerBot" TypeStarTransactionPartnerChannel = "starTransactionPartnerChannel" TypeStarTransactionPartnerUnsupported = "starTransactionPartnerUnsupported" TypeStarTransaction = "starTransaction" @@ -1009,10 +1015,10 @@ const ( TypeInputInvoiceMessage = "inputInvoiceMessage" TypeInputInvoiceName = "inputInvoiceName" TypeInputInvoiceTelegram = "inputInvoiceTelegram" - TypeMessageExtendedMediaPreview = "messageExtendedMediaPreview" - TypeMessageExtendedMediaPhoto = "messageExtendedMediaPhoto" - TypeMessageExtendedMediaVideo = "messageExtendedMediaVideo" - TypeMessageExtendedMediaUnsupported = "messageExtendedMediaUnsupported" + TypePaidMediaPreview = "paidMediaPreview" + TypePaidMediaPhoto = "paidMediaPhoto" + TypePaidMediaVideo = "paidMediaVideo" + TypePaidMediaUnsupported = "paidMediaUnsupported" TypePremiumGiveawayParameters = "premiumGiveawayParameters" TypeDatedFile = "datedFile" TypePassportElementTypePersonalDetails = "passportElementTypePersonalDetails" @@ -1091,6 +1097,7 @@ const ( TypeMessageAnimation = "messageAnimation" TypeMessageAudio = "messageAudio" TypeMessageDocument = "messageDocument" + TypeMessagePaidMedia = "messagePaidMedia" TypeMessagePhoto = "messagePhoto" TypeMessageSticker = "messageSticker" TypeMessageVideo = "messageVideo" @@ -1179,6 +1186,9 @@ const ( TypeTextEntityTypeCustomEmoji = "textEntityTypeCustomEmoji" TypeTextEntityTypeMediaTimestamp = "textEntityTypeMediaTimestamp" TypeInputThumbnail = "inputThumbnail" + TypeInputPaidMediaTypePhoto = "inputPaidMediaTypePhoto" + TypeInputPaidMediaTypeVideo = "inputPaidMediaTypeVideo" + TypeInputPaidMedia = "inputPaidMedia" TypeMessageSchedulingStateSendAtDate = "messageSchedulingStateSendAtDate" TypeMessageSchedulingStateSendWhenOnline = "messageSchedulingStateSendWhenOnline" TypeMessageSelfDestructTypeTimer = "messageSelfDestructTypeTimer" @@ -1189,6 +1199,7 @@ const ( TypeInputMessageAnimation = "inputMessageAnimation" TypeInputMessageAudio = "inputMessageAudio" TypeInputMessageDocument = "inputMessageDocument" + TypeInputMessagePaidMedia = "inputMessagePaidMedia" TypeInputMessagePhoto = "inputMessagePhoto" TypeInputMessageSticker = "inputMessageSticker" TypeInputMessageVideo = "inputMessageVideo" @@ -1515,6 +1526,7 @@ const ( TypePremiumFeatureMessagePrivacy = "premiumFeatureMessagePrivacy" TypePremiumFeatureLastSeenTimes = "premiumFeatureLastSeenTimes" TypePremiumFeatureBusiness = "premiumFeatureBusiness" + TypePremiumFeatureMessageEffects = "premiumFeatureMessageEffects" TypeBusinessFeatureLocation = "businessFeatureLocation" TypeBusinessFeatureOpeningHours = "businessFeatureOpeningHours" TypeBusinessFeatureQuickReplies = "businessFeatureQuickReplies" @@ -1616,6 +1628,7 @@ const ( TypePushMessageContentGameScore = "pushMessageContentGameScore" TypePushMessageContentInvoice = "pushMessageContentInvoice" TypePushMessageContentLocation = "pushMessageContentLocation" + TypePushMessageContentPaidMedia = "pushMessageContentPaidMedia" TypePushMessageContentPhoto = "pushMessageContentPhoto" TypePushMessageContentPoll = "pushMessageContentPoll" TypePushMessageContentPremiumGiftCode = "pushMessageContentPremiumGiftCode" @@ -2092,6 +2105,11 @@ type AuthorizationState interface { AuthorizationStateType() string } +// Describes parameters to be used for device verification +type FirebaseDeviceVerificationParameters interface { + FirebaseDeviceVerificationParametersType() string +} + // Points to a file type InputFile interface { InputFileType() string @@ -2357,9 +2375,9 @@ type InputInvoice interface { InputInvoiceType() string } -// Describes a media, which is attached to an invoice -type MessageExtendedMedia interface { - MessageExtendedMediaType() string +// Describes a paid media +type PaidMedia interface { + PaidMediaType() string } // Contains the type of Telegram Passport element @@ -2397,6 +2415,11 @@ type TextEntityType interface { TextEntityTypeType() string } +// Describes type of paid media to sent +type InputPaidMediaType interface { + InputPaidMediaTypeType() string +} + // Contains information about the time when a scheduled message will be sent type MessageSchedulingState interface { MessageSchedulingStateType() string @@ -3091,10 +3114,8 @@ func (*AuthenticationCodeTypeFragment) AuthenticationCodeTypeType() string { // A digit-only authentication code is delivered via Firebase Authentication to the official Android application type AuthenticationCodeTypeFirebaseAndroid struct { meta - // True, if Play Integrity API must be used for device verification. Otherwise, SafetyNet Attestation API must be used - UsePlayIntegrity bool `json:"use_play_integrity"` - // Nonce to pass to the Play Integrity API or the SafetyNet Attestation API - Nonce []byte `json:"nonce"` + // Parameters to be used for device verification + DeviceVerificationParameters FirebaseDeviceVerificationParameters `json:"device_verification_parameters"` // Length of the code Length int32 `json:"length"` } @@ -3119,6 +3140,25 @@ func (*AuthenticationCodeTypeFirebaseAndroid) AuthenticationCodeTypeType() strin return TypeAuthenticationCodeTypeFirebaseAndroid } +func (authenticationCodeTypeFirebaseAndroid *AuthenticationCodeTypeFirebaseAndroid) UnmarshalJSON(data []byte) error { + var tmp struct { + DeviceVerificationParameters json.RawMessage `json:"device_verification_parameters"` + Length int32 `json:"length"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + authenticationCodeTypeFirebaseAndroid.Length = tmp.Length + + fieldDeviceVerificationParameters, _ := UnmarshalFirebaseDeviceVerificationParameters(tmp.DeviceVerificationParameters) + authenticationCodeTypeFirebaseAndroid.DeviceVerificationParameters = fieldDeviceVerificationParameters + + return nil +} + // A digit-only authentication code is delivered via Firebase Authentication to the official iOS application type AuthenticationCodeTypeFirebaseIos struct { meta @@ -3836,6 +3876,62 @@ func (*AuthorizationStateClosed) AuthorizationStateType() string { return TypeAuthorizationStateClosed } +// Device verification must be performed with the SafetyNet Attestation API +type FirebaseDeviceVerificationParametersSafetyNet struct { + meta + // Nonce to pass to the SafetyNet Attestation API + Nonce []byte `json:"nonce"` +} + +func (entity *FirebaseDeviceVerificationParametersSafetyNet) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FirebaseDeviceVerificationParametersSafetyNet + + return json.Marshal((*stub)(entity)) +} + +func (*FirebaseDeviceVerificationParametersSafetyNet) GetClass() string { + return ClassFirebaseDeviceVerificationParameters +} + +func (*FirebaseDeviceVerificationParametersSafetyNet) GetType() string { + return TypeFirebaseDeviceVerificationParametersSafetyNet +} + +func (*FirebaseDeviceVerificationParametersSafetyNet) FirebaseDeviceVerificationParametersType() string { + return TypeFirebaseDeviceVerificationParametersSafetyNet +} + +// Device verification must be performed with the classic Play Integrity verification (https://developer.android.com/google/play/integrity/classic) +type FirebaseDeviceVerificationParametersPlayIntegrity struct { + meta + // Base64url-encoded nonce to pass to the Play Integrity API + Nonce string `json:"nonce"` + // Cloud project number to pass to the Play Integrity API + CloudProjectNumber JsonInt64 `json:"cloud_project_number"` +} + +func (entity *FirebaseDeviceVerificationParametersPlayIntegrity) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FirebaseDeviceVerificationParametersPlayIntegrity + + return json.Marshal((*stub)(entity)) +} + +func (*FirebaseDeviceVerificationParametersPlayIntegrity) GetClass() string { + return ClassFirebaseDeviceVerificationParameters +} + +func (*FirebaseDeviceVerificationParametersPlayIntegrity) GetType() string { + return TypeFirebaseDeviceVerificationParametersPlayIntegrity +} + +func (*FirebaseDeviceVerificationParametersPlayIntegrity) FirebaseDeviceVerificationParametersType() string { + return TypeFirebaseDeviceVerificationParametersPlayIntegrity +} + // Represents the current state of 2-step verification type PasswordState struct { meta @@ -5912,7 +6008,7 @@ type BotMenuButton struct { meta // Text of the button Text string `json:"text"` - // URL to be passed to openWebApp + // URL of a Web App to open when the button is pressed. If the link is of the type internalLinkTypeWebApp, then it must be processed accordingly. Otherwise, the link must be passed to openWebApp Url string `json:"url"` } @@ -7073,7 +7169,7 @@ func (*PremiumStatePaymentOption) GetType() string { return TypePremiumStatePaymentOption } -// Describes an option for creating Telegram Premium gift codes +// Describes an option for creating Telegram Premium gift codes. Use telegramPaymentPurposePremiumGiftCodes for out-of-store payments type PremiumGiftCodePaymentOption struct { meta // ISO 4217 currency code for Telegram Premium gift code payment @@ -7193,7 +7289,7 @@ func (premiumGiftCodeInfo *PremiumGiftCodeInfo) UnmarshalJSON(data []byte) error return nil } -// Describes an option for buying Telegram stars +// Describes an option for buying Telegram stars. Use telegramPaymentPurposeStars for out-of-store payments type StarPaymentOption struct { meta // ISO 4217 currency code for the payment @@ -7415,33 +7511,60 @@ func (starTransactionPartnerFragment *StarTransactionPartnerFragment) UnmarshalJ return nil } -// The transaction is a transaction with another user -type StarTransactionPartnerUser struct { +// The transaction is a transaction with Telegram Ad platform +type StarTransactionPartnerTelegramAds struct{ meta - // Identifier of the user - UserId int64 `json:"user_id"` - // Information about the bought product; may be null if none - ProductInfo *ProductInfo `json:"product_info"` } -func (entity *StarTransactionPartnerUser) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionPartnerTelegramAds) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub StarTransactionPartnerUser + type stub StarTransactionPartnerTelegramAds return json.Marshal((*stub)(entity)) } -func (*StarTransactionPartnerUser) GetClass() string { +func (*StarTransactionPartnerTelegramAds) GetClass() string { return ClassStarTransactionPartner } -func (*StarTransactionPartnerUser) GetType() string { - return TypeStarTransactionPartnerUser +func (*StarTransactionPartnerTelegramAds) GetType() string { + return TypeStarTransactionPartnerTelegramAds } -func (*StarTransactionPartnerUser) StarTransactionPartnerType() string { - return TypeStarTransactionPartnerUser +func (*StarTransactionPartnerTelegramAds) StarTransactionPartnerType() string { + return TypeStarTransactionPartnerTelegramAds +} + +// The transaction is a transaction with a bot +type StarTransactionPartnerBot struct { + meta + // Identifier of the bot + BotUserId int64 `json:"bot_user_id"` + // Information about the bought product; may be null if not applicable + ProductInfo *ProductInfo `json:"product_info"` + // Invoice payload; for bots only + InvoicePayload []byte `json:"invoice_payload"` +} + +func (entity *StarTransactionPartnerBot) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionPartnerBot + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionPartnerBot) GetClass() string { + return ClassStarTransactionPartner +} + +func (*StarTransactionPartnerBot) GetType() string { + return TypeStarTransactionPartnerBot +} + +func (*StarTransactionPartnerBot) StarTransactionPartnerType() string { + return TypeStarTransactionPartnerBot } // The transaction is a transaction with a channel chat @@ -7449,6 +7572,10 @@ type StarTransactionPartnerChannel struct { meta // Identifier of the chat ChatId int64 `json:"chat_id"` + // Identifier of the corresponding message with paid media; can be an identifier of a deleted message + PaidMediaMessageId int64 `json:"paid_media_message_id"` + // Information about the bought media + Media []PaidMedia `json:"media"` } func (entity *StarTransactionPartnerChannel) MarshalJSON() ([]byte, error) { @@ -7471,6 +7598,27 @@ func (*StarTransactionPartnerChannel) StarTransactionPartnerType() string { return TypeStarTransactionPartnerChannel } +func (starTransactionPartnerChannel *StarTransactionPartnerChannel) UnmarshalJSON(data []byte) error { + var tmp struct { + ChatId int64 `json:"chat_id"` + PaidMediaMessageId int64 `json:"paid_media_message_id"` + Media []json.RawMessage `json:"media"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + starTransactionPartnerChannel.ChatId = tmp.ChatId + starTransactionPartnerChannel.PaidMediaMessageId = tmp.PaidMediaMessageId + + fieldMedia, _ := UnmarshalListOfPaidMedia(tmp.Media) + starTransactionPartnerChannel.Media = fieldMedia + + return nil +} + // The transaction is a transaction with unknown partner type StarTransactionPartnerUnsupported struct{ meta @@ -9718,6 +9866,8 @@ type SupergroupFullInfo struct { CanHaveSponsoredMessages bool `json:"can_have_sponsored_messages"` // True, if aggressive anti-spam checks are enabled in the supergroup. The value of this field is only available to chat administrators HasAggressiveAntiSpamEnabled bool `json:"has_aggressive_anti_spam_enabled"` + // True, if paid media can be sent and forwarded to the channel chat; for channels only + HasPaidMediaAllowed bool `json:"has_paid_media_allowed"` // True, if the supergroup or channel has pinned stories HasPinnedStories bool `json:"has_pinned_stories"` // Number of times the current user boosted the supergroup or channel @@ -10997,7 +11147,7 @@ type MessageReplyToMessage struct { Origin MessageOrigin `json:"origin"` // Point in time (Unix timestamp) when the message was sent if the message was from another chat or topic; 0 for messages from the same chat OriginSendDate int32 `json:"origin_send_date"` - // Media content of the message if the message was from another chat or topic; may be null for messages from the same chat and messages without media. Can be only one of the following types: messageAnimation, messageAudio, messageContact, messageDice, messageDocument, messageGame, messageInvoice, messageLocation, messagePhoto, messagePoll, messagePremiumGiveaway, messagePremiumGiveawayWinners, messageSticker, messageStory, messageText (for link preview), messageVenue, messageVideo, messageVideoNote, or messageVoiceNote + // Media content of the message if the message was from another chat or topic; may be null for messages from the same chat and messages without media. Can be only one of the following types: messageAnimation, messageAudio, messageContact, messageDice, messageDocument, messageGame, messageInvoice, messageLocation, messagePaidMedia, messagePhoto, messagePoll, messagePremiumGiveaway, messagePremiumGiveawayWinners, messageSticker, messageStory, messageText (for link preview), messageVenue, messageVideo, messageVideoNote, or messageVoiceNote Content MessageContent `json:"content"` } @@ -14312,7 +14462,7 @@ func (keyboardButton *KeyboardButton) UnmarshalJSON(data []byte) error { // A button that opens a specified URL type InlineKeyboardButtonTypeUrl struct { meta - // HTTP or tg:// URL to open + // HTTP or tg:// URL to open. If the link is of the type internalLinkTypeWebApp, then the button must be marked as a Web App button Url string `json:"url"` } @@ -17970,6 +18120,8 @@ type ThemeParameters struct { HeaderBackgroundColor int32 `json:"header_background_color"` // A color of the section background in the RGB24 format SectionBackgroundColor int32 `json:"section_background_color"` + // A color of the section separator in the RGB24 format + SectionSeparatorColor int32 `json:"section_separator_color"` // A color of text in the RGB24 format TextColor int32 `json:"text_color"` // An accent color of the text in the RGB24 format @@ -18704,7 +18856,7 @@ func (paymentReceipt *PaymentReceipt) UnmarshalJSON(data []byte) error { return nil } -// An invoice from a message of the type messageInvoice +// An invoice from a message of the type messageInvoice or paid media purchase from messagePaidMedia type InputInvoiceMessage struct { meta // Chat identifier of the message @@ -18804,7 +18956,7 @@ func (inputInvoiceTelegram *InputInvoiceTelegram) UnmarshalJSON(data []byte) err } // The media is hidden until the invoice is paid -type MessageExtendedMediaPreview struct { +type PaidMediaPreview struct { meta // Media width; 0 if unknown Width int32 `json:"width"` @@ -18814,113 +18966,105 @@ type MessageExtendedMediaPreview struct { Duration int32 `json:"duration"` // Media minithumbnail; may be null Minithumbnail *Minithumbnail `json:"minithumbnail"` - // Media caption - Caption *FormattedText `json:"caption"` } -func (entity *MessageExtendedMediaPreview) MarshalJSON() ([]byte, error) { +func (entity *PaidMediaPreview) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub MessageExtendedMediaPreview + type stub PaidMediaPreview return json.Marshal((*stub)(entity)) } -func (*MessageExtendedMediaPreview) GetClass() string { - return ClassMessageExtendedMedia +func (*PaidMediaPreview) GetClass() string { + return ClassPaidMedia } -func (*MessageExtendedMediaPreview) GetType() string { - return TypeMessageExtendedMediaPreview +func (*PaidMediaPreview) GetType() string { + return TypePaidMediaPreview } -func (*MessageExtendedMediaPreview) MessageExtendedMediaType() string { - return TypeMessageExtendedMediaPreview +func (*PaidMediaPreview) PaidMediaType() string { + return TypePaidMediaPreview } // The media is a photo -type MessageExtendedMediaPhoto struct { +type PaidMediaPhoto struct { meta // The photo Photo *Photo `json:"photo"` - // Photo caption - Caption *FormattedText `json:"caption"` } -func (entity *MessageExtendedMediaPhoto) MarshalJSON() ([]byte, error) { +func (entity *PaidMediaPhoto) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub MessageExtendedMediaPhoto + type stub PaidMediaPhoto return json.Marshal((*stub)(entity)) } -func (*MessageExtendedMediaPhoto) GetClass() string { - return ClassMessageExtendedMedia +func (*PaidMediaPhoto) GetClass() string { + return ClassPaidMedia } -func (*MessageExtendedMediaPhoto) GetType() string { - return TypeMessageExtendedMediaPhoto +func (*PaidMediaPhoto) GetType() string { + return TypePaidMediaPhoto } -func (*MessageExtendedMediaPhoto) MessageExtendedMediaType() string { - return TypeMessageExtendedMediaPhoto +func (*PaidMediaPhoto) PaidMediaType() string { + return TypePaidMediaPhoto } // The media is a video -type MessageExtendedMediaVideo struct { +type PaidMediaVideo struct { meta // The video Video *Video `json:"video"` - // Photo caption - Caption *FormattedText `json:"caption"` } -func (entity *MessageExtendedMediaVideo) MarshalJSON() ([]byte, error) { +func (entity *PaidMediaVideo) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub MessageExtendedMediaVideo + type stub PaidMediaVideo return json.Marshal((*stub)(entity)) } -func (*MessageExtendedMediaVideo) GetClass() string { - return ClassMessageExtendedMedia +func (*PaidMediaVideo) GetClass() string { + return ClassPaidMedia } -func (*MessageExtendedMediaVideo) GetType() string { - return TypeMessageExtendedMediaVideo +func (*PaidMediaVideo) GetType() string { + return TypePaidMediaVideo } -func (*MessageExtendedMediaVideo) MessageExtendedMediaType() string { - return TypeMessageExtendedMediaVideo +func (*PaidMediaVideo) PaidMediaType() string { + return TypePaidMediaVideo } // The media is unsupported -type MessageExtendedMediaUnsupported struct { +type PaidMediaUnsupported struct{ meta - // Media caption - Caption *FormattedText `json:"caption"` } -func (entity *MessageExtendedMediaUnsupported) MarshalJSON() ([]byte, error) { +func (entity *PaidMediaUnsupported) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub MessageExtendedMediaUnsupported + type stub PaidMediaUnsupported return json.Marshal((*stub)(entity)) } -func (*MessageExtendedMediaUnsupported) GetClass() string { - return ClassMessageExtendedMedia +func (*PaidMediaUnsupported) GetClass() string { + return ClassPaidMedia } -func (*MessageExtendedMediaUnsupported) GetType() string { - return TypeMessageExtendedMediaUnsupported +func (*PaidMediaUnsupported) GetType() string { + return TypePaidMediaUnsupported } -func (*MessageExtendedMediaUnsupported) MessageExtendedMediaType() string { - return TypeMessageExtendedMediaUnsupported +func (*PaidMediaUnsupported) PaidMediaType() string { + return TypePaidMediaUnsupported } // Describes parameters of a Telegram Premium giveaway @@ -21145,7 +21289,7 @@ type MessageAnimation struct { Animation *Animation `json:"animation"` // Animation caption Caption *FormattedText `json:"caption"` - // True, if caption must be shown above the animation; otherwise, caption must be shown below the animation + // True, if the caption must be shown above the animation; otherwise, the caption must be shown below the animation ShowCaptionAboveMedia bool `json:"show_caption_above_media"` // True, if the animation preview must be covered by a spoiler animation HasSpoiler bool `json:"has_spoiler"` @@ -21231,6 +21375,62 @@ func (*MessageDocument) MessageContentType() string { return TypeMessageDocument } +// A message with paid media +type MessagePaidMedia struct { + meta + // Number of stars needed to buy access to the media in the message + StarCount int64 `json:"star_count"` + // Information about the media + Media []PaidMedia `json:"media"` + // Media caption + Caption *FormattedText `json:"caption"` + // True, if the caption must be shown above the media; otherwise, the caption must be shown below the media + ShowCaptionAboveMedia bool `json:"show_caption_above_media"` +} + +func (entity *MessagePaidMedia) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessagePaidMedia + + return json.Marshal((*stub)(entity)) +} + +func (*MessagePaidMedia) GetClass() string { + return ClassMessageContent +} + +func (*MessagePaidMedia) GetType() string { + return TypeMessagePaidMedia +} + +func (*MessagePaidMedia) MessageContentType() string { + return TypeMessagePaidMedia +} + +func (messagePaidMedia *MessagePaidMedia) UnmarshalJSON(data []byte) error { + var tmp struct { + StarCount int64 `json:"star_count"` + Media []json.RawMessage `json:"media"` + Caption *FormattedText `json:"caption"` + ShowCaptionAboveMedia bool `json:"show_caption_above_media"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messagePaidMedia.StarCount = tmp.StarCount + messagePaidMedia.Caption = tmp.Caption + messagePaidMedia.ShowCaptionAboveMedia = tmp.ShowCaptionAboveMedia + + fieldMedia, _ := UnmarshalListOfPaidMedia(tmp.Media) + messagePaidMedia.Media = fieldMedia + + return nil +} + // A photo message type MessagePhoto struct { meta @@ -21238,7 +21438,7 @@ type MessagePhoto struct { Photo *Photo `json:"photo"` // Photo caption Caption *FormattedText `json:"caption"` - // True, if caption must be shown above the photo; otherwise, caption must be shown below the photo + // True, if the caption must be shown above the photo; otherwise, the caption must be shown below the photo ShowCaptionAboveMedia bool `json:"show_caption_above_media"` // True, if the photo preview must be covered by a spoiler animation HasSpoiler bool `json:"has_spoiler"` @@ -21302,7 +21502,7 @@ type MessageVideo struct { Video *Video `json:"video"` // Video caption Caption *FormattedText `json:"caption"` - // True, if caption must be shown above the video; otherwise, caption must be shown below the video + // True, if the caption must be shown above the video; otherwise, the caption must be shown below the video ShowCaptionAboveMedia bool `json:"show_caption_above_media"` // True, if the video preview must be covered by a spoiler animation HasSpoiler bool `json:"has_spoiler"` @@ -21774,8 +21974,10 @@ type MessageInvoice struct { NeedShippingAddress bool `json:"need_shipping_address"` // The identifier of the message with the receipt, after the product has been purchased ReceiptMessageId int64 `json:"receipt_message_id"` - // Extended media attached to the invoice; may be null - ExtendedMedia MessageExtendedMedia `json:"extended_media"` + // Extended media attached to the invoice; may be null if none + PaidMedia PaidMedia `json:"paid_media"` + // Extended media caption; may be null if none + PaidMediaCaption *FormattedText `json:"paid_media_caption"` } func (entity *MessageInvoice) MarshalJSON() ([]byte, error) { @@ -21807,7 +22009,8 @@ func (messageInvoice *MessageInvoice) UnmarshalJSON(data []byte) error { IsTest bool `json:"is_test"` NeedShippingAddress bool `json:"need_shipping_address"` ReceiptMessageId int64 `json:"receipt_message_id"` - ExtendedMedia json.RawMessage `json:"extended_media"` + PaidMedia json.RawMessage `json:"paid_media"` + PaidMediaCaption *FormattedText `json:"paid_media_caption"` } err := json.Unmarshal(data, &tmp) @@ -21822,9 +22025,10 @@ func (messageInvoice *MessageInvoice) UnmarshalJSON(data []byte) error { messageInvoice.IsTest = tmp.IsTest messageInvoice.NeedShippingAddress = tmp.NeedShippingAddress messageInvoice.ReceiptMessageId = tmp.ReceiptMessageId + messageInvoice.PaidMediaCaption = tmp.PaidMediaCaption - fieldExtendedMedia, _ := UnmarshalMessageExtendedMedia(tmp.ExtendedMedia) - messageInvoice.ExtendedMedia = fieldExtendedMedia + fieldPaidMedia, _ := UnmarshalPaidMedia(tmp.PaidMedia) + messageInvoice.PaidMedia = fieldPaidMedia return nil } @@ -22854,7 +23058,7 @@ func (messagePremiumGiftCode *MessagePremiumGiftCode) UnmarshalJSON(data []byte) return nil } -// A Telegram Premium giveaway was created for the chat +// A Telegram Premium giveaway was created for the chat. Use telegramPaymentPurposePremiumGiveaway or storePaymentPurposePremiumGiveaway to create a giveaway type MessagePremiumGiveawayCreated struct{ meta } @@ -23931,6 +24135,122 @@ func (inputThumbnail *InputThumbnail) UnmarshalJSON(data []byte) error { return nil } +// The media is a photo. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20 +type InputPaidMediaTypePhoto struct{ + meta +} + +func (entity *InputPaidMediaTypePhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputPaidMediaTypePhoto + + return json.Marshal((*stub)(entity)) +} + +func (*InputPaidMediaTypePhoto) GetClass() string { + return ClassInputPaidMediaType +} + +func (*InputPaidMediaTypePhoto) GetType() string { + return TypeInputPaidMediaTypePhoto +} + +func (*InputPaidMediaTypePhoto) InputPaidMediaTypeType() string { + return TypeInputPaidMediaTypePhoto +} + +// The media is a video +type InputPaidMediaTypeVideo struct { + meta + // Duration of the video, in seconds + Duration int32 `json:"duration"` + // True, if the video is supposed to be streamed + SupportsStreaming bool `json:"supports_streaming"` +} + +func (entity *InputPaidMediaTypeVideo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputPaidMediaTypeVideo + + return json.Marshal((*stub)(entity)) +} + +func (*InputPaidMediaTypeVideo) GetClass() string { + return ClassInputPaidMediaType +} + +func (*InputPaidMediaTypeVideo) GetType() string { + return TypeInputPaidMediaTypeVideo +} + +func (*InputPaidMediaTypeVideo) InputPaidMediaTypeType() string { + return TypeInputPaidMediaTypeVideo +} + +// Describes a paid media to be sent +type InputPaidMedia struct { + meta + // Type of the media + Type InputPaidMediaType `json:"type"` + // Photo or video to be sent + Media InputFile `json:"media"` + // Media thumbnail; pass null to skip thumbnail uploading + Thumbnail *InputThumbnail `json:"thumbnail"` + // File identifiers of the stickers added to the media, if applicable + AddedStickerFileIds []int32 `json:"added_sticker_file_ids"` + // Media width + Width int32 `json:"width"` + // Media height + Height int32 `json:"height"` +} + +func (entity *InputPaidMedia) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputPaidMedia + + return json.Marshal((*stub)(entity)) +} + +func (*InputPaidMedia) GetClass() string { + return ClassInputPaidMedia +} + +func (*InputPaidMedia) GetType() string { + return TypeInputPaidMedia +} + +func (inputPaidMedia *InputPaidMedia) UnmarshalJSON(data []byte) error { + var tmp struct { + Type json.RawMessage `json:"type"` + Media json.RawMessage `json:"media"` + Thumbnail *InputThumbnail `json:"thumbnail"` + AddedStickerFileIds []int32 `json:"added_sticker_file_ids"` + Width int32 `json:"width"` + Height int32 `json:"height"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + inputPaidMedia.Thumbnail = tmp.Thumbnail + inputPaidMedia.AddedStickerFileIds = tmp.AddedStickerFileIds + inputPaidMedia.Width = tmp.Width + inputPaidMedia.Height = tmp.Height + + fieldType, _ := UnmarshalInputPaidMediaType(tmp.Type) + inputPaidMedia.Type = fieldType + + fieldMedia, _ := UnmarshalInputFile(tmp.Media) + inputPaidMedia.Media = fieldMedia + + return nil +} + // The message will be sent at the specified date type MessageSchedulingStateSendAtDate struct { meta @@ -24103,7 +24423,7 @@ func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { return nil } -// Options to be used when a message content is copied without reference to the original sender. Service messages, messages with messageInvoice, messagePremiumGiveaway, or messagePremiumGiveawayWinners content can't be copied +// Options to be used when a message content is copied without reference to the original sender. Service messages, messages with messageInvoice, messagePaidMedia, messagePremiumGiveaway, or messagePremiumGiveawayWinners content can't be copied type MessageCopyOptions struct { meta // True, if content of the message needs to be copied without reference to the original sender. Always true if the message is forwarded to a secret chat or is local @@ -24180,7 +24500,7 @@ type InputMessageAnimation struct { Height int32 `json:"height"` // Animation caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters Caption *FormattedText `json:"caption"` - // True, if caption must be shown above the animation; otherwise, caption must be shown below the animation; not supported in secret chats + // True, if the caption must be shown above the animation; otherwise, the caption must be shown below the animation; not supported in secret chats ShowCaptionAboveMedia bool `json:"show_caption_above_media"` // True, if the animation preview must be covered by a spoiler animation; not supported in secret chats HasSpoiler bool `json:"has_spoiler"` @@ -24359,6 +24679,39 @@ func (inputMessageDocument *InputMessageDocument) UnmarshalJSON(data []byte) err return nil } +// A message with paid media; can be used only in channel chats with supergroupFullInfo.has_paid_media_allowed +type InputMessagePaidMedia struct { + meta + // The number of stars that must be paid to see the media; 1-getOption("paid_media_message_star_count_max") + StarCount int64 `json:"star_count"` + // The content of the paid media + PaidMedia []*InputPaidMedia `json:"paid_media"` + // Message caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters + Caption *FormattedText `json:"caption"` + // True, if the caption must be shown above the video; otherwise, the caption must be shown below the video; not supported in secret chats + ShowCaptionAboveMedia bool `json:"show_caption_above_media"` +} + +func (entity *InputMessagePaidMedia) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputMessagePaidMedia + + return json.Marshal((*stub)(entity)) +} + +func (*InputMessagePaidMedia) GetClass() string { + return ClassInputMessageContent +} + +func (*InputMessagePaidMedia) GetType() string { + return TypeInputMessagePaidMedia +} + +func (*InputMessagePaidMedia) InputMessageContentType() string { + return TypeInputMessagePaidMedia +} + // A photo message type InputMessagePhoto struct { meta @@ -24374,7 +24727,7 @@ type InputMessagePhoto struct { Height int32 `json:"height"` // Photo caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters Caption *FormattedText `json:"caption"` - // True, if caption must be shown above the photo; otherwise, caption must be shown below the photo; not supported in secret chats + // True, if the caption must be shown above the photo; otherwise, the caption must be shown below the photo; not supported in secret chats ShowCaptionAboveMedia bool `json:"show_caption_above_media"` // Photo self-destruct type; pass null if none; private chats only SelfDestructType MessageSelfDestructType `json:"self_destruct_type"` @@ -24516,7 +24869,7 @@ type InputMessageVideo struct { SupportsStreaming bool `json:"supports_streaming"` // Video caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters Caption *FormattedText `json:"caption"` - // True, if caption must be shown above the video; otherwise, caption must be shown below the video; not supported in secret chats + // True, if the caption must be shown above the video; otherwise, the caption must be shown below the video; not supported in secret chats ShowCaptionAboveMedia bool `json:"show_caption_above_media"` // Video self-destruct type; pass null if none; private chats only SelfDestructType MessageSelfDestructType `json:"self_destruct_type"` @@ -24877,8 +25230,10 @@ type InputMessageInvoice struct { ProviderData string `json:"provider_data"` // Unique invoice bot deep link parameter for the generation of this invoice. If empty, it would be possible to pay directly from forwards of the invoice message StartParameter string `json:"start_parameter"` - // The content of extended media attached to the invoice. The content of the message to be sent. Must be one of the following types: inputMessagePhoto, inputMessageVideo - ExtendedMediaContent InputMessageContent `json:"extended_media_content"` + // The content of paid media attached to the invoice; pass null if none + PaidMedia *InputPaidMedia `json:"paid_media"` + // Paid media caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters + PaidMediaCaption *FormattedText `json:"paid_media_caption"` } func (entity *InputMessageInvoice) MarshalJSON() ([]byte, error) { @@ -24901,45 +25256,6 @@ func (*InputMessageInvoice) InputMessageContentType() string { return TypeInputMessageInvoice } -func (inputMessageInvoice *InputMessageInvoice) UnmarshalJSON(data []byte) error { - var tmp struct { - Invoice *Invoice `json:"invoice"` - Title string `json:"title"` - Description string `json:"description"` - PhotoUrl string `json:"photo_url"` - PhotoSize int32 `json:"photo_size"` - PhotoWidth int32 `json:"photo_width"` - PhotoHeight int32 `json:"photo_height"` - Payload []byte `json:"payload"` - ProviderToken string `json:"provider_token"` - ProviderData string `json:"provider_data"` - StartParameter string `json:"start_parameter"` - ExtendedMediaContent json.RawMessage `json:"extended_media_content"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - inputMessageInvoice.Invoice = tmp.Invoice - inputMessageInvoice.Title = tmp.Title - inputMessageInvoice.Description = tmp.Description - inputMessageInvoice.PhotoUrl = tmp.PhotoUrl - inputMessageInvoice.PhotoSize = tmp.PhotoSize - inputMessageInvoice.PhotoWidth = tmp.PhotoWidth - inputMessageInvoice.PhotoHeight = tmp.PhotoHeight - inputMessageInvoice.Payload = tmp.Payload - inputMessageInvoice.ProviderToken = tmp.ProviderToken - inputMessageInvoice.ProviderData = tmp.ProviderData - inputMessageInvoice.StartParameter = tmp.StartParameter - - fieldExtendedMediaContent, _ := UnmarshalInputMessageContent(tmp.ExtendedMediaContent) - inputMessageInvoice.ExtendedMediaContent = fieldExtendedMediaContent - - return nil -} - // A message with a poll. Polls can't be sent to secret chats. Polls can be sent only to a private chat with a bot type InputMessagePoll struct { meta @@ -28639,7 +28955,7 @@ func (*ResendCodeReasonUserRequest) ResendCodeReasonType() string { // The code is re-sent, because device verification has failed type ResendCodeReasonVerificationFailed struct { meta - // Cause of the verification failure, for example, PLAY_SERVICES_NOT_AVAILABLE, APNS_RECEIVE_TIMEOUT, APNS_INIT_FAILED, etc. + // Cause of the verification failure, for example, PLAY_SERVICES_NOT_AVAILABLE, APNS_RECEIVE_TIMEOUT, or APNS_INIT_FAILED ErrorMessage string `json:"error_message"` } @@ -35283,6 +35599,31 @@ func (*PremiumFeatureBusiness) PremiumFeatureType() string { return TypePremiumFeatureBusiness } +// The ability to use all available message effects +type PremiumFeatureMessageEffects struct{ + meta +} + +func (entity *PremiumFeatureMessageEffects) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumFeatureMessageEffects + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumFeatureMessageEffects) GetClass() string { + return ClassPremiumFeature +} + +func (*PremiumFeatureMessageEffects) GetType() string { + return TypePremiumFeatureMessageEffects +} + +func (*PremiumFeatureMessageEffects) PremiumFeatureType() string { + return TypePremiumFeatureMessageEffects +} + // The ability to set location type BusinessFeatureLocation struct{ meta @@ -36947,7 +37288,7 @@ type BackgroundTypePattern struct { meta // Fill of the background Fill BackgroundFill `json:"fill"` - // Intensity of the pattern when it is shown above the filled background; 0-100. + // Intensity of the pattern when it is shown above the filled background; 0-100 Intensity int32 `json:"intensity"` // True, if the background fill must be applied only to the pattern itself. All other pixels are black in this case. For dark themes only IsInverted bool `json:"is_inverted"` @@ -38250,6 +38591,35 @@ func (*PushMessageContentLocation) PushMessageContentType() string { return TypePushMessageContentLocation } +// A message with paid media +type PushMessageContentPaidMedia struct { + meta + // Number of stars needed to buy access to the media in the message; 0 for pinned message + StarCount int64 `json:"star_count"` + // True, if the message is a pinned message with the specified content + IsPinned bool `json:"is_pinned"` +} + +func (entity *PushMessageContentPaidMedia) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentPaidMedia + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentPaidMedia) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentPaidMedia) GetType() string { + return TypePushMessageContentPaidMedia +} + +func (*PushMessageContentPaidMedia) PushMessageContentType() string { + return TypePushMessageContentPaidMedia +} + // A photo message type PushMessageContentPhoto struct { meta @@ -40321,7 +40691,7 @@ func (*UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages) UserPrivacySetti // Contains privacy settings for message read date in private chats. Read dates are always shown to the users that can see online status of the current user regardless of this setting type ReadDatePrivacySettings struct { meta - // True, if message read date is shown to other users in private chats. If false and the current user isn't a Telegram Premium user, then they will not be able to see other's message read date. + // True, if message read date is shown to other users in private chats. If false and the current user isn't a Telegram Premium user, then they will not be able to see other's message read date ShowReadDate bool `json:"show_read_date"` } @@ -41676,7 +42046,7 @@ func (*InternalLinkTypeBotStart) InternalLinkTypeType() string { return TypeInternalLinkTypeBotStart } -// The link is a link to a Telegram bot, which is supposed to be added to a group chat. Call searchPublicChat with the given bot username, check that the user is a bot and can be added to groups, ask the current user to select a basic group or a supergroup chat to add the bot to, taking into account that bots can be added to a public supergroup only by administrators of the supergroup. If administrator rights are provided by the link, call getChatMember to receive the current bot rights in the chat and if the bot already is an administrator, check that the current user can edit its administrator rights, combine received rights with the requested administrator rights, show confirmation box to the user, and call setChatMemberStatus with the chosen chat and confirmed administrator rights. Before call to setChatMemberStatus it may be required to upgrade the chosen basic group chat to a supergroup chat. Then, if start_parameter isn't empty, call sendBotStartMessage with the given start parameter and the chosen chat; otherwise, just send /start message with bot's username added to the chat. +// The link is a link to a Telegram bot, which is supposed to be added to a group chat. Call searchPublicChat with the given bot username, check that the user is a bot and can be added to groups, ask the current user to select a basic group or a supergroup chat to add the bot to, taking into account that bots can be added to a public supergroup only by administrators of the supergroup. If administrator rights are provided by the link, call getChatMember to receive the current bot rights in the chat and if the bot already is an administrator, check that the current user can edit its administrator rights, combine received rights with the requested administrator rights, show confirmation box to the user, and call setChatMemberStatus with the chosen chat and confirmed administrator rights. Before call to setChatMemberStatus it may be required to upgrade the chosen basic group chat to a supergroup chat. Then, if start_parameter isn't empty, call sendBotStartMessage with the given start parameter and the chosen chat; otherwise, just send /start message with bot's username added to the chat type InternalLinkTypeBotStartInGroup struct { meta // Username of the bot @@ -42441,6 +42811,8 @@ type InternalLinkTypeSideMenuBot struct { BotUsername string `json:"bot_username"` // URL to be passed to getWebAppUrl Url string `json:"url"` + // True, if the Web App must be opened in a compact mode instead of a full-size mode + IsCompact bool `json:"is_compact"` } func (entity *InternalLinkTypeSideMenuBot) MarshalJSON() ([]byte, error) { @@ -42721,6 +43093,8 @@ type InternalLinkTypeWebApp struct { WebAppShortName string `json:"web_app_short_name"` // Start parameter to be passed to getWebAppLinkUrl StartParameter string `json:"start_parameter"` + // True, if the Web App must be opened in a compact mode instead of a full-size mode + IsCompact bool `json:"is_compact"` } func (entity *InternalLinkTypeWebApp) MarshalJSON() ([]byte, error) { @@ -49406,8 +49780,10 @@ type UpdateApplicationVerificationRequired struct { meta // Unique identifier for the verification process VerificationId int64 `json:"verification_id"` - // Unique nonce for the classic Play Integrity verification (https://developer.android.com/google/play/integrity/classic) for Android, or a unique string to compare with verify_nonce field from a push notification for iOS + // Unique base64url-encoded nonce for the classic Play Integrity verification (https://developer.android.com/google/play/integrity/classic) for Android, or a unique string to compare with verify_nonce field from a push notification for iOS Nonce string `json:"nonce"` + // Cloud project number to pass to the Play Integrity API on Android + CloudProjectNumber JsonInt64 `json:"cloud_project_number"` } func (entity *UpdateApplicationVerificationRequired) MarshalJSON() ([]byte, error) { diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 945db86..cf266e8 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -200,6 +200,40 @@ func UnmarshalListOfAuthorizationState(dataList []json.RawMessage) ([]Authorizat return list, nil } +func UnmarshalFirebaseDeviceVerificationParameters(data json.RawMessage) (FirebaseDeviceVerificationParameters, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeFirebaseDeviceVerificationParametersSafetyNet: + return UnmarshalFirebaseDeviceVerificationParametersSafetyNet(data) + + case TypeFirebaseDeviceVerificationParametersPlayIntegrity: + return UnmarshalFirebaseDeviceVerificationParametersPlayIntegrity(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfFirebaseDeviceVerificationParameters(dataList []json.RawMessage) ([]FirebaseDeviceVerificationParameters, error) { + list := []FirebaseDeviceVerificationParameters{} + + for _, data := range dataList { + entity, err := UnmarshalFirebaseDeviceVerificationParameters(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalInputFile(data json.RawMessage) (InputFile, error) { var meta meta @@ -680,8 +714,11 @@ func UnmarshalStarTransactionPartner(data json.RawMessage) (StarTransactionPartn case TypeStarTransactionPartnerFragment: return UnmarshalStarTransactionPartnerFragment(data) - case TypeStarTransactionPartnerUser: - return UnmarshalStarTransactionPartnerUser(data) + case TypeStarTransactionPartnerTelegramAds: + return UnmarshalStarTransactionPartnerTelegramAds(data) + + case TypeStarTransactionPartnerBot: + return UnmarshalStarTransactionPartnerBot(data) case TypeStarTransactionPartnerChannel: return UnmarshalStarTransactionPartnerChannel(data) @@ -2398,7 +2435,7 @@ func UnmarshalListOfInputInvoice(dataList []json.RawMessage) ([]InputInvoice, er return list, nil } -func UnmarshalMessageExtendedMedia(data json.RawMessage) (MessageExtendedMedia, error) { +func UnmarshalPaidMedia(data json.RawMessage) (PaidMedia, error) { var meta meta err := json.Unmarshal(data, &meta) @@ -2407,28 +2444,28 @@ func UnmarshalMessageExtendedMedia(data json.RawMessage) (MessageExtendedMedia, } switch meta.Type { - case TypeMessageExtendedMediaPreview: - return UnmarshalMessageExtendedMediaPreview(data) + case TypePaidMediaPreview: + return UnmarshalPaidMediaPreview(data) - case TypeMessageExtendedMediaPhoto: - return UnmarshalMessageExtendedMediaPhoto(data) + case TypePaidMediaPhoto: + return UnmarshalPaidMediaPhoto(data) - case TypeMessageExtendedMediaVideo: - return UnmarshalMessageExtendedMediaVideo(data) + case TypePaidMediaVideo: + return UnmarshalPaidMediaVideo(data) - case TypeMessageExtendedMediaUnsupported: - return UnmarshalMessageExtendedMediaUnsupported(data) + case TypePaidMediaUnsupported: + return UnmarshalPaidMediaUnsupported(data) default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } } -func UnmarshalListOfMessageExtendedMedia(dataList []json.RawMessage) ([]MessageExtendedMedia, error) { - list := []MessageExtendedMedia{} +func UnmarshalListOfPaidMedia(dataList []json.RawMessage) ([]PaidMedia, error) { + list := []PaidMedia{} for _, data := range dataList { - entity, err := UnmarshalMessageExtendedMedia(data) + entity, err := UnmarshalPaidMedia(data) if err != nil { return nil, err } @@ -2770,6 +2807,9 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessageDocument: return UnmarshalMessageDocument(data) + case TypeMessagePaidMedia: + return UnmarshalMessagePaidMedia(data) + case TypeMessagePhoto: return UnmarshalMessagePhoto(data) @@ -3078,6 +3118,40 @@ func UnmarshalListOfTextEntityType(dataList []json.RawMessage) ([]TextEntityType return list, nil } +func UnmarshalInputPaidMediaType(data json.RawMessage) (InputPaidMediaType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeInputPaidMediaTypePhoto: + return UnmarshalInputPaidMediaTypePhoto(data) + + case TypeInputPaidMediaTypeVideo: + return UnmarshalInputPaidMediaTypeVideo(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfInputPaidMediaType(dataList []json.RawMessage) ([]InputPaidMediaType, error) { + list := []InputPaidMediaType{} + + for _, data := range dataList { + entity, err := UnmarshalInputPaidMediaType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalMessageSchedulingState(data json.RawMessage) (MessageSchedulingState, error) { var meta meta @@ -3167,6 +3241,9 @@ func UnmarshalInputMessageContent(data json.RawMessage) (InputMessageContent, er case TypeInputMessageDocument: return UnmarshalInputMessageDocument(data) + case TypeInputMessagePaidMedia: + return UnmarshalInputMessagePaidMedia(data) + case TypeInputMessagePhoto: return UnmarshalInputMessagePhoto(data) @@ -4838,6 +4915,9 @@ func UnmarshalPremiumFeature(data json.RawMessage) (PremiumFeature, error) { case TypePremiumFeatureBusiness: return UnmarshalPremiumFeatureBusiness(data) + case TypePremiumFeatureMessageEffects: + return UnmarshalPremiumFeatureMessageEffects(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -5553,6 +5633,9 @@ func UnmarshalPushMessageContent(data json.RawMessage) (PushMessageContent, erro case TypePushMessageContentLocation: return UnmarshalPushMessageContentLocation(data) + case TypePushMessageContentPaidMedia: + return UnmarshalPushMessageContentPaidMedia(data) + case TypePushMessageContentPhoto: return UnmarshalPushMessageContentPhoto(data) @@ -7931,6 +8014,22 @@ func UnmarshalAuthorizationStateClosed(data json.RawMessage) (*AuthorizationStat return &resp, err } +func UnmarshalFirebaseDeviceVerificationParametersSafetyNet(data json.RawMessage) (*FirebaseDeviceVerificationParametersSafetyNet, error) { + var resp FirebaseDeviceVerificationParametersSafetyNet + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFirebaseDeviceVerificationParametersPlayIntegrity(data json.RawMessage) (*FirebaseDeviceVerificationParametersPlayIntegrity, error) { + var resp FirebaseDeviceVerificationParametersPlayIntegrity + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPasswordState(data json.RawMessage) (*PasswordState, error) { var resp PasswordState @@ -8819,8 +8918,16 @@ func UnmarshalStarTransactionPartnerFragment(data json.RawMessage) (*StarTransac return &resp, err } -func UnmarshalStarTransactionPartnerUser(data json.RawMessage) (*StarTransactionPartnerUser, error) { - var resp StarTransactionPartnerUser +func UnmarshalStarTransactionPartnerTelegramAds(data json.RawMessage) (*StarTransactionPartnerTelegramAds, error) { + var resp StarTransactionPartnerTelegramAds + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionPartnerBot(data json.RawMessage) (*StarTransactionPartnerBot, error) { + var resp StarTransactionPartnerBot err := json.Unmarshal(data, &resp) @@ -11395,32 +11502,32 @@ func UnmarshalInputInvoiceTelegram(data json.RawMessage) (*InputInvoiceTelegram, return &resp, err } -func UnmarshalMessageExtendedMediaPreview(data json.RawMessage) (*MessageExtendedMediaPreview, error) { - var resp MessageExtendedMediaPreview +func UnmarshalPaidMediaPreview(data json.RawMessage) (*PaidMediaPreview, error) { + var resp PaidMediaPreview err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalMessageExtendedMediaPhoto(data json.RawMessage) (*MessageExtendedMediaPhoto, error) { - var resp MessageExtendedMediaPhoto +func UnmarshalPaidMediaPhoto(data json.RawMessage) (*PaidMediaPhoto, error) { + var resp PaidMediaPhoto err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalMessageExtendedMediaVideo(data json.RawMessage) (*MessageExtendedMediaVideo, error) { - var resp MessageExtendedMediaVideo +func UnmarshalPaidMediaVideo(data json.RawMessage) (*PaidMediaVideo, error) { + var resp PaidMediaVideo err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalMessageExtendedMediaUnsupported(data json.RawMessage) (*MessageExtendedMediaUnsupported, error) { - var resp MessageExtendedMediaUnsupported +func UnmarshalPaidMediaUnsupported(data json.RawMessage) (*PaidMediaUnsupported, error) { + var resp PaidMediaUnsupported err := json.Unmarshal(data, &resp) @@ -12051,6 +12158,14 @@ func UnmarshalMessageDocument(data json.RawMessage) (*MessageDocument, error) { return &resp, err } +func UnmarshalMessagePaidMedia(data json.RawMessage) (*MessagePaidMedia, error) { + var resp MessagePaidMedia + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessagePhoto(data json.RawMessage) (*MessagePhoto, error) { var resp MessagePhoto @@ -12755,6 +12870,30 @@ func UnmarshalInputThumbnail(data json.RawMessage) (*InputThumbnail, error) { return &resp, err } +func UnmarshalInputPaidMediaTypePhoto(data json.RawMessage) (*InputPaidMediaTypePhoto, error) { + var resp InputPaidMediaTypePhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPaidMediaTypeVideo(data json.RawMessage) (*InputPaidMediaTypeVideo, error) { + var resp InputPaidMediaTypeVideo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPaidMedia(data json.RawMessage) (*InputPaidMedia, error) { + var resp InputPaidMedia + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageSchedulingStateSendAtDate(data json.RawMessage) (*MessageSchedulingStateSendAtDate, error) { var resp MessageSchedulingStateSendAtDate @@ -12835,6 +12974,14 @@ func UnmarshalInputMessageDocument(data json.RawMessage) (*InputMessageDocument, return &resp, err } +func UnmarshalInputMessagePaidMedia(data json.RawMessage) (*InputMessagePaidMedia, error) { + var resp InputMessagePaidMedia + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInputMessagePhoto(data json.RawMessage) (*InputMessagePhoto, error) { var resp InputMessagePhoto @@ -15443,6 +15590,14 @@ func UnmarshalPremiumFeatureBusiness(data json.RawMessage) (*PremiumFeatureBusin return &resp, err } +func UnmarshalPremiumFeatureMessageEffects(data json.RawMessage) (*PremiumFeatureMessageEffects, error) { + var resp PremiumFeatureMessageEffects + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalBusinessFeatureLocation(data json.RawMessage) (*BusinessFeatureLocation, error) { var resp BusinessFeatureLocation @@ -16251,6 +16406,14 @@ func UnmarshalPushMessageContentLocation(data json.RawMessage) (*PushMessageCont return &resp, err } +func UnmarshalPushMessageContentPaidMedia(data json.RawMessage) (*PushMessageContentPaidMedia, error) { + var resp PushMessageContentPaidMedia + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPushMessageContentPhoto(data json.RawMessage) (*PushMessageContentPhoto, error) { var resp PushMessageContentPhoto @@ -19997,6 +20160,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeAuthorizationStateClosed: return UnmarshalAuthorizationStateClosed(data) + case TypeFirebaseDeviceVerificationParametersSafetyNet: + return UnmarshalFirebaseDeviceVerificationParametersSafetyNet(data) + + case TypeFirebaseDeviceVerificationParametersPlayIntegrity: + return UnmarshalFirebaseDeviceVerificationParametersPlayIntegrity(data) + case TypePasswordState: return UnmarshalPasswordState(data) @@ -20330,8 +20499,11 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarTransactionPartnerFragment: return UnmarshalStarTransactionPartnerFragment(data) - case TypeStarTransactionPartnerUser: - return UnmarshalStarTransactionPartnerUser(data) + case TypeStarTransactionPartnerTelegramAds: + return UnmarshalStarTransactionPartnerTelegramAds(data) + + case TypeStarTransactionPartnerBot: + return UnmarshalStarTransactionPartnerBot(data) case TypeStarTransactionPartnerChannel: return UnmarshalStarTransactionPartnerChannel(data) @@ -21296,17 +21468,17 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInputInvoiceTelegram: return UnmarshalInputInvoiceTelegram(data) - case TypeMessageExtendedMediaPreview: - return UnmarshalMessageExtendedMediaPreview(data) + case TypePaidMediaPreview: + return UnmarshalPaidMediaPreview(data) - case TypeMessageExtendedMediaPhoto: - return UnmarshalMessageExtendedMediaPhoto(data) + case TypePaidMediaPhoto: + return UnmarshalPaidMediaPhoto(data) - case TypeMessageExtendedMediaVideo: - return UnmarshalMessageExtendedMediaVideo(data) + case TypePaidMediaVideo: + return UnmarshalPaidMediaVideo(data) - case TypeMessageExtendedMediaUnsupported: - return UnmarshalMessageExtendedMediaUnsupported(data) + case TypePaidMediaUnsupported: + return UnmarshalPaidMediaUnsupported(data) case TypePremiumGiveawayParameters: return UnmarshalPremiumGiveawayParameters(data) @@ -21542,6 +21714,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageDocument: return UnmarshalMessageDocument(data) + case TypeMessagePaidMedia: + return UnmarshalMessagePaidMedia(data) + case TypeMessagePhoto: return UnmarshalMessagePhoto(data) @@ -21806,6 +21981,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInputThumbnail: return UnmarshalInputThumbnail(data) + case TypeInputPaidMediaTypePhoto: + return UnmarshalInputPaidMediaTypePhoto(data) + + case TypeInputPaidMediaTypeVideo: + return UnmarshalInputPaidMediaTypeVideo(data) + + case TypeInputPaidMedia: + return UnmarshalInputPaidMedia(data) + case TypeMessageSchedulingStateSendAtDate: return UnmarshalMessageSchedulingStateSendAtDate(data) @@ -21836,6 +22020,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInputMessageDocument: return UnmarshalInputMessageDocument(data) + case TypeInputMessagePaidMedia: + return UnmarshalInputMessagePaidMedia(data) + case TypeInputMessagePhoto: return UnmarshalInputMessagePhoto(data) @@ -22814,6 +23001,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePremiumFeatureBusiness: return UnmarshalPremiumFeatureBusiness(data) + case TypePremiumFeatureMessageEffects: + return UnmarshalPremiumFeatureMessageEffects(data) + case TypeBusinessFeatureLocation: return UnmarshalBusinessFeatureLocation(data) @@ -23117,6 +23307,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePushMessageContentLocation: return UnmarshalPushMessageContentLocation(data) + case TypePushMessageContentPaidMedia: + return UnmarshalPushMessageContentPaidMedia(data) + case TypePushMessageContentPhoto: return UnmarshalPushMessageContentPhoto(data) diff --git a/data/td_api.tl b/data/td_api.tl index 14fb6f4..2a28b78 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -59,10 +59,9 @@ authenticationCodeTypeMissedCall phone_number_prefix:string length:int32 = Authe authenticationCodeTypeFragment url:string length:int32 = AuthenticationCodeType; //@description A digit-only authentication code is delivered via Firebase Authentication to the official Android application -//@use_play_integrity True, if Play Integrity API must be used for device verification. Otherwise, SafetyNet Attestation API must be used -//@nonce Nonce to pass to the Play Integrity API or the SafetyNet Attestation API +//@device_verification_parameters Parameters to be used for device verification //@length Length of the code -authenticationCodeTypeFirebaseAndroid use_play_integrity:Bool nonce:bytes length:int32 = AuthenticationCodeType; +authenticationCodeTypeFirebaseAndroid device_verification_parameters:FirebaseDeviceVerificationParameters length:int32 = AuthenticationCodeType; //@description A digit-only authentication code is delivered via Firebase Authentication to the official iOS application //@receipt Receipt of successful application token validation to compare with receipt from push notification @@ -173,6 +172,17 @@ authorizationStateClosing = AuthorizationState; authorizationStateClosed = AuthorizationState; +//@class FirebaseDeviceVerificationParameters @description Describes parameters to be used for device verification + +//@description Device verification must be performed with the SafetyNet Attestation API @nonce Nonce to pass to the SafetyNet Attestation API +firebaseDeviceVerificationParametersSafetyNet nonce:bytes = FirebaseDeviceVerificationParameters; + +//@description Device verification must be performed with the classic Play Integrity verification (https://developer.android.com/google/play/integrity/classic) +//@nonce Base64url-encoded nonce to pass to the Play Integrity API +//@cloud_project_number Cloud project number to pass to the Play Integrity API +firebaseDeviceVerificationParametersPlayIntegrity nonce:string cloud_project_number:int64 = FirebaseDeviceVerificationParameters; + + //@description Represents the current state of 2-step verification //@has_password True, if a 2-step verification password is set //@password_hint Hint for the password; may be empty @@ -579,7 +589,9 @@ botCommand command:string description:string = BotCommand; //@description Contains a list of bot commands @bot_user_id Bot's user identifier @commands List of bot commands botCommands bot_user_id:int53 commands:vector = BotCommands; -//@description Describes a button to be shown instead of bot commands menu button @text Text of the button @url URL to be passed to openWebApp +//@description Describes a button to be shown instead of bot commands menu button +//@text Text of the button +//@url URL of a Web App to open when the button is pressed. If the link is of the type internalLinkTypeWebApp, then it must be processed accordingly. Otherwise, the link must be passed to openWebApp botMenuButton text:string url:string = BotMenuButton; @@ -811,7 +823,7 @@ premiumPaymentOption currency:string amount:int53 discount_percentage:int32 mont //@last_transaction_id Identifier of the last in-store transaction for the currently used option premiumStatePaymentOption payment_option:premiumPaymentOption is_current:Bool is_upgrade:Bool last_transaction_id:string = PremiumStatePaymentOption; -//@description Describes an option for creating Telegram Premium gift codes +//@description Describes an option for creating Telegram Premium gift codes. Use telegramPaymentPurposePremiumGiftCodes for out-of-store payments //@currency ISO 4217 currency code for Telegram Premium gift code payment //@amount The amount to pay, in the smallest units of the currency //@user_count Number of users which will be able to activate the gift codes @@ -833,7 +845,7 @@ premiumGiftCodePaymentOptions options:vector = Pre //@use_date Point in time (Unix timestamp) when the code was activated; 0 if none premiumGiftCodeInfo creator_id:MessageSender creation_date:int32 is_from_giveaway:Bool giveaway_message_id:int53 month_count:int32 user_id:int53 use_date:int32 = PremiumGiftCodeInfo; -//@description Describes an option for buying Telegram stars +//@description Describes an option for buying Telegram stars. Use telegramPaymentPurposeStars for out-of-store payments //@currency ISO 4217 currency code for the payment //@amount The amount to pay, in the smallest units of the currency //@star_count Number of Telegram stars that will be purchased @@ -868,11 +880,20 @@ starTransactionPartnerGooglePlay = StarTransactionPartner; //@description The transaction is a transaction with Fragment @withdrawal_state State of the withdrawal; may be null for refunds from Fragment starTransactionPartnerFragment withdrawal_state:RevenueWithdrawalState = StarTransactionPartner; -//@description The transaction is a transaction with another user @user_id Identifier of the user @product_info Information about the bought product; may be null if none -starTransactionPartnerUser user_id:int53 product_info:productInfo = StarTransactionPartner; +//@description The transaction is a transaction with Telegram Ad platform +starTransactionPartnerTelegramAds = StarTransactionPartner; -//@description The transaction is a transaction with a channel chat @chat_id Identifier of the chat -starTransactionPartnerChannel chat_id:int53 = StarTransactionPartner; +//@description The transaction is a transaction with a bot +//@bot_user_id Identifier of the bot +//@product_info Information about the bought product; may be null if not applicable +//@invoice_payload Invoice payload; for bots only +starTransactionPartnerBot bot_user_id:int53 product_info:productInfo invoice_payload:bytes = StarTransactionPartner; + +//@description The transaction is a transaction with a channel chat +//@chat_id Identifier of the chat +//@paid_media_message_id Identifier of the corresponding message with paid media; can be an identifier of a deleted message +//@media Information about the bought media +starTransactionPartnerChannel chat_id:int53 paid_media_message_id:int53 media:vector = StarTransactionPartner; //@description The transaction is a transaction with unknown partner starTransactionPartnerUnsupported = StarTransactionPartner; @@ -1298,6 +1319,7 @@ supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:Chat //-so this option affects only private non-forum supergroups without a linked chat. The value of this field is only available to chat administrators //@can_have_sponsored_messages True, if the chat can have sponsored messages. The value of this field is only available to the owner of the chat //@has_aggressive_anti_spam_enabled True, if aggressive anti-spam checks are enabled in the supergroup. The value of this field is only available to chat administrators +//@has_paid_media_allowed True, if paid media can be sent and forwarded to the channel chat; for channels only //@has_pinned_stories True, if the supergroup or channel has pinned stories //@my_boost_count Number of times the current user boosted the supergroup or channel //@unrestrict_boost_count Number of times the supergroup must be boosted by a user to ignore slow mode and chat permission restrictions; 0 if unspecified @@ -1308,7 +1330,7 @@ supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:Chat //@bot_commands List of commands of bots in the group //@upgraded_from_basic_group_id Identifier of the basic group from which supergroup was upgraded; 0 if none //@upgraded_from_max_message_id Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none -supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_get_revenue_statistics:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool can_have_sponsored_messages:Bool has_aggressive_anti_spam_enabled:Bool has_pinned_stories:Bool my_boost_count:int32 unrestrict_boost_count:int32 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; +supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_get_revenue_statistics:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool can_have_sponsored_messages:Bool has_aggressive_anti_spam_enabled:Bool has_paid_media_allowed:Bool has_pinned_stories:Bool my_boost_count:int32 unrestrict_boost_count:int32 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; //@class SecretChatState @description Describes the current secret chat state @@ -1520,8 +1542,8 @@ inputTextQuote text:formattedText position:int32 = InputTextQuote; //@origin_send_date Point in time (Unix timestamp) when the message was sent if the message was from another chat or topic; 0 for messages from the same chat //@content Media content of the message if the message was from another chat or topic; may be null for messages from the same chat and messages without media. //-Can be only one of the following types: messageAnimation, messageAudio, messageContact, messageDice, messageDocument, messageGame, messageInvoice, messageLocation, -//-messagePhoto, messagePoll, messagePremiumGiveaway, messagePremiumGiveawayWinners, messageSticker, messageStory, messageText (for link preview), messageVenue, -//-messageVideo, messageVideoNote, or messageVoiceNote +//-messagePaidMedia, messagePhoto, messagePoll, messagePremiumGiveaway, messagePremiumGiveawayWinners, messageSticker, messageStory, messageText (for link preview), +//-messageVenue, messageVideo, messageVideoNote, or messageVoiceNote messageReplyToMessage chat_id:int53 message_id:int53 quote:textQuote origin:MessageOrigin origin_send_date:int32 content:MessageContent = MessageReplyTo; //@description Describes a story replied by a given message @story_sender_chat_id The identifier of the sender of the story @story_id The identifier of the story @@ -2103,7 +2125,7 @@ keyboardButton text:string type:KeyboardButtonType = KeyboardButton; //@class InlineKeyboardButtonType @description Describes the type of inline keyboard button -//@description A button that opens a specified URL @url HTTP or tg:// URL to open +//@description A button that opens a specified URL @url HTTP or tg:// URL to open. If the link is of the type internalLinkTypeWebApp, then the button must be marked as a Web App button inlineKeyboardButtonTypeUrl url:string = InlineKeyboardButtonType; //@description A button that opens a specified URL and automatically authorize the current user by calling getLoginUrlInfo @url An HTTP URL to pass to getLoginUrlInfo @id Unique button identifier @forward_text If non-empty, new text of the button in forwarded messages @@ -2635,6 +2657,7 @@ locationAddress country_code:string state:string city:string street:string = Loc //@secondary_background_color A secondary color for the background in the RGB24 format //@header_background_color A color of the header background in the RGB24 format //@section_background_color A color of the section background in the RGB24 format +//@section_separator_color A color of the section separator in the RGB24 format //@text_color A color of text in the RGB24 format //@accent_text_color An accent color of the text in the RGB24 format //@section_header_text_color A color of text on the section headers in the RGB24 format @@ -2644,7 +2667,7 @@ locationAddress country_code:string state:string city:string street:string = Loc //@link_color A color of links in the RGB24 format //@button_color A color of the buttons in the RGB24 format //@button_text_color A color of text on the buttons in the RGB24 format -themeParameters background_color:int32 secondary_background_color:int32 header_background_color:int32 section_background_color:int32 text_color:int32 accent_text_color:int32 section_header_text_color:int32 subtitle_text_color:int32 destructive_text_color:int32 hint_color:int32 link_color:int32 button_color:int32 button_text_color:int32 = ThemeParameters; +themeParameters background_color:int32 secondary_background_color:int32 header_background_color:int32 section_background_color:int32 section_separator_color:int32 text_color:int32 accent_text_color:int32 section_header_text_color:int32 subtitle_text_color:int32 destructive_text_color:int32 hint_color:int32 link_color:int32 button_color:int32 button_text_color:int32 = ThemeParameters; //@description Portion of the price of a product (e.g., "delivery cost", "tax amount") @label Label for this portion of the product price @amount Currency amount in the smallest units of the currency @@ -2777,7 +2800,7 @@ paymentReceipt product_info:productInfo date:int32 seller_bot_user_id:int53 type //@class InputInvoice @description Describes an invoice to process -//@description An invoice from a message of the type messageInvoice @chat_id Chat identifier of the message @message_id Message identifier +//@description An invoice from a message of the type messageInvoice or paid media purchase from messagePaidMedia @chat_id Chat identifier of the message @message_id Message identifier inputInvoiceMessage chat_id:int53 message_id:int53 = InputInvoice; //@description An invoice from a link of the type internalLinkTypeInvoice @name Name of the invoice @@ -2787,24 +2810,23 @@ inputInvoiceName name:string = InputInvoice; inputInvoiceTelegram purpose:TelegramPaymentPurpose = InputInvoice; -//@class MessageExtendedMedia @description Describes a media, which is attached to an invoice +//@class PaidMedia @description Describes a paid media //@description The media is hidden until the invoice is paid //@width Media width; 0 if unknown //@height Media height; 0 if unknown //@duration Media duration, in seconds; 0 if unknown //@minithumbnail Media minithumbnail; may be null -//@caption Media caption -messageExtendedMediaPreview width:int32 height:int32 duration:int32 minithumbnail:minithumbnail caption:formattedText = MessageExtendedMedia; +paidMediaPreview width:int32 height:int32 duration:int32 minithumbnail:minithumbnail = PaidMedia; -//@description The media is a photo @photo The photo @caption Photo caption -messageExtendedMediaPhoto photo:photo caption:formattedText = MessageExtendedMedia; +//@description The media is a photo @photo The photo +paidMediaPhoto photo:photo = PaidMedia; -//@description The media is a video @video The video @caption Photo caption -messageExtendedMediaVideo video:video caption:formattedText = MessageExtendedMedia; +//@description The media is a video @video The video +paidMediaVideo video:video = PaidMedia; -//@description The media is unsupported @caption Media caption -messageExtendedMediaUnsupported caption:formattedText = MessageExtendedMedia; +//@description The media is unsupported +paidMediaUnsupported = PaidMedia; //@description Describes parameters of a Telegram Premium giveaway @@ -3111,7 +3133,7 @@ messageText text:formattedText web_page:webPage link_preview_options:linkPreview //@description An animation message (GIF-style). //@animation The animation description //@caption Animation caption -//@show_caption_above_media True, if caption must be shown above the animation; otherwise, caption must be shown below the animation +//@show_caption_above_media True, if the caption must be shown above the animation; otherwise, the caption must be shown below the animation //@has_spoiler True, if the animation preview must be covered by a spoiler animation //@is_secret True, if the animation thumbnail must be blurred and the animation must be shown only while tapped messageAnimation animation:animation caption:formattedText show_caption_above_media:Bool has_spoiler:Bool is_secret:Bool = MessageContent; @@ -3122,10 +3144,17 @@ messageAudio audio:audio caption:formattedText = MessageContent; //@description A document message (general file) @document The document description @caption Document caption messageDocument document:document caption:formattedText = MessageContent; +//@description A message with paid media +//@star_count Number of stars needed to buy access to the media in the message +//@media Information about the media +//@caption Media caption +//@show_caption_above_media True, if the caption must be shown above the media; otherwise, the caption must be shown below the media +messagePaidMedia star_count:int53 media:vector caption:formattedText show_caption_above_media:Bool = MessageContent; + //@description A photo message //@photo The photo //@caption Photo caption -//@show_caption_above_media True, if caption must be shown above the photo; otherwise, caption must be shown below the photo +//@show_caption_above_media True, if the caption must be shown above the photo; otherwise, the caption must be shown below the photo //@has_spoiler True, if the photo preview must be covered by a spoiler animation //@is_secret True, if the photo must be blurred and must be shown only while tapped messagePhoto photo:photo caption:formattedText show_caption_above_media:Bool has_spoiler:Bool is_secret:Bool = MessageContent; @@ -3136,7 +3165,7 @@ messageSticker sticker:sticker is_premium:Bool = MessageContent; //@description A video message //@video The video description //@caption Video caption -//@show_caption_above_media True, if caption must be shown above the video; otherwise, caption must be shown below the video +//@show_caption_above_media True, if the caption must be shown above the video; otherwise, the caption must be shown below the video //@has_spoiler True, if the video preview must be covered by a spoiler animation //@is_secret True, if the video thumbnail must be blurred and the video must be shown only while tapped messageVideo video:video caption:formattedText show_caption_above_media:Bool has_spoiler:Bool is_secret:Bool = MessageContent; @@ -3204,8 +3233,9 @@ messageStory story_sender_chat_id:int53 story_id:int32 via_mention:Bool = Messag //@is_test True, if the invoice is a test invoice //@need_shipping_address True, if the shipping address must be specified //@receipt_message_id The identifier of the message with the receipt, after the product has been purchased -//@extended_media Extended media attached to the invoice; may be null -messageInvoice product_info:productInfo currency:string total_amount:int53 start_parameter:string is_test:Bool need_shipping_address:Bool receipt_message_id:int53 extended_media:MessageExtendedMedia = MessageContent; +//@paid_media Extended media attached to the invoice; may be null if none +//@paid_media_caption Extended media caption; may be null if none +messageInvoice product_info:productInfo currency:string total_amount:int53 start_parameter:string is_test:Bool need_shipping_address:Bool receipt_message_id:int53 paid_media:PaidMedia paid_media_caption:formattedText = MessageContent; //@description A message with information about an ended call @is_video True, if the call was a video call @discard_reason Reason why the call was discarded @duration Call duration, in seconds messageCall is_video:Bool discard_reason:CallDiscardReason duration:int32 = MessageContent; @@ -3345,7 +3375,7 @@ messageGiftedPremium gifter_user_id:int53 currency:string amount:int53 cryptocur //@code The gift code messagePremiumGiftCode creator_id:MessageSender is_from_giveaway:Bool is_unclaimed:Bool currency:string amount:int53 cryptocurrency:string cryptocurrency_amount:int64 month_count:int32 sticker:sticker code:string = MessageContent; -//@description A Telegram Premium giveaway was created for the chat +//@description A Telegram Premium giveaway was created for the chat. Use telegramPaymentPurposePremiumGiveaway or storePaymentPurposePremiumGiveaway to create a giveaway messagePremiumGiveawayCreated = MessageContent; //@description A Telegram Premium giveaway @@ -3482,6 +3512,27 @@ textEntityTypeMediaTimestamp media_timestamp:int32 = TextEntityType; inputThumbnail thumbnail:InputFile width:int32 height:int32 = InputThumbnail; +//@class InputPaidMediaType @description Describes type of paid media to sent + +//@description The media is a photo. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20 +inputPaidMediaTypePhoto = InputPaidMediaType; + +//@description The media is a video +//@duration Duration of the video, in seconds +//@supports_streaming True, if the video is supposed to be streamed +inputPaidMediaTypeVideo duration:int32 supports_streaming:Bool = InputPaidMediaType; + + +//@description Describes a paid media to be sent +//@type Type of the media +//@media Photo or video to be sent +//@thumbnail Media thumbnail; pass null to skip thumbnail uploading +//@added_sticker_file_ids File identifiers of the stickers added to the media, if applicable +//@width Media width +//@height Media height +inputPaidMedia type:InputPaidMediaType media:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector width:int32 height:int32 = InputPaidMedia; + + //@class MessageSchedulingState @description Contains information about the time when a scheduled message will be sent //@description The message will be sent at the specified date @send_date Point in time (Unix timestamp) when the message will be sent. The date must be within 367 days in the future @@ -3511,7 +3562,7 @@ messageSelfDestructTypeImmediately = MessageSelfDestructType; //@only_preview Pass true to get a fake message instead of actually sending them messageSendOptions disable_notification:Bool from_background:Bool protect_content:Bool update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState effect_id:int64 sending_id:int32 only_preview:Bool = MessageSendOptions; -//@description Options to be used when a message content is copied without reference to the original sender. Service messages, messages with messageInvoice, messagePremiumGiveaway, or messagePremiumGiveawayWinners content can't be copied +//@description Options to be used when a message content is copied without reference to the original sender. Service messages, messages with messageInvoice, messagePaidMedia, messagePremiumGiveaway, or messagePremiumGiveawayWinners content can't be copied //@send_copy True, if content of the message needs to be copied without reference to the original sender. Always true if the message is forwarded to a secret chat or is local //@replace_caption True, if media caption of the message copy needs to be replaced. Ignored if send_copy is false //@new_caption New message caption; pass null to copy message without caption. Ignored if replace_caption is false @@ -3536,7 +3587,7 @@ inputMessageText text:formattedText link_preview_options:linkPreviewOptions clea //@width Width of the animation; may be replaced by the server //@height Height of the animation; may be replaced by the server //@caption Animation caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters -//@show_caption_above_media True, if caption must be shown above the animation; otherwise, caption must be shown below the animation; not supported in secret chats +//@show_caption_above_media True, if the caption must be shown above the animation; otherwise, the caption must be shown below the animation; not supported in secret chats //@has_spoiler True, if the animation preview must be covered by a spoiler animation; not supported in secret chats inputMessageAnimation animation:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector duration:int32 width:int32 height:int32 caption:formattedText show_caption_above_media:Bool has_spoiler:Bool = InputMessageContent; @@ -3556,6 +3607,13 @@ inputMessageAudio audio:InputFile album_cover_thumbnail:inputThumbnail duration: //@caption Document caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters inputMessageDocument document:InputFile thumbnail:inputThumbnail disable_content_type_detection:Bool caption:formattedText = InputMessageContent; +//@description A message with paid media; can be used only in channel chats with supergroupFullInfo.has_paid_media_allowed +//@star_count The number of stars that must be paid to see the media; 1-getOption("paid_media_message_star_count_max") +//@paid_media The content of the paid media +//@caption Message caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters +//@show_caption_above_media True, if the caption must be shown above the video; otherwise, the caption must be shown below the video; not supported in secret chats +inputMessagePaidMedia star_count:int53 paid_media:vector caption:formattedText show_caption_above_media:Bool = InputMessageContent; + //@description A photo message //@photo Photo to send. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20 //@thumbnail Photo thumbnail to be sent; pass null to skip thumbnail uploading. The thumbnail is sent to the other party only in secret chats @@ -3563,7 +3621,7 @@ inputMessageDocument document:InputFile thumbnail:inputThumbnail disable_content //@width Photo width //@height Photo height //@caption Photo caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters -//@show_caption_above_media True, if caption must be shown above the photo; otherwise, caption must be shown below the photo; not supported in secret chats +//@show_caption_above_media True, if the caption must be shown above the photo; otherwise, the caption must be shown below the photo; not supported in secret chats //@self_destruct_type Photo self-destruct type; pass null if none; private chats only //@has_spoiler True, if the photo preview must be covered by a spoiler animation; not supported in secret chats inputMessagePhoto photo:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector width:int32 height:int32 caption:formattedText show_caption_above_media:Bool self_destruct_type:MessageSelfDestructType has_spoiler:Bool = InputMessageContent; @@ -3585,7 +3643,7 @@ inputMessageSticker sticker:InputFile thumbnail:inputThumbnail width:int32 heigh //@height Video height //@supports_streaming True, if the video is supposed to be streamed //@caption Video caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters -//@show_caption_above_media True, if caption must be shown above the video; otherwise, caption must be shown below the video; not supported in secret chats +//@show_caption_above_media True, if the caption must be shown above the video; otherwise, the caption must be shown below the video; not supported in secret chats //@self_destruct_type Video self-destruct type; pass null if none; private chats only //@has_spoiler True, if the video preview must be covered by a spoiler animation; not supported in secret chats inputMessageVideo video:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector duration:int32 width:int32 height:int32 supports_streaming:Bool caption:formattedText show_caption_above_media:Bool self_destruct_type:MessageSelfDestructType has_spoiler:Bool = InputMessageContent; @@ -3637,8 +3695,9 @@ inputMessageGame bot_user_id:int53 game_short_name:string = InputMessageContent; //@provider_token Payment provider token; may be empty for payments in Telegram Stars //@provider_data JSON-encoded data about the invoice, which will be shared with the payment provider //@start_parameter Unique invoice bot deep link parameter for the generation of this invoice. If empty, it would be possible to pay directly from forwards of the invoice message -//@extended_media_content The content of extended media attached to the invoice. The content of the message to be sent. Must be one of the following types: inputMessagePhoto, inputMessageVideo -inputMessageInvoice invoice:invoice title:string description:string photo_url:string photo_size:int32 photo_width:int32 photo_height:int32 payload:bytes provider_token:string provider_data:string start_parameter:string extended_media_content:InputMessageContent = InputMessageContent; +//@paid_media The content of paid media attached to the invoice; pass null if none +//@paid_media_caption Paid media caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters +inputMessageInvoice invoice:invoice title:string description:string photo_url:string photo_size:int32 photo_width:int32 photo_height:int32 payload:bytes provider_token:string provider_data:string start_parameter:string paid_media:inputPaidMedia paid_media_caption:formattedText = InputMessageContent; //@description A message with a poll. Polls can't be sent to secret chats. Polls can be sent only to a private chat with a bot //@question Poll question; 1-255 characters (up to 300 characters for bots). Only custom emoji entities are allowed to be added and only by Premium users @@ -4249,7 +4308,7 @@ chatBoostSlots slots:vector = ChatBoostSlots; resendCodeReasonUserRequest = ResendCodeReason; //@description The code is re-sent, because device verification has failed -//@error_message Cause of the verification failure, for example, PLAY_SERVICES_NOT_AVAILABLE, APNS_RECEIVE_TIMEOUT, APNS_INIT_FAILED, etc. +//@error_message Cause of the verification failure, for example, PLAY_SERVICES_NOT_AVAILABLE, APNS_RECEIVE_TIMEOUT, or APNS_INIT_FAILED resendCodeReasonVerificationFailed error_message:string = ResendCodeReason; @@ -5253,6 +5312,9 @@ premiumFeatureLastSeenTimes = PremiumFeature; //@description The ability to use Business features premiumFeatureBusiness = PremiumFeature; +//@description The ability to use all available message effects +premiumFeatureMessageEffects = PremiumFeature; + //@class BusinessFeature @description Describes a feature available to Business user accounts @@ -5485,7 +5547,7 @@ backgroundTypeWallpaper is_blurred:Bool is_moving:Bool = BackgroundType; //@description A PNG or TGV (gzipped subset of SVG with MIME type "application/x-tgwallpattern") pattern to be combined with the background fill chosen by the user //@fill Fill of the background -//@intensity Intensity of the pattern when it is shown above the filled background; 0-100. +//@intensity Intensity of the pattern when it is shown above the filled background; 0-100 //@is_inverted True, if the background fill must be applied only to the pattern itself. All other pixels are black in this case. For dark themes only //@is_moving True, if the background needs to be slightly moved when device is tilted backgroundTypePattern fill:BackgroundFill intensity:int32 is_inverted:Bool is_moving:Bool = BackgroundType; @@ -5665,6 +5727,11 @@ pushMessageContentInvoice price:string is_pinned:Bool = PushMessageContent; //@description A message with a location @is_live True, if the location is live @is_pinned True, if the message is a pinned message with the specified content pushMessageContentLocation is_live:Bool is_pinned:Bool = PushMessageContent; +//@description A message with paid media +//@star_count Number of stars needed to buy access to the media in the message; 0 for pinned message +//@is_pinned True, if the message is a pinned message with the specified content +pushMessageContentPaidMedia star_count:int53 is_pinned:Bool = PushMessageContent; + //@description A photo message //@photo Message content; may be null //@caption Photo caption @@ -5954,7 +6021,7 @@ userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages = UserPrivacySetting; //@description Contains privacy settings for message read date in private chats. Read dates are always shown to the users that can see online status of the current user regardless of this setting -//@show_read_date True, if message read date is shown to other users in private chats. If false and the current user isn't a Telegram Premium user, then they will not be able to see other's message read date. +//@show_read_date True, if message read date is shown to other users in private chats. If false and the current user isn't a Telegram Premium user, then they will not be able to see other's message read date readDatePrivacySettings show_read_date:Bool = ReadDatePrivacySettings; //@description Contains privacy settings for new chats with non-contacts @@ -6175,7 +6242,7 @@ internalLinkTypeBotStart bot_username:string start_parameter:string autostart:Bo //-If administrator rights are provided by the link, call getChatMember to receive the current bot rights in the chat and if the bot already is an administrator, //-check that the current user can edit its administrator rights, combine received rights with the requested administrator rights, show confirmation box to the user, //-and call setChatMemberStatus with the chosen chat and confirmed administrator rights. Before call to setChatMemberStatus it may be required to upgrade the chosen basic group chat to a supergroup chat. -//-Then, if start_parameter isn't empty, call sendBotStartMessage with the given start parameter and the chosen chat; otherwise, just send /start message with bot's username added to the chat. +//-Then, if start_parameter isn't empty, call sendBotStartMessage with the given start parameter and the chosen chat; otherwise, just send /start message with bot's username added to the chat //@bot_username Username of the bot //@start_parameter The parameter to be passed to sendBotStartMessage //@administrator_rights Expected administrator rights for the bot; may be null @@ -6306,7 +6373,8 @@ internalLinkTypeSettings = InternalLinkType; //-If the bot is added to side menu, then use getWebAppUrl with the given URL and open the returned URL as a Web App //@bot_username Username of the bot //@url URL to be passed to getWebAppUrl -internalLinkTypeSideMenuBot bot_username:string url:string = InternalLinkType; +//@is_compact True, if the Web App must be opened in a compact mode instead of a full-size mode +internalLinkTypeSideMenuBot bot_username:string url:string is_compact:Bool = InternalLinkType; //@description The link is a link to a sticker set. Call searchStickerSet with the given sticker set name to process the link and show the sticker set. //-If the sticker set is found and the user wants to add it, then call changeStickerSet @@ -6355,7 +6423,8 @@ internalLinkTypeVideoChat chat_username:string invite_hash:string is_live_stream //@bot_username Username of the bot that owns the Web App //@web_app_short_name Short name of the Web App //@start_parameter Start parameter to be passed to getWebAppLinkUrl -internalLinkTypeWebApp bot_username:string web_app_short_name:string start_parameter:string = InternalLinkType; +//@is_compact True, if the Web App must be opened in a compact mode instead of a full-size mode +internalLinkTypeWebApp bot_username:string web_app_short_name:string start_parameter:string is_compact:Bool = InternalLinkType; //@description Contains an HTTPS link to a message in a supergroup or channel, or a forum topic @link The link @is_public True, if the link will work for non-members of the chat @@ -7304,9 +7373,10 @@ updateFileRemovedFromDownloads file_id:int32 counts:downloadedFileCounts = Updat //@description A request can't be completed unless application verification is performed; for official mobile applications only. //-The method setApplicationVerificationToken must be called once the verification is completed or failed //@verification_id Unique identifier for the verification process -//@nonce Unique nonce for the classic Play Integrity verification (https://developer.android.com/google/play/integrity/classic) for Android, +//@nonce Unique base64url-encoded nonce for the classic Play Integrity verification (https://developer.android.com/google/play/integrity/classic) for Android, //-or a unique string to compare with verify_nonce field from a push notification for iOS -updateApplicationVerificationRequired verification_id:int53 nonce:string = Update; +//@cloud_project_number Cloud project number to pass to the Play Integrity API on Android +updateApplicationVerificationRequired verification_id:int53 nonce:string cloud_project_number:int64 = Update; //@description New call was created or information about a call was updated @call New data about a call updateCall call:call = Update; @@ -8401,7 +8471,7 @@ editMessageMedia chat_id:int53 message_id:int53 reply_markup:ReplyMarkup input_m //@message_id Identifier of the message //@reply_markup The new message reply markup; pass null if none; for bots only //@caption New message content caption; 0-getOption("message_caption_length_max") characters; pass null to remove caption -//@show_caption_above_media Pass true to show the caption above the media; otherwise, caption will be shown below the media. Can be true only for animation, photo, and video messages +//@show_caption_above_media Pass true to show the caption above the media; otherwise, the caption will be shown below the media. Can be true only for animation, photo, and video messages editMessageCaption chat_id:int53 message_id:int53 reply_markup:ReplyMarkup caption:formattedText show_caption_above_media:Bool = Message; //@description Edits the message reply markup; for bots only. Returns the edited message after the edit is completed on the server side. @@ -8437,7 +8507,7 @@ editInlineMessageMedia inline_message_id:string reply_markup:ReplyMarkup input_m //@inline_message_id Inline message identifier //@reply_markup The new message reply markup; pass null if none //@caption New message content caption; pass null to remove caption; 0-getOption("message_caption_length_max") characters -//@show_caption_above_media Pass true to show the caption above the media; otherwise, caption will be shown below the media. Can be true only for animation, photo, and video messages +//@show_caption_above_media Pass true to show the caption above the media; otherwise, the caption will be shown below the media. Can be true only for animation, photo, and video messages editInlineMessageCaption inline_message_id:string reply_markup:ReplyMarkup caption:formattedText show_caption_above_media:Bool = Ok; //@description Edits the reply markup of an inline message sent via a bot; for bots only @@ -8514,7 +8584,7 @@ editBusinessMessageMedia business_connection_id:string chat_id:int53 message_id: //@message_id Identifier of the message //@reply_markup The new message reply markup; pass null if none //@caption New message content caption; pass null to remove caption; 0-getOption("message_caption_length_max") characters -//@show_caption_above_media Pass true to show the caption above the media; otherwise, caption will be shown below the media. Can be true only for animation, photo, and video messages +//@show_caption_above_media Pass true to show the caption above the media; otherwise, the caption will be shown below the media. Can be true only for animation, photo, and video messages editBusinessMessageCaption business_connection_id:string chat_id:int53 message_id:int53 reply_markup:ReplyMarkup caption:formattedText show_caption_above_media:Bool = BusinessMessage; //@description Edits the reply markup of a message sent on behalf of a business account; for bots only @@ -10524,7 +10594,7 @@ getChatEventLog chat_id:int53 query:string from_event_id:int64 limit:int32 filte getTimeZones = TimeZones; -//@description Returns an invoice payment form. This method must be called when the user presses inline button of the type inlineKeyboardButtonTypeBuy +//@description Returns an invoice payment form. This method must be called when the user presses inline button of the type inlineKeyboardButtonTypeBuy, or wants to buy access to media in a messagePaidMedia message //@input_invoice The invoice //@theme Preferred payment form theme; pass null to use the default theme getPaymentForm input_invoice:InputInvoice theme:themeParameters = PaymentForm; @@ -10728,7 +10798,7 @@ reportMessageReactions chat_id:int53 message_id:int53 sender_id:MessageSender = //@description Returns detailed revenue statistics about a chat. Currently, this method can be used only for channels if supergroupFullInfo.can_get_revenue_statistics == true @chat_id Chat identifier @is_dark Pass true if a dark theme is used by the application getChatRevenueStatistics chat_id:int53 is_dark:Bool = ChatRevenueStatistics; -//@description Returns URL for chat revenue withdrawal; requires owner privileges in the chat. Currently, this method can be used only for channels if supergroupFullInfo.can_get_revenue_statistics == true and getOption("can_withdraw_chat_revenue") +//@description Returns a URL for chat revenue withdrawal; requires owner privileges in the chat. Currently, this method can be used only for channels if supergroupFullInfo.can_get_revenue_statistics == true and getOption("can_withdraw_chat_revenue") //@chat_id Chat identifier //@password The 2-step verification password of the current user getChatRevenueWithdrawalUrl chat_id:int53 password:string = HttpUrl; @@ -10741,16 +10811,20 @@ getChatRevenueTransactions chat_id:int53 offset:int32 limit:int32 = ChatRevenueT //@description Returns detailed Telegram star revenue statistics -//@owner_id Identifier of the owner of the Telegram stars; can be identifier of an owned bot, or identifier of a channel chat with supergroupFullInfo.can_get_revenue_statistics == true +//@owner_id Identifier of the owner of the Telegram stars; can be identifier of an owned bot, or identifier of an owned channel chat //@is_dark Pass true if a dark theme is used by the application getStarRevenueStatistics owner_id:MessageSender is_dark:Bool = StarRevenueStatistics; -//@description Returns URL for Telegram star withdrawal -//@owner_id Identifier of the owner of the Telegram stars; can be identifier of an owned bot, or identifier of a channel chat with supergroupFullInfo.can_get_revenue_statistics == true +//@description Returns a URL for Telegram star withdrawal +//@owner_id Identifier of the owner of the Telegram stars; can be identifier of an owned bot, or identifier of an owned channel chat //@star_count The number of Telegram stars to withdraw. Must be at least getOption("star_withdrawal_count_min") //@password The 2-step verification password of the current user getStarWithdrawalUrl owner_id:MessageSender star_count:int53 password:string = HttpUrl; +//@description Returns a URL for a Telegram Ad platform account that can be used to set up advertisments for the chat paid in the owned Telegram stars +//@owner_id Identifier of the owner of the Telegram stars; can be identifier of an owned bot, or identifier of an owned channel chat +getStarAdAccountUrl owner_id:MessageSender = HttpUrl; + //@description Returns detailed statistics about a chat. Currently, this method can be used only for supergroups and channels. Can be used only if supergroupFullInfo.can_get_statistics == true @chat_id Chat identifier @is_dark Pass true if a dark theme is used by the application getChatStatistics chat_id:int53 is_dark:Bool = ChatStatistics; From fa003a9460d1000fcaa26ef15ab0ff9dd355fc06 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Tue, 6 Aug 2024 06:37:01 +0800 Subject: [PATCH 22/54] Update to TDLib 1.8.34 --- client/function.go | 541 +++++++++-- client/type.go | 2024 +++++++++++++++++++++++++++++++++++------ client/unmarshaler.go | 737 ++++++++++++++- data/td_api.tl | 704 ++++++++++---- 4 files changed, 3454 insertions(+), 552 deletions(-) diff --git a/client/function.go b/client/function.go index 356fb63..ea870e2 100755 --- a/client/function.go +++ b/client/function.go @@ -1471,6 +1471,35 @@ func (client *Client) GetMessages(req *GetMessagesRequest) (*Messages, error) { return UnmarshalMessages(result.Data) } +type GetMessagePropertiesRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` +} + +// Returns properties of a message; this is an offline request +func (client *Client) GetMessageProperties(req *GetMessagePropertiesRequest) (*MessageProperties, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getMessageProperties", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessageProperties(result.Data) +} + type GetMessageThreadRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -1478,7 +1507,7 @@ type GetMessageThreadRequest struct { MessageId int64 `json:"message_id"` } -// Returns information about a message thread. Can be used only if message.can_get_message_thread == true +// Returns information about a message thread. Can be used only if messageProperties.can_get_message_thread == true func (client *Client) GetMessageThread(req *GetMessageThreadRequest) (*MessageThreadInfo, error) { result, err := client.Send(Request{ meta: meta{ @@ -1507,7 +1536,7 @@ type GetMessageReadDateRequest struct { MessageId int64 `json:"message_id"` } -// Returns read date of a recent outgoing message in a private chat. The method can be called if message.can_get_read_date == true and the message is read +// Returns read date of a recent outgoing message in a private chat. The method can be called if messageProperties.can_get_read_date == true func (client *Client) GetMessageReadDate(req *GetMessageReadDateRequest) (MessageReadDate, error) { result, err := client.Send(Request{ meta: meta{ @@ -1554,7 +1583,7 @@ type GetMessageViewersRequest struct { MessageId int64 `json:"message_id"` } -// Returns viewers of a recent outgoing message in a basic group or a supergroup chat. For video notes and voice notes only users, opened content of the message, are returned. The method can be called if message.can_get_viewers == true +// Returns viewers of a recent outgoing message in a basic group or a supergroup chat. For video notes and voice notes only users, opened content of the message, are returned. The method can be called if messageProperties.can_get_viewers == true func (client *Client) GetMessageViewers(req *GetMessageViewersRequest) (*MessageViewers, error) { result, err := client.Send(Request{ meta: meta{ @@ -2308,7 +2337,7 @@ type GetSavedMessagesTopicHistoryRequest struct { Limit int32 `json:"limit"` } -// Returns messages in a Saved Messages topic. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id) +// Returns messages in a Saved Messages topic. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id) func (client *Client) GetSavedMessagesTopicHistory(req *GetSavedMessagesTopicHistoryRequest) (*Messages, error) { result, err := client.Send(Request{ meta: meta{ @@ -2519,7 +2548,7 @@ type GetChatHistoryRequest struct { OnlyLocal bool `json:"only_local"` } -// Returns messages in a chat. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id). For optimal performance, the number of returned messages is chosen by TDLib. This is an offline request if only_local is true +// Returns messages in a chat. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id). For optimal performance, the number of returned messages is chosen by TDLib. This is an offline request if only_local is true func (client *Client) GetChatHistory(req *GetChatHistoryRequest) (*Messages, error) { result, err := client.Send(Request{ meta: meta{ @@ -2557,7 +2586,7 @@ type GetMessageThreadHistoryRequest struct { Limit int32 `json:"limit"` } -// Returns messages in a message thread of a message. Can be used only if message.can_get_message_thread == true. Message thread of a channel message is in the channel's linked supergroup. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id). For optimal performance, the number of returned messages is chosen by TDLib +// Returns messages in a message thread of a message. Can be used only if messageProperties.can_get_message_thread == true. Message thread of a channel message is in the channel's linked supergroup. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id). For optimal performance, the number of returned messages is chosen by TDLib func (client *Client) GetMessageThreadHistory(req *GetMessageThreadHistoryRequest) (*Messages, error) { result, err := client.Send(Request{ meta: meta{ @@ -3343,7 +3372,7 @@ type GetChatScheduledMessagesRequest struct { ChatId int64 `json:"chat_id"` } -// Returns all scheduled messages in a chat. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id) +// Returns all scheduled messages in a chat. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id) func (client *Client) GetChatScheduledMessages(req *GetChatScheduledMessagesRequest) (*Messages, error) { result, err := client.Send(Request{ meta: meta{ @@ -3532,7 +3561,7 @@ type GetMessageLinkRequest struct { ChatId int64 `json:"chat_id"` // Identifier of the message MessageId int64 `json:"message_id"` - // If not 0, timestamp from which the video/audio/video note/voice note/story playing must start, in seconds. The media can be in the message content or in its web page preview + // If not 0, timestamp from which the video/audio/video note/voice note/story playing must start, in seconds. The media can be in the message content or in its link preview MediaTimestamp int32 `json:"media_timestamp"` // Pass true to create a link for the whole media album ForAlbum bool `json:"for_album"` @@ -3540,7 +3569,7 @@ type GetMessageLinkRequest struct { InMessageThread bool `json:"in_message_thread"` } -// Returns an HTTPS link to a message in a chat. Available only for already sent messages in supergroups and channels, or if message.can_get_media_timestamp_links and a media timestamp link is generated. This is an offline request +// Returns an HTTPS link to a message in a chat. Available only if messageProperties.can_get_link, or if messageProperties.can_get_media_timestamp_links and a media timestamp link is generated. This is an offline request func (client *Client) GetMessageLink(req *GetMessageLinkRequest) (*MessageLink, error) { result, err := client.Send(Request{ meta: meta{ @@ -3574,7 +3603,7 @@ type GetMessageEmbeddingCodeRequest struct { ForAlbum bool `json:"for_album"` } -// Returns an HTML code for embedding the message. Available only for messages in supergroups and channels with a username +// Returns an HTML code for embedding the message. Available only if messageProperties.can_get_embedding_code func (client *Client) GetMessageEmbeddingCode(req *GetMessageEmbeddingCodeRequest) (*Text, error) { result, err := client.Send(Request{ meta: meta{ @@ -3687,11 +3716,11 @@ func (client *Client) TranslateMessageText(req *TranslateMessageTextRequest) (*F type RecognizeSpeechRequest struct { // Identifier of the chat to which the message belongs ChatId int64 `json:"chat_id"` - // Identifier of the message + // Identifier of the message. Use messageProperties.can_recognize_speech to check whether the message is suitable MessageId int64 `json:"message_id"` } -// Recognizes speech in a video note or a voice note message. The message must be successfully sent, must not be scheduled, and must be from a non-secret chat +// Recognizes speech in a video note or a voice note message func (client *Client) RecognizeSpeech(req *RecognizeSpeechRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -3962,7 +3991,7 @@ type ForwardMessagesRequest struct { MessageThreadId int64 `json:"message_thread_id"` // Identifier of the chat from which to forward messages FromChatId int64 `json:"from_chat_id"` - // Identifiers of the messages to forward. Message identifiers must be in a strictly increasing order. At most 100 messages can be forwarded simultaneously. A message can be forwarded only if message.can_be_forwarded + // Identifiers of the messages to forward. Message identifiers must be in a strictly increasing order. At most 100 messages can be forwarded simultaneously. A message can be forwarded only if messageProperties.can_be_forwarded MessageIds []int64 `json:"message_ids"` // Options to be used to send the messages; pass null to use default options Options *MessageSendOptions `json:"options"` @@ -4130,7 +4159,7 @@ func (client *Client) AddLocalMessage(req *AddLocalMessageRequest) (*Message, er type DeleteMessagesRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` - // Identifiers of the messages to be deleted + // Identifiers of the messages to be deleted. Use messageProperties.can_be_deleted_only_for_self and messageProperties.can_be_deleted_for_all_users to get suitable messages MessageIds []int64 `json:"message_ids"` // Pass true to delete messages for all chat members. Always true for supergroups, channels and secret chats Revoke bool `json:"revoke"` @@ -4226,7 +4255,7 @@ func (client *Client) DeleteChatMessagesByDate(req *DeleteChatMessagesByDateRequ type EditMessageTextRequest struct { // The chat the message belongs to ChatId int64 `json:"chat_id"` - // Identifier of the message + // Identifier of the message. Use messageProperties.can_be_edited to check whether the message can be edited MessageId int64 `json:"message_id"` // The new message reply markup; pass null if none; for bots only ReplyMarkup ReplyMarkup `json:"reply_markup"` @@ -4234,7 +4263,7 @@ type EditMessageTextRequest struct { InputMessageContent InputMessageContent `json:"input_message_content"` } -// Edits the text of a message (or a text of a game message). Returns the edited message after the edit is completed on the server side. Can be used only if message.can_be_edited == true +// Edits the text of a message (or a text of a game message). Returns the edited message after the edit is completed on the server side func (client *Client) EditMessageText(req *EditMessageTextRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -4261,7 +4290,7 @@ func (client *Client) EditMessageText(req *EditMessageTextRequest) (*Message, er type EditMessageLiveLocationRequest struct { // The chat the message belongs to ChatId int64 `json:"chat_id"` - // Identifier of the message + // Identifier of the message. Use messageProperties.can_be_edited to check whether the message can be edited MessageId int64 `json:"message_id"` // The new message reply markup; pass null if none; for bots only ReplyMarkup ReplyMarkup `json:"reply_markup"` @@ -4275,7 +4304,7 @@ type EditMessageLiveLocationRequest struct { ProximityAlertRadius int32 `json:"proximity_alert_radius"` } -// Edits the message content of a live location. Messages can be edited for a limited period of time specified in the live location. Returns the edited message after the edit is completed on the server side. Can be used only if message.can_be_edited == true +// Edits the message content of a live location. Messages can be edited for a limited period of time specified in the live location. Returns the edited message after the edit is completed on the server side func (client *Client) EditMessageLiveLocation(req *EditMessageLiveLocationRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -4305,7 +4334,7 @@ func (client *Client) EditMessageLiveLocation(req *EditMessageLiveLocationReques type EditMessageMediaRequest struct { // The chat the message belongs to ChatId int64 `json:"chat_id"` - // Identifier of the message + // Identifier of the message. Use messageProperties.can_be_edited to check whether the message can be edited MessageId int64 `json:"message_id"` // The new message reply markup; pass null if none; for bots only ReplyMarkup ReplyMarkup `json:"reply_markup"` @@ -4313,7 +4342,7 @@ type EditMessageMediaRequest struct { InputMessageContent InputMessageContent `json:"input_message_content"` } -// Edits the content of a message with an animation, an audio, a document, a photo or a video, including message caption. If only the caption needs to be edited, use editMessageCaption instead. The media can't be edited if the message was set to self-destruct or to a self-destructing media. The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa. Returns the edited message after the edit is completed on the server side. Can be used only if message.can_be_edited == true +// Edits the content of a message with an animation, an audio, a document, a photo or a video, including message caption. If only the caption needs to be edited, use editMessageCaption instead. The media can't be edited if the message was set to self-destruct or to a self-destructing media. The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa. Returns the edited message after the edit is completed on the server side func (client *Client) EditMessageMedia(req *EditMessageMediaRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -4340,7 +4369,7 @@ func (client *Client) EditMessageMedia(req *EditMessageMediaRequest) (*Message, type EditMessageCaptionRequest struct { // The chat the message belongs to ChatId int64 `json:"chat_id"` - // Identifier of the message + // Identifier of the message. Use messageProperties.can_be_edited to check whether the message can be edited MessageId int64 `json:"message_id"` // The new message reply markup; pass null if none; for bots only ReplyMarkup ReplyMarkup `json:"reply_markup"` @@ -4350,7 +4379,7 @@ type EditMessageCaptionRequest struct { ShowCaptionAboveMedia bool `json:"show_caption_above_media"` } -// Edits the message content caption. Returns the edited message after the edit is completed on the server side. Can be used only if message.can_be_edited == true +// Edits the message content caption. Returns the edited message after the edit is completed on the server side func (client *Client) EditMessageCaption(req *EditMessageCaptionRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -4378,13 +4407,13 @@ func (client *Client) EditMessageCaption(req *EditMessageCaptionRequest) (*Messa type EditMessageReplyMarkupRequest struct { // The chat the message belongs to ChatId int64 `json:"chat_id"` - // Identifier of the message + // Identifier of the message. Use messageProperties.can_be_edited to check whether the message can be edited MessageId int64 `json:"message_id"` // The new message reply markup; pass null if none ReplyMarkup ReplyMarkup `json:"reply_markup"` } -// Edits the message reply markup; for bots only. Returns the edited message after the edit is completed on the server side. Can be used only if message.can_be_edited == true +// Edits the message reply markup; for bots only. Returns the edited message after the edit is completed on the server side func (client *Client) EditMessageReplyMarkup(req *EditMessageReplyMarkupRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -4579,7 +4608,7 @@ func (client *Client) EditInlineMessageReplyMarkup(req *EditInlineMessageReplyMa type EditMessageSchedulingStateRequest struct { // The chat the message belongs to ChatId int64 `json:"chat_id"` - // Identifier of the message + // Identifier of the message. Use messageProperties.can_edit_scheduling_state to check whether the message is suitable MessageId int64 `json:"message_id"` // The new message scheduling state; pass null to send the message immediately SchedulingState MessageSchedulingState `json:"scheduling_state"` @@ -4611,13 +4640,13 @@ func (client *Client) EditMessageSchedulingState(req *EditMessageSchedulingState type SetMessageFactCheckRequest struct { // The channel chat the message belongs to ChatId int64 `json:"chat_id"` - // Identifier of the message. The message must be one of the following types: messageAnimation, messageAudio, messageDocument, messagePhoto, messageText, messageVideo + // Identifier of the message MessageId int64 `json:"message_id"` // New text of the fact-check; 0-getOption("fact_check_length_max") characters; pass null to remove it. Only Bold, Italic, and TextUrl entities with https://t.me/ links are supported Text *FormattedText `json:"text"` } -// Changes the fact-check of a message. Can be only used if getOption("can_edit_fact_check") == true +// Changes the fact-check of a message. Can be only used if messageProperties.can_set_fact_check == true func (client *Client) SetMessageFactCheck(req *SetMessageFactCheckRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -4965,6 +4994,41 @@ func (client *Client) StopBusinessPoll(req *StopBusinessPollRequest) (*BusinessM return UnmarshalBusinessMessage(result.Data) } +type SetBusinessMessageIsPinnedRequest struct { + // Unique identifier of business connection on behalf of which the message was sent + BusinessConnectionId string `json:"business_connection_id"` + // The chat the message belongs to + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` + // Pass true to pin the message, pass false to unpin it + IsPinned bool `json:"is_pinned"` +} + +// Pins or unpins a message sent on behalf of a business account; for bots only +func (client *Client) SetBusinessMessageIsPinned(req *SetBusinessMessageIsPinnedRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBusinessMessageIsPinned", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "chat_id": req.ChatId, + "message_id": req.MessageId, + "is_pinned": req.IsPinned, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type CheckQuickReplyShortcutNameRequest struct { // The name of the shortcut; 1-32 characters Name string `json:"name"` @@ -5889,7 +5953,7 @@ func (client *Client) SetMessageReactions(req *SetMessageReactionsRequest) (*Ok, type GetMessageAddedReactionsRequest struct { // Identifier of the chat to which the message belongs ChatId int64 `json:"chat_id"` - // Identifier of the message + // Identifier of the message. Use messageProperties.can_get_added_reactions to check whether added reactions can be received for the message MessageId int64 `json:"message_id"` // Type of the reactions to return; pass null to return all added reactions ReactionType ReactionType `json:"reaction_type"` @@ -6558,13 +6622,13 @@ func (client *Client) GetPollVoters(req *GetPollVotersRequest) (*MessageSenders, type StopPollRequest struct { // Identifier of the chat to which the poll belongs ChatId int64 `json:"chat_id"` - // Identifier of the message containing the poll + // Identifier of the message containing the poll. Use messageProperties.can_be_edited to check whether the poll can be stopped MessageId int64 `json:"message_id"` // The new message reply markup; pass null if none; for bots only ReplyMarkup ReplyMarkup `json:"reply_markup"` } -// Stops a poll. A poll in a message can be stopped when the message has can_be_edited flag is set +// Stops a poll func (client *Client) StopPoll(req *StopPollRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -6661,7 +6725,7 @@ func (client *Client) GetBusinessConnection(req *GetBusinessConnectionRequest) ( type GetLoginUrlInfoRequest struct { // Chat identifier of the message with the button ChatId int64 `json:"chat_id"` - // Message identifier of the message with the button + // Message identifier of the message with the button. The message must not be scheduled MessageId int64 `json:"message_id"` // Button identifier ButtonId int64 `json:"button_id"` @@ -6889,6 +6953,35 @@ func (client *Client) AnswerInlineQuery(req *AnswerInlineQueryRequest) (*Ok, err return UnmarshalOk(result.Data) } +type GetPopularWebAppBotsRequest struct { + // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results + Offset string `json:"offset"` + // The maximum number of bots to be returned; up to 100 + Limit int32 `json:"limit"` +} + +// Returns popular Web App bots +func (client *Client) GetPopularWebAppBots(req *GetPopularWebAppBotsRequest) (*FoundUsers, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getPopularWebAppBots", + }, + Data: map[string]interface{}{ + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFoundUsers(result.Data) +} + type SearchWebAppRequest struct { // Identifier of the target bot BotUserId int64 `json:"bot_user_id"` @@ -6929,7 +7022,7 @@ type GetWebAppLinkUrlRequest struct { StartParameter string `json:"start_parameter"` // Preferred Web App theme; pass null to use the default theme Theme *ThemeParameters `json:"theme"` - // Short name of the application; 0-64 English letters, digits, and underscores + // Short name of the current application; 0-64 English letters, digits, and underscores ApplicationName string `json:"application_name"` // Pass true if the current user allowed the bot to send them messages AllowWriteAccess bool `json:"allow_write_access"` @@ -6962,18 +7055,56 @@ func (client *Client) GetWebAppLinkUrl(req *GetWebAppLinkUrlRequest) (*HttpUrl, return UnmarshalHttpUrl(result.Data) } -type GetWebAppUrlRequest struct { +type GetMainWebAppRequest struct { + // Identifier of the chat in which the Web App is opened; pass 0 if none + ChatId int64 `json:"chat_id"` // Identifier of the target bot BotUserId int64 `json:"bot_user_id"` - // The URL from a keyboardButtonTypeWebApp button, inlineQueryResultsButtonTypeWebApp button, an internalLinkTypeSideMenuBot link, or an empty when the bot is opened from the side menu - Url string `json:"url"` + // Start parameter from internalLinkTypeMainWebApp + StartParameter string `json:"start_parameter"` // Preferred Web App theme; pass null to use the default theme Theme *ThemeParameters `json:"theme"` - // Short name of the application; 0-64 English letters, digits, and underscores + // Short name of the current application; 0-64 English letters, digits, and underscores ApplicationName string `json:"application_name"` } -// Returns an HTTPS URL of a Web App to open from the side menu, a keyboardButtonTypeWebApp button, an inlineQueryResultsButtonTypeWebApp button, or an internalLinkTypeSideMenuBot link +// Returns information needed to open the main Web App of a bot +func (client *Client) GetMainWebApp(req *GetMainWebAppRequest) (*MainWebApp, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getMainWebApp", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "bot_user_id": req.BotUserId, + "start_parameter": req.StartParameter, + "theme": req.Theme, + "application_name": req.ApplicationName, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMainWebApp(result.Data) +} + +type GetWebAppUrlRequest struct { + // Identifier of the target bot + BotUserId int64 `json:"bot_user_id"` + // The URL from a keyboardButtonTypeWebApp button, inlineQueryResultsButtonTypeWebApp button, or an empty string when the bot is opened from the side menu + Url string `json:"url"` + // Preferred Web App theme; pass null to use the default theme + Theme *ThemeParameters `json:"theme"` + // Short name of the current application; 0-64 English letters, digits, and underscores + ApplicationName string `json:"application_name"` +} + +// Returns an HTTPS URL of a Web App to open from the side menu, a keyboardButtonTypeWebApp button, or an inlineQueryResultsButtonTypeWebApp button func (client *Client) GetWebAppUrl(req *GetWebAppUrlRequest) (*HttpUrl, error) { result, err := client.Send(Request{ meta: meta{ @@ -7038,7 +7169,7 @@ type OpenWebAppRequest struct { Url string `json:"url"` // Preferred Web App theme; pass null to use the default theme Theme *ThemeParameters `json:"theme"` - // Short name of the application; 0-64 English letters, digits, and underscores + // Short name of the current application; 0-64 English letters, digits, and underscores ApplicationName string `json:"application_name"` // If not 0, the message thread identifier in which the message will be sent MessageThreadId int64 `json:"message_thread_id"` @@ -7131,7 +7262,7 @@ func (client *Client) AnswerWebAppQuery(req *AnswerWebAppQueryRequest) (*SentWeb type GetCallbackQueryAnswerRequest struct { // Identifier of the chat with the message ChatId int64 `json:"chat_id"` - // Identifier of the message from which the query originated + // Identifier of the message from which the query originated. The message must not be scheduled MessageId int64 `json:"message_id"` // Query payload Payload CallbackQueryPayload `json:"payload"` @@ -7721,6 +7852,9 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeLanguageSettings: return UnmarshalInternalLinkTypeLanguageSettings(result.Data) + case TypeInternalLinkTypeMainWebApp: + return UnmarshalInternalLinkTypeMainWebApp(result.Data) + case TypeInternalLinkTypeMessage: return UnmarshalInternalLinkTypeMessage(result.Data) @@ -7760,9 +7894,6 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeSettings: return UnmarshalInternalLinkTypeSettings(result.Data) - case TypeInternalLinkTypeSideMenuBot: - return UnmarshalInternalLinkTypeSideMenuBot(result.Data) - case TypeInternalLinkTypeStickerSet: return UnmarshalInternalLinkTypeStickerSet(result.Data) @@ -7803,7 +7934,7 @@ type GetExternalLinkInfoRequest struct { Link string `json:"link"` } -// Returns information about an action to be done when the current user clicks an external link. Don't use this method for links from secret chats if web page preview is disabled in secret chats +// Returns information about an action to be done when the current user clicks an external link. Don't use this method for links from secret chats if link preview is disabled in secret chats func (client *Client) GetExternalLinkInfo(req *GetExternalLinkInfoRequest) (LoginUrlInfo, error) { result, err := client.Send(Request{ meta: meta{ @@ -9534,7 +9665,7 @@ type PinChatMessageRequest struct { OnlyForSelf bool `json:"only_for_self"` } -// Pins a message in a chat; requires can_pin_messages member right if the chat is a basic group or supergroup, or can_edit_messages administrator right if the chat is a channel +// Pins a message in a chat. A message can be pinned only if messageProperties.can_be_pinned func (client *Client) PinChatMessage(req *PinChatMessageRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -10317,6 +10448,32 @@ func (client *Client) ReadChatList(req *ReadChatListRequest) (*Ok, error) { return UnmarshalOk(result.Data) } +type GetCurrentWeatherRequest struct { + // The location + Location *Location `json:"location"` +} + +// Returns the current weather in the given location +func (client *Client) GetCurrentWeather(req *GetCurrentWeatherRequest) (*CurrentWeather, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getCurrentWeather", + }, + Data: map[string]interface{}{ + "location": req.Location, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalCurrentWeather(result.Data) +} + type GetStoryRequest struct { // Identifier of the chat that posted the story StorySenderChatId int64 `json:"story_sender_chat_id"` @@ -10369,7 +10526,7 @@ func (client *Client) GetChatsToSendStories() (*Chats, error) { } type CanSendStoryRequest struct { - // Chat identifier + // Chat identifier. Pass Saved Messages chat identifier when posting a story on behalf of the current user ChatId int64 `json:"chat_id"` } @@ -10416,7 +10573,7 @@ func (client *Client) CanSendStory(req *CanSendStoryRequest) (CanSendStoryResult } type SendStoryRequest struct { - // Identifier of the chat that will post the story + // Identifier of the chat that will post the story. Pass Saved Messages chat identifier when posting a story on behalf of the current user ChatId int64 `json:"chat_id"` // Content of the story Content InputStoryContent `json:"content"` @@ -10428,7 +10585,7 @@ type SendStoryRequest struct { PrivacySettings StoryPrivacySettings `json:"privacy_settings"` // Period after which the story is moved to archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400 for Telegram Premium users, and 86400 otherwise ActivePeriod int32 `json:"active_period"` - // Full identifier of the original story, which content was used to create the story + // Full identifier of the original story, which content was used to create the story; pass null if the story isn't repost of another story FromStoryFullId *StoryFullId `json:"from_story_full_id"` // Pass true to keep the story accessible after expiration IsPostedToChatPage bool `json:"is_posted_to_chat_page"` @@ -10503,6 +10660,38 @@ func (client *Client) EditStory(req *EditStoryRequest) (*Ok, error) { return UnmarshalOk(result.Data) } +type EditStoryCoverRequest struct { + // Identifier of the chat that posted the story + StorySenderChatId int64 `json:"story_sender_chat_id"` + // Identifier of the story to edit + StoryId int32 `json:"story_id"` + // New timestamp of the frame, which will be used as video thumbnail + CoverFrameTimestamp float64 `json:"cover_frame_timestamp"` +} + +// Changes cover of a video story. Can be called only if story.can_be_edited == true and the story isn't being edited now +func (client *Client) EditStoryCover(req *EditStoryCoverRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editStoryCover", + }, + Data: map[string]interface{}{ + "story_sender_chat_id": req.StorySenderChatId, + "story_id": req.StoryId, + "cover_frame_timestamp": req.CoverFrameTimestamp, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type SetStoryPrivacySettingsRequest struct { // Identifier of the story StoryId int32 `json:"story_id"` @@ -10702,7 +10891,7 @@ type GetChatPostedToChatPageStoriesRequest struct { Limit int32 `json:"limit"` } -// Returns the list of stories that posted by the given chat to its chat page. If from_story_id == 0, then pinned stories are returned first. Then, stories are returned in a reverse chronological order (i.e., in order of decreasing story_id). For optimal performance, the number of returned stories is chosen by TDLib +// Returns the list of stories that posted by the given chat to its chat page. If from_story_id == 0, then pinned stories are returned first. Then, stories are returned in reverse chronological order (i.e., in order of decreasing story_id). For optimal performance, the number of returned stories is chosen by TDLib func (client *Client) GetChatPostedToChatPageStories(req *GetChatPostedToChatPageStoriesRequest) (*Stories, error) { result, err := client.Send(Request{ meta: meta{ @@ -10734,7 +10923,7 @@ type GetChatArchivedStoriesRequest struct { Limit int32 `json:"limit"` } -// Returns the list of all stories posted by the given chat; requires can_edit_stories right in the chat. The stories are returned in a reverse chronological order (i.e., in order of decreasing story_id). For optimal performance, the number of returned stories is chosen by TDLib +// Returns the list of all stories posted by the given chat; requires can_edit_stories right in the chat. The stories are returned in reverse chronological order (i.e., in order of decreasing story_id). For optimal performance, the number of returned stories is chosen by TDLib func (client *Client) GetChatArchivedStories(req *GetChatArchivedStoriesRequest) (*Stories, error) { result, err := client.Send(Request{ meta: meta{ @@ -15262,7 +15451,7 @@ func (client *Client) RemoveRecentHashtag(req *RemoveRecentHashtagRequest) (*Ok, return UnmarshalOk(result.Data) } -type GetWebPagePreviewRequest struct { +type GetLinkPreviewRequest struct { // Message text with formatting Text *FormattedText `json:"text"` // Options to be used for generation of the link preview; pass null to use default link preview options @@ -15270,10 +15459,10 @@ type GetWebPagePreviewRequest struct { } // Returns a link preview by the text of a message. Do not call this function too often. Returns a 404 error if the text has no link preview -func (client *Client) GetWebPagePreview(req *GetWebPagePreviewRequest) (*WebPage, error) { +func (client *Client) GetLinkPreview(req *GetLinkPreviewRequest) (*LinkPreview, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getWebPagePreview", + Type: "getLinkPreview", }, Data: map[string]interface{}{ "text": req.Text, @@ -15288,7 +15477,7 @@ func (client *Client) GetWebPagePreview(req *GetWebPagePreviewRequest) (*WebPage return nil, buildResponseError(result.Data) } - return UnmarshalWebPage(result.Data) + return UnmarshalLinkPreview(result.Data) } type GetWebPageInstantViewRequest struct { @@ -16543,6 +16732,192 @@ func (client *Client) SendWebAppCustomRequest(req *SendWebAppCustomRequestReques return UnmarshalCustomRequestResult(result.Data) } +type GetBotMediaPreviewsRequest struct { + // Identifier of the target bot. The bot must have the main Web App + BotUserId int64 `json:"bot_user_id"` +} + +// Returns the list of media previews of a bot +func (client *Client) GetBotMediaPreviews(req *GetBotMediaPreviewsRequest) (*BotMediaPreviews, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getBotMediaPreviews", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBotMediaPreviews(result.Data) +} + +type GetBotMediaPreviewInfoRequest struct { + // Identifier of the target bot. The bot must be owned and must have the main Web App + BotUserId int64 `json:"bot_user_id"` + // A two-letter ISO 639-1 language code for which to get previews. If empty, then default previews are returned + LanguageCode string `json:"language_code"` +} + +// Returns the list of media previews for the given language and the list of languages for which the bot has dedicated previews +func (client *Client) GetBotMediaPreviewInfo(req *GetBotMediaPreviewInfoRequest) (*BotMediaPreviewInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getBotMediaPreviewInfo", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "language_code": req.LanguageCode, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBotMediaPreviewInfo(result.Data) +} + +type AddBotMediaPreviewRequest struct { + // Identifier of the target bot. The bot must be owned and must have the main Web App + BotUserId int64 `json:"bot_user_id"` + // A two-letter ISO 639-1 language code for which preview is added. If empty, then the preview will be shown to all users for whose languages there are no dedicated previews. If non-empty, then there must be an official language pack of the same name, which is returned by getLocalizationTargetInfo + LanguageCode string `json:"language_code"` + // Content of the added preview + Content InputStoryContent `json:"content"` +} + +// Adds a new media preview to the beginning of the list of media previews of a bot. Returns the added preview after addition is completed server-side. The total number of previews must not exceed getOption("bot_media_preview_count_max") for the given language +func (client *Client) AddBotMediaPreview(req *AddBotMediaPreviewRequest) (*BotMediaPreview, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addBotMediaPreview", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "language_code": req.LanguageCode, + "content": req.Content, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBotMediaPreview(result.Data) +} + +type EditBotMediaPreviewRequest struct { + // Identifier of the target bot. The bot must be owned and must have the main Web App + BotUserId int64 `json:"bot_user_id"` + // Language code of the media preview to edit + LanguageCode string `json:"language_code"` + // File identifier of the media to replace + FileId int32 `json:"file_id"` + // Content of the new preview + Content InputStoryContent `json:"content"` +} + +// Replaces media preview in the list of media previews of a bot. Returns the new preview after edit is completed server-side +func (client *Client) EditBotMediaPreview(req *EditBotMediaPreviewRequest) (*BotMediaPreview, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editBotMediaPreview", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "language_code": req.LanguageCode, + "file_id": req.FileId, + "content": req.Content, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBotMediaPreview(result.Data) +} + +type ReorderBotMediaPreviewsRequest struct { + // Identifier of the target bot. The bot must be owned and must have the main Web App + BotUserId int64 `json:"bot_user_id"` + // Language code of the media previews to reorder + LanguageCode string `json:"language_code"` + // File identifiers of the media in the new order + FileIds []int32 `json:"file_ids"` +} + +// Changes order of media previews in the list of media previews of a bot +func (client *Client) ReorderBotMediaPreviews(req *ReorderBotMediaPreviewsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reorderBotMediaPreviews", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "language_code": req.LanguageCode, + "file_ids": req.FileIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DeleteBotMediaPreviewsRequest struct { + // Identifier of the target bot. The bot must be owned and must have the main Web App + BotUserId int64 `json:"bot_user_id"` + // Language code of the media previews to delete + LanguageCode string `json:"language_code"` + // File identifiers of the media to delete + FileIds []int32 `json:"file_ids"` +} + +// Delete media previews from the list of media previews of a bot +func (client *Client) DeleteBotMediaPreviews(req *DeleteBotMediaPreviewsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteBotMediaPreviews", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "language_code": req.LanguageCode, + "file_ids": req.FileIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type SetBotNameRequest struct { // Identifier of the target bot BotUserId int64 `json:"bot_user_id"` @@ -17518,7 +17893,7 @@ func (client *Client) ToggleSupergroupIsBroadcastGroup(req *ToggleSupergroupIsBr type ReportSupergroupSpamRequest struct { // Supergroup identifier SupergroupId int64 `json:"supergroup_id"` - // Identifiers of messages to report + // Identifiers of messages to report. Use messageProperties.can_be_reported to check whether the message can be reported MessageIds []int64 `json:"message_ids"` } @@ -17547,7 +17922,7 @@ func (client *Client) ReportSupergroupSpam(req *ReportSupergroupSpamRequest) (*O type ReportSupergroupAntiSpamFalsePositiveRequest struct { // Supergroup identifier SupergroupId int64 `json:"supergroup_id"` - // Identifier of the erroneously deleted message + // Identifier of the erroneously deleted message from chatEventMessageDeleted MessageId int64 `json:"message_id"` } @@ -17764,7 +18139,7 @@ type SendPaymentFormRequest struct { OrderInfoId string `json:"order_info_id"` // Identifier of a chosen shipping option, if applicable ShippingOptionId string `json:"shipping_option_id"` - // The credentials chosen by user for payment; pass null for a payment in Telegram stars + // The credentials chosen by user for payment; pass null for a payment in Telegram Stars Credentials InputCredentials `json:"credentials"` // Chosen by the user amount of tip in the smallest units of the currency TipAmount int64 `json:"tip_amount"` @@ -18904,7 +19279,7 @@ func (client *Client) RemoveChatActionBar(req *RemoveChatActionBarRequest) (*Ok, type ReportChatRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` - // Identifiers of reported messages; may be empty to report the whole chat + // Identifiers of reported messages; may be empty to report the whole chat. Use messageProperties.can_be_reported to check whether the message can be reported MessageIds []int64 `json:"message_ids"` // The reason for reporting the chat Reason ReportReason `json:"reason"` @@ -18980,7 +19355,7 @@ type ReportMessageReactionsRequest struct { SenderId MessageSender `json:"sender_id"` } -// Reports reactions set on a message to the Telegram moderators. Reactions on a message can be reported only if message.can_report_reactions +// Reports reactions set on a message to the Telegram moderators. Reactions on a message can be reported only if messageProperties.can_report_reactions func (client *Client) ReportMessageReactions(req *ReportMessageReactionsRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -19094,13 +19469,13 @@ func (client *Client) GetChatRevenueTransactions(req *GetChatRevenueTransactions } type GetStarRevenueStatisticsRequest struct { - // Identifier of the owner of the Telegram stars; can be identifier of an owned bot, or identifier of an owned channel chat + // Identifier of the owner of the Telegram Stars; can be identifier of an owned bot, or identifier of a channel chat with supergroupFullInfo.can_get_star_revenue_statistics == true OwnerId MessageSender `json:"owner_id"` // Pass true if a dark theme is used by the application IsDark bool `json:"is_dark"` } -// Returns detailed Telegram star revenue statistics +// Returns detailed Telegram Star revenue statistics func (client *Client) GetStarRevenueStatistics(req *GetStarRevenueStatisticsRequest) (*StarRevenueStatistics, error) { result, err := client.Send(Request{ meta: meta{ @@ -19123,15 +19498,15 @@ func (client *Client) GetStarRevenueStatistics(req *GetStarRevenueStatisticsRequ } type GetStarWithdrawalUrlRequest struct { - // Identifier of the owner of the Telegram stars; can be identifier of an owned bot, or identifier of an owned channel chat + // Identifier of the owner of the Telegram Stars; can be identifier of an owned bot, or identifier of an owned channel chat OwnerId MessageSender `json:"owner_id"` - // The number of Telegram stars to withdraw. Must be at least getOption("star_withdrawal_count_min") + // The number of Telegram Stars to withdraw. Must be at least getOption("star_withdrawal_count_min") StarCount int64 `json:"star_count"` // The 2-step verification password of the current user Password string `json:"password"` } -// Returns a URL for Telegram star withdrawal +// Returns a URL for Telegram Star withdrawal func (client *Client) GetStarWithdrawalUrl(req *GetStarWithdrawalUrlRequest) (*HttpUrl, error) { result, err := client.Send(Request{ meta: meta{ @@ -19155,11 +19530,11 @@ func (client *Client) GetStarWithdrawalUrl(req *GetStarWithdrawalUrlRequest) (*H } type GetStarAdAccountUrlRequest struct { - // Identifier of the owner of the Telegram stars; can be identifier of an owned bot, or identifier of an owned channel chat + // Identifier of the owner of the Telegram Stars; can be identifier of an owned bot, or identifier of an owned channel chat OwnerId MessageSender `json:"owner_id"` } -// Returns a URL for a Telegram Ad platform account that can be used to set up advertisments for the chat paid in the owned Telegram stars +// Returns a URL for a Telegram Ad platform account that can be used to set up advertisements for the chat paid in the owned Telegram Stars func (client *Client) GetStarAdAccountUrl(req *GetStarAdAccountUrlRequest) (*HttpUrl, error) { result, err := client.Send(Request{ meta: meta{ @@ -19227,7 +19602,7 @@ type GetMessageStatisticsRequest struct { IsDark bool `json:"is_dark"` } -// Returns detailed statistics about a message. Can be used only if message.can_get_statistics == true +// Returns detailed statistics about a message. Can be used only if messageProperties.can_get_statistics == true func (client *Client) GetMessageStatistics(req *GetMessageStatisticsRequest) (*MessageStatistics, error) { result, err := client.Send(Request{ meta: meta{ @@ -19261,7 +19636,7 @@ type GetMessagePublicForwardsRequest struct { Limit int32 `json:"limit"` } -// Returns forwarded copies of a channel message to different public channels and public reposts as a story. Can be used only if message.can_get_statistics == true. For optimal performance, the number of returned messages and stories is chosen by TDLib +// Returns forwarded copies of a channel message to different public channels and public reposts as a story. Can be used only if messageProperties.can_get_statistics == true. For optimal performance, the number of returned messages and stories is chosen by TDLib func (client *Client) GetMessagePublicForwards(req *GetMessagePublicForwardsRequest) (*PublicForwards, error) { result, err := client.Send(Request{ meta: meta{ @@ -20973,7 +21348,7 @@ func (client *Client) GetPremiumGiveawayInfo(req *GetPremiumGiveawayInfoRequest) } } -// Returns available options for Telegram stars purchase +// Returns available options for Telegram Stars purchase func (client *Client) GetStarPaymentOptions() (*StarPaymentOptions, error) { result, err := client.Send(Request{ meta: meta{ @@ -20992,8 +21367,34 @@ func (client *Client) GetStarPaymentOptions() (*StarPaymentOptions, error) { return UnmarshalStarPaymentOptions(result.Data) } +type GetStarGiftPaymentOptionsRequest struct { + // Identifier of the user that will receive Telegram Stars; pass 0 to get options for an unspecified user + UserId int64 `json:"user_id"` +} + +// Returns available options for Telegram Stars gifting +func (client *Client) GetStarGiftPaymentOptions(req *GetStarGiftPaymentOptionsRequest) (*StarPaymentOptions, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getStarGiftPaymentOptions", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStarPaymentOptions(result.Data) +} + type GetStarTransactionsRequest struct { - // Identifier of the owner of the Telegram stars; can be the identifier of the current user, identifier of an owned bot, or identifier of a channel chat with supergroupFullInfo.can_get_revenue_statistics == true + // Identifier of the owner of the Telegram Stars; can be the identifier of the current user, identifier of an owned bot, or identifier of a channel chat with supergroupFullInfo.can_get_star_revenue_statistics == true OwnerId MessageSender `json:"owner_id"` // Direction of the transactions to receive; pass null to get all transactions Direction StarTransactionDirection `json:"direction"` @@ -21003,7 +21404,7 @@ type GetStarTransactionsRequest struct { Limit int32 `json:"limit"` } -// Returns the list of Telegram star transactions for the specified owner +// Returns the list of Telegram Star transactions for the specified owner func (client *Client) GetStarTransactions(req *GetStarTransactionsRequest) (*StarTransactions, error) { result, err := client.Send(Request{ meta: meta{ diff --git a/client/type.go b/client/type.go index df140c3..23751f9 100755 --- a/client/type.go +++ b/client/type.go @@ -59,6 +59,8 @@ const ( ClassPageBlockHorizontalAlignment = "PageBlockHorizontalAlignment" ClassPageBlockVerticalAlignment = "PageBlockVerticalAlignment" ClassPageBlock = "PageBlock" + ClassLinkPreviewAlbumMedia = "LinkPreviewAlbumMedia" + ClassLinkPreviewType = "LinkPreviewType" ClassCollectibleItemType = "CollectibleItemType" ClassInputCredentials = "InputCredentials" ClassPaymentProvider = "PaymentProvider" @@ -245,6 +247,7 @@ const ( ClassBotInfo = "BotInfo" ClassUserFullInfo = "UserFullInfo" ClassUsers = "Users" + ClassFoundUsers = "FoundUsers" ClassChatAdministrator = "ChatAdministrator" ClassChatAdministrators = "ChatAdministrators" ClassChatMember = "ChatMember" @@ -328,6 +331,7 @@ const ( ClassInlineKeyboardButton = "InlineKeyboardButton" ClassFoundWebApp = "FoundWebApp" ClassWebAppInfo = "WebAppInfo" + ClassMainWebApp = "MainWebApp" ClassMessageThreadInfo = "MessageThreadInfo" ClassSavedMessagesTopic = "SavedMessagesTopic" ClassForumTopicIcon = "ForumTopicIcon" @@ -337,12 +341,13 @@ const ( ClassLinkPreviewOptions = "LinkPreviewOptions" ClassSharedUser = "SharedUser" ClassSharedChat = "SharedChat" + ClassThemeSettings = "ThemeSettings" ClassPageBlockCaption = "PageBlockCaption" ClassPageBlockListItem = "PageBlockListItem" ClassPageBlockTableCell = "PageBlockTableCell" ClassPageBlockRelatedArticle = "PageBlockRelatedArticle" ClassWebPageInstantView = "WebPageInstantView" - ClassWebPage = "WebPage" + ClassLinkPreview = "LinkPreview" ClassCountryInfo = "CountryInfo" ClassCountries = "Countries" ClassPhoneNumberInfo = "PhoneNumberInfo" @@ -383,6 +388,7 @@ const ( ClassInputPaidMedia = "InputPaidMedia" ClassMessageSendOptions = "MessageSendOptions" ClassMessageCopyOptions = "MessageCopyOptions" + ClassMessageProperties = "MessageProperties" ClassEmojiKeyword = "EmojiKeyword" ClassEmojiKeywords = "EmojiKeywords" ClassStickers = "Stickers" @@ -393,6 +399,7 @@ const ( ClassTrendingStickerSets = "TrendingStickerSets" ClassEmojiCategory = "EmojiCategory" ClassEmojiCategories = "EmojiCategories" + ClassCurrentWeather = "CurrentWeather" ClassStoryAreaPosition = "StoryAreaPosition" ClassStoryArea = "StoryArea" ClassInputStoryArea = "InputStoryArea" @@ -412,6 +419,9 @@ const ( ClassQuickReplyMessages = "QuickReplyMessages" ClassQuickReplyShortcut = "QuickReplyShortcut" ClassPublicForwards = "PublicForwards" + ClassBotMediaPreview = "BotMediaPreview" + ClassBotMediaPreviews = "BotMediaPreviews" + ClassBotMediaPreviewInfo = "BotMediaPreviewInfo" ClassChatBoostLevelFeatures = "ChatBoostLevelFeatures" ClassChatBoostFeatures = "ChatBoostFeatures" ClassPrepaidPremiumGiveaway = "PrepaidPremiumGiveaway" @@ -467,7 +477,6 @@ const ( ClassBusinessFeaturePromotionAnimation = "BusinessFeaturePromotionAnimation" ClassPremiumState = "PremiumState" ClassPushReceiverId = "PushReceiverId" - ClassThemeSettings = "ThemeSettings" ClassChatTheme = "ChatTheme" ClassTimeZone = "TimeZone" ClassTimeZones = "TimeZones" @@ -695,6 +704,7 @@ const ( TypeStarTransactionPartnerTelegramAds = "starTransactionPartnerTelegramAds" TypeStarTransactionPartnerBot = "starTransactionPartnerBot" TypeStarTransactionPartnerChannel = "starTransactionPartnerChannel" + TypeStarTransactionPartnerUser = "starTransactionPartnerUser" TypeStarTransactionPartnerUnsupported = "starTransactionPartnerUnsupported" TypeStarTransaction = "starTransaction" TypeStarTransactions = "starTransactions" @@ -715,6 +725,7 @@ const ( TypeBotInfo = "botInfo" TypeUserFullInfo = "userFullInfo" TypeUsers = "users" + TypeFoundUsers = "foundUsers" TypeChatAdministrator = "chatAdministrator" TypeChatAdministrators = "chatAdministrators" TypeChatMemberStatusCreator = "chatMemberStatusCreator" @@ -910,6 +921,7 @@ const ( TypeLoginUrlInfoRequestConfirmation = "loginUrlInfoRequestConfirmation" TypeFoundWebApp = "foundWebApp" TypeWebAppInfo = "webAppInfo" + TypeMainWebApp = "mainWebApp" TypeMessageThreadInfo = "messageThreadInfo" TypeSavedMessagesTopicTypeMyNotes = "savedMessagesTopicTypeMyNotes" TypeSavedMessagesTopicTypeAuthorHidden = "savedMessagesTopicTypeAuthorHidden" @@ -922,6 +934,7 @@ const ( TypeLinkPreviewOptions = "linkPreviewOptions" TypeSharedUser = "sharedUser" TypeSharedChat = "sharedChat" + TypeThemeSettings = "themeSettings" TypeRichTextPlain = "richTextPlain" TypeRichTextBold = "richTextBold" TypeRichTextItalic = "richTextItalic" @@ -979,7 +992,38 @@ const ( TypePageBlockRelatedArticles = "pageBlockRelatedArticles" TypePageBlockMap = "pageBlockMap" TypeWebPageInstantView = "webPageInstantView" - TypeWebPage = "webPage" + TypeLinkPreviewAlbumMediaPhoto = "linkPreviewAlbumMediaPhoto" + TypeLinkPreviewAlbumMediaVideo = "linkPreviewAlbumMediaVideo" + TypeLinkPreviewTypeAlbum = "linkPreviewTypeAlbum" + TypeLinkPreviewTypeAnimation = "linkPreviewTypeAnimation" + TypeLinkPreviewTypeApp = "linkPreviewTypeApp" + TypeLinkPreviewTypeArticle = "linkPreviewTypeArticle" + TypeLinkPreviewTypeAudio = "linkPreviewTypeAudio" + TypeLinkPreviewTypeBackground = "linkPreviewTypeBackground" + TypeLinkPreviewTypeChannelBoost = "linkPreviewTypeChannelBoost" + TypeLinkPreviewTypeChat = "linkPreviewTypeChat" + TypeLinkPreviewTypeDocument = "linkPreviewTypeDocument" + TypeLinkPreviewTypeEmbeddedAnimationPlayer = "linkPreviewTypeEmbeddedAnimationPlayer" + TypeLinkPreviewTypeEmbeddedAudioPlayer = "linkPreviewTypeEmbeddedAudioPlayer" + TypeLinkPreviewTypeEmbeddedVideoPlayer = "linkPreviewTypeEmbeddedVideoPlayer" + TypeLinkPreviewTypeInvoice = "linkPreviewTypeInvoice" + TypeLinkPreviewTypeMessage = "linkPreviewTypeMessage" + TypeLinkPreviewTypePhoto = "linkPreviewTypePhoto" + TypeLinkPreviewTypePremiumGiftCode = "linkPreviewTypePremiumGiftCode" + TypeLinkPreviewTypeShareableChatFolder = "linkPreviewTypeShareableChatFolder" + TypeLinkPreviewTypeSticker = "linkPreviewTypeSticker" + TypeLinkPreviewTypeStickerSet = "linkPreviewTypeStickerSet" + TypeLinkPreviewTypeStory = "linkPreviewTypeStory" + TypeLinkPreviewTypeSupergroupBoost = "linkPreviewTypeSupergroupBoost" + TypeLinkPreviewTypeTheme = "linkPreviewTypeTheme" + TypeLinkPreviewTypeUnsupported = "linkPreviewTypeUnsupported" + TypeLinkPreviewTypeUser = "linkPreviewTypeUser" + TypeLinkPreviewTypeVideo = "linkPreviewTypeVideo" + TypeLinkPreviewTypeVideoChat = "linkPreviewTypeVideoChat" + TypeLinkPreviewTypeVideoNote = "linkPreviewTypeVideoNote" + TypeLinkPreviewTypeVoiceNote = "linkPreviewTypeVoiceNote" + TypeLinkPreviewTypeWebApp = "linkPreviewTypeWebApp" + TypeLinkPreview = "linkPreview" TypeCountryInfo = "countryInfo" TypeCountries = "countries" TypePhoneNumberInfo = "phoneNumberInfo" @@ -1147,12 +1191,14 @@ const ( TypeMessageGameScore = "messageGameScore" TypeMessagePaymentSuccessful = "messagePaymentSuccessful" TypeMessagePaymentSuccessfulBot = "messagePaymentSuccessfulBot" + TypeMessagePaymentRefunded = "messagePaymentRefunded" TypeMessageGiftedPremium = "messageGiftedPremium" TypeMessagePremiumGiftCode = "messagePremiumGiftCode" TypeMessagePremiumGiveawayCreated = "messagePremiumGiveawayCreated" TypeMessagePremiumGiveaway = "messagePremiumGiveaway" TypeMessagePremiumGiveawayCompleted = "messagePremiumGiveawayCompleted" TypeMessagePremiumGiveawayWinners = "messagePremiumGiveawayWinners" + TypeMessageGiftedStars = "messageGiftedStars" TypeMessageContactRegistered = "messageContactRegistered" TypeMessageUsersShared = "messageUsersShared" TypeMessageChatShared = "messageChatShared" @@ -1214,6 +1260,7 @@ const ( TypeInputMessagePoll = "inputMessagePoll" TypeInputMessageStory = "inputMessageStory" TypeInputMessageForwarded = "inputMessageForwarded" + TypeMessageProperties = "messageProperties" TypeSearchMessagesFilterEmpty = "searchMessagesFilterEmpty" TypeSearchMessagesFilterAnimation = "searchMessagesFilterAnimation" TypeSearchMessagesFilterAudio = "searchMessagesFilterAudio" @@ -1268,12 +1315,14 @@ const ( TypeEmojiCategoryTypeRegularStickers = "emojiCategoryTypeRegularStickers" TypeEmojiCategoryTypeEmojiStatus = "emojiCategoryTypeEmojiStatus" TypeEmojiCategoryTypeChatPhoto = "emojiCategoryTypeChatPhoto" + TypeCurrentWeather = "currentWeather" TypeStoryAreaPosition = "storyAreaPosition" TypeStoryAreaTypeLocation = "storyAreaTypeLocation" TypeStoryAreaTypeVenue = "storyAreaTypeVenue" TypeStoryAreaTypeSuggestedReaction = "storyAreaTypeSuggestedReaction" TypeStoryAreaTypeMessage = "storyAreaTypeMessage" TypeStoryAreaTypeLink = "storyAreaTypeLink" + TypeStoryAreaTypeWeather = "storyAreaTypeWeather" TypeStoryArea = "storyArea" TypeInputStoryAreaTypeLocation = "inputStoryAreaTypeLocation" TypeInputStoryAreaTypeFoundVenue = "inputStoryAreaTypeFoundVenue" @@ -1281,6 +1330,7 @@ const ( TypeInputStoryAreaTypeSuggestedReaction = "inputStoryAreaTypeSuggestedReaction" TypeInputStoryAreaTypeMessage = "inputStoryAreaTypeMessage" TypeInputStoryAreaTypeLink = "inputStoryAreaTypeLink" + TypeInputStoryAreaTypeWeather = "inputStoryAreaTypeWeather" TypeInputStoryArea = "inputStoryArea" TypeInputStoryAreas = "inputStoryAreas" TypeStoryVideo = "storyVideo" @@ -1312,6 +1362,9 @@ const ( TypePublicForwardMessage = "publicForwardMessage" TypePublicForwardStory = "publicForwardStory" TypePublicForwards = "publicForwards" + TypeBotMediaPreview = "botMediaPreview" + TypeBotMediaPreviews = "botMediaPreviews" + TypeBotMediaPreviewInfo = "botMediaPreviewInfo" TypeChatBoostLevelFeatures = "chatBoostLevelFeatures" TypeChatBoostFeatures = "chatBoostFeatures" TypeChatBoostSourceGiftCode = "chatBoostSourceGiftCode" @@ -1562,9 +1615,11 @@ const ( TypeStorePaymentPurposePremiumGiftCodes = "storePaymentPurposePremiumGiftCodes" TypeStorePaymentPurposePremiumGiveaway = "storePaymentPurposePremiumGiveaway" TypeStorePaymentPurposeStars = "storePaymentPurposeStars" + TypeStorePaymentPurposeGiftedStars = "storePaymentPurposeGiftedStars" TypeTelegramPaymentPurposePremiumGiftCodes = "telegramPaymentPurposePremiumGiftCodes" TypeTelegramPaymentPurposePremiumGiveaway = "telegramPaymentPurposePremiumGiveaway" TypeTelegramPaymentPurposeStars = "telegramPaymentPurposeStars" + TypeTelegramPaymentPurposeGiftedStars = "telegramPaymentPurposeGiftedStars" TypeDeviceTokenFirebaseCloudMessaging = "deviceTokenFirebaseCloudMessaging" TypeDeviceTokenApplePush = "deviceTokenApplePush" TypeDeviceTokenApplePushVoIP = "deviceTokenApplePushVoIP" @@ -1588,7 +1643,6 @@ const ( TypeInputBackgroundLocal = "inputBackgroundLocal" TypeInputBackgroundRemote = "inputBackgroundRemote" TypeInputBackgroundPrevious = "inputBackgroundPrevious" - TypeThemeSettings = "themeSettings" TypeChatTheme = "chatTheme" TypeTimeZone = "timeZone" TypeTimeZones = "timeZones" @@ -1763,6 +1817,7 @@ const ( TypeInternalLinkTypeInvoice = "internalLinkTypeInvoice" TypeInternalLinkTypeLanguagePack = "internalLinkTypeLanguagePack" TypeInternalLinkTypeLanguageSettings = "internalLinkTypeLanguageSettings" + TypeInternalLinkTypeMainWebApp = "internalLinkTypeMainWebApp" TypeInternalLinkTypeMessage = "internalLinkTypeMessage" TypeInternalLinkTypeMessageDraft = "internalLinkTypeMessageDraft" TypeInternalLinkTypePassportDataRequest = "internalLinkTypePassportDataRequest" @@ -1776,7 +1831,6 @@ const ( TypeInternalLinkTypeQrCodeAuthentication = "internalLinkTypeQrCodeAuthentication" TypeInternalLinkTypeRestorePurchases = "internalLinkTypeRestorePurchases" TypeInternalLinkTypeSettings = "internalLinkTypeSettings" - TypeInternalLinkTypeSideMenuBot = "internalLinkTypeSideMenuBot" TypeInternalLinkTypeStickerSet = "internalLinkTypeStickerSet" TypeInternalLinkTypeStory = "internalLinkTypeStory" TypeInternalLinkTypeTheme = "internalLinkTypeTheme" @@ -1845,6 +1899,7 @@ const ( TypeTopChatCategoryGroups = "topChatCategoryGroups" TypeTopChatCategoryChannels = "topChatCategoryChannels" TypeTopChatCategoryInlineBots = "topChatCategoryInlineBots" + TypeTopChatCategoryWebAppBots = "topChatCategoryWebAppBots" TypeTopChatCategoryCalls = "topChatCategoryCalls" TypeTopChatCategoryForwardChats = "topChatCategoryForwardChats" TypeFoundPosition = "foundPosition" @@ -2165,12 +2220,12 @@ type InputChatPhoto interface { InputChatPhotoType() string } -// Describes direction of a transaction with Telegram stars +// Describes direction of a transaction with Telegram Stars type StarTransactionDirection interface { StarTransactionDirectionType() string } -// Describes source or recipient of a transaction with Telegram stars +// Describes source or recipient of a transaction with Telegram Stars type StarTransactionPartner interface { StarTransactionPartnerType() string } @@ -2325,7 +2380,7 @@ type SavedMessagesTopicType interface { SavedMessagesTopicTypeType() string } -// Describes a text object inside an instant-view web page +// Describes a formatted text object type RichText interface { RichTextType() string } @@ -2340,11 +2395,21 @@ type PageBlockVerticalAlignment interface { PageBlockVerticalAlignmentType() string } -// Describes a block of an instant view web page +// Describes a block of an instant view for a web page type PageBlock interface { PageBlockType() string } +// Describes a media from a link preview album +type LinkPreviewAlbumMedia interface { + LinkPreviewAlbumMediaType() string +} + +// Describes type of link preview +type LinkPreviewType interface { + LinkPreviewTypeType() string +} + // Describes a collectible item that can be purchased at https://fragment.com type CollectibleItemType interface { CollectibleItemTypeType() string @@ -2460,12 +2525,12 @@ type EmojiCategoryType interface { EmojiCategoryTypeType() string } -// Describes type of clickable rectangle area on a story media +// Describes type of clickable area on a story media type StoryAreaType interface { StoryAreaTypeType() string } -// Describes type of clickable rectangle area on a story media to be added +// Describes type of clickable area on a story media to be added type InputStoryAreaType interface { InputStoryAreaTypeType() string } @@ -5896,6 +5961,8 @@ type UserTypeBot struct { CanJoinGroups bool `json:"can_join_groups"` // True, if the bot can read all messages in basic group or supergroup chats and not just those addressed to the bot. In private and channel chats a bot can always read all messages CanReadAllGroupMessages bool `json:"can_read_all_group_messages"` + // True, if the bot has the main Web App + HasMainWebApp bool `json:"has_main_web_app"` // True, if the bot supports inline queries IsInline bool `json:"is_inline"` // Placeholder for inline queries (displayed on the application input field) @@ -5906,6 +5973,8 @@ type UserTypeBot struct { CanConnectToBusiness bool `json:"can_connect_to_business"` // True, if the bot can be added to attachment or side menu CanBeAddedToAttachmentMenu bool `json:"can_be_added_to_attachment_menu"` + // The number of recently active users of the bot + ActiveUserCount int32 `json:"active_user_count"` } func (entity *UserTypeBot) MarshalJSON() ([]byte, error) { @@ -6974,8 +7043,8 @@ type ChatPermissions struct { CanSendGames bool `json:"can_send_games"` // True, if the user can use inline bots. Implies can_send_messages permissions CanUseInlineBots bool `json:"can_use_inline_bots"` - // True, if the user may add a web page preview to their messages - CanAddWebPagePreviews bool `json:"can_add_web_page_previews"` + // True, if the user may add a link preview to their messages + CanAddLinkPreviews bool `json:"can_add_link_previews"` // True, if the user can change the chat title, photo, and other settings CanChangeInfo bool `json:"can_change_info"` // True, if the user can invite new users to the chat @@ -7289,14 +7358,14 @@ func (premiumGiftCodeInfo *PremiumGiftCodeInfo) UnmarshalJSON(data []byte) error return nil } -// Describes an option for buying Telegram stars. Use telegramPaymentPurposeStars for out-of-store payments +// Describes an option for buying Telegram Stars. Use telegramPaymentPurposeStars for out-of-store payments type StarPaymentOption struct { meta // ISO 4217 currency code for the payment Currency string `json:"currency"` // The amount to pay, in the smallest units of the currency Amount int64 `json:"amount"` - // Number of Telegram stars that will be purchased + // Number of Telegram Stars that will be purchased StarCount int64 `json:"star_count"` // Identifier of the store product associated with the option; may be empty if none StoreProductId string `json:"store_product_id"` @@ -7320,7 +7389,7 @@ func (*StarPaymentOption) GetType() string { return TypeStarPaymentOption } -// Contains a list of options for buying Telegram stars +// Contains a list of options for buying Telegram Stars type StarPaymentOptions struct { meta // The list of options @@ -7343,7 +7412,7 @@ func (*StarPaymentOptions) GetType() string { return TypeStarPaymentOptions } -// The transaction is incoming and increases the number of owned Telegram stars +// The transaction is incoming and increases the number of owned Telegram Stars type StarTransactionDirectionIncoming struct{ meta } @@ -7368,7 +7437,7 @@ func (*StarTransactionDirectionIncoming) StarTransactionDirectionType() string { return TypeStarTransactionDirectionIncoming } -// The transaction is outgoing and decreases the number of owned Telegram stars +// The transaction is outgoing and decreases the number of owned Telegram Stars type StarTransactionDirectionOutgoing struct{ meta } @@ -7539,8 +7608,8 @@ func (*StarTransactionPartnerTelegramAds) StarTransactionPartnerType() string { // The transaction is a transaction with a bot type StarTransactionPartnerBot struct { meta - // Identifier of the bot - BotUserId int64 `json:"bot_user_id"` + // Identifier of the bot for the user, or the user for the bot + UserId int64 `json:"user_id"` // Information about the bought product; may be null if not applicable ProductInfo *ProductInfo `json:"product_info"` // Invoice payload; for bots only @@ -7619,6 +7688,35 @@ func (starTransactionPartnerChannel *StarTransactionPartnerChannel) UnmarshalJSO return nil } +// The transaction is a gift of Telegram Stars from another user +type StarTransactionPartnerUser struct { + meta + // Identifier of the user; 0 if the gift was anonymous + UserId int64 `json:"user_id"` + // A sticker to be shown in the transaction information; may be null if unknown + Sticker *Sticker `json:"sticker"` +} + +func (entity *StarTransactionPartnerUser) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionPartnerUser + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionPartnerUser) GetClass() string { + return ClassStarTransactionPartner +} + +func (*StarTransactionPartnerUser) GetType() string { + return TypeStarTransactionPartnerUser +} + +func (*StarTransactionPartnerUser) StarTransactionPartnerType() string { + return TypeStarTransactionPartnerUser +} + // The transaction is a transaction with unknown partner type StarTransactionPartnerUnsupported struct{ meta @@ -7644,12 +7742,12 @@ func (*StarTransactionPartnerUnsupported) StarTransactionPartnerType() string { return TypeStarTransactionPartnerUnsupported } -// Represents a transaction changing the amount of owned Telegram stars +// Represents a transaction changing the amount of owned Telegram Stars type StarTransaction struct { meta // Unique identifier of the transaction Id string `json:"id"` - // The amount of added owned Telegram stars; negative for outgoing transactions + // The amount of added owned Telegram Stars; negative for outgoing transactions StarCount int64 `json:"star_count"` // True, if the transaction is a refund of a previous transaction IsRefund bool `json:"is_refund"` @@ -7700,12 +7798,12 @@ func (starTransaction *StarTransaction) UnmarshalJSON(data []byte) error { return nil } -// Represents a list of Telegram star transactions +// Represents a list of Telegram Star transactions type StarTransactions struct { meta - // The amount of owned Telegram stars + // The amount of owned Telegram Stars StarCount int64 `json:"star_count"` - // List of transactions with Telegram stars + // List of transactions with Telegram Stars Transactions []*StarTransaction `json:"transactions"` // The offset for the next request. If empty, then there are no more results NextOffset string `json:"next_offset"` @@ -8284,6 +8382,8 @@ type BotInfo struct { DefaultGroupAdministratorRights *ChatAdministratorRights `json:"default_group_administrator_rights"` // Default administrator rights for adding the bot to channels; may be null DefaultChannelAdministratorRights *ChatAdministratorRights `json:"default_channel_administrator_rights"` + // True, if the bot has media previews + HasMediaPreviews bool `json:"has_media_previews"` // The internal link, which can be used to edit bot commands; may be null EditCommandsLink InternalLinkType `json:"edit_commands_link"` // The internal link, which can be used to edit bot description; may be null @@ -8320,6 +8420,7 @@ func (botInfo *BotInfo) UnmarshalJSON(data []byte) error { Commands []*BotCommand `json:"commands"` DefaultGroupAdministratorRights *ChatAdministratorRights `json:"default_group_administrator_rights"` DefaultChannelAdministratorRights *ChatAdministratorRights `json:"default_channel_administrator_rights"` + HasMediaPreviews bool `json:"has_media_previews"` EditCommandsLink json.RawMessage `json:"edit_commands_link"` EditDescriptionLink json.RawMessage `json:"edit_description_link"` EditDescriptionMediaLink json.RawMessage `json:"edit_description_media_link"` @@ -8339,6 +8440,7 @@ func (botInfo *BotInfo) UnmarshalJSON(data []byte) error { botInfo.Commands = tmp.Commands botInfo.DefaultGroupAdministratorRights = tmp.DefaultGroupAdministratorRights botInfo.DefaultChannelAdministratorRights = tmp.DefaultChannelAdministratorRights + botInfo.HasMediaPreviews = tmp.HasMediaPreviews fieldEditCommandsLink, _ := UnmarshalInternalLinkType(tmp.EditCommandsLink) botInfo.EditCommandsLink = fieldEditCommandsLink @@ -8496,6 +8598,31 @@ func (*Users) GetType() string { return TypeUsers } +// Represents a list of found users +type FoundUsers struct { + meta + // Identifiers of the found users + UserIds []int64 `json:"user_ids"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` +} + +func (entity *FoundUsers) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FoundUsers + + return json.Marshal((*stub)(entity)) +} + +func (*FoundUsers) GetClass() string { + return ClassFoundUsers +} + +func (*FoundUsers) GetType() string { + return TypeFoundUsers +} + // Contains information about a chat administrator type ChatAdministrator struct { meta @@ -9712,7 +9839,7 @@ type Supergroup struct { Date int32 `json:"date"` // Status of the current user in the supergroup or channel; custom title will always be empty Status ChatMemberStatus `json:"status"` - // Number of members in the supergroup or channel; 0 if unknown. Currently, it is guaranteed to be known only if the supergroup or channel was received through getChatSimilarChats, getChatsToSendStories, getCreatedPublicChats, getGroupsInCommon, getInactiveSupergroupChats, getRecommendedChats, getSuitableDiscussionChats, getUserPrivacySettingRules, getVideoChatAvailableParticipants, searchChatsNearby, searchPublicChats, or in chatFolderInviteLinkInfo.missing_chat_ids, or in userFullInfo.personal_chat_id, or for chats with messages or stories from publicForwards + // Number of members in the supergroup or channel; 0 if unknown. Currently, it is guaranteed to be known only if the supergroup or channel was received through getChatSimilarChats, getChatsToSendStories, getCreatedPublicChats, getGroupsInCommon, getInactiveSupergroupChats, getRecommendedChats, getSuitableDiscussionChats, getUserPrivacySettingRules, getVideoChatAvailableParticipants, searchChatsNearby, searchPublicChats, or in chatFolderInviteLinkInfo.missing_chat_ids, or in userFullInfo.personal_chat_id, or for chats with messages or stories from publicForwards and foundStories MemberCount int32 `json:"member_count"` // Approximate boost level for the chat BoostLevel int32 `json:"boost_level"` @@ -9858,6 +9985,8 @@ type SupergroupFullInfo struct { CanGetStatistics bool `json:"can_get_statistics"` // True, if the supergroup or channel revenue statistics are available CanGetRevenueStatistics bool `json:"can_get_revenue_statistics"` + // True, if the supergroup or channel Telegram Star revenue statistics are available + CanGetStarRevenueStatistics bool `json:"can_get_star_revenue_statistics"` // True, if aggressive anti-spam checks can be enabled or disabled in the supergroup CanToggleAggressiveAntiSpam bool `json:"can_toggle_aggressive_anti_spam"` // 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, so this option affects only private non-forum supergroups without a linked chat. The value of this field is only available to chat administrators @@ -11050,7 +11179,7 @@ type MessageSendingStateFailed struct { meta // The cause of the message sending failure Error *Error `json:"error"` - // True, if the message can be re-sent + // True, if the message can be re-sent using resendMessages or readdQuickReplyShortcutMessages CanRetry bool `json:"can_retry"` // True, if the message can be re-sent only on behalf of a different sender NeedAnotherSender bool `json:"need_another_sender"` @@ -11232,7 +11361,7 @@ func (*MessageReplyToStory) MessageReplyToType() string { // Describes a message to be replied in the same chat and forum topic type InputMessageReplyToMessage struct { meta - // The identifier of the message to be replied in the same chat and forum topic + // The identifier of the message to be replied in the same chat and forum topic. A message can be replied in the same chat and forum topic only if messageProperties.can_be_replied MessageId int64 `json:"message_id"` // Quote from the message to be replied; pass null if none. Must always be null for replies in secret chats Quote *InputTextQuote `json:"quote"` @@ -11263,7 +11392,7 @@ type InputMessageReplyToExternalMessage struct { meta // The identifier of the chat to which the message to be replied belongs ChatId int64 `json:"chat_id"` - // The identifier of the message to be replied in the specified chat. A message can be replied in another chat or topic only if message.can_be_replied_in_another_chat + // The identifier of the message to be replied in the specified chat. A message can be replied in another chat or forum topic only if messageProperties.can_be_replied_in_another_chat MessageId int64 `json:"message_id"` // Quote from the message to be replied; pass null if none Quote *InputTextQuote `json:"quote"` @@ -11362,32 +11491,8 @@ type Message struct { IsPinned bool `json:"is_pinned"` // True, if the message was sent because of a scheduled action by the message sender, for example, as away, or greeting service message IsFromOffline bool `json:"is_from_offline"` - // True, if the message can be edited. For live location and poll messages this fields shows whether editMessageLiveLocation or stopPoll can be used with this message by the application - CanBeEdited bool `json:"can_be_edited"` - // True, if the message can be forwarded - CanBeForwarded bool `json:"can_be_forwarded"` - // True, if the message can be replied in another chat or topic - CanBeRepliedInAnotherChat bool `json:"can_be_replied_in_another_chat"` // True, if content of the message can be saved locally or copied CanBeSaved bool `json:"can_be_saved"` - // True, if the message can be deleted only for the current user while other users will continue to see it - CanBeDeletedOnlyForSelf bool `json:"can_be_deleted_only_for_self"` - // True, if the message can be deleted for all users - CanBeDeletedForAllUsers bool `json:"can_be_deleted_for_all_users"` - // True, if the list of added reactions is available through getMessageAddedReactions - CanGetAddedReactions bool `json:"can_get_added_reactions"` - // True, if the message statistics are available through getMessageStatistics - CanGetStatistics bool `json:"can_get_statistics"` - // True, if information about the message thread is available through getMessageThread and getMessageThreadHistory - CanGetMessageThread bool `json:"can_get_message_thread"` - // True, if read date of the message can be received through getMessageReadDate - CanGetReadDate bool `json:"can_get_read_date"` - // True, if chat members already viewed the message can be received through getMessageViewers - CanGetViewers bool `json:"can_get_viewers"` - // True, if media timestamp links can be generated for media timestamp entities in the message text, caption or web page description through getMessageLink - CanGetMediaTimestampLinks bool `json:"can_get_media_timestamp_links"` - // True, if reactions on the message can be reported through reportMessageReactions - CanReportReactions bool `json:"can_report_reactions"` // True, if media timestamp entities refers to a media in this message as opposed to a media in the replied message HasTimestampedMedia bool `json:"has_timestamped_media"` // True, if the message is a channel post. All messages to channels are channel posts, all other messages are not channel posts @@ -11468,19 +11573,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { IsOutgoing bool `json:"is_outgoing"` IsPinned bool `json:"is_pinned"` IsFromOffline bool `json:"is_from_offline"` - CanBeEdited bool `json:"can_be_edited"` - CanBeForwarded bool `json:"can_be_forwarded"` - CanBeRepliedInAnotherChat bool `json:"can_be_replied_in_another_chat"` CanBeSaved bool `json:"can_be_saved"` - CanBeDeletedOnlyForSelf bool `json:"can_be_deleted_only_for_self"` - CanBeDeletedForAllUsers bool `json:"can_be_deleted_for_all_users"` - CanGetAddedReactions bool `json:"can_get_added_reactions"` - CanGetStatistics bool `json:"can_get_statistics"` - CanGetMessageThread bool `json:"can_get_message_thread"` - CanGetReadDate bool `json:"can_get_read_date"` - CanGetViewers bool `json:"can_get_viewers"` - CanGetMediaTimestampLinks bool `json:"can_get_media_timestamp_links"` - CanReportReactions bool `json:"can_report_reactions"` HasTimestampedMedia bool `json:"has_timestamped_media"` IsChannelPost bool `json:"is_channel_post"` IsTopicMessage bool `json:"is_topic_message"` @@ -11519,19 +11612,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { message.IsOutgoing = tmp.IsOutgoing message.IsPinned = tmp.IsPinned message.IsFromOffline = tmp.IsFromOffline - message.CanBeEdited = tmp.CanBeEdited - message.CanBeForwarded = tmp.CanBeForwarded - message.CanBeRepliedInAnotherChat = tmp.CanBeRepliedInAnotherChat message.CanBeSaved = tmp.CanBeSaved - message.CanBeDeletedOnlyForSelf = tmp.CanBeDeletedOnlyForSelf - message.CanBeDeletedForAllUsers = tmp.CanBeDeletedForAllUsers - message.CanGetAddedReactions = tmp.CanGetAddedReactions - message.CanGetStatistics = tmp.CanGetStatistics - message.CanGetMessageThread = tmp.CanGetMessageThread - message.CanGetReadDate = tmp.CanGetReadDate - message.CanGetViewers = tmp.CanGetViewers - message.CanGetMediaTimestampLinks = tmp.CanGetMediaTimestampLinks - message.CanReportReactions = tmp.CanReportReactions message.HasTimestampedMedia = tmp.HasTimestampedMedia message.IsChannelPost = tmp.IsChannelPost message.IsTopicMessage = tmp.IsTopicMessage @@ -15001,6 +15082,31 @@ func (*WebAppInfo) GetType() string { return TypeWebAppInfo } +// Contains information about the main Web App of a bot +type MainWebApp struct { + meta + // URL of the Web App to open + Url string `json:"url"` + // True, if the Web App must always be opened in the compact mode instead of the full-size mode + IsCompact bool `json:"is_compact"` +} + +func (entity *MainWebApp) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MainWebApp + + return json.Marshal((*stub)(entity)) +} + +func (*MainWebApp) GetClass() string { + return ClassMainWebApp +} + +func (*MainWebApp) GetType() string { + return TypeMainWebApp +} + // Contains information about a message thread type MessageThreadInfo struct { meta @@ -15012,7 +15118,7 @@ type MessageThreadInfo struct { ReplyInfo *MessageReplyInfo `json:"reply_info"` // Approximate number of unread messages in the message thread UnreadMessageCount int32 `json:"unread_message_count"` - // The messages from which the thread starts. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id) + // The messages from which the thread starts. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id) Messages []*Message `json:"messages"` // A draft of a message in the message thread; may be null if none DraftMessage *DraftMessage `json:"draft_message"` @@ -15431,6 +15537,62 @@ func (*SharedChat) GetType() string { return TypeSharedChat } +// Describes theme settings +type ThemeSettings struct { + meta + // Theme accent color in ARGB format + AccentColor int32 `json:"accent_color"` + // The background to be used in chats; may be null + Background *Background `json:"background"` + // The fill to be used as a background for outgoing messages + OutgoingMessageFill BackgroundFill `json:"outgoing_message_fill"` + // If true, the freeform gradient fill needs to be animated on every sent message + AnimateOutgoingMessageFill bool `json:"animate_outgoing_message_fill"` + // Accent color of outgoing messages in ARGB format + OutgoingMessageAccentColor int32 `json:"outgoing_message_accent_color"` +} + +func (entity *ThemeSettings) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ThemeSettings + + return json.Marshal((*stub)(entity)) +} + +func (*ThemeSettings) GetClass() string { + return ClassThemeSettings +} + +func (*ThemeSettings) GetType() string { + return TypeThemeSettings +} + +func (themeSettings *ThemeSettings) UnmarshalJSON(data []byte) error { + var tmp struct { + AccentColor int32 `json:"accent_color"` + Background *Background `json:"background"` + OutgoingMessageFill json.RawMessage `json:"outgoing_message_fill"` + AnimateOutgoingMessageFill bool `json:"animate_outgoing_message_fill"` + OutgoingMessageAccentColor int32 `json:"outgoing_message_accent_color"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + themeSettings.AccentColor = tmp.AccentColor + themeSettings.Background = tmp.Background + themeSettings.AnimateOutgoingMessageFill = tmp.AnimateOutgoingMessageFill + themeSettings.OutgoingMessageAccentColor = tmp.OutgoingMessageAccentColor + + fieldOutgoingMessageFill, _ := UnmarshalBackgroundFill(tmp.OutgoingMessageFill) + themeSettings.OutgoingMessageFill = fieldOutgoingMessageFill + + return nil +} + // A plain text type RichTextPlain struct { meta @@ -15981,7 +16143,7 @@ func (*RichTextIcon) RichTextType() string { return TypeRichTextIcon } -// A reference to a richTexts object on the same web page +// A reference to a richTexts object on the same page type RichTextReference struct { meta // The text @@ -16060,7 +16222,7 @@ func (*RichTextAnchor) RichTextType() string { return TypeRichTextAnchor } -// A link to an anchor on the same web page +// A link to an anchor on the same page type RichTextAnchorLink struct { meta // The link text @@ -16155,7 +16317,7 @@ func (richTexts *RichTexts) UnmarshalJSON(data []byte) error { return nil } -// Contains a caption of an instant view web page block, consisting of a text and a trailing credit +// Contains a caption of another block type PageBlockCaption struct { meta // Content of the caption @@ -17264,7 +17426,7 @@ func (pageBlockCover *PageBlockCover) UnmarshalJSON(data []byte) error { // An embedded web page type PageBlockEmbedded struct { meta - // Web page URL, if available + // URL of the embedded page, if available Url string `json:"url"` // HTML-markup of the embedded page Html string `json:"html"` @@ -17305,7 +17467,7 @@ func (*PageBlockEmbedded) PageBlockType() string { // An embedded post type PageBlockEmbeddedPost struct { meta - // Web page URL + // URL of the embedded post Url string `json:"url"` // Post author Author string `json:"author"` @@ -17691,7 +17853,7 @@ func (*PageBlockMap) PageBlockType() string { // Describes an instant view page for a web page type WebPageInstantView struct { meta - // Content of the web page + // Content of the instant view page PageBlocks []PageBlock `json:"page_blocks"` // Number of the instant view views; 0 if unknown ViewCount int32 `json:"view_count"` @@ -17699,7 +17861,7 @@ type WebPageInstantView struct { Version int32 `json:"version"` // True, if the instant view must be shown from right to left IsRtl bool `json:"is_rtl"` - // True, if the instant view contains the full page. A network request might be needed to get the full web page instant view + // True, if the instant view contains the full page. A network request might be needed to get the full instant view IsFull bool `json:"is_full"` // An internal link to be opened to leave feedback about the instant view FeedbackLink InternalLinkType `json:"feedback_link"` @@ -17750,81 +17912,1029 @@ func (webPageInstantView *WebPageInstantView) UnmarshalJSON(data []byte) error { return nil } +// The media is a photo +type LinkPreviewAlbumMediaPhoto struct { + meta + // Photo description + Photo *Photo `json:"photo"` +} + +func (entity *LinkPreviewAlbumMediaPhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewAlbumMediaPhoto + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewAlbumMediaPhoto) GetClass() string { + return ClassLinkPreviewAlbumMedia +} + +func (*LinkPreviewAlbumMediaPhoto) GetType() string { + return TypeLinkPreviewAlbumMediaPhoto +} + +func (*LinkPreviewAlbumMediaPhoto) LinkPreviewAlbumMediaType() string { + return TypeLinkPreviewAlbumMediaPhoto +} + +// The media is a video +type LinkPreviewAlbumMediaVideo struct { + meta + // Video description + Video *Video `json:"video"` +} + +func (entity *LinkPreviewAlbumMediaVideo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewAlbumMediaVideo + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewAlbumMediaVideo) GetClass() string { + return ClassLinkPreviewAlbumMedia +} + +func (*LinkPreviewAlbumMediaVideo) GetType() string { + return TypeLinkPreviewAlbumMediaVideo +} + +func (*LinkPreviewAlbumMediaVideo) LinkPreviewAlbumMediaType() string { + return TypeLinkPreviewAlbumMediaVideo +} + +// The link is a link to a media album consisting of photos and videos +type LinkPreviewTypeAlbum struct { + meta + // The list of album media + Media []LinkPreviewAlbumMedia `json:"media"` + // Album caption + Caption string `json:"caption"` +} + +func (entity *LinkPreviewTypeAlbum) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeAlbum + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeAlbum) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeAlbum) GetType() string { + return TypeLinkPreviewTypeAlbum +} + +func (*LinkPreviewTypeAlbum) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeAlbum +} + +func (linkPreviewTypeAlbum *LinkPreviewTypeAlbum) UnmarshalJSON(data []byte) error { + var tmp struct { + Media []json.RawMessage `json:"media"` + Caption string `json:"caption"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + linkPreviewTypeAlbum.Caption = tmp.Caption + + fieldMedia, _ := UnmarshalListOfLinkPreviewAlbumMedia(tmp.Media) + linkPreviewTypeAlbum.Media = fieldMedia + + return nil +} + +// The link is a link to an animation +type LinkPreviewTypeAnimation struct { + meta + // The animation + Animation *Animation `json:"animation"` + // Author of the animation + Author string `json:"author"` +} + +func (entity *LinkPreviewTypeAnimation) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeAnimation + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeAnimation) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeAnimation) GetType() string { + return TypeLinkPreviewTypeAnimation +} + +func (*LinkPreviewTypeAnimation) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeAnimation +} + +// The link is a link to an app at App Store or Google Play +type LinkPreviewTypeApp struct { + meta + // Photo for the app + Photo *Photo `json:"photo"` + // Author of the app + Author string `json:"author"` +} + +func (entity *LinkPreviewTypeApp) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeApp + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeApp) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeApp) GetType() string { + return TypeLinkPreviewTypeApp +} + +func (*LinkPreviewTypeApp) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeApp +} + +// The link is a link to a web site +type LinkPreviewTypeArticle struct { + meta + // Article's main photo; may be null + Photo *Photo `json:"photo"` + // Author of the article + Author string `json:"author"` +} + +func (entity *LinkPreviewTypeArticle) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeArticle + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeArticle) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeArticle) GetType() string { + return TypeLinkPreviewTypeArticle +} + +func (*LinkPreviewTypeArticle) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeArticle +} + +// The link is a link to an audio +type LinkPreviewTypeAudio struct { + meta + // URL of the audio; may be empty if none + Url string `json:"url"` + // MIME type of the audio file + MimeType string `json:"mime_type"` + // The audio description; may be null if unknown + Audio *Audio `json:"audio"` + // Duration of the audio, in seconds; 0 if unknown + Duration int32 `json:"duration"` + // Author of the audio + Author string `json:"author"` +} + +func (entity *LinkPreviewTypeAudio) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeAudio + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeAudio) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeAudio) GetType() string { + return TypeLinkPreviewTypeAudio +} + +func (*LinkPreviewTypeAudio) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeAudio +} + +// The link is a link to a background. Link preview title and description are available only for filled backgrounds +type LinkPreviewTypeBackground struct { + meta + // Document with the background; may be null for filled backgrounds + Document *Document `json:"document"` +} + +func (entity *LinkPreviewTypeBackground) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeBackground + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeBackground) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeBackground) GetType() string { + return TypeLinkPreviewTypeBackground +} + +func (*LinkPreviewTypeBackground) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeBackground +} + +// The link is a link to boost a channel chat +type LinkPreviewTypeChannelBoost struct { + meta + // Photo of the chat; may be null + Photo *ChatPhoto `json:"photo"` +} + +func (entity *LinkPreviewTypeChannelBoost) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeChannelBoost + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeChannelBoost) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeChannelBoost) GetType() string { + return TypeLinkPreviewTypeChannelBoost +} + +func (*LinkPreviewTypeChannelBoost) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeChannelBoost +} + +// The link is a link to a chat +type LinkPreviewTypeChat struct { + meta + // Type of the chat + Type InviteLinkChatType `json:"type"` + // Photo of the chat; may be null + Photo *ChatPhoto `json:"photo"` + // True, if the link only creates join request + CreatesJoinRequest bool `json:"creates_join_request"` +} + +func (entity *LinkPreviewTypeChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeChat + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeChat) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeChat) GetType() string { + return TypeLinkPreviewTypeChat +} + +func (*LinkPreviewTypeChat) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeChat +} + +func (linkPreviewTypeChat *LinkPreviewTypeChat) UnmarshalJSON(data []byte) error { + var tmp struct { + Type json.RawMessage `json:"type"` + Photo *ChatPhoto `json:"photo"` + CreatesJoinRequest bool `json:"creates_join_request"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + linkPreviewTypeChat.Photo = tmp.Photo + linkPreviewTypeChat.CreatesJoinRequest = tmp.CreatesJoinRequest + + fieldType, _ := UnmarshalInviteLinkChatType(tmp.Type) + linkPreviewTypeChat.Type = fieldType + + return nil +} + +// The link is a link to a general file +type LinkPreviewTypeDocument struct { + meta + // The document description + Document *Document `json:"document"` + // Author of the document + Author string `json:"author"` +} + +func (entity *LinkPreviewTypeDocument) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeDocument + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeDocument) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeDocument) GetType() string { + return TypeLinkPreviewTypeDocument +} + +func (*LinkPreviewTypeDocument) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeDocument +} + +// The link is a link to an animation player +type LinkPreviewTypeEmbeddedAnimationPlayer struct { + meta + // URL of the external animation player + Url string `json:"url"` + // Thumbnail of the animation; may be null if unknown + Thumbnail *Photo `json:"thumbnail"` + // Duration of the animation, in seconds + Duration int32 `json:"duration"` + // Author of the animation + Author string `json:"author"` + // Expected width of the embedded player + Width int32 `json:"width"` + // Expected height of the embedded player + Height int32 `json:"height"` +} + +func (entity *LinkPreviewTypeEmbeddedAnimationPlayer) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeEmbeddedAnimationPlayer + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeEmbeddedAnimationPlayer) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeEmbeddedAnimationPlayer) GetType() string { + return TypeLinkPreviewTypeEmbeddedAnimationPlayer +} + +func (*LinkPreviewTypeEmbeddedAnimationPlayer) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeEmbeddedAnimationPlayer +} + +// The link is a link to an audio player +type LinkPreviewTypeEmbeddedAudioPlayer struct { + meta + // URL of the external audio player + Url string `json:"url"` + // Thumbnail of the audio; may be null if unknown + Thumbnail *Photo `json:"thumbnail"` + // Duration of the audio, in seconds + Duration int32 `json:"duration"` + // Author of the audio + Author string `json:"author"` + // Expected width of the embedded player + Width int32 `json:"width"` + // Expected height of the embedded player + Height int32 `json:"height"` +} + +func (entity *LinkPreviewTypeEmbeddedAudioPlayer) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeEmbeddedAudioPlayer + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeEmbeddedAudioPlayer) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeEmbeddedAudioPlayer) GetType() string { + return TypeLinkPreviewTypeEmbeddedAudioPlayer +} + +func (*LinkPreviewTypeEmbeddedAudioPlayer) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeEmbeddedAudioPlayer +} + +// The link is a link to a video player +type LinkPreviewTypeEmbeddedVideoPlayer struct { + meta + // URL of the external video player + Url string `json:"url"` + // Thumbnail of the video; may be null if unknown + Thumbnail *Photo `json:"thumbnail"` + // Duration of the video, in seconds + Duration int32 `json:"duration"` + // Author of the video + Author string `json:"author"` + // Expected width of the embedded player + Width int32 `json:"width"` + // Expected height of the embedded player + Height int32 `json:"height"` +} + +func (entity *LinkPreviewTypeEmbeddedVideoPlayer) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeEmbeddedVideoPlayer + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeEmbeddedVideoPlayer) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeEmbeddedVideoPlayer) GetType() string { + return TypeLinkPreviewTypeEmbeddedVideoPlayer +} + +func (*LinkPreviewTypeEmbeddedVideoPlayer) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeEmbeddedVideoPlayer +} + +// The link is a link to an invoice +type LinkPreviewTypeInvoice struct{ + meta +} + +func (entity *LinkPreviewTypeInvoice) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeInvoice + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeInvoice) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeInvoice) GetType() string { + return TypeLinkPreviewTypeInvoice +} + +func (*LinkPreviewTypeInvoice) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeInvoice +} + +// The link is a link to a text or a poll Telegram message +type LinkPreviewTypeMessage struct{ + meta +} + +func (entity *LinkPreviewTypeMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeMessage + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeMessage) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeMessage) GetType() string { + return TypeLinkPreviewTypeMessage +} + +func (*LinkPreviewTypeMessage) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeMessage +} + +// The link is a link to a photo +type LinkPreviewTypePhoto struct { + meta + // The photo + Photo *Photo `json:"photo"` + // Author of the photo + Author string `json:"author"` +} + +func (entity *LinkPreviewTypePhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypePhoto + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypePhoto) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypePhoto) GetType() string { + return TypeLinkPreviewTypePhoto +} + +func (*LinkPreviewTypePhoto) LinkPreviewTypeType() string { + return TypeLinkPreviewTypePhoto +} + +// The link is a link to a Telegram Premium gift code +type LinkPreviewTypePremiumGiftCode struct{ + meta +} + +func (entity *LinkPreviewTypePremiumGiftCode) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypePremiumGiftCode + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypePremiumGiftCode) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypePremiumGiftCode) GetType() string { + return TypeLinkPreviewTypePremiumGiftCode +} + +func (*LinkPreviewTypePremiumGiftCode) LinkPreviewTypeType() string { + return TypeLinkPreviewTypePremiumGiftCode +} + +// The link is a link to a shareable chat folder +type LinkPreviewTypeShareableChatFolder struct{ + meta +} + +func (entity *LinkPreviewTypeShareableChatFolder) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeShareableChatFolder + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeShareableChatFolder) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeShareableChatFolder) GetType() string { + return TypeLinkPreviewTypeShareableChatFolder +} + +func (*LinkPreviewTypeShareableChatFolder) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeShareableChatFolder +} + +// The link is a link to a sticker message +type LinkPreviewTypeSticker struct { + meta + // The sticker + Sticker *Sticker `json:"sticker"` +} + +func (entity *LinkPreviewTypeSticker) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeSticker + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeSticker) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeSticker) GetType() string { + return TypeLinkPreviewTypeSticker +} + +func (*LinkPreviewTypeSticker) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeSticker +} + +// The link is a link to a sticker set +type LinkPreviewTypeStickerSet struct { + meta + // Up to 4 stickers from the sticker set + Stickers []*Sticker `json:"stickers"` +} + +func (entity *LinkPreviewTypeStickerSet) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeStickerSet + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeStickerSet) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeStickerSet) GetType() string { + return TypeLinkPreviewTypeStickerSet +} + +func (*LinkPreviewTypeStickerSet) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeStickerSet +} + +// The link is a link to a story. Link preview description is unavailable +type LinkPreviewTypeStory struct { + meta + // The identifier of the chat that posted the story + StorySenderChatId int64 `json:"story_sender_chat_id"` + // Story identifier + StoryId int32 `json:"story_id"` +} + +func (entity *LinkPreviewTypeStory) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeStory + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeStory) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeStory) GetType() string { + return TypeLinkPreviewTypeStory +} + +func (*LinkPreviewTypeStory) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeStory +} + +// The link is a link to boost a supergroup chat +type LinkPreviewTypeSupergroupBoost struct { + meta + // Photo of the chat; may be null + Photo *ChatPhoto `json:"photo"` +} + +func (entity *LinkPreviewTypeSupergroupBoost) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeSupergroupBoost + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeSupergroupBoost) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeSupergroupBoost) GetType() string { + return TypeLinkPreviewTypeSupergroupBoost +} + +func (*LinkPreviewTypeSupergroupBoost) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeSupergroupBoost +} + +// The link is a link to a cloud theme. TDLib has no theme support yet +type LinkPreviewTypeTheme struct { + meta + // The list of files with theme description + Documents []*Document `json:"documents"` + // Settings for the cloud theme + Settings *ThemeSettings `json:"settings"` +} + +func (entity *LinkPreviewTypeTheme) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeTheme + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeTheme) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeTheme) GetType() string { + return TypeLinkPreviewTypeTheme +} + +func (*LinkPreviewTypeTheme) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeTheme +} + +// The link preview type is unsupported yet +type LinkPreviewTypeUnsupported struct{ + meta +} + +func (entity *LinkPreviewTypeUnsupported) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeUnsupported + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeUnsupported) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeUnsupported) GetType() string { + return TypeLinkPreviewTypeUnsupported +} + +func (*LinkPreviewTypeUnsupported) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeUnsupported +} + +// The link is a link to a user +type LinkPreviewTypeUser struct { + meta + // Photo of the user; may be null if none + Photo *ChatPhoto `json:"photo"` + // True, if the user is a bot + IsBot bool `json:"is_bot"` +} + +func (entity *LinkPreviewTypeUser) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeUser + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeUser) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeUser) GetType() string { + return TypeLinkPreviewTypeUser +} + +func (*LinkPreviewTypeUser) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeUser +} + +// The link is a link to a video +type LinkPreviewTypeVideo struct { + meta + // URL of the video; may be empty if none + Url string `json:"url"` + // MIME type of the video file + MimeType string `json:"mime_type"` + // The video description; may be null if unknown + Video *Video `json:"video"` + // Expected width of the preview + Width int32 `json:"width"` + // Expected height of the preview + Height int32 `json:"height"` + // Duration of the video, in seconds; 0 if unknown + Duration int32 `json:"duration"` + // Author of the video + Author string `json:"author"` +} + +func (entity *LinkPreviewTypeVideo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeVideo + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeVideo) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeVideo) GetType() string { + return TypeLinkPreviewTypeVideo +} + +func (*LinkPreviewTypeVideo) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeVideo +} + +// The link is a link to a video chat +type LinkPreviewTypeVideoChat struct { + meta + // Photo of the chat with the video chat; may be null if none + Photo *ChatPhoto `json:"photo"` + // True, if the video chat is expected to be a live stream in a channel or a broadcast group + IsLiveStream bool `json:"is_live_stream"` +} + +func (entity *LinkPreviewTypeVideoChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeVideoChat + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeVideoChat) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeVideoChat) GetType() string { + return TypeLinkPreviewTypeVideoChat +} + +func (*LinkPreviewTypeVideoChat) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeVideoChat +} + +// The link is a link to a video note message +type LinkPreviewTypeVideoNote struct { + meta + // The video note + VideoNote *VideoNote `json:"video_note"` +} + +func (entity *LinkPreviewTypeVideoNote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeVideoNote + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeVideoNote) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeVideoNote) GetType() string { + return TypeLinkPreviewTypeVideoNote +} + +func (*LinkPreviewTypeVideoNote) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeVideoNote +} + +// The link is a link to a voice note message +type LinkPreviewTypeVoiceNote struct { + meta + // The voice note + VoiceNote *VoiceNote `json:"voice_note"` +} + +func (entity *LinkPreviewTypeVoiceNote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeVoiceNote + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeVoiceNote) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeVoiceNote) GetType() string { + return TypeLinkPreviewTypeVoiceNote +} + +func (*LinkPreviewTypeVoiceNote) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeVoiceNote +} + +// The link is a link to a Web App +type LinkPreviewTypeWebApp struct { + meta + // Web App photo + Photo *Photo `json:"photo"` +} + +func (entity *LinkPreviewTypeWebApp) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeWebApp + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeWebApp) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeWebApp) GetType() string { + return TypeLinkPreviewTypeWebApp +} + +func (*LinkPreviewTypeWebApp) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeWebApp +} + // Describes a link preview -type WebPage struct { +type LinkPreview struct { meta // Original URL of the link Url string `json:"url"` // URL to display DisplayUrl string `json:"display_url"` - // Type of the web page. Can be: article, photo, audio, video, document, profile, app, or something else - Type string `json:"type"` // Short name of the site (e.g., Google Docs, App Store) SiteName string `json:"site_name"` // Title of the content Title string `json:"title"` // Description of the content Description *FormattedText `json:"description"` - // Image representing the content; may be null - Photo *Photo `json:"photo"` - // URL to show in the embedded preview - EmbedUrl string `json:"embed_url"` - // MIME type of the embedded preview, (e.g., text/html or video/mp4) - EmbedType string `json:"embed_type"` - // Width of the embedded preview - EmbedWidth int32 `json:"embed_width"` - // Height of the embedded preview - EmbedHeight int32 `json:"embed_height"` - // Duration of the content, in seconds - Duration int32 `json:"duration"` - // Author of the content - Author string `json:"author"` + // Type of the link preview + Type LinkPreviewType `json:"type"` // True, if size of media in the preview can be changed HasLargeMedia bool `json:"has_large_media"` // True, if large media preview must be shown; otherwise, the media preview must be shown small and only the first frame must be shown for videos ShowLargeMedia bool `json:"show_large_media"` + // True, if media must be shown above link preview description; otherwise, the media must be shown below the description + ShowMediaAboveDescription bool `json:"show_media_above_description"` // True, if there is no need to show an ordinary open URL confirmation, when opening the URL from the preview, because the URL is shown in the message text in clear SkipConfirmation bool `json:"skip_confirmation"` // True, if the link preview must be shown above message text; otherwise, the link preview must be shown below the message text ShowAboveText bool `json:"show_above_text"` - // Preview of the content as an animation, if available; may be null - Animation *Animation `json:"animation"` - // Preview of the content as an audio file, if available; may be null - Audio *Audio `json:"audio"` - // Preview of the content as a document, if available; may be null - Document *Document `json:"document"` - // Preview of the content as a sticker for small WEBP files, if available; may be null - Sticker *Sticker `json:"sticker"` - // Preview of the content as a video, if available; may be null - Video *Video `json:"video"` - // Preview of the content as a video note, if available; may be null - VideoNote *VideoNote `json:"video_note"` - // Preview of the content as a voice note, if available; may be null - VoiceNote *VoiceNote `json:"voice_note"` - // The identifier of the sender of the previewed story; 0 if none - StorySenderChatId int64 `json:"story_sender_chat_id"` - // The identifier of the previewed story; 0 if none - StoryId int32 `json:"story_id"` - // Up to 4 stickers from the sticker set available via the link - Stickers []*Sticker `json:"stickers"` - // Version of web page instant view (currently, can be 1 or 2); 0 if none + // Version of instant view (currently, can be 1 or 2) for the web page; 0 if none InstantViewVersion int32 `json:"instant_view_version"` } -func (entity *WebPage) MarshalJSON() ([]byte, error) { +func (entity *LinkPreview) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub WebPage + type stub LinkPreview return json.Marshal((*stub)(entity)) } -func (*WebPage) GetClass() string { - return ClassWebPage +func (*LinkPreview) GetClass() string { + return ClassLinkPreview } -func (*WebPage) GetType() string { - return TypeWebPage +func (*LinkPreview) GetType() string { + return TypeLinkPreview +} + +func (linkPreview *LinkPreview) UnmarshalJSON(data []byte) error { + var tmp struct { + Url string `json:"url"` + DisplayUrl string `json:"display_url"` + SiteName string `json:"site_name"` + Title string `json:"title"` + Description *FormattedText `json:"description"` + Type json.RawMessage `json:"type"` + HasLargeMedia bool `json:"has_large_media"` + ShowLargeMedia bool `json:"show_large_media"` + ShowMediaAboveDescription bool `json:"show_media_above_description"` + SkipConfirmation bool `json:"skip_confirmation"` + ShowAboveText bool `json:"show_above_text"` + InstantViewVersion int32 `json:"instant_view_version"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + linkPreview.Url = tmp.Url + linkPreview.DisplayUrl = tmp.DisplayUrl + linkPreview.SiteName = tmp.SiteName + linkPreview.Title = tmp.Title + linkPreview.Description = tmp.Description + linkPreview.HasLargeMedia = tmp.HasLargeMedia + linkPreview.ShowLargeMedia = tmp.ShowLargeMedia + linkPreview.ShowMediaAboveDescription = tmp.ShowMediaAboveDescription + linkPreview.SkipConfirmation = tmp.SkipConfirmation + linkPreview.ShowAboveText = tmp.ShowAboveText + linkPreview.InstantViewVersion = tmp.InstantViewVersion + + fieldType, _ := UnmarshalLinkPreviewType(tmp.Type) + linkPreview.Type = fieldType + + return nil } // Contains information about a country @@ -18609,10 +19719,10 @@ func (paymentFormTypeRegular *PaymentFormTypeRegular) UnmarshalJSON(data []byte) return nil } -// The payment form is for a payment in Telegram stars +// The payment form is for a payment in Telegram Stars type PaymentFormTypeStars struct { meta - // Number of Telegram stars that will be paid + // Number of Telegram Stars that will be paid StarCount int64 `json:"star_count"` } @@ -18775,10 +19885,10 @@ func (*PaymentReceiptTypeRegular) PaymentReceiptTypeType() string { return TypePaymentReceiptTypeRegular } -// The payment was done using Telegram stars +// The payment was done using Telegram Stars type PaymentReceiptTypeStars struct { meta - // Number of Telegram stars that were paid + // Number of Telegram Stars that were paid StarCount int64 `json:"star_count"` // Unique identifier of the transaction that can be used to dispute it TransactionId string `json:"transaction_id"` @@ -21257,7 +22367,7 @@ type MessageText struct { // Text of the message Text *FormattedText `json:"text"` // A link preview attached to the message; may be null - WebPage *WebPage `json:"web_page"` + LinkPreview *LinkPreview `json:"link_preview"` // Options which were used for generation of the link preview; may be null if default options were used LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options"` } @@ -21378,7 +22488,7 @@ func (*MessageDocument) MessageContentType() string { // A message with paid media type MessagePaidMedia struct { meta - // Number of stars needed to buy access to the media in the message + // Number of Telegram Stars needed to buy access to the media in the message StarCount int64 `json:"star_count"` // Information about the media Media []PaidMedia `json:"media"` @@ -22939,11 +24049,77 @@ func (*MessagePaymentSuccessfulBot) MessageContentType() string { return TypeMessagePaymentSuccessfulBot } -// Telegram Premium was gifted to the user +// A payment has been refunded +type MessagePaymentRefunded struct { + meta + // Identifier of the previous owner of the Telegram Stars that refunds them + OwnerId MessageSender `json:"owner_id"` + // Currency for the price of the product + Currency string `json:"currency"` + // Total price for the product, in the smallest units of the currency + TotalAmount int64 `json:"total_amount"` + // Invoice payload; only for bots + InvoicePayload []byte `json:"invoice_payload"` + // Telegram payment identifier + TelegramPaymentChargeId string `json:"telegram_payment_charge_id"` + // Provider payment identifier + ProviderPaymentChargeId string `json:"provider_payment_charge_id"` +} + +func (entity *MessagePaymentRefunded) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessagePaymentRefunded + + return json.Marshal((*stub)(entity)) +} + +func (*MessagePaymentRefunded) GetClass() string { + return ClassMessageContent +} + +func (*MessagePaymentRefunded) GetType() string { + return TypeMessagePaymentRefunded +} + +func (*MessagePaymentRefunded) MessageContentType() string { + return TypeMessagePaymentRefunded +} + +func (messagePaymentRefunded *MessagePaymentRefunded) UnmarshalJSON(data []byte) error { + var tmp struct { + OwnerId json.RawMessage `json:"owner_id"` + Currency string `json:"currency"` + TotalAmount int64 `json:"total_amount"` + InvoicePayload []byte `json:"invoice_payload"` + TelegramPaymentChargeId string `json:"telegram_payment_charge_id"` + ProviderPaymentChargeId string `json:"provider_payment_charge_id"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messagePaymentRefunded.Currency = tmp.Currency + messagePaymentRefunded.TotalAmount = tmp.TotalAmount + messagePaymentRefunded.InvoicePayload = tmp.InvoicePayload + messagePaymentRefunded.TelegramPaymentChargeId = tmp.TelegramPaymentChargeId + messagePaymentRefunded.ProviderPaymentChargeId = tmp.ProviderPaymentChargeId + + fieldOwnerId, _ := UnmarshalMessageSender(tmp.OwnerId) + messagePaymentRefunded.OwnerId = fieldOwnerId + + return nil +} + +// Telegram Premium was gifted to a user type MessageGiftedPremium struct { meta - // The identifier of a user that gifted Telegram Premium; 0 if the gift was anonymous + // The identifier of a user that gifted Telegram Premium; 0 if the gift was anonymous or is outgoing GifterUserId int64 `json:"gifter_user_id"` + // The identifier of a user that received Telegram Premium; 0 if the gift is incoming + ReceiverUserId int64 `json:"receiver_user_id"` // Currency for the paid amount Currency string `json:"currency"` // The paid amount, in the smallest units of the currency @@ -23194,6 +24370,49 @@ func (*MessagePremiumGiveawayWinners) MessageContentType() string { return TypeMessagePremiumGiveawayWinners } +// Telegram Stars were gifted to a user +type MessageGiftedStars struct { + meta + // The identifier of a user that gifted Telegram Stars; 0 if the gift was anonymous or is outgoing + GifterUserId int64 `json:"gifter_user_id"` + // The identifier of a user that received Telegram Stars; 0 if the gift is incoming + ReceiverUserId int64 `json:"receiver_user_id"` + // Currency for the paid amount + Currency string `json:"currency"` + // The paid amount, in the smallest units of the currency + Amount int64 `json:"amount"` + // Cryptocurrency used to pay for the gift; may be empty if none + Cryptocurrency string `json:"cryptocurrency"` + // The paid amount, in the smallest units of the cryptocurrency; 0 if none + CryptocurrencyAmount JsonInt64 `json:"cryptocurrency_amount"` + // Number of Telegram Stars that were gifted + StarCount int64 `json:"star_count"` + // Identifier of the transaction for Telegram Stars purchase; for receiver only + TransactionId string `json:"transaction_id"` + // A sticker to be shown in the message; may be null if unknown + Sticker *Sticker `json:"sticker"` +} + +func (entity *MessageGiftedStars) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageGiftedStars + + return json.Marshal((*stub)(entity)) +} + +func (*MessageGiftedStars) GetClass() string { + return ClassMessageContent +} + +func (*MessageGiftedStars) GetType() string { + return TypeMessageGiftedStars +} + +func (*MessageGiftedStars) MessageContentType() string { + return TypeMessageGiftedStars +} + // A contact has registered with Telegram type MessageContactRegistered struct{ meta @@ -24063,7 +25282,7 @@ func (*TextEntityTypeCustomEmoji) TextEntityTypeType() string { // A media timestamp type TextEntityTypeMediaTimestamp struct { meta - // Timestamp from which a video/audio/video note/voice note/story playing must start, in seconds. The media can be in the content or the web page preview of the current message, or in the same places in the replied message + // Timestamp from which a video/audio/video note/voice note/story playing must start, in seconds. The media can be in the content or the link preview of the current message, or in the same places in the replied message MediaTimestamp int32 `json:"media_timestamp"` } @@ -24682,7 +25901,7 @@ func (inputMessageDocument *InputMessageDocument) UnmarshalJSON(data []byte) err // A message with paid media; can be used only in channel chats with supergroupFullInfo.has_paid_media_allowed type InputMessagePaidMedia struct { meta - // The number of stars that must be paid to see the media; 1-getOption("paid_media_message_star_count_max") + // The number of Telegram Stars that must be paid to see the media; 1-getOption("paid_media_message_star_count_max") StarCount int64 `json:"star_count"` // The content of the paid media PaidMedia []*InputPaidMedia `json:"paid_media"` @@ -25358,7 +26577,7 @@ type InputMessageForwarded struct { meta // Identifier for the chat this forwarded message came from FromChatId int64 `json:"from_chat_id"` - // Identifier of the message to forward. A message can be forwarded only if message.can_be_forwarded + // Identifier of the message to forward. A message can be forwarded only if messageProperties.can_be_forwarded MessageId int64 `json:"message_id"` // True, if a game message is being shared from a launched game; applies only to game messages InGameShare bool `json:"in_game_share"` @@ -25386,6 +26605,77 @@ func (*InputMessageForwarded) InputMessageContentType() string { return TypeInputMessageForwarded } +// Contains properties of a message and describes actions that can be done with the message right now +type MessageProperties struct { + meta + // True, if the message can be deleted only for the current user while other users will continue to see it using the method deleteMessages with revoke == false + CanBeDeletedOnlyForSelf bool `json:"can_be_deleted_only_for_self"` + // True, if the message can be deleted for all users using the method deleteMessages with revoke == true + CanBeDeletedForAllUsers bool `json:"can_be_deleted_for_all_users"` + // True, if the message can be edited using the methods editMessageText, editMessageMedia, editMessageCaption, or editMessageReplyMarkup. For live location and poll messages this fields shows whether editMessageLiveLocation or stopPoll can be used with this message + CanBeEdited bool `json:"can_be_edited"` + // True, if the message can be forwarded using inputMessageForwarded or forwardMessages + CanBeForwarded bool `json:"can_be_forwarded"` + // True, if the message can be paid using inputInvoiceMessage + CanBePaid bool `json:"can_be_paid"` + // True, if the message can be pinned or unpinned in the chat using pinChatMessage or unpinChatMessage + CanBePinned bool `json:"can_be_pinned"` + // True, if the message can be replied in the same chat and forum topic using inputMessageReplyToMessage + CanBeReplied bool `json:"can_be_replied"` + // True, if the message can be replied in another chat or forum topic using inputMessageReplyToExternalMessage + CanBeRepliedInAnotherChat bool `json:"can_be_replied_in_another_chat"` + // True, if content of the message can be saved locally or copied using inputMessageForwarded or forwardMessages with copy options + CanBeSaved bool `json:"can_be_saved"` + // True, if the message can be shared in a story using inputStoryAreaTypeMessage + CanBeSharedInStory bool `json:"can_be_shared_in_story"` + // True, if scheduling state of the message can be edited + CanEditSchedulingState bool `json:"can_edit_scheduling_state"` + // True, if the list of added reactions is available using getMessageAddedReactions + CanGetAddedReactions bool `json:"can_get_added_reactions"` + // True, if code for message embedding can be received using getMessageEmbeddingCode + CanGetEmbeddingCode bool `json:"can_get_embedding_code"` + // True, if a link can be generated for the message using getMessageLink + CanGetLink bool `json:"can_get_link"` + // True, if media timestamp links can be generated for media timestamp entities in the message text, caption or link preview description using getMessageLink + CanGetMediaTimestampLinks bool `json:"can_get_media_timestamp_links"` + // True, if information about the message thread is available through getMessageThread and getMessageThreadHistory + CanGetMessageThread bool `json:"can_get_message_thread"` + // True, if read date of the message can be received through getMessageReadDate + CanGetReadDate bool `json:"can_get_read_date"` + // True, if message statistics are available through getMessageStatistics and message forwards can be received using getMessagePublicForwards + CanGetStatistics bool `json:"can_get_statistics"` + // True, if chat members already viewed the message can be received through getMessageViewers + CanGetViewers bool `json:"can_get_viewers"` + // True, if speech can be recognized for the message through recognizeSpeech + CanRecognizeSpeech bool `json:"can_recognize_speech"` + // True, if the message can be reported using reportChat + CanReportChat bool `json:"can_report_chat"` + // True, if reactions on the message can be reported through reportMessageReactions + CanReportReactions bool `json:"can_report_reactions"` + // True, if the message can be reported using reportSupergroupSpam + CanReportSupergroupSpam bool `json:"can_report_supergroup_spam"` + // True, if fact check for the message can be changed through setMessageFactCheck + CanSetFactCheck bool `json:"can_set_fact_check"` + // True, if message statistics must be available from context menu of the message + NeedShowStatistics bool `json:"need_show_statistics"` +} + +func (entity *MessageProperties) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageProperties + + return json.Marshal((*stub)(entity)) +} + +func (*MessageProperties) GetClass() string { + return ClassMessageProperties +} + +func (*MessageProperties) GetType() string { + return TypeMessageProperties +} + // Returns all found messages, no filter is applied type SearchMessagesFilterEmpty struct{ meta @@ -26923,6 +28213,31 @@ func (*EmojiCategoryTypeChatPhoto) EmojiCategoryTypeType() string { return TypeEmojiCategoryTypeChatPhoto } +// Describes the current weather +type CurrentWeather struct { + meta + // Temperature, in degree Celsius + Temperature float64 `json:"temperature"` + // Emoji representing the weather + Emoji string `json:"emoji"` +} + +func (entity *CurrentWeather) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CurrentWeather + + return json.Marshal((*stub)(entity)) +} + +func (*CurrentWeather) GetClass() string { + return ClassCurrentWeather +} + +func (*CurrentWeather) GetType() string { + return TypeCurrentWeather +} + // Describes position of a clickable rectangle area on a story media type StoryAreaPosition struct { meta @@ -27124,6 +28439,37 @@ func (*StoryAreaTypeLink) StoryAreaTypeType() string { return TypeStoryAreaTypeLink } +// An area with information about weather +type StoryAreaTypeWeather struct { + meta + // Temperature, in degree Celsius + Temperature float64 `json:"temperature"` + // Emoji representing the weather + Emoji string `json:"emoji"` + // A color of the area background in the ARGB format + BackgroundColor int32 `json:"background_color"` +} + +func (entity *StoryAreaTypeWeather) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryAreaTypeWeather + + return json.Marshal((*stub)(entity)) +} + +func (*StoryAreaTypeWeather) GetClass() string { + return ClassStoryAreaType +} + +func (*StoryAreaTypeWeather) GetType() string { + return TypeStoryAreaTypeWeather +} + +func (*StoryAreaTypeWeather) StoryAreaTypeType() string { + return TypeStoryAreaTypeWeather +} + // Describes a clickable rectangle area on a story media type StoryArea struct { meta @@ -27312,7 +28658,7 @@ type InputStoryAreaTypeMessage struct { meta // Identifier of the chat with the message. Currently, the chat must be a supergroup or a channel chat ChatId int64 `json:"chat_id"` - // Identifier of the message. Only successfully sent non-scheduled messages can be specified + // Identifier of the message. Use messageProperties.can_be_shared_in_story to check whether the message is suitable MessageId int64 `json:"message_id"` } @@ -27363,6 +28709,37 @@ func (*InputStoryAreaTypeLink) InputStoryAreaTypeType() string { return TypeInputStoryAreaTypeLink } +// An area with information about weather +type InputStoryAreaTypeWeather struct { + meta + // Temperature, in degree Celsius + Temperature float64 `json:"temperature"` + // Emoji representing the weather + Emoji string `json:"emoji"` + // A color of the area background in the ARGB format + BackgroundColor int32 `json:"background_color"` +} + +func (entity *InputStoryAreaTypeWeather) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputStoryAreaTypeWeather + + return json.Marshal((*stub)(entity)) +} + +func (*InputStoryAreaTypeWeather) GetClass() string { + return ClassInputStoryAreaType +} + +func (*InputStoryAreaTypeWeather) GetType() string { + return TypeInputStoryAreaTypeWeather +} + +func (*InputStoryAreaTypeWeather) InputStoryAreaTypeType() string { + return TypeInputStoryAreaTypeWeather +} + // Describes a clickable rectangle area on a story media to be added type InputStoryArea struct { meta @@ -27410,7 +28787,7 @@ func (inputStoryArea *InputStoryArea) UnmarshalJSON(data []byte) error { // Contains a list of story areas to be added type InputStoryAreas struct { meta - // List of input story areas. Currently, a story can have up to 10 inputStoryAreaTypeLocation, inputStoryAreaTypeFoundVenue, and inputStoryAreaTypePreviousVenue areas, up to getOption("story_suggested_reaction_area_count_max") inputStoryAreaTypeSuggestedReaction areas, up to 1 inputStoryAreaTypeMessage area, and up to getOption("story_link_area_count_max") inputStoryAreaTypeLink areas if the current user is a Telegram Premium user + // List of input story areas. Currently, a story can have up to 10 inputStoryAreaTypeLocation, inputStoryAreaTypeFoundVenue, and inputStoryAreaTypePreviousVenue areas, up to getOption("story_suggested_reaction_area_count_max") inputStoryAreaTypeSuggestedReaction areas, up to 1 inputStoryAreaTypeMessage area, up to getOption("story_link_area_count_max") inputStoryAreaTypeLink areas if the current user is a Telegram Premium user, and up to 3 inputStoryAreaTypeWeather areas Areas []*InputStoryArea `json:"areas"` } @@ -27449,6 +28826,8 @@ type StoryVideo struct { Thumbnail *Thumbnail `json:"thumbnail"` // Size of file prefix, which is supposed to be preloaded, in bytes PreloadPrefixSize int32 `json:"preload_prefix_size"` + // Timestamp of the frame used as video thumbnail + CoverFrameTimestamp float64 `json:"cover_frame_timestamp"` // File containing the video Video *File `json:"video"` } @@ -27607,6 +28986,8 @@ type InputStoryContentVideo struct { AddedStickerFileIds []int32 `json:"added_sticker_file_ids"` // Precise duration of the video, in seconds; 0-60 Duration float64 `json:"duration"` + // Timestamp of the frame, which will be used as video thumbnail + CoverFrameTimestamp float64 `json:"cover_frame_timestamp"` // True, if the video has no sound IsAnimation bool `json:"is_animation"` } @@ -27636,6 +29017,7 @@ func (inputStoryContentVideo *InputStoryContentVideo) UnmarshalJSON(data []byte) Video json.RawMessage `json:"video"` AddedStickerFileIds []int32 `json:"added_sticker_file_ids"` Duration float64 `json:"duration"` + CoverFrameTimestamp float64 `json:"cover_frame_timestamp"` IsAnimation bool `json:"is_animation"` } @@ -27646,6 +29028,7 @@ func (inputStoryContentVideo *InputStoryContentVideo) UnmarshalJSON(data []byte) inputStoryContentVideo.AddedStickerFileIds = tmp.AddedStickerFileIds inputStoryContentVideo.Duration = tmp.Duration + inputStoryContentVideo.CoverFrameTimestamp = tmp.CoverFrameTimestamp inputStoryContentVideo.IsAnimation = tmp.IsAnimation fieldVideo, _ := UnmarshalInputFile(tmp.Video) @@ -28088,7 +29471,7 @@ type ChatActiveStories struct { Order int64 `json:"order"` // Identifier of the last read active story MaxReadStoryId int32 `json:"max_read_story_id"` - // Basic information about the stories; use getStory to get full information about the stories. The stories are in a chronological order (i.e., in order of increasing story identifiers) + // Basic information about the stories; use getStory to get full information about the stories. The stories are in chronological order (i.e., in order of increasing story identifiers) Stories []*StoryInfo `json:"stories"` } @@ -28543,6 +29926,98 @@ func (publicForwards *PublicForwards) UnmarshalJSON(data []byte) error { return nil } +// Describes media previews of a bot +type BotMediaPreview struct { + meta + // Point in time (Unix timestamp) when the preview was added or changed last time + Date int32 `json:"date"` + // Content of the preview + Content StoryContent `json:"content"` +} + +func (entity *BotMediaPreview) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BotMediaPreview + + return json.Marshal((*stub)(entity)) +} + +func (*BotMediaPreview) GetClass() string { + return ClassBotMediaPreview +} + +func (*BotMediaPreview) GetType() string { + return TypeBotMediaPreview +} + +func (botMediaPreview *BotMediaPreview) UnmarshalJSON(data []byte) error { + var tmp struct { + Date int32 `json:"date"` + Content json.RawMessage `json:"content"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + botMediaPreview.Date = tmp.Date + + fieldContent, _ := UnmarshalStoryContent(tmp.Content) + botMediaPreview.Content = fieldContent + + return nil +} + +// Contains a list of media previews of a bot +type BotMediaPreviews struct { + meta + // List of media previews + Previews []*BotMediaPreview `json:"previews"` +} + +func (entity *BotMediaPreviews) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BotMediaPreviews + + return json.Marshal((*stub)(entity)) +} + +func (*BotMediaPreviews) GetClass() string { + return ClassBotMediaPreviews +} + +func (*BotMediaPreviews) GetType() string { + return TypeBotMediaPreviews +} + +// Contains a list of media previews of a bot for the given language and the list of languages for which the bot has dedicated previews +type BotMediaPreviewInfo struct { + meta + // List of media previews + Previews []*BotMediaPreview `json:"previews"` + // List of language codes for which the bot has dedicated previews + LanguageCodes []string `json:"language_codes"` +} + +func (entity *BotMediaPreviewInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BotMediaPreviewInfo + + return json.Marshal((*stub)(entity)) +} + +func (*BotMediaPreviewInfo) GetClass() string { + return ClassBotMediaPreviewInfo +} + +func (*BotMediaPreviewInfo) GetType() string { + return TypeBotMediaPreviewInfo +} + // Contains a list of features available on a specific chat boost level type ChatBoostLevelFeatures struct { meta @@ -36584,7 +38059,7 @@ func (*StorePaymentPurposePremiumSubscription) StorePaymentPurposeType() string // The user gifting Telegram Premium to another user type StorePaymentPurposeGiftedPremium struct { meta - // Identifier of the user to which Premium was gifted + // Identifier of the user to which Telegram Premium is gifted UserId int64 `json:"user_id"` // ISO 4217 currency code of the payment currency Currency string `json:"currency"` @@ -36676,14 +38151,14 @@ func (*StorePaymentPurposePremiumGiveaway) StorePaymentPurposeType() string { return TypeStorePaymentPurposePremiumGiveaway } -// The user buying Telegram stars +// The user buying Telegram Stars type StorePaymentPurposeStars struct { meta // ISO 4217 currency code of the payment currency Currency string `json:"currency"` // Paid amount, in the smallest units of the currency Amount int64 `json:"amount"` - // Number of bought stars + // Number of bought Telegram Stars StarCount int64 `json:"star_count"` } @@ -36707,6 +38182,39 @@ func (*StorePaymentPurposeStars) StorePaymentPurposeType() string { return TypeStorePaymentPurposeStars } +// The user buying Telegram Stars for other users +type StorePaymentPurposeGiftedStars struct { + meta + // Identifier of the user to which Telegram Stars are gifted + UserId int64 `json:"user_id"` + // ISO 4217 currency code of the payment currency + Currency string `json:"currency"` + // Paid amount, in the smallest units of the currency + Amount int64 `json:"amount"` + // Number of bought Telegram Stars + StarCount int64 `json:"star_count"` +} + +func (entity *StorePaymentPurposeGiftedStars) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StorePaymentPurposeGiftedStars + + return json.Marshal((*stub)(entity)) +} + +func (*StorePaymentPurposeGiftedStars) GetClass() string { + return ClassStorePaymentPurpose +} + +func (*StorePaymentPurposeGiftedStars) GetType() string { + return TypeStorePaymentPurposeGiftedStars +} + +func (*StorePaymentPurposeGiftedStars) StorePaymentPurposeType() string { + return TypeStorePaymentPurposeGiftedStars +} + // The user creating Telegram Premium gift codes for other users type TelegramPaymentPurposePremiumGiftCodes struct { meta @@ -36777,14 +38285,14 @@ func (*TelegramPaymentPurposePremiumGiveaway) TelegramPaymentPurposeType() strin return TypeTelegramPaymentPurposePremiumGiveaway } -// The user buying Telegram stars +// The user buying Telegram Stars type TelegramPaymentPurposeStars struct { meta // ISO 4217 currency code of the payment currency Currency string `json:"currency"` // Paid amount, in the smallest units of the currency Amount int64 `json:"amount"` - // Number of bought stars + // Number of bought Telegram Stars StarCount int64 `json:"star_count"` } @@ -36808,6 +38316,39 @@ func (*TelegramPaymentPurposeStars) TelegramPaymentPurposeType() string { return TypeTelegramPaymentPurposeStars } +// The user buying Telegram Stars for other users +type TelegramPaymentPurposeGiftedStars struct { + meta + // Identifier of the user to which Telegram Stars are gifted + UserId int64 `json:"user_id"` + // ISO 4217 currency code of the payment currency + Currency string `json:"currency"` + // Paid amount, in the smallest units of the currency + Amount int64 `json:"amount"` + // Number of bought Telegram Stars + StarCount int64 `json:"star_count"` +} + +func (entity *TelegramPaymentPurposeGiftedStars) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TelegramPaymentPurposeGiftedStars + + return json.Marshal((*stub)(entity)) +} + +func (*TelegramPaymentPurposeGiftedStars) GetClass() string { + return ClassTelegramPaymentPurpose +} + +func (*TelegramPaymentPurposeGiftedStars) GetType() string { + return TypeTelegramPaymentPurposeGiftedStars +} + +func (*TelegramPaymentPurposeGiftedStars) TelegramPaymentPurposeType() string { + return TypeTelegramPaymentPurposeGiftedStars +} + // A token for Firebase Cloud Messaging type DeviceTokenFirebaseCloudMessaging struct { meta @@ -37506,62 +39047,6 @@ func (*InputBackgroundPrevious) InputBackgroundType() string { return TypeInputBackgroundPrevious } -// Describes theme settings -type ThemeSettings struct { - meta - // Theme accent color in ARGB format - AccentColor int32 `json:"accent_color"` - // The background to be used in chats; may be null - Background *Background `json:"background"` - // The fill to be used as a background for outgoing messages - OutgoingMessageFill BackgroundFill `json:"outgoing_message_fill"` - // If true, the freeform gradient fill needs to be animated on every sent message - AnimateOutgoingMessageFill bool `json:"animate_outgoing_message_fill"` - // Accent color of outgoing messages in ARGB format - OutgoingMessageAccentColor int32 `json:"outgoing_message_accent_color"` -} - -func (entity *ThemeSettings) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ThemeSettings - - return json.Marshal((*stub)(entity)) -} - -func (*ThemeSettings) GetClass() string { - return ClassThemeSettings -} - -func (*ThemeSettings) GetType() string { - return TypeThemeSettings -} - -func (themeSettings *ThemeSettings) UnmarshalJSON(data []byte) error { - var tmp struct { - AccentColor int32 `json:"accent_color"` - Background *Background `json:"background"` - OutgoingMessageFill json.RawMessage `json:"outgoing_message_fill"` - AnimateOutgoingMessageFill bool `json:"animate_outgoing_message_fill"` - OutgoingMessageAccentColor int32 `json:"outgoing_message_accent_color"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - themeSettings.AccentColor = tmp.AccentColor - themeSettings.Background = tmp.Background - themeSettings.AnimateOutgoingMessageFill = tmp.AnimateOutgoingMessageFill - themeSettings.OutgoingMessageAccentColor = tmp.OutgoingMessageAccentColor - - fieldOutgoingMessageFill, _ := UnmarshalBackgroundFill(tmp.OutgoingMessageFill) - themeSettings.OutgoingMessageFill = fieldOutgoingMessageFill - - return nil -} - // Describes a chat theme type ChatTheme struct { meta @@ -38594,7 +40079,7 @@ func (*PushMessageContentLocation) PushMessageContentType() string { // A message with paid media type PushMessageContentPaidMedia struct { meta - // Number of stars needed to buy access to the media in the message; 0 for pinned message + // Number of Telegram Stars needed to buy access to the media in the message; 0 for pinned message StarCount int64 `json:"star_count"` // True, if the message is a pinned message with the specified content IsPinned bool `json:"is_pinned"` @@ -41880,7 +43365,7 @@ func (*InternalLinkTypeActiveSessions) InternalLinkTypeType() string { return TypeInternalLinkTypeActiveSessions } -// The link is a link to an attachment menu bot to be opened in the specified or a chosen chat. Process given target_chat to open the chat. Then, call searchPublicChat with the given bot username, check that the user is a bot and can be added to attachment menu. Then, use getAttachmentMenuBot to receive information about the bot. If the bot isn't added to attachment menu, then show a disclaimer about Mini Apps being a third-party apps, ask the user to accept their Terms of service and confirm adding the bot to side and attachment menu. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. If the attachment menu bot can't be used in the opened chat, show an error to the user. If the bot is added to attachment menu and can be used in the chat, then use openWebApp with the given URL +// The link is a link to an attachment menu bot to be opened in the specified or a chosen chat. Process given target_chat to open the chat. Then, call searchPublicChat with the given bot username, check that the user is a bot and can be added to attachment menu. Then, use getAttachmentMenuBot to receive information about the bot. If the bot isn't added to attachment menu, then show a disclaimer about Mini Apps being third-party apps, ask the user to accept their Terms of service and confirm adding the bot to side and attachment menu. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. If the attachment menu bot can't be used in the opened chat, show an error to the user. If the bot is added to attachment menu and can be used in the chat, then use openWebApp with the given URL type InternalLinkTypeAttachmentMenuBot struct { meta // Target chat to be opened @@ -42422,6 +43907,37 @@ func (*InternalLinkTypeLanguageSettings) InternalLinkTypeType() string { return TypeInternalLinkTypeLanguageSettings } +// The link is a link to the main Web App of a bot. Call searchPublicChat with the given bot username, check that the user is a bot and has the main Web App. If the bot can be added to attachment menu, then use getAttachmentMenuBot to receive information about the bot, then if the bot isn't added to side menu, show a disclaimer about Mini Apps being third-party apps, ask the user to accept their Terms of service and confirm adding the bot to side and attachment menu, then if the user accepts the terms and confirms adding, use toggleBotIsAddedToAttachmentMenu to add the bot. Then, use getMainWebApp with the given start parameter and open the returned URL as a Web App +type InternalLinkTypeMainWebApp struct { + meta + // Username of the bot + BotUsername string `json:"bot_username"` + // Start parameter to be passed to getMainWebApp + StartParameter string `json:"start_parameter"` + // True, if the Web App must be opened in the compact mode instead of the full-size mode + IsCompact bool `json:"is_compact"` +} + +func (entity *InternalLinkTypeMainWebApp) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeMainWebApp + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeMainWebApp) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeMainWebApp) GetType() string { + return TypeInternalLinkTypeMainWebApp +} + +func (*InternalLinkTypeMainWebApp) InternalLinkTypeType() string { + return TypeInternalLinkTypeMainWebApp +} + // The link is a link to a Telegram message or a forum topic. Call getMessageLinkInfo with the given URL to process the link, and then open received forum topic or chat and show the message there type InternalLinkTypeMessage struct { meta @@ -42707,6 +44223,8 @@ type InternalLinkTypePublicChat struct { ChatUsername string `json:"chat_username"` // Draft text for message to send in the chat DraftText string `json:"draft_text"` + // True, if chat profile information screen must be opened; otherwise, the chat itself must be opened + OpenProfile bool `json:"open_profile"` } func (entity *InternalLinkTypePublicChat) MarshalJSON() ([]byte, error) { @@ -42804,37 +44322,6 @@ func (*InternalLinkTypeSettings) InternalLinkTypeType() string { return TypeInternalLinkTypeSettings } -// The link is a link to a bot, which can be installed to the side menu. Call searchPublicChat with the given bot username, check that the user is a bot and can be added to attachment menu. Then, use getAttachmentMenuBot to receive information about the bot. If the bot isn't added to side menu, then show a disclaimer about Mini Apps being a third-party apps, ask the user to accept their Terms of service and confirm adding the bot to side and attachment menu. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. If the bot is added to side menu, then use getWebAppUrl with the given URL and open the returned URL as a Web App -type InternalLinkTypeSideMenuBot struct { - meta - // Username of the bot - BotUsername string `json:"bot_username"` - // URL to be passed to getWebAppUrl - Url string `json:"url"` - // True, if the Web App must be opened in a compact mode instead of a full-size mode - IsCompact bool `json:"is_compact"` -} - -func (entity *InternalLinkTypeSideMenuBot) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InternalLinkTypeSideMenuBot - - return json.Marshal((*stub)(entity)) -} - -func (*InternalLinkTypeSideMenuBot) GetClass() string { - return ClassInternalLinkType -} - -func (*InternalLinkTypeSideMenuBot) GetType() string { - return TypeInternalLinkTypeSideMenuBot -} - -func (*InternalLinkTypeSideMenuBot) InternalLinkTypeType() string { - return TypeInternalLinkTypeSideMenuBot -} - // The link is a link to a sticker set. Call searchStickerSet with the given sticker set name to process the link and show the sticker set. If the sticker set is found and the user wants to add it, then call changeStickerSet type InternalLinkTypeStickerSet struct { meta @@ -42893,7 +44380,7 @@ func (*InternalLinkTypeStory) InternalLinkTypeType() string { return TypeInternalLinkTypeStory } -// The link is a link to a theme. TDLib has no theme support yet +// The link is a link to a cloud theme. TDLib has no theme support yet type InternalLinkTypeTheme struct { meta // Name of the theme @@ -42997,13 +44484,15 @@ func (*InternalLinkTypeUnsupportedProxy) InternalLinkTypeType() string { return TypeInternalLinkTypeUnsupportedProxy } -// The link is a link to a user by its phone number. Call searchUserByPhoneNumber with the given phone number to process the link. If the user is found, then call createPrivateChat and open the chat. If draft text isn't empty, then put the draft text in the input field +// The link is a link to a user by its phone number. Call searchUserByPhoneNumber with the given phone number to process the link. If the user is found, then call createPrivateChat and open user's profile information screen or the chat itself. If draft text isn't empty, then put the draft text in the input field type InternalLinkTypeUserPhoneNumber struct { meta // Phone number of the user PhoneNumber string `json:"phone_number"` // Draft text for message to send in the chat DraftText string `json:"draft_text"` + // True, if user's profile information screen must be opened; otherwise, the chat itself must be opened + OpenProfile bool `json:"open_profile"` } func (entity *InternalLinkTypeUserPhoneNumber) MarshalJSON() ([]byte, error) { @@ -43084,7 +44573,7 @@ func (*InternalLinkTypeVideoChat) InternalLinkTypeType() string { return TypeInternalLinkTypeVideoChat } -// The link is a link to a Web App. Call searchPublicChat with the given bot username, check that the user is a bot, then call searchWebApp with the received bot and the given web_app_short_name. Process received foundWebApp by showing a confirmation dialog if needed. If the bot can be added to attachment or side menu, but isn't added yet, then show a disclaimer about Mini Apps being a third-party apps instead of the dialog and ask the user to accept their Terms of service. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. Then, call getWebAppLinkUrl and open the returned URL as a Web App +// The link is a link to a Web App. Call searchPublicChat with the given bot username, check that the user is a bot, then call searchWebApp with the received bot and the given web_app_short_name. Process received foundWebApp by showing a confirmation dialog if needed. If the bot can be added to attachment or side menu, but isn't added yet, then show a disclaimer about Mini Apps being third-party apps instead of the dialog and ask the user to accept their Terms of service. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. Then, call getWebAppLinkUrl and open the returned URL as a Web App type InternalLinkTypeWebApp struct { meta // Username of the bot that owns the Web App @@ -43093,7 +44582,7 @@ type InternalLinkTypeWebApp struct { WebAppShortName string `json:"web_app_short_name"` // Start parameter to be passed to getWebAppLinkUrl StartParameter string `json:"start_parameter"` - // True, if the Web App must be opened in a compact mode instead of a full-size mode + // True, if the Web App must be opened in the compact mode instead of the full-size mode IsCompact bool `json:"is_compact"` } @@ -43153,7 +44642,7 @@ type MessageLinkInfo struct { MessageThreadId int64 `json:"message_thread_id"` // If found, the linked message; may be null Message *Message `json:"message"` - // Timestamp from which the video/audio/video note/voice note/story playing must start, in seconds; 0 if not specified. The media can be in the message content or in its web page preview + // Timestamp from which the video/audio/video note/voice note/story playing must start, in seconds; 0 if not specified. The media can be in the message content or in its link preview MediaTimestamp int32 `json:"media_timestamp"` // True, if the whole media album to which the message belongs is linked ForAlbum bool `json:"for_album"` @@ -44713,6 +46202,31 @@ func (*TopChatCategoryInlineBots) TopChatCategoryType() string { return TypeTopChatCategoryInlineBots } +// A category containing frequently used chats with bots, which Web Apps were opened +type TopChatCategoryWebAppBots struct{ + meta +} + +func (entity *TopChatCategoryWebAppBots) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TopChatCategoryWebAppBots + + return json.Marshal((*stub)(entity)) +} + +func (*TopChatCategoryWebAppBots) GetClass() string { + return ClassTopChatCategory +} + +func (*TopChatCategoryWebAppBots) GetType() string { + return TypeTopChatCategoryWebAppBots +} + +func (*TopChatCategoryWebAppBots) TopChatCategoryType() string { + return TypeTopChatCategoryWebAppBots +} + // A category containing frequently used chats used for calls type TopChatCategoryCalls struct{ meta @@ -46714,16 +48228,16 @@ func (*ChatRevenueTransactions) GetType() string { return TypeChatRevenueTransactions } -// Contains information about Telegram stars earned by a bot or a chat +// Contains information about Telegram Stars earned by a bot or a chat type StarRevenueStatus struct { meta - // Total number of the stars earned + // Total number of Telegram Stars earned TotalCount int64 `json:"total_count"` - // The number of Telegram stars that aren't withdrawn yet + // The number of Telegram Stars that aren't withdrawn yet CurrentCount int64 `json:"current_count"` - // The number of Telegram stars that are available for withdrawal + // The number of Telegram Stars that are available for withdrawal AvailableCount int64 `json:"available_count"` - // True, if Telegram stars can be withdrawn now or later + // True, if Telegram Stars can be withdrawn now or later WithdrawalEnabled bool `json:"withdrawal_enabled"` // Time left before the next withdrawal can be started, in seconds; 0 if withdrawal can be started now NextWithdrawalIn int32 `json:"next_withdrawal_in"` @@ -46745,14 +48259,14 @@ func (*StarRevenueStatus) GetType() string { return TypeStarRevenueStatus } -// A detailed statistics about Telegram stars earned by a bot or a chat +// A detailed statistics about Telegram Stars earned by a bot or a chat type StarRevenueStatistics struct { meta // A graph containing amount of revenue in a given day RevenueByDayGraph StatisticalGraph `json:"revenue_by_day_graph"` - // Telegram star revenue status + // Telegram Star revenue status Status *StarRevenueStatus `json:"status"` - // Current conversion rate of a Telegram star to USD + // Current conversion rate of a Telegram Star to USD UsdRate float64 `json:"usd_rate"` } @@ -51057,10 +52571,10 @@ func (*UpdateSavedMessagesTags) UpdateType() string { return TypeUpdateSavedMessagesTags } -// The number of Telegram stars owned by the current user has changed +// The number of Telegram Stars owned by the current user has changed type UpdateOwnedStarCount struct { meta - // The new number of Telegram stars owned + // The new number of Telegram Stars owned StarCount int64 `json:"star_count"` } @@ -51113,12 +52627,12 @@ func (*UpdateChatRevenueAmount) UpdateType() string { return TypeUpdateChatRevenueAmount } -// The Telegram star revenue earned by a bot or a chat has changed. If star transactions screen of the chat is opened, then getStarTransactions may be called to fetch new transactions +// The Telegram Star revenue earned by a bot or a chat has changed. If Telegram Star transaction screen of the chat is opened, then getStarTransactions may be called to fetch new transactions type UpdateStarRevenueStatus struct { meta - // Identifier of the owner of the Telegram stars + // Identifier of the owner of the Telegram Stars OwnerId MessageSender `json:"owner_id"` - // New Telegram star revenue status + // New Telegram Star revenue status Status *StarRevenueStatus `json:"status"` } diff --git a/client/unmarshaler.go b/client/unmarshaler.go index cf266e8..87e7ed3 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -723,6 +723,9 @@ func UnmarshalStarTransactionPartner(data json.RawMessage) (StarTransactionPartn case TypeStarTransactionPartnerChannel: return UnmarshalStarTransactionPartnerChannel(data) + case TypeStarTransactionPartnerUser: + return UnmarshalStarTransactionPartnerUser(data) + case TypeStarTransactionPartnerUnsupported: return UnmarshalStarTransactionPartnerUnsupported(data) @@ -2219,6 +2222,155 @@ func UnmarshalListOfPageBlock(dataList []json.RawMessage) ([]PageBlock, error) { return list, nil } +func UnmarshalLinkPreviewAlbumMedia(data json.RawMessage) (LinkPreviewAlbumMedia, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeLinkPreviewAlbumMediaPhoto: + return UnmarshalLinkPreviewAlbumMediaPhoto(data) + + case TypeLinkPreviewAlbumMediaVideo: + return UnmarshalLinkPreviewAlbumMediaVideo(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfLinkPreviewAlbumMedia(dataList []json.RawMessage) ([]LinkPreviewAlbumMedia, error) { + list := []LinkPreviewAlbumMedia{} + + for _, data := range dataList { + entity, err := UnmarshalLinkPreviewAlbumMedia(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalLinkPreviewType(data json.RawMessage) (LinkPreviewType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeLinkPreviewTypeAlbum: + return UnmarshalLinkPreviewTypeAlbum(data) + + case TypeLinkPreviewTypeAnimation: + return UnmarshalLinkPreviewTypeAnimation(data) + + case TypeLinkPreviewTypeApp: + return UnmarshalLinkPreviewTypeApp(data) + + case TypeLinkPreviewTypeArticle: + return UnmarshalLinkPreviewTypeArticle(data) + + case TypeLinkPreviewTypeAudio: + return UnmarshalLinkPreviewTypeAudio(data) + + case TypeLinkPreviewTypeBackground: + return UnmarshalLinkPreviewTypeBackground(data) + + case TypeLinkPreviewTypeChannelBoost: + return UnmarshalLinkPreviewTypeChannelBoost(data) + + case TypeLinkPreviewTypeChat: + return UnmarshalLinkPreviewTypeChat(data) + + case TypeLinkPreviewTypeDocument: + return UnmarshalLinkPreviewTypeDocument(data) + + case TypeLinkPreviewTypeEmbeddedAnimationPlayer: + return UnmarshalLinkPreviewTypeEmbeddedAnimationPlayer(data) + + case TypeLinkPreviewTypeEmbeddedAudioPlayer: + return UnmarshalLinkPreviewTypeEmbeddedAudioPlayer(data) + + case TypeLinkPreviewTypeEmbeddedVideoPlayer: + return UnmarshalLinkPreviewTypeEmbeddedVideoPlayer(data) + + case TypeLinkPreviewTypeInvoice: + return UnmarshalLinkPreviewTypeInvoice(data) + + case TypeLinkPreviewTypeMessage: + return UnmarshalLinkPreviewTypeMessage(data) + + case TypeLinkPreviewTypePhoto: + return UnmarshalLinkPreviewTypePhoto(data) + + case TypeLinkPreviewTypePremiumGiftCode: + return UnmarshalLinkPreviewTypePremiumGiftCode(data) + + case TypeLinkPreviewTypeShareableChatFolder: + return UnmarshalLinkPreviewTypeShareableChatFolder(data) + + case TypeLinkPreviewTypeSticker: + return UnmarshalLinkPreviewTypeSticker(data) + + case TypeLinkPreviewTypeStickerSet: + return UnmarshalLinkPreviewTypeStickerSet(data) + + case TypeLinkPreviewTypeStory: + return UnmarshalLinkPreviewTypeStory(data) + + case TypeLinkPreviewTypeSupergroupBoost: + return UnmarshalLinkPreviewTypeSupergroupBoost(data) + + case TypeLinkPreviewTypeTheme: + return UnmarshalLinkPreviewTypeTheme(data) + + case TypeLinkPreviewTypeUnsupported: + return UnmarshalLinkPreviewTypeUnsupported(data) + + case TypeLinkPreviewTypeUser: + return UnmarshalLinkPreviewTypeUser(data) + + case TypeLinkPreviewTypeVideo: + return UnmarshalLinkPreviewTypeVideo(data) + + case TypeLinkPreviewTypeVideoChat: + return UnmarshalLinkPreviewTypeVideoChat(data) + + case TypeLinkPreviewTypeVideoNote: + return UnmarshalLinkPreviewTypeVideoNote(data) + + case TypeLinkPreviewTypeVoiceNote: + return UnmarshalLinkPreviewTypeVoiceNote(data) + + case TypeLinkPreviewTypeWebApp: + return UnmarshalLinkPreviewTypeWebApp(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfLinkPreviewType(dataList []json.RawMessage) ([]LinkPreviewType, error) { + list := []LinkPreviewType{} + + for _, data := range dataList { + entity, err := UnmarshalLinkPreviewType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalCollectibleItemType(data json.RawMessage) (CollectibleItemType, error) { var meta meta @@ -2957,6 +3109,9 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessagePaymentSuccessfulBot: return UnmarshalMessagePaymentSuccessfulBot(data) + case TypeMessagePaymentRefunded: + return UnmarshalMessagePaymentRefunded(data) + case TypeMessageGiftedPremium: return UnmarshalMessageGiftedPremium(data) @@ -2975,6 +3130,9 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessagePremiumGiveawayWinners: return UnmarshalMessagePremiumGiveawayWinners(data) + case TypeMessageGiftedStars: + return UnmarshalMessageGiftedStars(data) + case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) @@ -3601,6 +3759,9 @@ func UnmarshalStoryAreaType(data json.RawMessage) (StoryAreaType, error) { case TypeStoryAreaTypeLink: return UnmarshalStoryAreaTypeLink(data) + case TypeStoryAreaTypeWeather: + return UnmarshalStoryAreaTypeWeather(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -3647,6 +3808,9 @@ func UnmarshalInputStoryAreaType(data json.RawMessage) (InputStoryAreaType, erro case TypeInputStoryAreaTypeLink: return UnmarshalInputStoryAreaTypeLink(data) + case TypeInputStoryAreaTypeWeather: + return UnmarshalInputStoryAreaTypeWeather(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -5117,6 +5281,9 @@ func UnmarshalStorePaymentPurpose(data json.RawMessage) (StorePaymentPurpose, er case TypeStorePaymentPurposeStars: return UnmarshalStorePaymentPurposeStars(data) + case TypeStorePaymentPurposeGiftedStars: + return UnmarshalStorePaymentPurposeGiftedStars(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -5154,6 +5321,9 @@ func UnmarshalTelegramPaymentPurpose(data json.RawMessage) (TelegramPaymentPurpo case TypeTelegramPaymentPurposeStars: return UnmarshalTelegramPaymentPurposeStars(data) + case TypeTelegramPaymentPurposeGiftedStars: + return UnmarshalTelegramPaymentPurposeGiftedStars(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -6329,6 +6499,9 @@ func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { case TypeInternalLinkTypeLanguageSettings: return UnmarshalInternalLinkTypeLanguageSettings(data) + case TypeInternalLinkTypeMainWebApp: + return UnmarshalInternalLinkTypeMainWebApp(data) + case TypeInternalLinkTypeMessage: return UnmarshalInternalLinkTypeMessage(data) @@ -6368,9 +6541,6 @@ func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { case TypeInternalLinkTypeSettings: return UnmarshalInternalLinkTypeSettings(data) - case TypeInternalLinkTypeSideMenuBot: - return UnmarshalInternalLinkTypeSideMenuBot(data) - case TypeInternalLinkTypeStickerSet: return UnmarshalInternalLinkTypeStickerSet(data) @@ -6723,6 +6893,9 @@ func UnmarshalTopChatCategory(data json.RawMessage) (TopChatCategory, error) { case TypeTopChatCategoryInlineBots: return UnmarshalTopChatCategoryInlineBots(data) + case TypeTopChatCategoryWebAppBots: + return UnmarshalTopChatCategoryWebAppBots(data) + case TypeTopChatCategoryCalls: return UnmarshalTopChatCategoryCalls(data) @@ -8942,6 +9115,14 @@ func UnmarshalStarTransactionPartnerChannel(data json.RawMessage) (*StarTransact return &resp, err } +func UnmarshalStarTransactionPartnerUser(data json.RawMessage) (*StarTransactionPartnerUser, error) { + var resp StarTransactionPartnerUser + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarTransactionPartnerUnsupported(data json.RawMessage) (*StarTransactionPartnerUnsupported, error) { var resp StarTransactionPartnerUnsupported @@ -9102,6 +9283,14 @@ func UnmarshalUsers(data json.RawMessage) (*Users, error) { return &resp, err } +func UnmarshalFoundUsers(data json.RawMessage) (*FoundUsers, error) { + var resp FoundUsers + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatAdministrator(data json.RawMessage) (*ChatAdministrator, error) { var resp ChatAdministrator @@ -10662,6 +10851,14 @@ func UnmarshalWebAppInfo(data json.RawMessage) (*WebAppInfo, error) { return &resp, err } +func UnmarshalMainWebApp(data json.RawMessage) (*MainWebApp, error) { + var resp MainWebApp + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageThreadInfo(data json.RawMessage) (*MessageThreadInfo, error) { var resp MessageThreadInfo @@ -10758,6 +10955,14 @@ func UnmarshalSharedChat(data json.RawMessage) (*SharedChat, error) { return &resp, err } +func UnmarshalThemeSettings(data json.RawMessage) (*ThemeSettings, error) { + var resp ThemeSettings + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalRichTextPlain(data json.RawMessage) (*RichTextPlain, error) { var resp RichTextPlain @@ -11214,8 +11419,256 @@ func UnmarshalWebPageInstantView(data json.RawMessage) (*WebPageInstantView, err return &resp, err } -func UnmarshalWebPage(data json.RawMessage) (*WebPage, error) { - var resp WebPage +func UnmarshalLinkPreviewAlbumMediaPhoto(data json.RawMessage) (*LinkPreviewAlbumMediaPhoto, error) { + var resp LinkPreviewAlbumMediaPhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewAlbumMediaVideo(data json.RawMessage) (*LinkPreviewAlbumMediaVideo, error) { + var resp LinkPreviewAlbumMediaVideo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeAlbum(data json.RawMessage) (*LinkPreviewTypeAlbum, error) { + var resp LinkPreviewTypeAlbum + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeAnimation(data json.RawMessage) (*LinkPreviewTypeAnimation, error) { + var resp LinkPreviewTypeAnimation + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeApp(data json.RawMessage) (*LinkPreviewTypeApp, error) { + var resp LinkPreviewTypeApp + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeArticle(data json.RawMessage) (*LinkPreviewTypeArticle, error) { + var resp LinkPreviewTypeArticle + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeAudio(data json.RawMessage) (*LinkPreviewTypeAudio, error) { + var resp LinkPreviewTypeAudio + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeBackground(data json.RawMessage) (*LinkPreviewTypeBackground, error) { + var resp LinkPreviewTypeBackground + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeChannelBoost(data json.RawMessage) (*LinkPreviewTypeChannelBoost, error) { + var resp LinkPreviewTypeChannelBoost + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeChat(data json.RawMessage) (*LinkPreviewTypeChat, error) { + var resp LinkPreviewTypeChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeDocument(data json.RawMessage) (*LinkPreviewTypeDocument, error) { + var resp LinkPreviewTypeDocument + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeEmbeddedAnimationPlayer(data json.RawMessage) (*LinkPreviewTypeEmbeddedAnimationPlayer, error) { + var resp LinkPreviewTypeEmbeddedAnimationPlayer + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeEmbeddedAudioPlayer(data json.RawMessage) (*LinkPreviewTypeEmbeddedAudioPlayer, error) { + var resp LinkPreviewTypeEmbeddedAudioPlayer + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeEmbeddedVideoPlayer(data json.RawMessage) (*LinkPreviewTypeEmbeddedVideoPlayer, error) { + var resp LinkPreviewTypeEmbeddedVideoPlayer + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeInvoice(data json.RawMessage) (*LinkPreviewTypeInvoice, error) { + var resp LinkPreviewTypeInvoice + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeMessage(data json.RawMessage) (*LinkPreviewTypeMessage, error) { + var resp LinkPreviewTypeMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypePhoto(data json.RawMessage) (*LinkPreviewTypePhoto, error) { + var resp LinkPreviewTypePhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypePremiumGiftCode(data json.RawMessage) (*LinkPreviewTypePremiumGiftCode, error) { + var resp LinkPreviewTypePremiumGiftCode + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeShareableChatFolder(data json.RawMessage) (*LinkPreviewTypeShareableChatFolder, error) { + var resp LinkPreviewTypeShareableChatFolder + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeSticker(data json.RawMessage) (*LinkPreviewTypeSticker, error) { + var resp LinkPreviewTypeSticker + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeStickerSet(data json.RawMessage) (*LinkPreviewTypeStickerSet, error) { + var resp LinkPreviewTypeStickerSet + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeStory(data json.RawMessage) (*LinkPreviewTypeStory, error) { + var resp LinkPreviewTypeStory + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeSupergroupBoost(data json.RawMessage) (*LinkPreviewTypeSupergroupBoost, error) { + var resp LinkPreviewTypeSupergroupBoost + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeTheme(data json.RawMessage) (*LinkPreviewTypeTheme, error) { + var resp LinkPreviewTypeTheme + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeUnsupported(data json.RawMessage) (*LinkPreviewTypeUnsupported, error) { + var resp LinkPreviewTypeUnsupported + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeUser(data json.RawMessage) (*LinkPreviewTypeUser, error) { + var resp LinkPreviewTypeUser + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeVideo(data json.RawMessage) (*LinkPreviewTypeVideo, error) { + var resp LinkPreviewTypeVideo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeVideoChat(data json.RawMessage) (*LinkPreviewTypeVideoChat, error) { + var resp LinkPreviewTypeVideoChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeVideoNote(data json.RawMessage) (*LinkPreviewTypeVideoNote, error) { + var resp LinkPreviewTypeVideoNote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeVoiceNote(data json.RawMessage) (*LinkPreviewTypeVoiceNote, error) { + var resp LinkPreviewTypeVoiceNote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeWebApp(data json.RawMessage) (*LinkPreviewTypeWebApp, error) { + var resp LinkPreviewTypeWebApp + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreview(data json.RawMessage) (*LinkPreview, error) { + var resp LinkPreview err := json.Unmarshal(data, &resp) @@ -12558,6 +13011,14 @@ func UnmarshalMessagePaymentSuccessfulBot(data json.RawMessage) (*MessagePayment return &resp, err } +func UnmarshalMessagePaymentRefunded(data json.RawMessage) (*MessagePaymentRefunded, error) { + var resp MessagePaymentRefunded + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageGiftedPremium(data json.RawMessage) (*MessageGiftedPremium, error) { var resp MessageGiftedPremium @@ -12606,6 +13067,14 @@ func UnmarshalMessagePremiumGiveawayWinners(data json.RawMessage) (*MessagePremi return &resp, err } +func UnmarshalMessageGiftedStars(data json.RawMessage) (*MessageGiftedStars, error) { + var resp MessageGiftedStars + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageContactRegistered(data json.RawMessage) (*MessageContactRegistered, error) { var resp MessageContactRegistered @@ -13094,6 +13563,14 @@ func UnmarshalInputMessageForwarded(data json.RawMessage) (*InputMessageForwarde return &resp, err } +func UnmarshalMessageProperties(data json.RawMessage) (*MessageProperties, error) { + var resp MessageProperties + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalSearchMessagesFilterEmpty(data json.RawMessage) (*SearchMessagesFilterEmpty, error) { var resp SearchMessagesFilterEmpty @@ -13526,6 +14003,14 @@ func UnmarshalEmojiCategoryTypeChatPhoto(data json.RawMessage) (*EmojiCategoryTy return &resp, err } +func UnmarshalCurrentWeather(data json.RawMessage) (*CurrentWeather, error) { + var resp CurrentWeather + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStoryAreaPosition(data json.RawMessage) (*StoryAreaPosition, error) { var resp StoryAreaPosition @@ -13574,6 +14059,14 @@ func UnmarshalStoryAreaTypeLink(data json.RawMessage) (*StoryAreaTypeLink, error return &resp, err } +func UnmarshalStoryAreaTypeWeather(data json.RawMessage) (*StoryAreaTypeWeather, error) { + var resp StoryAreaTypeWeather + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStoryArea(data json.RawMessage) (*StoryArea, error) { var resp StoryArea @@ -13630,6 +14123,14 @@ func UnmarshalInputStoryAreaTypeLink(data json.RawMessage) (*InputStoryAreaTypeL return &resp, err } +func UnmarshalInputStoryAreaTypeWeather(data json.RawMessage) (*InputStoryAreaTypeWeather, error) { + var resp InputStoryAreaTypeWeather + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInputStoryArea(data json.RawMessage) (*InputStoryArea, error) { var resp InputStoryArea @@ -13878,6 +14379,30 @@ func UnmarshalPublicForwards(data json.RawMessage) (*PublicForwards, error) { return &resp, err } +func UnmarshalBotMediaPreview(data json.RawMessage) (*BotMediaPreview, error) { + var resp BotMediaPreview + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBotMediaPreviews(data json.RawMessage) (*BotMediaPreviews, error) { + var resp BotMediaPreviews + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBotMediaPreviewInfo(data json.RawMessage) (*BotMediaPreviewInfo, error) { + var resp BotMediaPreviewInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatBoostLevelFeatures(data json.RawMessage) (*ChatBoostLevelFeatures, error) { var resp ChatBoostLevelFeatures @@ -15878,6 +16403,14 @@ func UnmarshalStorePaymentPurposeStars(data json.RawMessage) (*StorePaymentPurpo return &resp, err } +func UnmarshalStorePaymentPurposeGiftedStars(data json.RawMessage) (*StorePaymentPurposeGiftedStars, error) { + var resp StorePaymentPurposeGiftedStars + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalTelegramPaymentPurposePremiumGiftCodes(data json.RawMessage) (*TelegramPaymentPurposePremiumGiftCodes, error) { var resp TelegramPaymentPurposePremiumGiftCodes @@ -15902,6 +16435,14 @@ func UnmarshalTelegramPaymentPurposeStars(data json.RawMessage) (*TelegramPaymen return &resp, err } +func UnmarshalTelegramPaymentPurposeGiftedStars(data json.RawMessage) (*TelegramPaymentPurposeGiftedStars, error) { + var resp TelegramPaymentPurposeGiftedStars + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalDeviceTokenFirebaseCloudMessaging(data json.RawMessage) (*DeviceTokenFirebaseCloudMessaging, error) { var resp DeviceTokenFirebaseCloudMessaging @@ -16086,14 +16627,6 @@ func UnmarshalInputBackgroundPrevious(data json.RawMessage) (*InputBackgroundPre return &resp, err } -func UnmarshalThemeSettings(data json.RawMessage) (*ThemeSettings, error) { - var resp ThemeSettings - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - func UnmarshalChatTheme(data json.RawMessage) (*ChatTheme, error) { var resp ChatTheme @@ -17486,6 +18019,14 @@ func UnmarshalInternalLinkTypeLanguageSettings(data json.RawMessage) (*InternalL return &resp, err } +func UnmarshalInternalLinkTypeMainWebApp(data json.RawMessage) (*InternalLinkTypeMainWebApp, error) { + var resp InternalLinkTypeMainWebApp + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInternalLinkTypeMessage(data json.RawMessage) (*InternalLinkTypeMessage, error) { var resp InternalLinkTypeMessage @@ -17590,14 +18131,6 @@ func UnmarshalInternalLinkTypeSettings(data json.RawMessage) (*InternalLinkTypeS return &resp, err } -func UnmarshalInternalLinkTypeSideMenuBot(data json.RawMessage) (*InternalLinkTypeSideMenuBot, error) { - var resp InternalLinkTypeSideMenuBot - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - func UnmarshalInternalLinkTypeStickerSet(data json.RawMessage) (*InternalLinkTypeStickerSet, error) { var resp InternalLinkTypeStickerSet @@ -18142,6 +18675,14 @@ func UnmarshalTopChatCategoryInlineBots(data json.RawMessage) (*TopChatCategoryI return &resp, err } +func UnmarshalTopChatCategoryWebAppBots(data json.RawMessage) (*TopChatCategoryWebAppBots, error) { + var resp TopChatCategoryWebAppBots + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalTopChatCategoryCalls(data json.RawMessage) (*TopChatCategoryCalls, error) { var resp TopChatCategoryCalls @@ -20508,6 +21049,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarTransactionPartnerChannel: return UnmarshalStarTransactionPartnerChannel(data) + case TypeStarTransactionPartnerUser: + return UnmarshalStarTransactionPartnerUser(data) + case TypeStarTransactionPartnerUnsupported: return UnmarshalStarTransactionPartnerUnsupported(data) @@ -20568,6 +21112,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUsers: return UnmarshalUsers(data) + case TypeFoundUsers: + return UnmarshalFoundUsers(data) + case TypeChatAdministrator: return UnmarshalChatAdministrator(data) @@ -21153,6 +21700,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeWebAppInfo: return UnmarshalWebAppInfo(data) + case TypeMainWebApp: + return UnmarshalMainWebApp(data) + case TypeMessageThreadInfo: return UnmarshalMessageThreadInfo(data) @@ -21189,6 +21739,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSharedChat: return UnmarshalSharedChat(data) + case TypeThemeSettings: + return UnmarshalThemeSettings(data) + case TypeRichTextPlain: return UnmarshalRichTextPlain(data) @@ -21360,8 +21913,101 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeWebPageInstantView: return UnmarshalWebPageInstantView(data) - case TypeWebPage: - return UnmarshalWebPage(data) + case TypeLinkPreviewAlbumMediaPhoto: + return UnmarshalLinkPreviewAlbumMediaPhoto(data) + + case TypeLinkPreviewAlbumMediaVideo: + return UnmarshalLinkPreviewAlbumMediaVideo(data) + + case TypeLinkPreviewTypeAlbum: + return UnmarshalLinkPreviewTypeAlbum(data) + + case TypeLinkPreviewTypeAnimation: + return UnmarshalLinkPreviewTypeAnimation(data) + + case TypeLinkPreviewTypeApp: + return UnmarshalLinkPreviewTypeApp(data) + + case TypeLinkPreviewTypeArticle: + return UnmarshalLinkPreviewTypeArticle(data) + + case TypeLinkPreviewTypeAudio: + return UnmarshalLinkPreviewTypeAudio(data) + + case TypeLinkPreviewTypeBackground: + return UnmarshalLinkPreviewTypeBackground(data) + + case TypeLinkPreviewTypeChannelBoost: + return UnmarshalLinkPreviewTypeChannelBoost(data) + + case TypeLinkPreviewTypeChat: + return UnmarshalLinkPreviewTypeChat(data) + + case TypeLinkPreviewTypeDocument: + return UnmarshalLinkPreviewTypeDocument(data) + + case TypeLinkPreviewTypeEmbeddedAnimationPlayer: + return UnmarshalLinkPreviewTypeEmbeddedAnimationPlayer(data) + + case TypeLinkPreviewTypeEmbeddedAudioPlayer: + return UnmarshalLinkPreviewTypeEmbeddedAudioPlayer(data) + + case TypeLinkPreviewTypeEmbeddedVideoPlayer: + return UnmarshalLinkPreviewTypeEmbeddedVideoPlayer(data) + + case TypeLinkPreviewTypeInvoice: + return UnmarshalLinkPreviewTypeInvoice(data) + + case TypeLinkPreviewTypeMessage: + return UnmarshalLinkPreviewTypeMessage(data) + + case TypeLinkPreviewTypePhoto: + return UnmarshalLinkPreviewTypePhoto(data) + + case TypeLinkPreviewTypePremiumGiftCode: + return UnmarshalLinkPreviewTypePremiumGiftCode(data) + + case TypeLinkPreviewTypeShareableChatFolder: + return UnmarshalLinkPreviewTypeShareableChatFolder(data) + + case TypeLinkPreviewTypeSticker: + return UnmarshalLinkPreviewTypeSticker(data) + + case TypeLinkPreviewTypeStickerSet: + return UnmarshalLinkPreviewTypeStickerSet(data) + + case TypeLinkPreviewTypeStory: + return UnmarshalLinkPreviewTypeStory(data) + + case TypeLinkPreviewTypeSupergroupBoost: + return UnmarshalLinkPreviewTypeSupergroupBoost(data) + + case TypeLinkPreviewTypeTheme: + return UnmarshalLinkPreviewTypeTheme(data) + + case TypeLinkPreviewTypeUnsupported: + return UnmarshalLinkPreviewTypeUnsupported(data) + + case TypeLinkPreviewTypeUser: + return UnmarshalLinkPreviewTypeUser(data) + + case TypeLinkPreviewTypeVideo: + return UnmarshalLinkPreviewTypeVideo(data) + + case TypeLinkPreviewTypeVideoChat: + return UnmarshalLinkPreviewTypeVideoChat(data) + + case TypeLinkPreviewTypeVideoNote: + return UnmarshalLinkPreviewTypeVideoNote(data) + + case TypeLinkPreviewTypeVoiceNote: + return UnmarshalLinkPreviewTypeVoiceNote(data) + + case TypeLinkPreviewTypeWebApp: + return UnmarshalLinkPreviewTypeWebApp(data) + + case TypeLinkPreview: + return UnmarshalLinkPreview(data) case TypeCountryInfo: return UnmarshalCountryInfo(data) @@ -21864,6 +22510,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessagePaymentSuccessfulBot: return UnmarshalMessagePaymentSuccessfulBot(data) + case TypeMessagePaymentRefunded: + return UnmarshalMessagePaymentRefunded(data) + case TypeMessageGiftedPremium: return UnmarshalMessageGiftedPremium(data) @@ -21882,6 +22531,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessagePremiumGiveawayWinners: return UnmarshalMessagePremiumGiveawayWinners(data) + case TypeMessageGiftedStars: + return UnmarshalMessageGiftedStars(data) + case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) @@ -22065,6 +22717,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInputMessageForwarded: return UnmarshalInputMessageForwarded(data) + case TypeMessageProperties: + return UnmarshalMessageProperties(data) + case TypeSearchMessagesFilterEmpty: return UnmarshalSearchMessagesFilterEmpty(data) @@ -22227,6 +22882,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeEmojiCategoryTypeChatPhoto: return UnmarshalEmojiCategoryTypeChatPhoto(data) + case TypeCurrentWeather: + return UnmarshalCurrentWeather(data) + case TypeStoryAreaPosition: return UnmarshalStoryAreaPosition(data) @@ -22245,6 +22903,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStoryAreaTypeLink: return UnmarshalStoryAreaTypeLink(data) + case TypeStoryAreaTypeWeather: + return UnmarshalStoryAreaTypeWeather(data) + case TypeStoryArea: return UnmarshalStoryArea(data) @@ -22266,6 +22927,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInputStoryAreaTypeLink: return UnmarshalInputStoryAreaTypeLink(data) + case TypeInputStoryAreaTypeWeather: + return UnmarshalInputStoryAreaTypeWeather(data) + case TypeInputStoryArea: return UnmarshalInputStoryArea(data) @@ -22359,6 +23023,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePublicForwards: return UnmarshalPublicForwards(data) + case TypeBotMediaPreview: + return UnmarshalBotMediaPreview(data) + + case TypeBotMediaPreviews: + return UnmarshalBotMediaPreviews(data) + + case TypeBotMediaPreviewInfo: + return UnmarshalBotMediaPreviewInfo(data) + case TypeChatBoostLevelFeatures: return UnmarshalChatBoostLevelFeatures(data) @@ -23109,6 +23782,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStorePaymentPurposeStars: return UnmarshalStorePaymentPurposeStars(data) + case TypeStorePaymentPurposeGiftedStars: + return UnmarshalStorePaymentPurposeGiftedStars(data) + case TypeTelegramPaymentPurposePremiumGiftCodes: return UnmarshalTelegramPaymentPurposePremiumGiftCodes(data) @@ -23118,6 +23794,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeTelegramPaymentPurposeStars: return UnmarshalTelegramPaymentPurposeStars(data) + case TypeTelegramPaymentPurposeGiftedStars: + return UnmarshalTelegramPaymentPurposeGiftedStars(data) + case TypeDeviceTokenFirebaseCloudMessaging: return UnmarshalDeviceTokenFirebaseCloudMessaging(data) @@ -23187,9 +23866,6 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInputBackgroundPrevious: return UnmarshalInputBackgroundPrevious(data) - case TypeThemeSettings: - return UnmarshalThemeSettings(data) - case TypeChatTheme: return UnmarshalChatTheme(data) @@ -23712,6 +24388,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInternalLinkTypeLanguageSettings: return UnmarshalInternalLinkTypeLanguageSettings(data) + case TypeInternalLinkTypeMainWebApp: + return UnmarshalInternalLinkTypeMainWebApp(data) + case TypeInternalLinkTypeMessage: return UnmarshalInternalLinkTypeMessage(data) @@ -23751,9 +24430,6 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInternalLinkTypeSettings: return UnmarshalInternalLinkTypeSettings(data) - case TypeInternalLinkTypeSideMenuBot: - return UnmarshalInternalLinkTypeSideMenuBot(data) - case TypeInternalLinkTypeStickerSet: return UnmarshalInternalLinkTypeStickerSet(data) @@ -23958,6 +24634,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeTopChatCategoryInlineBots: return UnmarshalTopChatCategoryInlineBots(data) + case TypeTopChatCategoryWebAppBots: + return UnmarshalTopChatCategoryWebAppBots(data) + case TypeTopChatCategoryCalls: return UnmarshalTopChatCategoryCalls(data) diff --git a/data/td_api.tl b/data/td_api.tl index 2a28b78..b6cdc87 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -572,12 +572,14 @@ userTypeDeleted = UserType; //@can_be_edited True, if the bot is owned by the current user and can be edited using the methods toggleBotUsernameIsActive, reorderBotActiveUsernames, setBotProfilePhoto, setBotName, setBotInfoDescription, and setBotInfoShortDescription //@can_join_groups True, if the bot can be invited to basic group and supergroup chats //@can_read_all_group_messages True, if the bot can read all messages in basic group or supergroup chats and not just those addressed to the bot. In private and channel chats a bot can always read all messages +//@has_main_web_app True, if the bot has the main Web App //@is_inline True, if the bot supports inline queries //@inline_query_placeholder Placeholder for inline queries (displayed on the application input field) //@need_location True, if the location of the user is expected to be sent with every inline query to this bot //@can_connect_to_business True, if the bot supports connection to Telegram Business accounts //@can_be_added_to_attachment_menu True, if the bot can be added to attachment or side menu -userTypeBot can_be_edited:Bool can_join_groups:Bool can_read_all_group_messages:Bool is_inline:Bool inline_query_placeholder:string need_location:Bool can_connect_to_business:Bool can_be_added_to_attachment_menu:Bool = UserType; +//@active_user_count The number of recently active users of the bot +userTypeBot can_be_edited:Bool can_join_groups:Bool can_read_all_group_messages:Bool has_main_web_app:Bool is_inline:Bool inline_query_placeholder:string need_location:Bool can_connect_to_business:Bool can_be_added_to_attachment_menu:Bool active_user_count:int32 = UserType; //@description No information on the user besides the user identifier is available, yet this user has not been deleted. This object is extremely rare and must be handled like a deleted user. It is not possible to perform any actions on users of this type userTypeUnknown = UserType; @@ -774,12 +776,12 @@ inputChatPhotoSticker sticker:chatPhotoSticker = InputChatPhoto; //@can_send_animations True, if the user can send animations. Implies can_send_messages permissions //@can_send_games True, if the user can send games. Implies can_send_messages permissions //@can_use_inline_bots True, if the user can use inline bots. Implies can_send_messages permissions -//@can_add_web_page_previews True, if the user may add a web page preview to their messages +//@can_add_link_previews True, if the user may add a link preview to their messages //@can_change_info True, if the user can change the chat title, photo, and other settings //@can_invite_users True, if the user can invite new users to the chat //@can_pin_messages True, if the user can pin messages //@can_create_topics True, if the user can create topics -chatPermissions can_send_basic_messages:Bool can_send_audios:Bool can_send_documents:Bool can_send_photos:Bool can_send_videos:Bool can_send_video_notes:Bool can_send_voice_notes:Bool can_send_polls:Bool can_send_stickers:Bool can_send_animations:Bool can_send_games:Bool can_use_inline_bots:Bool can_add_web_page_previews:Bool can_change_info:Bool can_invite_users:Bool can_pin_messages:Bool can_create_topics:Bool = ChatPermissions; +chatPermissions can_send_basic_messages:Bool can_send_audios:Bool can_send_documents:Bool can_send_photos:Bool can_send_videos:Bool can_send_video_notes:Bool can_send_voice_notes:Bool can_send_polls:Bool can_send_stickers:Bool can_send_animations:Bool can_send_games:Bool can_use_inline_bots:Bool can_add_link_previews:Bool can_change_info:Bool can_invite_users:Bool can_pin_messages:Bool can_create_topics:Bool = ChatPermissions; //@description Describes rights of the administrator //@can_manage_chat True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report supergroup spam messages and ignore slow mode. Implied by any other privilege; applicable to supergroups and channels only @@ -845,28 +847,28 @@ premiumGiftCodePaymentOptions options:vector = Pre //@use_date Point in time (Unix timestamp) when the code was activated; 0 if none premiumGiftCodeInfo creator_id:MessageSender creation_date:int32 is_from_giveaway:Bool giveaway_message_id:int53 month_count:int32 user_id:int53 use_date:int32 = PremiumGiftCodeInfo; -//@description Describes an option for buying Telegram stars. Use telegramPaymentPurposeStars for out-of-store payments +//@description Describes an option for buying Telegram Stars. Use telegramPaymentPurposeStars for out-of-store payments //@currency ISO 4217 currency code for the payment //@amount The amount to pay, in the smallest units of the currency -//@star_count Number of Telegram stars that will be purchased +//@star_count Number of Telegram Stars that will be purchased //@store_product_id Identifier of the store product associated with the option; may be empty if none //@is_additional True, if the option must be shown only in the full list of payment options starPaymentOption currency:string amount:int53 star_count:int53 store_product_id:string is_additional:Bool = StarPaymentOption; -//@description Contains a list of options for buying Telegram stars @options The list of options +//@description Contains a list of options for buying Telegram Stars @options The list of options starPaymentOptions options:vector = StarPaymentOptions; -//@class StarTransactionDirection @description Describes direction of a transaction with Telegram stars +//@class StarTransactionDirection @description Describes direction of a transaction with Telegram Stars -//@description The transaction is incoming and increases the number of owned Telegram stars +//@description The transaction is incoming and increases the number of owned Telegram Stars starTransactionDirectionIncoming = StarTransactionDirection; -//@description The transaction is outgoing and decreases the number of owned Telegram stars +//@description The transaction is outgoing and decreases the number of owned Telegram Stars starTransactionDirectionOutgoing = StarTransactionDirection; -//@class StarTransactionPartner @description Describes source or recipient of a transaction with Telegram stars +//@class StarTransactionPartner @description Describes source or recipient of a transaction with Telegram Stars //@description The transaction is a transaction with Telegram through a bot starTransactionPartnerTelegram = StarTransactionPartner; @@ -884,10 +886,10 @@ starTransactionPartnerFragment withdrawal_state:RevenueWithdrawalState = StarTra starTransactionPartnerTelegramAds = StarTransactionPartner; //@description The transaction is a transaction with a bot -//@bot_user_id Identifier of the bot +//@user_id Identifier of the bot for the user, or the user for the bot //@product_info Information about the bought product; may be null if not applicable //@invoice_payload Invoice payload; for bots only -starTransactionPartnerBot bot_user_id:int53 product_info:productInfo invoice_payload:bytes = StarTransactionPartner; +starTransactionPartnerBot user_id:int53 product_info:productInfo invoice_payload:bytes = StarTransactionPartner; //@description The transaction is a transaction with a channel chat //@chat_id Identifier of the chat @@ -895,21 +897,26 @@ starTransactionPartnerBot bot_user_id:int53 product_info:productInfo invoice_pay //@media Information about the bought media starTransactionPartnerChannel chat_id:int53 paid_media_message_id:int53 media:vector = StarTransactionPartner; +//@description The transaction is a gift of Telegram Stars from another user +//@user_id Identifier of the user; 0 if the gift was anonymous +//@sticker A sticker to be shown in the transaction information; may be null if unknown +starTransactionPartnerUser user_id:int53 sticker:sticker = StarTransactionPartner; + //@description The transaction is a transaction with unknown partner starTransactionPartnerUnsupported = StarTransactionPartner; -//@description Represents a transaction changing the amount of owned Telegram stars +//@description Represents a transaction changing the amount of owned Telegram Stars //@id Unique identifier of the transaction -//@star_count The amount of added owned Telegram stars; negative for outgoing transactions +//@star_count The amount of added owned Telegram Stars; negative for outgoing transactions //@is_refund True, if the transaction is a refund of a previous transaction //@date Point in time (Unix timestamp) when the transaction was completed //@partner Source of the incoming transaction, or its recipient for outgoing transactions starTransaction id:string star_count:int53 is_refund:Bool date:int32 partner:StarTransactionPartner = StarTransaction; -//@description Represents a list of Telegram star transactions -//@star_count The amount of owned Telegram stars -//@transactions List of transactions with Telegram stars +//@description Represents a list of Telegram Star transactions +//@star_count The amount of owned Telegram Stars +//@transactions List of transactions with Telegram Stars //@next_offset The offset for the next request. If empty, then there are no more results starTransactions star_count:int53 transactions:vector next_offset:string = StarTransactions; @@ -1031,11 +1038,12 @@ user id:int53 access_hash:int64 first_name:string last_name:string usernames:use //@commands List of the bot commands //@default_group_administrator_rights Default administrator rights for adding the bot to basic group and supergroup chats; may be null //@default_channel_administrator_rights Default administrator rights for adding the bot to channels; may be null +//@has_media_previews True, if the bot has media previews //@edit_commands_link The internal link, which can be used to edit bot commands; may be null //@edit_description_link The internal link, which can be used to edit bot description; may be null //@edit_description_media_link The internal link, which can be used to edit the photo or animation shown in the chat with the bot if the chat is empty; may be null //@edit_settings_link The internal link, which can be used to edit bot settings; may be null -botInfo short_description:string description:string photo:photo animation:animation menu_button:botMenuButton commands:vector default_group_administrator_rights:chatAdministratorRights default_channel_administrator_rights:chatAdministratorRights edit_commands_link:InternalLinkType edit_description_link:InternalLinkType edit_description_media_link:InternalLinkType edit_settings_link:InternalLinkType = BotInfo; +botInfo short_description:string description:string photo:photo animation:animation menu_button:botMenuButton commands:vector default_group_administrator_rights:chatAdministratorRights default_channel_administrator_rights:chatAdministratorRights has_media_previews:Bool edit_commands_link:InternalLinkType edit_description_link:InternalLinkType edit_description_media_link:InternalLinkType edit_settings_link:InternalLinkType = BotInfo; //@description Contains full information about a user //@personal_photo User profile photo set by the current user for the contact; may be null. If null and user.profile_photo is null, then the photo is empty; otherwise, it is unknown. @@ -1066,6 +1074,9 @@ userFullInfo personal_photo:chatPhoto photo:chatPhoto public_photo:chatPhoto blo //@description Represents a list of users @total_count Approximate total number of users found @user_ids A list of user identifiers users total_count:int32 user_ids:vector = Users; +//@description Represents a list of found users @user_ids Identifiers of the found users @next_offset The offset for the next request. If empty, then there are no more results +foundUsers user_ids:vector next_offset:string = FoundUsers; + //@description Contains information about a chat administrator @user_id User identifier of the administrator @custom_title Custom title of the administrator @is_owner True, if the user is the owner of the chat chatAdministrator user_id:int53 custom_title:string is_owner:Bool = ChatAdministrator; @@ -1278,7 +1289,7 @@ basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int53 memb //@member_count Number of members in the supergroup or channel; 0 if unknown. Currently, it is guaranteed to be known only if the supergroup or channel was received through //-getChatSimilarChats, getChatsToSendStories, getCreatedPublicChats, getGroupsInCommon, getInactiveSupergroupChats, getRecommendedChats, getSuitableDiscussionChats, //-getUserPrivacySettingRules, getVideoChatAvailableParticipants, searchChatsNearby, searchPublicChats, or in chatFolderInviteLinkInfo.missing_chat_ids, or in userFullInfo.personal_chat_id, -//-or for chats with messages or stories from publicForwards +//-or for chats with messages or stories from publicForwards and foundStories //@boost_level Approximate boost level for the chat //@has_linked_chat True, if the channel has a discussion group, or the supergroup is the designated discussion group for a channel //@has_location True, if the supergroup is connected to a location, i.e. the supergroup is a location-based supergroup @@ -1314,6 +1325,7 @@ supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:Chat //@can_set_location True, if the supergroup location can be changed //@can_get_statistics True, if the supergroup or channel statistics are available //@can_get_revenue_statistics True, if the supergroup or channel revenue statistics are available +//@can_get_star_revenue_statistics True, if the supergroup or channel Telegram Star revenue statistics are available //@can_toggle_aggressive_anti_spam True, if aggressive anti-spam checks can be enabled or disabled in the supergroup //@is_all_history_available 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, //-so this option affects only private non-forum supergroups without a linked chat. The value of this field is only available to chat administrators @@ -1330,7 +1342,7 @@ supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:Chat //@bot_commands List of commands of bots in the group //@upgraded_from_basic_group_id Identifier of the basic group from which supergroup was upgraded; 0 if none //@upgraded_from_max_message_id Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none -supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_get_revenue_statistics:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool can_have_sponsored_messages:Bool has_aggressive_anti_spam_enabled:Bool has_paid_media_allowed:Bool has_pinned_stories:Bool my_boost_count:int32 unrestrict_boost_count:int32 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; +supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_get_revenue_statistics:Bool can_get_star_revenue_statistics:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool can_have_sponsored_messages:Bool has_aggressive_anti_spam_enabled:Bool has_paid_media_allowed:Bool has_pinned_stories:Bool my_boost_count:int32 unrestrict_boost_count:int32 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; //@class SecretChatState @description Describes the current secret chat state @@ -1512,7 +1524,7 @@ messageSendingStatePending sending_id:int32 = MessageSendingState; //@description The message failed to be sent //@error The cause of the message sending failure -//@can_retry True, if the message can be re-sent +//@can_retry True, if the message can be re-sent using resendMessages or readdQuickReplyShortcutMessages //@need_another_sender True, if the message can be re-sent only on behalf of a different sender //@need_another_reply_quote True, if the message can be re-sent only if another quote is chosen in the message that is replied by the given message //@need_drop_reply True, if the message can be re-sent only if the message to be replied is removed. This will be done automatically by resendMessages @@ -1553,13 +1565,13 @@ messageReplyToStory story_sender_chat_id:int53 story_id:int32 = MessageReplyTo; //@class InputMessageReplyTo @description Contains information about the message or the story to be replied //@description Describes a message to be replied in the same chat and forum topic -//@message_id The identifier of the message to be replied in the same chat and forum topic +//@message_id The identifier of the message to be replied in the same chat and forum topic. A message can be replied in the same chat and forum topic only if messageProperties.can_be_replied //@quote Quote from the message to be replied; pass null if none. Must always be null for replies in secret chats inputMessageReplyToMessage message_id:int53 quote:inputTextQuote = InputMessageReplyTo; //@description Describes a message to be replied that is from a different chat or a forum topic; not supported in secret chats //@chat_id The identifier of the chat to which the message to be replied belongs -//@message_id The identifier of the message to be replied in the specified chat. A message can be replied in another chat or topic only if message.can_be_replied_in_another_chat +//@message_id The identifier of the message to be replied in the specified chat. A message can be replied in another chat or forum topic only if messageProperties.can_be_replied_in_another_chat //@quote Quote from the message to be replied; pass null if none inputMessageReplyToExternalMessage chat_id:int53 message_id:int53 quote:inputTextQuote = InputMessageReplyTo; @@ -1584,19 +1596,7 @@ factCheck text:formattedText country_code:string = FactCheck; //@is_outgoing True, if the message is outgoing //@is_pinned True, if the message is pinned //@is_from_offline True, if the message was sent because of a scheduled action by the message sender, for example, as away, or greeting service message -//@can_be_edited True, if the message can be edited. For live location and poll messages this fields shows whether editMessageLiveLocation or stopPoll can be used with this message by the application -//@can_be_forwarded True, if the message can be forwarded -//@can_be_replied_in_another_chat True, if the message can be replied in another chat or topic //@can_be_saved True, if content of the message can be saved locally or copied -//@can_be_deleted_only_for_self True, if the message can be deleted only for the current user while other users will continue to see it -//@can_be_deleted_for_all_users True, if the message can be deleted for all users -//@can_get_added_reactions True, if the list of added reactions is available through getMessageAddedReactions -//@can_get_statistics True, if the message statistics are available through getMessageStatistics -//@can_get_message_thread True, if information about the message thread is available through getMessageThread and getMessageThreadHistory -//@can_get_read_date True, if read date of the message can be received through getMessageReadDate -//@can_get_viewers True, if chat members already viewed the message can be received through getMessageViewers -//@can_get_media_timestamp_links True, if media timestamp links can be generated for media timestamp entities in the message text, caption or web page description through getMessageLink -//@can_report_reactions True, if reactions on the message can be reported through reportMessageReactions //@has_timestamped_media True, if media timestamp entities refers to a media in this message as opposed to a media in the replied message //@is_channel_post True, if the message is a channel post. All messages to channels are channel posts, all other messages are not channel posts //@is_topic_message True, if the message is a forum topic message @@ -1623,7 +1623,8 @@ factCheck text:formattedText country_code:string = FactCheck; //@restriction_reason If non-empty, contains a human-readable description of the reason why access to this message must be restricted //@content Content of the message //@reply_markup Reply markup for the message; may be null if none -message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool is_from_offline:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_get_added_reactions:Bool can_get_statistics:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_viewers:Bool can_get_media_timestamp_links:Bool can_report_reactions:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector fact_check:factCheck reply_to:MessageReplyTo message_thread_id:int53 saved_messages_topic_id:int53 self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 sender_business_bot_user_id:int53 sender_boost_count:int32 author_signature:string media_album_id:int64 effect_id:int64 restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; +message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool is_from_offline:Bool can_be_saved:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector fact_check:factCheck reply_to:MessageReplyTo message_thread_id:int53 saved_messages_topic_id:int53 self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 sender_business_bot_user_id:int53 sender_boost_count:int32 author_signature:string media_album_id:int64 effect_id:int64 restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; + //@description Contains a list of messages @total_count Approximate total number of messages found @messages List of messages; messages may be null messages total_count:int32 messages:vector = Messages; @@ -2204,13 +2205,16 @@ foundWebApp web_app:webApp request_write_access:Bool skip_confirmation:Bool = Fo //@description Contains information about a Web App @launch_id Unique identifier for the Web App launch @url A Web App URL to open in a web view webAppInfo launch_id:int64 url:string = WebAppInfo; +//@description Contains information about the main Web App of a bot @url URL of the Web App to open @is_compact True, if the Web App must always be opened in the compact mode instead of the full-size mode +mainWebApp url:string is_compact:Bool = MainWebApp; + //@description Contains information about a message thread //@chat_id Identifier of the chat to which the message thread belongs //@message_thread_id Message thread identifier, unique within the chat //@reply_info Information about the message thread; may be null for forum topic threads //@unread_message_count Approximate number of unread messages in the message thread -//@messages The messages from which the thread starts. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id) +//@messages The messages from which the thread starts. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id) //@draft_message A draft of a message in the message thread; may be null if none messageThreadInfo chat_id:int53 message_thread_id:int53 reply_info:messageReplyInfo unread_message_count:int32 messages:vector draft_message:draftMessage = MessageThreadInfo; @@ -2299,7 +2303,16 @@ sharedUser user_id:int53 first_name:string last_name:string username:string phot sharedChat chat_id:int53 title:string username:string photo:photo = SharedChat; -//@class RichText @description Describes a text object inside an instant-view web page +//@description Describes theme settings +//@accent_color Theme accent color in ARGB format +//@background The background to be used in chats; may be null +//@outgoing_message_fill The fill to be used as a background for outgoing messages +//@animate_outgoing_message_fill If true, the freeform gradient fill needs to be animated on every sent message +//@outgoing_message_accent_color Accent color of outgoing messages in ARGB format +themeSettings accent_color:int32 background:background outgoing_message_fill:BackgroundFill animate_outgoing_message_fill:Bool outgoing_message_accent_color:int32 = ThemeSettings; + + +//@class RichText @description Describes a formatted text object //@description A plain text @text Text richTextPlain text:string = RichText; @@ -2343,20 +2356,20 @@ richTextPhoneNumber text:RichText phone_number:string = RichText; //@height Height of a bounding box in which the image must be shown; 0 if unknown richTextIcon document:document width:int32 height:int32 = RichText; -//@description A reference to a richTexts object on the same web page @text The text @anchor_name The name of a richTextAnchor object, which is the first element of the target richTexts object @url An HTTP URL, opening the reference +//@description A reference to a richTexts object on the same page @text The text @anchor_name The name of a richTextAnchor object, which is the first element of the target richTexts object @url An HTTP URL, opening the reference richTextReference text:RichText anchor_name:string url:string = RichText; //@description An anchor @name Anchor name richTextAnchor name:string = RichText; -//@description A link to an anchor on the same web page @text The link text @anchor_name The anchor name. If the name is empty, the link must bring back to top @url An HTTP URL, opening the anchor +//@description A link to an anchor on the same page @text The link text @anchor_name The anchor name. If the name is empty, the link must bring back to top @url An HTTP URL, opening the anchor richTextAnchorLink text:RichText anchor_name:string url:string = RichText; //@description A concatenation of rich texts @texts Texts richTexts texts:vector = RichText; -//@description Contains a caption of an instant view web page block, consisting of a text and a trailing credit @text Content of the caption @credit Block credit (like HTML tag ) +//@description Contains a caption of another block @text Content of the caption @credit Block credit (like HTML tag ) pageBlockCaption text:RichText credit:RichText = PageBlockCaption; //@description Describes an item of a list page block @label Item label @page_blocks Item blocks @@ -2403,7 +2416,7 @@ pageBlockTableCell text:RichText is_header:Bool colspan:int32 rowspan:int32 alig pageBlockRelatedArticle url:string title:string description:string photo:photo author:string publish_date:int32 = PageBlockRelatedArticle; -//@class PageBlock @description Describes a block of an instant view web page +//@class PageBlock @description Describes a block of an instant view for a web page //@description The title of a page @title Title pageBlockTitle title:RichText = PageBlock; @@ -2485,7 +2498,7 @@ pageBlockVoiceNote voice_note:voiceNote caption:pageBlockCaption = PageBlock; pageBlockCover cover:PageBlock = PageBlock; //@description An embedded web page -//@url Web page URL, if available +//@url URL of the embedded page, if available //@html HTML-markup of the embedded page //@poster_photo Poster photo, if available; may be null //@width Block width; 0 if unknown @@ -2496,7 +2509,7 @@ pageBlockCover cover:PageBlock = PageBlock; pageBlockEmbedded url:string html:string poster_photo:photo width:int32 height:int32 caption:pageBlockCaption is_full_width:Bool allow_scrolling:Bool = PageBlock; //@description An embedded post -//@url Web page URL +//@url URL of the embedded post //@author Post author //@author_photo Post author photo; may be null //@date Point in time (Unix timestamp) when the post was created; 0 if unknown @@ -2549,45 +2562,163 @@ pageBlockMap location:location zoom:int32 width:int32 height:int32 caption:pageB //@description Describes an instant view page for a web page -//@page_blocks Content of the web page +//@page_blocks Content of the instant view page //@view_count Number of the instant view views; 0 if unknown //@version Version of the instant view; currently, can be 1 or 2 //@is_rtl True, if the instant view must be shown from right to left -//@is_full True, if the instant view contains the full page. A network request might be needed to get the full web page instant view +//@is_full True, if the instant view contains the full page. A network request might be needed to get the full instant view //@feedback_link An internal link to be opened to leave feedback about the instant view webPageInstantView page_blocks:vector view_count:int32 version:int32 is_rtl:Bool is_full:Bool feedback_link:InternalLinkType = WebPageInstantView; +//@class LinkPreviewAlbumMedia @description Describes a media from a link preview album + +//@description The media is a photo @photo Photo description +linkPreviewAlbumMediaPhoto photo:photo = LinkPreviewAlbumMedia; + +//@description The media is a video @video Video description +linkPreviewAlbumMediaVideo video:video = LinkPreviewAlbumMedia; + + +//@class LinkPreviewType @description Describes type of link preview + +//@description The link is a link to a media album consisting of photos and videos @media The list of album media @caption Album caption +linkPreviewTypeAlbum media:vector caption:string = LinkPreviewType; + +//@description The link is a link to an animation @animation The animation @author Author of the animation +linkPreviewTypeAnimation animation:animation author:string = LinkPreviewType; + +//@description The link is a link to an app at App Store or Google Play @photo Photo for the app @author Author of the app +linkPreviewTypeApp photo:photo author:string = LinkPreviewType; + +//@description The link is a link to a web site @photo Article's main photo; may be null @author Author of the article +linkPreviewTypeArticle photo:photo author:string = LinkPreviewType; + +//@description The link is a link to an audio +//@url URL of the audio; may be empty if none +//@mime_type MIME type of the audio file +//@audio The audio description; may be null if unknown +//@duration Duration of the audio, in seconds; 0 if unknown +//@author Author of the audio +linkPreviewTypeAudio url:string mime_type:string audio:audio duration:int32 author:string = LinkPreviewType; + +//@description The link is a link to a background. Link preview title and description are available only for filled backgrounds @document Document with the background; may be null for filled backgrounds +linkPreviewTypeBackground document:document = LinkPreviewType; + +//@description The link is a link to boost a channel chat @photo Photo of the chat; may be null +linkPreviewTypeChannelBoost photo:chatPhoto = LinkPreviewType; + +//@description The link is a link to a chat +//@type Type of the chat +//@photo Photo of the chat; may be null +//@creates_join_request True, if the link only creates join request +linkPreviewTypeChat type:InviteLinkChatType photo:chatPhoto creates_join_request:Bool = LinkPreviewType; + +//@description The link is a link to a general file @document The document description @author Author of the document +linkPreviewTypeDocument document:document author:string = LinkPreviewType; + +//@description The link is a link to an animation player +//@url URL of the external animation player +//@thumbnail Thumbnail of the animation; may be null if unknown +//@duration Duration of the animation, in seconds +//@author Author of the animation +//@width Expected width of the embedded player +//@height Expected height of the embedded player +linkPreviewTypeEmbeddedAnimationPlayer url:string thumbnail:photo duration:int32 author:string width:int32 height:int32 = LinkPreviewType; + +//@description The link is a link to an audio player +//@url URL of the external audio player +//@thumbnail Thumbnail of the audio; may be null if unknown +//@duration Duration of the audio, in seconds +//@author Author of the audio +//@width Expected width of the embedded player +//@height Expected height of the embedded player +linkPreviewTypeEmbeddedAudioPlayer url:string thumbnail:photo duration:int32 author:string width:int32 height:int32 = LinkPreviewType; + +//@description The link is a link to a video player +//@url URL of the external video player +//@thumbnail Thumbnail of the video; may be null if unknown +//@duration Duration of the video, in seconds +//@author Author of the video +//@width Expected width of the embedded player +//@height Expected height of the embedded player +linkPreviewTypeEmbeddedVideoPlayer url:string thumbnail:photo duration:int32 author:string width:int32 height:int32 = LinkPreviewType; + +//@description The link is a link to an invoice +linkPreviewTypeInvoice = LinkPreviewType; + +//@description The link is a link to a text or a poll Telegram message +linkPreviewTypeMessage = LinkPreviewType; + +//@description The link is a link to a photo @photo The photo @author Author of the photo +linkPreviewTypePhoto photo:photo author:string = LinkPreviewType; + +//@description The link is a link to a Telegram Premium gift code +linkPreviewTypePremiumGiftCode = LinkPreviewType; + +//@description The link is a link to a shareable chat folder +linkPreviewTypeShareableChatFolder = LinkPreviewType; + +//@description The link is a link to a sticker message @sticker The sticker +linkPreviewTypeSticker sticker:sticker = LinkPreviewType; + +//@description The link is a link to a sticker set @stickers Up to 4 stickers from the sticker set +linkPreviewTypeStickerSet stickers:vector = LinkPreviewType; + +//@description The link is a link to a story. Link preview description is unavailable @story_sender_chat_id The identifier of the chat that posted the story @story_id Story identifier +linkPreviewTypeStory story_sender_chat_id:int53 story_id:int32 = LinkPreviewType; + +//@description The link is a link to boost a supergroup chat @photo Photo of the chat; may be null +linkPreviewTypeSupergroupBoost photo:chatPhoto = LinkPreviewType; + +//@description The link is a link to a cloud theme. TDLib has no theme support yet @documents The list of files with theme description @settings Settings for the cloud theme +linkPreviewTypeTheme documents:vector settings:themeSettings = LinkPreviewType; + +//@description The link preview type is unsupported yet +linkPreviewTypeUnsupported = LinkPreviewType; + +//@description The link is a link to a user @photo Photo of the user; may be null if none @is_bot True, if the user is a bot +linkPreviewTypeUser photo:chatPhoto is_bot:Bool = LinkPreviewType; + +//@description The link is a link to a video +//@url URL of the video; may be empty if none +//@mime_type MIME type of the video file +//@video The video description; may be null if unknown +//@width Expected width of the preview +//@height Expected height of the preview +//@duration Duration of the video, in seconds; 0 if unknown +//@author Author of the video +linkPreviewTypeVideo url:string mime_type:string video:video width:int32 height:int32 duration:int32 author:string = LinkPreviewType; + +//@description The link is a link to a video chat +//@photo Photo of the chat with the video chat; may be null if none +//@is_live_stream True, if the video chat is expected to be a live stream in a channel or a broadcast group +linkPreviewTypeVideoChat photo:chatPhoto is_live_stream:Bool = LinkPreviewType; + +//@description The link is a link to a video note message @video_note The video note +linkPreviewTypeVideoNote video_note:videoNote = LinkPreviewType; + +//@description The link is a link to a voice note message @voice_note The voice note +linkPreviewTypeVoiceNote voice_note:voiceNote = LinkPreviewType; + +//@description The link is a link to a Web App @photo Web App photo +linkPreviewTypeWebApp photo:photo = LinkPreviewType; + + //@description Describes a link preview //@url Original URL of the link //@display_url URL to display -//@type Type of the web page. Can be: article, photo, audio, video, document, profile, app, or something else //@site_name Short name of the site (e.g., Google Docs, App Store) //@title Title of the content //@param_description Description of the content -//@photo Image representing the content; may be null -//@embed_url URL to show in the embedded preview -//@embed_type MIME type of the embedded preview, (e.g., text/html or video/mp4) -//@embed_width Width of the embedded preview -//@embed_height Height of the embedded preview -//@duration Duration of the content, in seconds -//@author Author of the content +//@type Type of the link preview //@has_large_media True, if size of media in the preview can be changed //@show_large_media True, if large media preview must be shown; otherwise, the media preview must be shown small and only the first frame must be shown for videos +//@show_media_above_description True, if media must be shown above link preview description; otherwise, the media must be shown below the description //@skip_confirmation True, if there is no need to show an ordinary open URL confirmation, when opening the URL from the preview, because the URL is shown in the message text in clear //@show_above_text True, if the link preview must be shown above message text; otherwise, the link preview must be shown below the message text -//@animation Preview of the content as an animation, if available; may be null -//@audio Preview of the content as an audio file, if available; may be null -//@document Preview of the content as a document, if available; may be null -//@sticker Preview of the content as a sticker for small WEBP files, if available; may be null -//@video Preview of the content as a video, if available; may be null -//@video_note Preview of the content as a video note, if available; may be null -//@voice_note Preview of the content as a voice note, if available; may be null -//@story_sender_chat_id The identifier of the sender of the previewed story; 0 if none -//@story_id The identifier of the previewed story; 0 if none -//@stickers Up to 4 stickers from the sticker set available via the link -//@instant_view_version Version of web page instant view (currently, can be 1 or 2); 0 if none -webPage url:string display_url:string type:string site_name:string title:string description:formattedText photo:photo embed_url:string embed_type:string embed_width:int32 embed_height:int32 duration:int32 author:string has_large_media:Bool show_large_media:Bool skip_confirmation:Bool show_above_text:Bool animation:animation audio:audio document:document sticker:sticker video:video video_note:videoNote voice_note:voiceNote story_sender_chat_id:int53 story_id:int32 stickers:vector instant_view_version:int32 = WebPage; +//@instant_view_version Version of instant view (currently, can be 1 or 2) for the web page; 0 if none +linkPreview url:string display_url:string site_name:string title:string description:formattedText type:LinkPreviewType has_large_media:Bool show_large_media:Bool show_media_above_description:Bool skip_confirmation:Bool show_above_text:Bool instant_view_version:int32 = LinkPreview; //@description Contains information about a country @@ -2755,7 +2886,7 @@ paymentOption title:string url:string = PaymentOption; //@need_password True, if the user will be able to save credentials, if sets up a 2-step verification password paymentFormTypeRegular invoice:invoice payment_provider_user_id:int53 payment_provider:PaymentProvider additional_payment_options:vector saved_order_info:orderInfo saved_credentials:vector can_save_credentials:Bool need_password:Bool = PaymentFormType; -//@description The payment form is for a payment in Telegram stars @star_count Number of Telegram stars that will be paid +//@description The payment form is for a payment in Telegram Stars @star_count Number of Telegram Stars that will be paid paymentFormTypeStars star_count:int53 = PaymentFormType; @@ -2784,8 +2915,8 @@ paymentResult success:Bool verification_url:string = PaymentResult; //@tip_amount The amount of tip chosen by the buyer in the smallest units of the currency paymentReceiptTypeRegular payment_provider_user_id:int53 invoice:invoice order_info:orderInfo shipping_option:shippingOption credentials_title:string tip_amount:int53 = PaymentReceiptType; -//@description The payment was done using Telegram stars -//@star_count Number of Telegram stars that were paid +//@description The payment was done using Telegram Stars +//@star_count Number of Telegram Stars that were paid //@transaction_id Unique identifier of the transaction that can be used to dispute it paymentReceiptTypeStars star_count:int53 transaction_id:string = PaymentReceiptType; @@ -2800,7 +2931,9 @@ paymentReceipt product_info:productInfo date:int32 seller_bot_user_id:int53 type //@class InputInvoice @description Describes an invoice to process -//@description An invoice from a message of the type messageInvoice or paid media purchase from messagePaidMedia @chat_id Chat identifier of the message @message_id Message identifier +//@description An invoice from a message of the type messageInvoice or paid media purchase from messagePaidMedia +//@chat_id Chat identifier of the message +//@message_id Message identifier inputInvoiceMessage chat_id:int53 message_id:int53 = InputInvoice; //@description An invoice from a link of the type internalLinkTypeInvoice @name Name of the invoice @@ -3126,9 +3259,9 @@ inputPassportElementError type:PassportElementType message:string source:InputPa //@description A text message //@text Text of the message -//@web_page A link preview attached to the message; may be null +//@link_preview A link preview attached to the message; may be null //@link_preview_options Options which were used for generation of the link preview; may be null if default options were used -messageText text:formattedText web_page:webPage link_preview_options:linkPreviewOptions = MessageContent; +messageText text:formattedText link_preview:linkPreview link_preview_options:linkPreviewOptions = MessageContent; //@description An animation message (GIF-style). //@animation The animation description @@ -3145,7 +3278,7 @@ messageAudio audio:audio caption:formattedText = MessageContent; messageDocument document:document caption:formattedText = MessageContent; //@description A message with paid media -//@star_count Number of stars needed to buy access to the media in the message +//@star_count Number of Telegram Stars needed to buy access to the media in the message //@media Information about the media //@caption Media caption //@show_caption_above_media True, if the caption must be shown above the media; otherwise, the caption must be shown below the media @@ -3352,15 +3485,25 @@ messagePaymentSuccessful invoice_chat_id:int53 invoice_message_id:int53 currency //@provider_payment_charge_id Provider payment identifier messagePaymentSuccessfulBot currency:string total_amount:int53 is_recurring:Bool is_first_recurring:Bool invoice_payload:bytes shipping_option_id:string order_info:orderInfo telegram_payment_charge_id:string provider_payment_charge_id:string = MessageContent; -//@description Telegram Premium was gifted to the user -//@gifter_user_id The identifier of a user that gifted Telegram Premium; 0 if the gift was anonymous +//@description A payment has been refunded +//@owner_id Identifier of the previous owner of the Telegram Stars that refunds them +//@currency Currency for the price of the product +//@total_amount Total price for the product, in the smallest units of the currency +//@invoice_payload Invoice payload; only for bots +//@telegram_payment_charge_id Telegram payment identifier +//@provider_payment_charge_id Provider payment identifier +messagePaymentRefunded owner_id:MessageSender currency:string total_amount:int53 invoice_payload:bytes telegram_payment_charge_id:string provider_payment_charge_id:string = MessageContent; + +//@description Telegram Premium was gifted to a user +//@gifter_user_id The identifier of a user that gifted Telegram Premium; 0 if the gift was anonymous or is outgoing +//@receiver_user_id The identifier of a user that received Telegram Premium; 0 if the gift is incoming //@currency Currency for the paid amount //@amount The paid amount, in the smallest units of the currency //@cryptocurrency Cryptocurrency used to pay for the gift; may be empty if none //@cryptocurrency_amount The paid amount, in the smallest units of the cryptocurrency; 0 if none //@month_count Number of months the Telegram Premium subscription will be active //@sticker A sticker to be shown in the message; may be null if unknown -messageGiftedPremium gifter_user_id:int53 currency:string amount:int53 cryptocurrency:string cryptocurrency_amount:int64 month_count:int32 sticker:sticker = MessageContent; +messageGiftedPremium gifter_user_id:int53 receiver_user_id:int53 currency:string amount:int53 cryptocurrency:string cryptocurrency_amount:int64 month_count:int32 sticker:sticker = MessageContent; //@description A Telegram Premium gift code was created for the user //@creator_id Identifier of a chat or a user that created the gift code; may be null if unknown @@ -3405,6 +3548,18 @@ messagePremiumGiveawayCompleted giveaway_message_id:int53 winner_count:int32 unc //@unclaimed_prize_count Number of undistributed prizes messagePremiumGiveawayWinners boosted_chat_id:int53 giveaway_message_id:int53 additional_chat_count:int32 actual_winners_selection_date:int32 only_new_members:Bool was_refunded:Bool month_count:int32 prize_description:string winner_count:int32 winner_user_ids:vector unclaimed_prize_count:int32 = MessageContent; +//@description Telegram Stars were gifted to a user +//@gifter_user_id The identifier of a user that gifted Telegram Stars; 0 if the gift was anonymous or is outgoing +//@receiver_user_id The identifier of a user that received Telegram Stars; 0 if the gift is incoming +//@currency Currency for the paid amount +//@amount The paid amount, in the smallest units of the currency +//@cryptocurrency Cryptocurrency used to pay for the gift; may be empty if none +//@cryptocurrency_amount The paid amount, in the smallest units of the cryptocurrency; 0 if none +//@star_count Number of Telegram Stars that were gifted +//@transaction_id Identifier of the transaction for Telegram Stars purchase; for receiver only +//@sticker A sticker to be shown in the message; may be null if unknown +messageGiftedStars gifter_user_id:int53 receiver_user_id:int53 currency:string amount:int53 cryptocurrency:string cryptocurrency_amount:int64 star_count:int53 transaction_id:string sticker:sticker = MessageContent; + //@description A contact has registered with Telegram messageContactRegistered = MessageContent; @@ -3501,7 +3656,7 @@ textEntityTypeMentionName user_id:int53 = TextEntityType; //@description A custom emoji. The text behind a custom emoji must be an emoji. Only premium users can use premium custom emoji @custom_emoji_id Unique identifier of the custom emoji textEntityTypeCustomEmoji custom_emoji_id:int64 = TextEntityType; -//@description A media timestamp @media_timestamp Timestamp from which a video/audio/video note/voice note/story playing must start, in seconds. The media can be in the content or the web page preview of the current message, or in the same places in the replied message +//@description A media timestamp @media_timestamp Timestamp from which a video/audio/video note/voice note/story playing must start, in seconds. The media can be in the content or the link preview of the current message, or in the same places in the replied message textEntityTypeMediaTimestamp media_timestamp:int32 = TextEntityType; @@ -3608,7 +3763,7 @@ inputMessageAudio audio:InputFile album_cover_thumbnail:inputThumbnail duration: inputMessageDocument document:InputFile thumbnail:inputThumbnail disable_content_type_detection:Bool caption:formattedText = InputMessageContent; //@description A message with paid media; can be used only in channel chats with supergroupFullInfo.has_paid_media_allowed -//@star_count The number of stars that must be paid to see the media; 1-getOption("paid_media_message_star_count_max") +//@star_count The number of Telegram Stars that must be paid to see the media; 1-getOption("paid_media_message_star_count_max") //@paid_media The content of the paid media //@caption Message caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters //@show_caption_above_media True, if the caption must be shown above the video; otherwise, the caption must be shown below the video; not supported in secret chats @@ -3716,12 +3871,42 @@ inputMessageStory story_sender_chat_id:int53 story_id:int32 = InputMessageConten //@description A forwarded message //@from_chat_id Identifier for the chat this forwarded message came from -//@message_id Identifier of the message to forward. A message can be forwarded only if message.can_be_forwarded +//@message_id Identifier of the message to forward. A message can be forwarded only if messageProperties.can_be_forwarded //@in_game_share True, if a game message is being shared from a launched game; applies only to game messages //@copy_options Options to be used to copy content of the message without reference to the original sender; pass null to forward the message as usual inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool copy_options:messageCopyOptions = InputMessageContent; +//@description Contains properties of a message and describes actions that can be done with the message right now +//@can_be_deleted_only_for_self True, if the message can be deleted only for the current user while other users will continue to see it using the method deleteMessages with revoke == false +//@can_be_deleted_for_all_users True, if the message can be deleted for all users using the method deleteMessages with revoke == true +//@can_be_edited True, if the message can be edited using the methods editMessageText, editMessageMedia, editMessageCaption, or editMessageReplyMarkup. +//-For live location and poll messages this fields shows whether editMessageLiveLocation or stopPoll can be used with this message +//@can_be_forwarded True, if the message can be forwarded using inputMessageForwarded or forwardMessages +//@can_be_paid True, if the message can be paid using inputInvoiceMessage +//@can_be_pinned True, if the message can be pinned or unpinned in the chat using pinChatMessage or unpinChatMessage +//@can_be_replied True, if the message can be replied in the same chat and forum topic using inputMessageReplyToMessage +//@can_be_replied_in_another_chat True, if the message can be replied in another chat or forum topic using inputMessageReplyToExternalMessage +//@can_be_saved True, if content of the message can be saved locally or copied using inputMessageForwarded or forwardMessages with copy options +//@can_be_shared_in_story True, if the message can be shared in a story using inputStoryAreaTypeMessage +//@can_edit_scheduling_state True, if scheduling state of the message can be edited +//@can_get_added_reactions True, if the list of added reactions is available using getMessageAddedReactions +//@can_get_embedding_code True, if code for message embedding can be received using getMessageEmbeddingCode +//@can_get_link True, if a link can be generated for the message using getMessageLink +//@can_get_media_timestamp_links True, if media timestamp links can be generated for media timestamp entities in the message text, caption or link preview description using getMessageLink +//@can_get_message_thread True, if information about the message thread is available through getMessageThread and getMessageThreadHistory +//@can_get_read_date True, if read date of the message can be received through getMessageReadDate +//@can_get_statistics True, if message statistics are available through getMessageStatistics and message forwards can be received using getMessagePublicForwards +//@can_get_viewers True, if chat members already viewed the message can be received through getMessageViewers +//@can_recognize_speech True, if speech can be recognized for the message through recognizeSpeech +//@can_report_chat True, if the message can be reported using reportChat +//@can_report_reactions True, if reactions on the message can be reported through reportMessageReactions +//@can_report_supergroup_spam True, if the message can be reported using reportSupergroupSpam +//@can_set_fact_check True, if fact check for the message can be changed through setMessageFactCheck +//@need_show_statistics True, if message statistics must be available from context menu of the message +messageProperties can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_paid:Bool can_be_pinned:Bool can_be_replied:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_shared_in_story:Bool can_edit_scheduling_state:Bool can_get_added_reactions:Bool can_get_embedding_code:Bool can_get_link:Bool can_get_media_timestamp_links:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_statistics:Bool can_get_viewers:Bool can_recognize_speech:Bool can_report_chat:Bool can_report_reactions:Bool can_report_supergroup_spam:Bool can_set_fact_check:Bool need_show_statistics:Bool = MessageProperties; + + //@class SearchMessagesFilter @description Represents a filter for message search results //@description Returns all found messages, no filter is applied @@ -3937,6 +4122,12 @@ emojiCategoryTypeEmojiStatus = EmojiCategoryType; emojiCategoryTypeChatPhoto = EmojiCategoryType; +//@description Describes the current weather +//@temperature Temperature, in degree Celsius +//@emoji Emoji representing the weather +currentWeather temperature:double emoji:string = CurrentWeather; + + //@description Describes position of a clickable rectangle area on a story media //@x_percentage The abscissa of the rectangle's center, as a percentage of the media width //@y_percentage The ordinate of the rectangle's center, as a percentage of the media height @@ -3947,7 +4138,7 @@ emojiCategoryTypeChatPhoto = EmojiCategoryType; storyAreaPosition x_percentage:double y_percentage:double width_percentage:double height_percentage:double rotation_angle:double corner_radius_percentage:double = StoryAreaPosition; -//@class StoryAreaType @description Describes type of clickable rectangle area on a story media +//@class StoryAreaType @description Describes type of clickable area on a story media //@description An area pointing to a location @location The location @address Address of the location; may be null if unknown storyAreaTypeLocation location:location address:locationAddress = StoryAreaType; @@ -3968,12 +4159,18 @@ storyAreaTypeMessage chat_id:int53 message_id:int53 = StoryAreaType; //@description An area pointing to a HTTP or tg:// link @url HTTP or tg:// URL to be opened when the area is clicked storyAreaTypeLink url:string = StoryAreaType; +//@description An area with information about weather +//@temperature Temperature, in degree Celsius +//@emoji Emoji representing the weather +//@background_color A color of the area background in the ARGB format +storyAreaTypeWeather temperature:double emoji:string background_color:int32 = StoryAreaType; + //@description Describes a clickable rectangle area on a story media @position Position of the area @type Type of the area storyArea position:storyAreaPosition type:StoryAreaType = StoryArea; -//@class InputStoryAreaType @description Describes type of clickable rectangle area on a story media to be added +//@class InputStoryAreaType @description Describes type of clickable area on a story media to be added //@description An area pointing to a location @location The location @address Address of the location; pass null if unknown inputStoryAreaTypeLocation location:location address:locationAddress = InputStoryAreaType; @@ -3996,13 +4193,19 @@ inputStoryAreaTypeSuggestedReaction reaction_type:ReactionType is_dark:Bool is_f //@description An area pointing to a message //@chat_id Identifier of the chat with the message. Currently, the chat must be a supergroup or a channel chat -//@message_id Identifier of the message. Only successfully sent non-scheduled messages can be specified +//@message_id Identifier of the message. Use messageProperties.can_be_shared_in_story to check whether the message is suitable inputStoryAreaTypeMessage chat_id:int53 message_id:int53 = InputStoryAreaType; //@description An area pointing to a HTTP or tg:// link //@url HTTP or tg:// URL to be opened when the area is clicked inputStoryAreaTypeLink url:string = InputStoryAreaType; +//@description An area with information about weather +//@temperature Temperature, in degree Celsius +//@emoji Emoji representing the weather +//@background_color A color of the area background in the ARGB format +inputStoryAreaTypeWeather temperature:double emoji:string background_color:int32 = InputStoryAreaType; + //@description Describes a clickable rectangle area on a story media to be added @position Position of the area @type Type of the area inputStoryArea position:storyAreaPosition type:InputStoryAreaType = InputStoryArea; @@ -4010,8 +4213,9 @@ inputStoryArea position:storyAreaPosition type:InputStoryAreaType = InputStoryAr //@description Contains a list of story areas to be added @areas List of input story areas. Currently, a story can have //-up to 10 inputStoryAreaTypeLocation, inputStoryAreaTypeFoundVenue, and inputStoryAreaTypePreviousVenue areas, //-up to getOption("story_suggested_reaction_area_count_max") inputStoryAreaTypeSuggestedReaction areas, -//-up to 1 inputStoryAreaTypeMessage area, and -//-up to getOption("story_link_area_count_max") inputStoryAreaTypeLink areas if the current user is a Telegram Premium user +//-up to 1 inputStoryAreaTypeMessage area, +//-up to getOption("story_link_area_count_max") inputStoryAreaTypeLink areas if the current user is a Telegram Premium user, and +//-up to 3 inputStoryAreaTypeWeather areas inputStoryAreas areas:vector = InputStoryAreas; @@ -4024,8 +4228,9 @@ inputStoryAreas areas:vector = InputStoryAreas; //@minithumbnail Video minithumbnail; may be null //@thumbnail Video thumbnail in JPEG or MPEG4 format; may be null //@preload_prefix_size Size of file prefix, which is supposed to be preloaded, in bytes +//@cover_frame_timestamp Timestamp of the frame used as video thumbnail //@video File containing the video -storyVideo duration:double width:int32 height:int32 has_stickers:Bool is_animation:Bool minithumbnail:minithumbnail thumbnail:thumbnail preload_prefix_size:int32 video:file = StoryVideo; +storyVideo duration:double width:int32 height:int32 has_stickers:Bool is_animation:Bool minithumbnail:minithumbnail thumbnail:thumbnail preload_prefix_size:int32 cover_frame_timestamp:double video:file = StoryVideo; //@class StoryContent @description Contains the content of a story @@ -4051,8 +4256,9 @@ inputStoryContentPhoto photo:InputFile added_sticker_file_ids:vector = In //@video Video to be sent. The video size must be 720x1280. The video must be streamable and stored in MPEG4 format, after encoding with x265 codec and key frames added each second //@added_sticker_file_ids File identifiers of the stickers added to the video, if applicable //@duration Precise duration of the video, in seconds; 0-60 +//@cover_frame_timestamp Timestamp of the frame, which will be used as video thumbnail //@is_animation True, if the video has no sound -inputStoryContentVideo video:InputFile added_sticker_file_ids:vector duration:double is_animation:Bool = InputStoryContent; +inputStoryContentVideo video:InputFile added_sticker_file_ids:vector duration:double cover_frame_timestamp:double is_animation:Bool = InputStoryContent; //@class StoryList @description Describes a list of stories @@ -4137,7 +4343,7 @@ storyInfo story_id:int32 date:int32 is_for_close_friends:Bool = StoryInfo; //@list Identifier of the story list in which the stories are shown; may be null if the stories aren't shown in a story list //@order A parameter used to determine order of the stories in the story list; 0 if the stories doesn't need to be shown in the story list. Stories must be sorted by the pair (order, story_sender_chat_id) in descending order //@max_read_story_id Identifier of the last read active story -//@stories Basic information about the stories; use getStory to get full information about the stories. The stories are in a chronological order (i.e., in order of increasing story identifiers) +//@stories Basic information about the stories; use getStory to get full information about the stories. The stories are in chronological order (i.e., in order of increasing story identifiers) chatActiveStories chat_id:int53 list:StoryList order:int53 max_read_story_id:int32 stories:vector = ChatActiveStories; @@ -4207,6 +4413,20 @@ publicForwardStory story:story = PublicForward; publicForwards total_count:int32 forwards:vector next_offset:string = PublicForwards; +//@description Describes media previews of a bot +//@date Point in time (Unix timestamp) when the preview was added or changed last time +//@content Content of the preview +botMediaPreview date:int32 content:StoryContent = BotMediaPreview; + +//@description Contains a list of media previews of a bot @previews List of media previews +botMediaPreviews previews:vector = BotMediaPreviews; + +//@description Contains a list of media previews of a bot for the given language and the list of languages for which the bot has dedicated previews +//@previews List of media previews +//@language_codes List of language codes for which the bot has dedicated previews +botMediaPreviewInfo previews:vector language_codes:vector = BotMediaPreviewInfo; + + //@description Contains a list of features available on a specific chat boost level //@level Target chat boost level //@story_per_day_count Number of stories that the chat can publish daily @@ -5429,7 +5649,10 @@ premiumState state:formattedText payment_options:vector Devices > Scan QR and scan the code" needs to be shown @@ -6367,15 +6606,6 @@ internalLinkTypeRestorePurchases = InternalLinkType; //@description The link is a link to application settings internalLinkTypeSettings = InternalLinkType; -//@description The link is a link to a bot, which can be installed to the side menu. Call searchPublicChat with the given bot username, check that the user is a bot and can be added to attachment menu. -//-Then, use getAttachmentMenuBot to receive information about the bot. If the bot isn't added to side menu, then show a disclaimer about Mini Apps being a third-party apps, -//-ask the user to accept their Terms of service and confirm adding the bot to side and attachment menu. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. -//-If the bot is added to side menu, then use getWebAppUrl with the given URL and open the returned URL as a Web App -//@bot_username Username of the bot -//@url URL to be passed to getWebAppUrl -//@is_compact True, if the Web App must be opened in a compact mode instead of a full-size mode -internalLinkTypeSideMenuBot bot_username:string url:string is_compact:Bool = InternalLinkType; - //@description The link is a link to a sticker set. Call searchStickerSet with the given sticker set name to process the link and show the sticker set. //-If the sticker set is found and the user wants to add it, then call changeStickerSet //@sticker_set_name Name of the sticker set @@ -6387,7 +6617,7 @@ internalLinkTypeStickerSet sticker_set_name:string expect_custom_emoji:Bool = In //@story_id Story identifier internalLinkTypeStory story_sender_username:string story_id:int32 = InternalLinkType; -//@description The link is a link to a theme. TDLib has no theme support yet @theme_name Name of the theme +//@description The link is a link to a cloud theme. TDLib has no theme support yet @theme_name Name of the theme internalLinkTypeTheme theme_name:string = InternalLinkType; //@description The link is a link to the theme section of the app settings @@ -6400,10 +6630,11 @@ internalLinkTypeUnknownDeepLink link:string = InternalLinkType; internalLinkTypeUnsupportedProxy = InternalLinkType; //@description The link is a link to a user by its phone number. Call searchUserByPhoneNumber with the given phone number to process the link. -//-If the user is found, then call createPrivateChat and open the chat. If draft text isn't empty, then put the draft text in the input field +//-If the user is found, then call createPrivateChat and open user's profile information screen or the chat itself. If draft text isn't empty, then put the draft text in the input field //@phone_number Phone number of the user //@draft_text Draft text for message to send in the chat -internalLinkTypeUserPhoneNumber phone_number:string draft_text:string = InternalLinkType; +//@open_profile True, if user's profile information screen must be opened; otherwise, the chat itself must be opened +internalLinkTypeUserPhoneNumber phone_number:string draft_text:string open_profile:Bool = InternalLinkType; //@description The link is a link to a user by a temporary token. Call searchUserByToken with the given token to process the link. //-If the user is found, then call createPrivateChat and open the chat @@ -6417,13 +6648,13 @@ internalLinkTypeUserToken token:string = InternalLinkType; internalLinkTypeVideoChat chat_username:string invite_hash:string is_live_stream:Bool = InternalLinkType; //@description The link is a link to a Web App. Call searchPublicChat with the given bot username, check that the user is a bot, then call searchWebApp with the received bot and the given web_app_short_name. -//-Process received foundWebApp by showing a confirmation dialog if needed. If the bot can be added to attachment or side menu, but isn't added yet, then show a disclaimer about Mini Apps being a third-party apps +//-Process received foundWebApp by showing a confirmation dialog if needed. If the bot can be added to attachment or side menu, but isn't added yet, then show a disclaimer about Mini Apps being third-party apps //-instead of the dialog and ask the user to accept their Terms of service. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. //-Then, call getWebAppLinkUrl and open the returned URL as a Web App //@bot_username Username of the bot that owns the Web App //@web_app_short_name Short name of the Web App //@start_parameter Start parameter to be passed to getWebAppLinkUrl -//@is_compact True, if the Web App must be opened in a compact mode instead of a full-size mode +//@is_compact True, if the Web App must be opened in the compact mode instead of the full-size mode internalLinkTypeWebApp bot_username:string web_app_short_name:string start_parameter:string is_compact:Bool = InternalLinkType; @@ -6435,7 +6666,7 @@ messageLink link:string is_public:Bool = MessageLink; //@chat_id If found, identifier of the chat to which the link points, 0 otherwise //@message_thread_id If found, identifier of the message thread in which to open the message, or a forum topic to open if the message is missing //@message If found, the linked message; may be null -//@media_timestamp Timestamp from which the video/audio/video note/voice note/story playing must start, in seconds; 0 if not specified. The media can be in the message content or in its web page preview +//@media_timestamp Timestamp from which the video/audio/video note/voice note/story playing must start, in seconds; 0 if not specified. The media can be in the message content or in its link preview //@for_album True, if the whole media album to which the message belongs is linked messageLinkInfo is_public:Bool chat_id:int53 message_thread_id:int53 message:message media_timestamp:int32 for_album:Bool = MessageLinkInfo; @@ -6680,6 +6911,9 @@ topChatCategoryChannels = TopChatCategory; //@description A category containing frequently used chats with inline bots sorted by their usage in inline mode topChatCategoryInlineBots = TopChatCategory; +//@description A category containing frequently used chats with bots, which Web Apps were opened +topChatCategoryWebAppBots = TopChatCategory; + //@description A category containing frequently used chats used for calls topChatCategoryCalls = TopChatCategory; @@ -6986,18 +7220,18 @@ chatRevenueTransaction cryptocurrency:string cryptocurrency_amount:int64 type:Ch chatRevenueTransactions total_count:int32 transactions:vector = ChatRevenueTransactions; -//@description Contains information about Telegram stars earned by a bot or a chat -//@total_count Total number of the stars earned -//@current_count The number of Telegram stars that aren't withdrawn yet -//@available_count The number of Telegram stars that are available for withdrawal -//@withdrawal_enabled True, if Telegram stars can be withdrawn now or later +//@description Contains information about Telegram Stars earned by a bot or a chat +//@total_count Total number of Telegram Stars earned +//@current_count The number of Telegram Stars that aren't withdrawn yet +//@available_count The number of Telegram Stars that are available for withdrawal +//@withdrawal_enabled True, if Telegram Stars can be withdrawn now or later //@next_withdrawal_in Time left before the next withdrawal can be started, in seconds; 0 if withdrawal can be started now starRevenueStatus total_count:int53 current_count:int53 available_count:int53 withdrawal_enabled:Bool next_withdrawal_in:int32 = StarRevenueStatus; -//@description A detailed statistics about Telegram stars earned by a bot or a chat +//@description A detailed statistics about Telegram Stars earned by a bot or a chat //@revenue_by_day_graph A graph containing amount of revenue in a given day -//@status Telegram star revenue status -//@usd_rate Current conversion rate of a Telegram star to USD +//@status Telegram Star revenue status +//@usd_rate Current conversion rate of a Telegram Star to USD starRevenueStatistics revenue_by_day_graph:StatisticalGraph status:starRevenueStatus usd_rate:double = StarRevenueStatistics; @@ -7515,7 +7749,7 @@ updateDefaultReactionType reaction_type:ReactionType = Update; //@tags The new tags updateSavedMessagesTags saved_messages_topic_id:int53 tags:savedMessagesTags = Update; -//@description The number of Telegram stars owned by the current user has changed @star_count The new number of Telegram stars owned +//@description The number of Telegram Stars owned by the current user has changed @star_count The new number of Telegram Stars owned updateOwnedStarCount star_count:int53 = Update; //@description The revenue earned from sponsored messages in a chat has changed. If chat revenue screen is opened, then getChatRevenueTransactions may be called to fetch new transactions @@ -7523,9 +7757,9 @@ updateOwnedStarCount star_count:int53 = Update; //@revenue_amount New amount of earned revenue updateChatRevenueAmount chat_id:int53 revenue_amount:chatRevenueAmount = Update; -//@description The Telegram star revenue earned by a bot or a chat has changed. If star transactions screen of the chat is opened, then getStarTransactions may be called to fetch new transactions -//@owner_id Identifier of the owner of the Telegram stars -//@status New Telegram star revenue status +//@description The Telegram Star revenue earned by a bot or a chat has changed. If Telegram Star transaction screen of the chat is opened, then getStarTransactions may be called to fetch new transactions +//@owner_id Identifier of the owner of the Telegram Stars +//@status New Telegram Star revenue status updateStarRevenueStatus owner_id:MessageSender status:starRevenueStatus = Update; //@description The parameters of speech recognition without Telegram Premium subscription has changed @@ -7956,15 +8190,18 @@ getCallbackQueryMessage chat_id:int53 message_id:int53 callback_query_id:int64 = //@description Returns information about messages. If a message is not found, returns null on the corresponding position of the result @chat_id Identifier of the chat the messages belong to @message_ids Identifiers of the messages to get getMessages chat_id:int53 message_ids:vector = Messages; -//@description Returns information about a message thread. Can be used only if message.can_get_message_thread == true @chat_id Chat identifier @message_id Identifier of the message +//@description Returns properties of a message; this is an offline request @chat_id Chat identifier @message_id Identifier of the message +getMessageProperties chat_id:int53 message_id:int53 = MessageProperties; + +//@description Returns information about a message thread. Can be used only if messageProperties.can_get_message_thread == true @chat_id Chat identifier @message_id Identifier of the message getMessageThread chat_id:int53 message_id:int53 = MessageThreadInfo; -//@description Returns read date of a recent outgoing message in a private chat. The method can be called if message.can_get_read_date == true and the message is read +//@description Returns read date of a recent outgoing message in a private chat. The method can be called if messageProperties.can_get_read_date == true //@chat_id Chat identifier //@message_id Identifier of the message getMessageReadDate chat_id:int53 message_id:int53 = MessageReadDate; -//@description Returns viewers of a recent outgoing message in a basic group or a supergroup chat. For video notes and voice notes only users, opened content of the message, are returned. The method can be called if message.can_get_viewers == true +//@description Returns viewers of a recent outgoing message in a basic group or a supergroup chat. For video notes and voice notes only users, opened content of the message, are returned. The method can be called if messageProperties.can_get_viewers == true //@chat_id Chat identifier //@message_id Identifier of the message getMessageViewers chat_id:int53 message_id:int53 = MessageViewers; @@ -8072,7 +8309,7 @@ getSuitablePersonalChats = Chats; //@limit The maximum number of topics to be loaded. For optimal performance, the number of loaded topics is chosen by TDLib and can be smaller than the specified limit, even if the end of the list is not reached loadSavedMessagesTopics limit:int32 = Ok; -//@description Returns messages in a Saved Messages topic. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id) +//@description Returns messages in a Saved Messages topic. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id) //@saved_messages_topic_id Identifier of Saved Messages topic which messages will be fetched //@from_message_id Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message //@offset Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages @@ -8110,7 +8347,7 @@ setPinnedSavedMessagesTopics saved_messages_topic_ids:vector = Ok; getGroupsInCommon user_id:int53 offset_chat_id:int53 limit:int32 = Chats; -//@description Returns messages in a chat. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id). +//@description Returns messages in a chat. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id). //-For optimal performance, the number of returned messages is chosen by TDLib. This is an offline request if only_local is true //@chat_id Chat identifier //@from_message_id Identifier of the message starting from which history must be fetched; use 0 to get results from the last message @@ -8120,8 +8357,8 @@ getGroupsInCommon user_id:int53 offset_chat_id:int53 limit:int32 = Chats; //@only_local Pass true to get only messages that are available without sending network requests getChatHistory chat_id:int53 from_message_id:int53 offset:int32 limit:int32 only_local:Bool = Messages; -//@description Returns messages in a message thread of a message. Can be used only if message.can_get_message_thread == true. Message thread of a channel message is in the channel's linked supergroup. -//-The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id). For optimal performance, the number of returned messages is chosen by TDLib +//@description Returns messages in a message thread of a message. Can be used only if messageProperties.can_get_message_thread == true. Message thread of a channel message is in the channel's linked supergroup. +//-The messages are returned in reverse chronological order (i.e., in order of decreasing message_id). For optimal performance, the number of returned messages is chosen by TDLib //@chat_id Chat identifier //@message_id Message identifier, which thread history needs to be returned //@from_message_id Identifier of the message starting from which history must be fetched; use 0 to get results from the last message @@ -8276,7 +8513,7 @@ getChatMessageCount chat_id:int53 filter:SearchMessagesFilter saved_messages_top //@saved_messages_topic_id If not 0, only messages in the specified Saved Messages topic will be considered; pass 0 to consider all relevant messages, or for chats other than Saved Messages getChatMessagePosition chat_id:int53 message_id:int53 filter:SearchMessagesFilter message_thread_id:int53 saved_messages_topic_id:int53 = Count; -//@description Returns all scheduled messages in a chat. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id) @chat_id Chat identifier +//@description Returns all scheduled messages in a chat. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id) @chat_id Chat identifier getChatScheduledMessages chat_id:int53 = Messages; //@description Returns sponsored messages to be shown in a chat; for channel chats only @chat_id Identifier of the chat @@ -8301,15 +8538,15 @@ removeNotification notification_group_id:int32 notification_id:int32 = Ok; removeNotificationGroup notification_group_id:int32 max_notification_id:int32 = Ok; -//@description Returns an HTTPS link to a message in a chat. Available only for already sent messages in supergroups and channels, or if message.can_get_media_timestamp_links and a media timestamp link is generated. This is an offline request +//@description Returns an HTTPS link to a message in a chat. Available only if messageProperties.can_get_link, or if messageProperties.can_get_media_timestamp_links and a media timestamp link is generated. This is an offline request //@chat_id Identifier of the chat to which the message belongs //@message_id Identifier of the message -//@media_timestamp If not 0, timestamp from which the video/audio/video note/voice note/story playing must start, in seconds. The media can be in the message content or in its web page preview +//@media_timestamp If not 0, timestamp from which the video/audio/video note/voice note/story playing must start, in seconds. The media can be in the message content or in its link preview //@for_album Pass true to create a link for the whole media album //@in_message_thread Pass true to create a link to the message as a channel post comment, in a message thread, or a forum topic getMessageLink chat_id:int53 message_id:int53 media_timestamp:int32 for_album:Bool in_message_thread:Bool = MessageLink; -//@description Returns an HTML code for embedding the message. Available only for messages in supergroups and channels with a username +//@description Returns an HTML code for embedding the message. Available only if messageProperties.can_get_embedding_code //@chat_id Identifier of the chat to which the message belongs //@message_id Identifier of the message //@for_album Pass true to return an HTML code for embedding of the whole media album @@ -8338,9 +8575,9 @@ translateText text:formattedText to_language_code:string = FormattedText; //-"st", "sn", "sd", "si", "sk", "sl", "so", "es", "su", "sw", "sv", "tl", "tg", "ta", "tt", "te", "th", "tr", "tk", "uk", "ur", "ug", "uz", "vi", "cy", "xh", "yi", "ji", "yo", "zu" translateMessageText chat_id:int53 message_id:int53 to_language_code:string = FormattedText; -//@description Recognizes speech in a video note or a voice note message. The message must be successfully sent, must not be scheduled, and must be from a non-secret chat +//@description Recognizes speech in a video note or a voice note message //@chat_id Identifier of the chat to which the message belongs -//@message_id Identifier of the message +//@message_id Identifier of the message. Use messageProperties.can_recognize_speech to check whether the message is suitable recognizeSpeech chat_id:int53 message_id:int53 = Ok; //@description Rates recognized speech in a video note or a voice note message @chat_id Identifier of the chat to which the message belongs @message_id Identifier of the message @is_good Pass true if the speech recognition is good @@ -8392,7 +8629,7 @@ sendInlineQueryResultMessage chat_id:int53 message_thread_id:int53 reply_to:Inpu //@chat_id Identifier of the chat to which to forward messages //@message_thread_id If not 0, the message thread identifier in which the message will be sent; for forum threads only //@from_chat_id Identifier of the chat from which to forward messages -//@message_ids Identifiers of the messages to forward. Message identifiers must be in a strictly increasing order. At most 100 messages can be forwarded simultaneously. A message can be forwarded only if message.can_be_forwarded +//@message_ids Identifiers of the messages to forward. Message identifiers must be in a strictly increasing order. At most 100 messages can be forwarded simultaneously. A message can be forwarded only if messageProperties.can_be_forwarded //@options Options to be used to send the messages; pass null to use default options //@send_copy Pass true to copy content of the messages without reference to the original sender. Always true if the messages are forwarded to a secret chat or are local //@remove_caption Pass true to remove media captions of message copies. Ignored if send_copy is false @@ -8422,7 +8659,10 @@ sendChatScreenshotTakenNotification chat_id:int53 = Ok; //@input_message_content The content of the message to be added addLocalMessage chat_id:int53 sender_id:MessageSender reply_to:InputMessageReplyTo disable_notification:Bool input_message_content:InputMessageContent = Message; -//@description Deletes messages @chat_id Chat identifier @message_ids Identifiers of the messages to be deleted @revoke Pass true to delete messages for all chat members. Always true for supergroups, channels and secret chats +//@description Deletes messages +//@chat_id Chat identifier +//@message_ids Identifiers of the messages to be deleted. Use messageProperties.can_be_deleted_only_for_self and messageProperties.can_be_deleted_for_all_users to get suitable messages +//@revoke Pass true to delete messages for all chat members. Always true for supergroups, channels and secret chats deleteMessages chat_id:int53 message_ids:vector revoke:Bool = Ok; //@description Deletes all messages sent by the specified message sender in a chat. Supported only for supergroups; requires can_delete_messages administrator privileges @chat_id Chat identifier @sender_id Identifier of the sender of messages to delete @@ -8436,18 +8676,17 @@ deleteChatMessagesBySender chat_id:int53 sender_id:MessageSender = Ok; deleteChatMessagesByDate chat_id:int53 min_date:int32 max_date:int32 revoke:Bool = Ok; -//@description Edits the text of a message (or a text of a game message). Returns the edited message after the edit is completed on the server side. -//-Can be used only if message.can_be_edited == true +//@description Edits the text of a message (or a text of a game message). Returns the edited message after the edit is completed on the server side //@chat_id The chat the message belongs to -//@message_id Identifier of the message +//@message_id Identifier of the message. Use messageProperties.can_be_edited to check whether the message can be edited //@reply_markup The new message reply markup; pass null if none; for bots only //@input_message_content New text content of the message. Must be of type inputMessageText editMessageText chat_id:int53 message_id:int53 reply_markup:ReplyMarkup input_message_content:InputMessageContent = Message; //@description Edits the message content of a live location. Messages can be edited for a limited period of time specified in the live location. -//-Returns the edited message after the edit is completed on the server side. Can be used only if message.can_be_edited == true +//-Returns the edited message after the edit is completed on the server side //@chat_id The chat the message belongs to -//@message_id Identifier of the message +//@message_id Identifier of the message. Use messageProperties.can_be_edited to check whether the message can be edited //@reply_markup The new message reply markup; pass null if none; for bots only //@location New location content of the message; pass null to stop sharing the live location //@live_period New time relative to the message send date, for which the location can be updated, in seconds. If 0x7FFFFFFF specified, then the location can be updated forever. @@ -8458,26 +8697,24 @@ editMessageLiveLocation chat_id:int53 message_id:int53 reply_markup:ReplyMarkup //@description Edits the content of a message with an animation, an audio, a document, a photo or a video, including message caption. If only the caption needs to be edited, use editMessageCaption instead. //-The media can't be edited if the message was set to self-destruct or to a self-destructing media. The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa. -//-Returns the edited message after the edit is completed on the server side. Can be used only if message.can_be_edited == true +//-Returns the edited message after the edit is completed on the server side //@chat_id The chat the message belongs to -//@message_id Identifier of the message +//@message_id Identifier of the message. Use messageProperties.can_be_edited to check whether the message can be edited //@reply_markup The new message reply markup; pass null if none; for bots only //@input_message_content New content of the message. Must be one of the following types: inputMessageAnimation, inputMessageAudio, inputMessageDocument, inputMessagePhoto or inputMessageVideo editMessageMedia chat_id:int53 message_id:int53 reply_markup:ReplyMarkup input_message_content:InputMessageContent = Message; -//@description Edits the message content caption. Returns the edited message after the edit is completed on the server side. -//-Can be used only if message.can_be_edited == true +//@description Edits the message content caption. Returns the edited message after the edit is completed on the server side //@chat_id The chat the message belongs to -//@message_id Identifier of the message +//@message_id Identifier of the message. Use messageProperties.can_be_edited to check whether the message can be edited //@reply_markup The new message reply markup; pass null if none; for bots only //@caption New message content caption; 0-getOption("message_caption_length_max") characters; pass null to remove caption //@show_caption_above_media Pass true to show the caption above the media; otherwise, the caption will be shown below the media. Can be true only for animation, photo, and video messages editMessageCaption chat_id:int53 message_id:int53 reply_markup:ReplyMarkup caption:formattedText show_caption_above_media:Bool = Message; -//@description Edits the message reply markup; for bots only. Returns the edited message after the edit is completed on the server side. -//-Can be used only if message.can_be_edited == true +//@description Edits the message reply markup; for bots only. Returns the edited message after the edit is completed on the server side //@chat_id The chat the message belongs to -//@message_id Identifier of the message +//@message_id Identifier of the message. Use messageProperties.can_be_edited to check whether the message can be edited //@reply_markup The new message reply markup; pass null if none editMessageReplyMarkup chat_id:int53 message_id:int53 reply_markup:ReplyMarkup = Message; @@ -8517,13 +8754,13 @@ editInlineMessageReplyMarkup inline_message_id:string reply_markup:ReplyMarkup = //@description Edits the time when a scheduled message will be sent. Scheduling state of all messages in the same album or forwarded together with the message will be also changed //@chat_id The chat the message belongs to -//@message_id Identifier of the message +//@message_id Identifier of the message. Use messageProperties.can_edit_scheduling_state to check whether the message is suitable //@scheduling_state The new message scheduling state; pass null to send the message immediately editMessageSchedulingState chat_id:int53 message_id:int53 scheduling_state:MessageSchedulingState = Ok; -//@description Changes the fact-check of a message. Can be only used if getOption("can_edit_fact_check") == true +//@description Changes the fact-check of a message. Can be only used if messageProperties.can_set_fact_check == true //@chat_id The channel chat the message belongs to -//@message_id Identifier of the message. The message must be one of the following types: messageAnimation, messageAudio, messageDocument, messagePhoto, messageText, messageVideo +//@message_id Identifier of the message //@text New text of the fact-check; 0-getOption("fact_check_length_max") characters; pass null to remove it. Only Bold, Italic, and TextUrl entities with https://t.me/ links are supported setMessageFactCheck chat_id:int53 message_id:int53 text:formattedText = Ok; @@ -8601,6 +8838,13 @@ editBusinessMessageReplyMarkup business_connection_id:string chat_id:int53 messa //@reply_markup The new message reply markup; pass null if none stopBusinessPoll business_connection_id:string chat_id:int53 message_id:int53 reply_markup:ReplyMarkup = BusinessMessage; +//@description Pins or unpins a message sent on behalf of a business account; for bots only +//@business_connection_id Unique identifier of business connection on behalf of which the message was sent +//@chat_id The chat the message belongs to +//@message_id Identifier of the message +//@is_pinned Pass true to pin the message, pass false to unpin it +setBusinessMessageIsPinned business_connection_id:string chat_id:int53 message_id:int53 is_pinned:Bool = Ok; + //@description Checks validness of a name for a quick reply shortcut. Can be called synchronously @name The name of the shortcut; 1-32 characters checkQuickReplyShortcutName name:string = Ok; @@ -8765,7 +9009,7 @@ setMessageReactions chat_id:int53 message_id:int53 reaction_types:vector = Ok; //@limit The maximum number of voters to be returned; must be positive and can't be greater than 50. For optimal performance, the number of returned voters is chosen by TDLib and can be smaller than the specified limit, even if the end of the voter list has not been reached getPollVoters chat_id:int53 message_id:int53 option_id:int32 offset:int32 limit:int32 = MessageSenders; -//@description Stops a poll. A poll in a message can be stopped when the message has can_be_edited flag is set +//@description Stops a poll //@chat_id Identifier of the chat to which the poll belongs -//@message_id Identifier of the message containing the poll +//@message_id Identifier of the message containing the poll. Use messageProperties.can_be_edited to check whether the poll can be stopped //@reply_markup The new message reply markup; pass null if none; for bots only stopPoll chat_id:int53 message_id:int53 reply_markup:ReplyMarkup = Ok; @@ -8870,7 +9114,7 @@ getBusinessConnection connection_id:string = BusinessConnection; //@description Returns information about a button of type inlineKeyboardButtonTypeLoginUrl. The method needs to be called when the user presses the button //@chat_id Chat identifier of the message with the button -//@message_id Message identifier of the message with the button +//@message_id Message identifier of the message with the button. The message must not be scheduled //@button_id Button identifier getLoginUrlInfo chat_id:int53 message_id:int53 button_id:int53 = LoginUrlInfo; @@ -8920,6 +9164,11 @@ getInlineQueryResults bot_user_id:int53 chat_id:int53 user_location:location que answerInlineQuery inline_query_id:int64 is_personal:Bool button:inlineQueryResultsButton results:vector cache_time:int32 next_offset:string = Ok; +//@description Returns popular Web App bots +//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results +//@limit The maximum number of bots to be returned; up to 100 +getPopularWebAppBots offset:string limit:int32 = FoundUsers; + //@description Returns information about a Web App by its short name. Returns a 404 error if the Web App is not found //@bot_user_id Identifier of the target bot //@web_app_short_name Short name of the Web App @@ -8931,15 +9180,23 @@ searchWebApp bot_user_id:int53 web_app_short_name:string = FoundWebApp; //@web_app_short_name Short name of the Web App //@start_parameter Start parameter from internalLinkTypeWebApp //@theme Preferred Web App theme; pass null to use the default theme -//@application_name Short name of the application; 0-64 English letters, digits, and underscores +//@application_name Short name of the current application; 0-64 English letters, digits, and underscores //@allow_write_access Pass true if the current user allowed the bot to send them messages getWebAppLinkUrl chat_id:int53 bot_user_id:int53 web_app_short_name:string start_parameter:string theme:themeParameters application_name:string allow_write_access:Bool = HttpUrl; -//@description Returns an HTTPS URL of a Web App to open from the side menu, a keyboardButtonTypeWebApp button, an inlineQueryResultsButtonTypeWebApp button, or an internalLinkTypeSideMenuBot link +//@description Returns information needed to open the main Web App of a bot +//@chat_id Identifier of the chat in which the Web App is opened; pass 0 if none //@bot_user_id Identifier of the target bot -//@url The URL from a keyboardButtonTypeWebApp button, inlineQueryResultsButtonTypeWebApp button, an internalLinkTypeSideMenuBot link, or an empty when the bot is opened from the side menu +//@start_parameter Start parameter from internalLinkTypeMainWebApp //@theme Preferred Web App theme; pass null to use the default theme -//@application_name Short name of the application; 0-64 English letters, digits, and underscores +//@application_name Short name of the current application; 0-64 English letters, digits, and underscores +getMainWebApp chat_id:int53 bot_user_id:int53 start_parameter:string theme:themeParameters application_name:string = MainWebApp; + +//@description Returns an HTTPS URL of a Web App to open from the side menu, a keyboardButtonTypeWebApp button, or an inlineQueryResultsButtonTypeWebApp button +//@bot_user_id Identifier of the target bot +//@url The URL from a keyboardButtonTypeWebApp button, inlineQueryResultsButtonTypeWebApp button, or an empty string when the bot is opened from the side menu +//@theme Preferred Web App theme; pass null to use the default theme +//@application_name Short name of the current application; 0-64 English letters, digits, and underscores getWebAppUrl bot_user_id:int53 url:string theme:themeParameters application_name:string = HttpUrl; //@description Sends data received from a keyboardButtonTypeWebApp Web App to a bot @@ -8954,7 +9211,7 @@ sendWebAppData bot_user_id:int53 button_text:string data:string = Ok; //@bot_user_id Identifier of the bot, providing the Web App //@url The URL from an inlineKeyboardButtonTypeWebApp button, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an empty string otherwise //@theme Preferred Web App theme; pass null to use the default theme -//@application_name Short name of the application; 0-64 English letters, digits, and underscores +//@application_name Short name of the current application; 0-64 English letters, digits, and underscores //@message_thread_id If not 0, the message thread identifier in which the message will be sent //@reply_to Information about the message or story to be replied in the message sent by the Web App; pass null if none openWebApp chat_id:int53 bot_user_id:int53 url:string theme:themeParameters application_name:string message_thread_id:int53 reply_to:InputMessageReplyTo = WebAppInfo; @@ -8970,7 +9227,7 @@ answerWebAppQuery web_app_query_id:string result:InputInlineQueryResult = SentWe //@description Sends a callback query to a bot and returns an answer. Returns an error with code 502 if the bot fails to answer the query before the query timeout expires //@chat_id Identifier of the chat with the message -//@message_id Identifier of the message from which the query originated +//@message_id Identifier of the message from which the query originated. The message must not be scheduled //@payload Query payload getCallbackQueryAnswer chat_id:int53 message_id:int53 payload:CallbackQueryPayload = CallbackQueryAnswer; @@ -9057,7 +9314,7 @@ getInternalLink type:InternalLinkType is_http:Bool = HttpUrl; //@description Returns information about the type of internal link. Returns a 404 error if the link is not internal. Can be called before authorization @link The link getInternalLinkType link:string = InternalLinkType; -//@description Returns information about an action to be done when the current user clicks an external link. Don't use this method for links from secret chats if web page preview is disabled in secret chats @link The link +//@description Returns information about an action to be done when the current user clicks an external link. Don't use this method for links from secret chats if link preview is disabled in secret chats @link The link getExternalLinkInfo link:string = LoginUrlInfo; //@description Returns an HTTP URL which can be used to automatically authorize the current user on a website after clicking an HTTP link. Use the method getExternalLinkInfo to find whether a prior user confirmation is needed @@ -9303,7 +9560,7 @@ setChatLocation chat_id:int53 location:chatLocation = Ok; //@description Changes the slow mode delay of a chat. Available only for supergroups; requires can_restrict_members right @chat_id Chat identifier @slow_mode_delay New slow mode delay for the chat, in seconds; must be one of 0, 10, 30, 60, 300, 900, 3600 setChatSlowModeDelay chat_id:int53 slow_mode_delay:int32 = Ok; -//@description Pins a message in a chat; requires can_pin_messages member right if the chat is a basic group or supergroup, or can_edit_messages administrator right if the chat is a channel +//@description Pins a message in a chat. A message can be pinned only if messageProperties.can_be_pinned //@chat_id Identifier of the chat //@message_id Identifier of the new pinned message //@disable_notification Pass true to disable notification about the pinned message. Notifications are always disabled in channels and private chats @@ -9426,6 +9683,10 @@ setPinnedChats chat_list:ChatList chat_ids:vector = Ok; readChatList chat_list:ChatList = Ok; +//@description Returns the current weather in the given location @location The location +getCurrentWeather location:location = CurrentWeather; + + //@description Returns a story //@story_sender_chat_id Identifier of the chat that posted the story //@story_id Story identifier @@ -9435,17 +9696,18 @@ getStory story_sender_chat_id:int53 story_id:int32 only_local:Bool = Story; //@description Returns supergroup and channel chats in which the current user has the right to post stories. The chats must be rechecked with canSendStory before actually trying to post a story there getChatsToSendStories = Chats; -//@description Checks whether the current user can send a story on behalf of a chat; requires can_post_stories right for supergroup and channel chats @chat_id Chat identifier +//@description Checks whether the current user can send a story on behalf of a chat; requires can_post_stories right for supergroup and channel chats +//@chat_id Chat identifier. Pass Saved Messages chat identifier when posting a story on behalf of the current user canSendStory chat_id:int53 = CanSendStoryResult; //@description Sends a new story to a chat; requires can_post_stories right for supergroup and channel chats. Returns a temporary story -//@chat_id Identifier of the chat that will post the story +//@chat_id Identifier of the chat that will post the story. Pass Saved Messages chat identifier when posting a story on behalf of the current user //@content Content of the story //@areas Clickable rectangle areas to be shown on the story media; pass null if none //@caption Story caption; pass null to use an empty caption; 0-getOption("story_caption_length_max") characters; can have entities only if getOption("can_use_text_entities_in_story_caption") //@privacy_settings The privacy settings for the story; ignored for stories sent to supergroup and channel chats //@active_period Period after which the story is moved to archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400 for Telegram Premium users, and 86400 otherwise -//@from_story_full_id Full identifier of the original story, which content was used to create the story +//@from_story_full_id Full identifier of the original story, which content was used to create the story; pass null if the story isn't repost of another story //@is_posted_to_chat_page Pass true to keep the story accessible after expiration //@protect_content Pass true if the content of the story must be protected from forwarding and screenshotting sendStory chat_id:int53 content:InputStoryContent areas:inputStoryAreas caption:formattedText privacy_settings:StoryPrivacySettings active_period:int32 from_story_full_id:storyFullId is_posted_to_chat_page:Bool protect_content:Bool = Story; @@ -9458,6 +9720,12 @@ sendStory chat_id:int53 content:InputStoryContent areas:inputStoryAreas caption: //@caption New story caption; pass null to keep the current caption editStory story_sender_chat_id:int53 story_id:int32 content:InputStoryContent areas:inputStoryAreas caption:formattedText = Ok; +//@description Changes cover of a video story. Can be called only if story.can_be_edited == true and the story isn't being edited now +//@story_sender_chat_id Identifier of the chat that posted the story +//@story_id Identifier of the story to edit +//@cover_frame_timestamp New timestamp of the frame, which will be used as video thumbnail +editStoryCover story_sender_chat_id:int53 story_id:int32 cover_frame_timestamp:double = Ok; + //@description Changes privacy settings of a story. The method can be called only for stories posted on behalf of the current user and if story.can_be_edited == true //@story_id Identifier of the story //@privacy_settings The new privacy settigs for the story @@ -9489,7 +9757,7 @@ setChatActiveStoriesList chat_id:int53 story_list:StoryList = Ok; getChatActiveStories chat_id:int53 = ChatActiveStories; //@description Returns the list of stories that posted by the given chat to its chat page. If from_story_id == 0, then pinned stories are returned first. -//-Then, stories are returned in a reverse chronological order (i.e., in order of decreasing story_id). For optimal performance, the number of returned stories is chosen by TDLib +//-Then, stories are returned in reverse chronological order (i.e., in order of decreasing story_id). For optimal performance, the number of returned stories is chosen by TDLib //@chat_id Chat identifier //@from_story_id Identifier of the story starting from which stories must be returned; use 0 to get results from pinned and the newest story //@limit The maximum number of stories to be returned @@ -9497,7 +9765,7 @@ getChatActiveStories chat_id:int53 = ChatActiveStories; getChatPostedToChatPageStories chat_id:int53 from_story_id:int32 limit:int32 = Stories; //@description Returns the list of all stories posted by the given chat; requires can_edit_stories right in the chat. -//-The stories are returned in a reverse chronological order (i.e., in order of decreasing story_id). For optimal performance, the number of returned stories is chosen by TDLib +//-The stories are returned in reverse chronological order (i.e., in order of decreasing story_id). For optimal performance, the number of returned stories is chosen by TDLib //@chat_id Chat identifier //@from_story_id Identifier of the story starting from which stories must be returned; use 0 to get results from the last story //@limit The maximum number of stories to be returned @@ -10230,7 +10498,7 @@ removeRecentHashtag hashtag:string = Ok; //@description Returns a link preview by the text of a message. Do not call this function too often. Returns a 404 error if the text has no link preview //@text Message text with formatting //@link_preview_options Options to be used for generation of the link preview; pass null to use default link preview options -getWebPagePreview text:formattedText link_preview_options:linkPreviewOptions = WebPage; +getLinkPreview text:formattedText link_preview_options:linkPreviewOptions = LinkPreview; //@description Returns an instant view version of a web page if available. Returns a 404 error if the web page has no instant view page @url The web page URL @force_full Pass true to get full instant view for the web page getWebPageInstantView url:string force_full:Bool = WebPageInstantView; @@ -10412,6 +10680,41 @@ allowBotToSendMessages bot_user_id:int53 = Ok; sendWebAppCustomRequest bot_user_id:int53 method:string parameters:string = CustomRequestResult; +//@description Returns the list of media previews of a bot @bot_user_id Identifier of the target bot. The bot must have the main Web App +getBotMediaPreviews bot_user_id:int53 = BotMediaPreviews; + +//@description Returns the list of media previews for the given language and the list of languages for which the bot has dedicated previews +//@bot_user_id Identifier of the target bot. The bot must be owned and must have the main Web App +//@language_code A two-letter ISO 639-1 language code for which to get previews. If empty, then default previews are returned +getBotMediaPreviewInfo bot_user_id:int53 language_code:string = BotMediaPreviewInfo; + +//@description Adds a new media preview to the beginning of the list of media previews of a bot. Returns the added preview after addition is completed server-side. The total number of previews must not exceed getOption("bot_media_preview_count_max") for the given language +//@bot_user_id Identifier of the target bot. The bot must be owned and must have the main Web App +//@language_code A two-letter ISO 639-1 language code for which preview is added. If empty, then the preview will be shown to all users for whose languages there are no dedicated previews. +//-If non-empty, then there must be an official language pack of the same name, which is returned by getLocalizationTargetInfo +//@content Content of the added preview +addBotMediaPreview bot_user_id:int53 language_code:string content:InputStoryContent = BotMediaPreview; + +//@description Replaces media preview in the list of media previews of a bot. Returns the new preview after edit is completed server-side +//@bot_user_id Identifier of the target bot. The bot must be owned and must have the main Web App +//@language_code Language code of the media preview to edit +//@file_id File identifier of the media to replace +//@content Content of the new preview +editBotMediaPreview bot_user_id:int53 language_code:string file_id:int32 content:InputStoryContent = BotMediaPreview; + +//@description Changes order of media previews in the list of media previews of a bot +//@bot_user_id Identifier of the target bot. The bot must be owned and must have the main Web App +//@language_code Language code of the media previews to reorder +//@file_ids File identifiers of the media in the new order +reorderBotMediaPreviews bot_user_id:int53 language_code:string file_ids:vector = Ok; + +//@description Delete media previews from the list of media previews of a bot +//@bot_user_id Identifier of the target bot. The bot must be owned and must have the main Web App +//@language_code Language code of the media previews to delete +//@file_ids File identifiers of the media to delete +deleteBotMediaPreviews bot_user_id:int53 language_code:string file_ids:vector = Ok; + + //@description Sets the name of a bot. Can be called only if userTypeBot.can_be_edited == true //@bot_user_id Identifier of the target bot //@language_code A two-letter ISO 639-1 language code. If empty, the name will be shown to all users for whose languages there is no dedicated name @@ -10560,12 +10863,14 @@ toggleSupergroupIsForum supergroup_id:int53 is_forum:Bool = Ok; //@description Upgrades supergroup to a broadcast group; requires owner privileges in the supergroup @supergroup_id Identifier of the supergroup toggleSupergroupIsBroadcastGroup supergroup_id:int53 = Ok; -//@description Reports messages in a supergroup as spam; requires administrator rights in the supergroup @supergroup_id Supergroup identifier @message_ids Identifiers of messages to report +//@description Reports messages in a supergroup as spam; requires administrator rights in the supergroup +//@supergroup_id Supergroup identifier +//@message_ids Identifiers of messages to report. Use messageProperties.can_be_reported to check whether the message can be reported reportSupergroupSpam supergroup_id:int53 message_ids:vector = Ok; //@description Reports a false deletion of a message by aggressive anti-spam checks; requires administrator rights in the supergroup. Can be called only for messages from chatEventMessageDeleted with can_report_anti_spam_false_positive == true //@supergroup_id Supergroup identifier -//@message_id Identifier of the erroneously deleted message +//@message_id Identifier of the erroneously deleted message from chatEventMessageDeleted reportSupergroupAntiSpamFalsePositive supergroup_id:int53 message_id:int53 = Ok; //@description Returns information about members or banned users in a supergroup or channel. Can be used only if supergroupFullInfo.can_get_members == true; additionally, administrator privileges may be required for some filters @@ -10610,7 +10915,7 @@ validateOrderInfo input_invoice:InputInvoice order_info:orderInfo allow_save:Boo //@payment_form_id Payment form identifier returned by getPaymentForm //@order_info_id Identifier returned by validateOrderInfo, or an empty string //@shipping_option_id Identifier of a chosen shipping option, if applicable -//@credentials The credentials chosen by user for payment; pass null for a payment in Telegram stars +//@credentials The credentials chosen by user for payment; pass null for a payment in Telegram Stars //@tip_amount Chosen by the user amount of tip in the smallest units of the currency sendPaymentForm input_invoice:InputInvoice payment_form_id:int64 order_info_id:string shipping_option_id:string credentials:InputCredentials tip_amount:int53 = PaymentResult; @@ -10776,7 +11081,7 @@ removeChatActionBar chat_id:int53 = Ok; //@description Reports a chat to the Telegram moderators. A chat can be reported only from the chat action bar, or if chat.can_be_reported //@chat_id Chat identifier -//@message_ids Identifiers of reported messages; may be empty to report the whole chat +//@message_ids Identifiers of reported messages; may be empty to report the whole chat. Use messageProperties.can_be_reported to check whether the message can be reported //@reason The reason for reporting the chat //@text Additional report details; 0-1024 characters reportChat chat_id:int53 message_ids:vector reason:ReportReason text:string = Ok; @@ -10788,7 +11093,7 @@ reportChat chat_id:int53 message_ids:vector reason:ReportReason text:stri //@text Additional report details; 0-1024 characters reportChatPhoto chat_id:int53 file_id:int32 reason:ReportReason text:string = Ok; -//@description Reports reactions set on a message to the Telegram moderators. Reactions on a message can be reported only if message.can_report_reactions +//@description Reports reactions set on a message to the Telegram moderators. Reactions on a message can be reported only if messageProperties.can_report_reactions //@chat_id Chat identifier //@message_id Message identifier //@sender_id Identifier of the sender, which added the reaction @@ -10810,29 +11115,29 @@ getChatRevenueWithdrawalUrl chat_id:int53 password:string = HttpUrl; getChatRevenueTransactions chat_id:int53 offset:int32 limit:int32 = ChatRevenueTransactions; -//@description Returns detailed Telegram star revenue statistics -//@owner_id Identifier of the owner of the Telegram stars; can be identifier of an owned bot, or identifier of an owned channel chat +//@description Returns detailed Telegram Star revenue statistics +//@owner_id Identifier of the owner of the Telegram Stars; can be identifier of an owned bot, or identifier of a channel chat with supergroupFullInfo.can_get_star_revenue_statistics == true //@is_dark Pass true if a dark theme is used by the application getStarRevenueStatistics owner_id:MessageSender is_dark:Bool = StarRevenueStatistics; -//@description Returns a URL for Telegram star withdrawal -//@owner_id Identifier of the owner of the Telegram stars; can be identifier of an owned bot, or identifier of an owned channel chat -//@star_count The number of Telegram stars to withdraw. Must be at least getOption("star_withdrawal_count_min") +//@description Returns a URL for Telegram Star withdrawal +//@owner_id Identifier of the owner of the Telegram Stars; can be identifier of an owned bot, or identifier of an owned channel chat +//@star_count The number of Telegram Stars to withdraw. Must be at least getOption("star_withdrawal_count_min") //@password The 2-step verification password of the current user getStarWithdrawalUrl owner_id:MessageSender star_count:int53 password:string = HttpUrl; -//@description Returns a URL for a Telegram Ad platform account that can be used to set up advertisments for the chat paid in the owned Telegram stars -//@owner_id Identifier of the owner of the Telegram stars; can be identifier of an owned bot, or identifier of an owned channel chat +//@description Returns a URL for a Telegram Ad platform account that can be used to set up advertisements for the chat paid in the owned Telegram Stars +//@owner_id Identifier of the owner of the Telegram Stars; can be identifier of an owned bot, or identifier of an owned channel chat getStarAdAccountUrl owner_id:MessageSender = HttpUrl; //@description Returns detailed statistics about a chat. Currently, this method can be used only for supergroups and channels. Can be used only if supergroupFullInfo.can_get_statistics == true @chat_id Chat identifier @is_dark Pass true if a dark theme is used by the application getChatStatistics chat_id:int53 is_dark:Bool = ChatStatistics; -//@description Returns detailed statistics about a message. Can be used only if message.can_get_statistics == true @chat_id Chat identifier @message_id Message identifier @is_dark Pass true if a dark theme is used by the application +//@description Returns detailed statistics about a message. Can be used only if messageProperties.can_get_statistics == true @chat_id Chat identifier @message_id Message identifier @is_dark Pass true if a dark theme is used by the application getMessageStatistics chat_id:int53 message_id:int53 is_dark:Bool = MessageStatistics; -//@description Returns forwarded copies of a channel message to different public channels and public reposts as a story. Can be used only if message.can_get_statistics == true. For optimal performance, the number of returned messages and stories is chosen by TDLib +//@description Returns forwarded copies of a channel message to different public channels and public reposts as a story. Can be used only if messageProperties.can_get_statistics == true. For optimal performance, the number of returned messages and stories is chosen by TDLib //@chat_id Chat identifier of the message //@message_id Message identifier //@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results @@ -11089,12 +11394,15 @@ launchPrepaidPremiumGiveaway giveaway_id:int64 parameters:premiumGiveawayParamet //@message_id Identifier of the giveaway or a giveaway winners message in the chat getPremiumGiveawayInfo chat_id:int53 message_id:int53 = PremiumGiveawayInfo; -//@description Returns available options for Telegram stars purchase +//@description Returns available options for Telegram Stars purchase getStarPaymentOptions = StarPaymentOptions; -//@description Returns the list of Telegram star transactions for the specified owner -//@owner_id Identifier of the owner of the Telegram stars; can be the identifier of the current user, identifier of an owned bot, -//-or identifier of a channel chat with supergroupFullInfo.can_get_revenue_statistics == true +//@description Returns available options for Telegram Stars gifting @user_id Identifier of the user that will receive Telegram Stars; pass 0 to get options for an unspecified user +getStarGiftPaymentOptions user_id:int53 = StarPaymentOptions; + +//@description Returns the list of Telegram Star transactions for the specified owner +//@owner_id Identifier of the owner of the Telegram Stars; can be the identifier of the current user, identifier of an owned bot, +//-or identifier of a channel chat with supergroupFullInfo.can_get_star_revenue_statistics == true //@direction Direction of the transactions to receive; pass null to get all transactions //@offset Offset of the first transaction to return as received from the previous request; use empty string to get the first chunk of results //@limit The maximum number of transactions to return From 4b5b0a30a0bff0da26ee107f9a3cdbb13b27c8e4 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Wed, 14 Aug 2024 22:18:40 +0800 Subject: [PATCH 23/54] Update to TDLib 1.8.35 --- client/function.go | 296 +++++++++++++++-- client/type.go | 718 ++++++++++++++++++++++++++++++++++++++++-- client/unmarshaler.go | 279 ++++++++++++++++ data/td_api.tl | 252 +++++++++++---- 4 files changed, 1432 insertions(+), 113 deletions(-) diff --git a/client/function.go b/client/function.go index ea870e2..54cfddc 100755 --- a/client/function.go +++ b/client/function.go @@ -3173,25 +3173,6 @@ func (client *Client) SearchChatRecentLocationMessages(req *SearchChatRecentLoca return UnmarshalMessages(result.Data) } -// Returns all active live locations that need to be updated by the application. The list is persistent across application restarts only if the message database is used -func (client *Client) GetActiveLiveLocationMessages() (*Messages, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "getActiveLiveLocationMessages", - }, - Data: map[string]interface{}{}, - }) - if err != nil { - return nil, err - } - - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } - - return UnmarshalMessages(result.Data) -} - type GetChatMessageByDateRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -5850,7 +5831,7 @@ type AddMessageReactionRequest struct { ChatId int64 `json:"chat_id"` // Identifier of the message MessageId int64 `json:"message_id"` - // Type of the reaction to add + // Type of the reaction to add. Use addPaidMessageReaction instead to add the paid reaction ReactionType ReactionType `json:"reaction_type"` // Pass true if the reaction is added with a big animation IsBig bool `json:"is_big"` @@ -5888,7 +5869,7 @@ type RemoveMessageReactionRequest struct { ChatId int64 `json:"chat_id"` // Identifier of the message MessageId int64 `json:"message_id"` - // Type of the reaction to remove + // Type of the reaction to remove. The paid reaction can't be removed ReactionType ReactionType `json:"reaction_type"` } @@ -5915,6 +5896,102 @@ func (client *Client) RemoveMessageReaction(req *RemoveMessageReactionRequest) ( return UnmarshalOk(result.Data) } +type AddPaidMessageReactionRequest struct { + // Identifier of the chat to which the message belongs + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` + // Number of Telegram Stars to be used for the reaction; 1-getOption("paid_reaction_star_count_max") + StarCount int64 `json:"star_count"` + // Pass true to make paid reaction of the user on the message anonymous; pass false to make the user's profile visible among top reactors + IsAnonymous bool `json:"is_anonymous"` +} + +// Adds the paid message reaction to a message. Use getMessageAvailableReactions to receive the list of available reactions for the message +func (client *Client) AddPaidMessageReaction(req *AddPaidMessageReactionRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addPaidMessageReaction", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "star_count": req.StarCount, + "is_anonymous": req.IsAnonymous, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type RemovePendingPaidMessageReactionsRequest struct { + // Identifier of the chat to which the message belongs + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` +} + +// Removes all pending paid reactions on a message. Can be called within 5 seconds after the last addPaidMessageReaction call +func (client *Client) RemovePendingPaidMessageReactions(req *RemovePendingPaidMessageReactionsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removePendingPaidMessageReactions", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type TogglePaidMessageReactionIsAnonymousRequest struct { + // Identifier of the chat to which the message belongs + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` + // Pass true to make paid reaction of the user on the message anonymous; pass false to make the user's profile visible among top reactors + IsAnonymous bool `json:"is_anonymous"` +} + +// Changes whether the paid message reaction of the user to a message is anonymous. The message must have paid reaction added by the user +func (client *Client) TogglePaidMessageReactionIsAnonymous(req *TogglePaidMessageReactionIsAnonymousRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "togglePaidMessageReactionIsAnonymous", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "is_anonymous": req.IsAnonymous, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type SetMessageReactionsRequest struct { // Identifier of the chat to which the message belongs ChatId int64 `json:"chat_id"` @@ -5953,9 +6030,9 @@ func (client *Client) SetMessageReactions(req *SetMessageReactionsRequest) (*Ok, type GetMessageAddedReactionsRequest struct { // Identifier of the chat to which the message belongs ChatId int64 `json:"chat_id"` - // Identifier of the message. Use messageProperties.can_get_added_reactions to check whether added reactions can be received for the message + // Identifier of the message. Use message.interaction_info.reactions.can_get_added_reactions to check whether added reactions can be received for the message MessageId int64 `json:"message_id"` - // Type of the reactions to return; pass null to return all added reactions + // Type of the reactions to return; pass null to return all added reactions; reactionTypePaid isn't supported ReactionType ReactionType `json:"reaction_type"` // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results Offset string `json:"offset"` @@ -5989,7 +6066,7 @@ func (client *Client) GetMessageAddedReactions(req *GetMessageAddedReactionsRequ } type SetDefaultReactionTypeRequest struct { - // New type of the default reaction + // New type of the default reaction. The paid reaction can't be set as default ReactionType ReactionType `json:"reaction_type"` } @@ -7816,6 +7893,9 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeBusinessChat: return UnmarshalInternalLinkTypeBusinessChat(result.Data) + case TypeInternalLinkTypeBuyStars: + return UnmarshalInternalLinkTypeBuyStars(result.Data) + case TypeInternalLinkTypeChangePhoneNumber: return UnmarshalInternalLinkTypeChangePhoneNumber(result.Data) @@ -11064,7 +11144,7 @@ type SetStoryReactionRequest struct { StorySenderChatId int64 `json:"story_sender_chat_id"` // The identifier of the story StoryId int32 `json:"story_id"` - // Type of the reaction to set; pass null to remove the reaction. `reactionTypeCustomEmoji` reactions can be used only by Telegram Premium users + // Type of the reaction to set; pass null to remove the reaction. Custom emoji reactions can be used only by Telegram Premium users. Paid reactions can't be set ReactionType ReactionType `json:"reaction_type"` // Pass true if the reaction needs to be added to recent reactions UpdateRecentReactions bool `json:"update_recent_reactions"` @@ -11143,7 +11223,7 @@ type GetChatStoryInteractionsRequest struct { StorySenderChatId int64 `json:"story_sender_chat_id"` // Story identifier StoryId int32 `json:"story_id"` - // Pass the default heart reaction or a suggested reaction type to receive only interactions with the specified reaction type; pass null to receive all interactions + // Pass the default heart reaction or a suggested reaction type to receive only interactions with the specified reaction type; pass null to receive all interactions; reactionTypePaid isn't supported ReactionType ReactionType `json:"reaction_type"` // Pass true to get forwards and reposts first, then reactions, then other views; pass false to get interactions sorted just by interaction date PreferForwards bool `json:"prefer_forwards"` @@ -12416,6 +12496,38 @@ func (client *Client) CreateChatInviteLink(req *CreateChatInviteLinkRequest) (*C return UnmarshalChatInviteLink(result.Data) } +type CreateChatSubscriptionInviteLinkRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Invite link name; 0-32 characters + Name string `json:"name"` + // Information about subscription plan that will be applied to the users joining the chat via the link. Subscription period must be 2592000 in production environment, and 60 or 300 if Telegram test environment is used + SubscriptionPricing *StarSubscriptionPricing `json:"subscription_pricing"` +} + +// Creates a new subscription invite link for a channel chat. Requires can_invite_users right in the chat +func (client *Client) CreateChatSubscriptionInviteLink(req *CreateChatSubscriptionInviteLinkRequest) (*ChatInviteLink, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "createChatSubscriptionInviteLink", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "name": req.Name, + "subscription_pricing": req.SubscriptionPricing, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatInviteLink(result.Data) +} + type EditChatInviteLinkRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -12431,7 +12543,7 @@ type EditChatInviteLinkRequest struct { CreatesJoinRequest bool `json:"creates_join_request"` } -// Edits a non-primary invite link for a chat. Available for basic groups, supergroups, and channels. Requires administrator privileges and can_invite_users right in the chat for own links and owner privileges for other links +// Edits a non-primary invite link for a chat. Available for basic groups, supergroups, and channels. If the link creates a subscription, then expiration_date, member_limit and creates_join_request must not be used Requires administrator privileges and can_invite_users right in the chat for own links and owner privileges for other links func (client *Client) EditChatInviteLink(req *EditChatInviteLinkRequest) (*ChatInviteLink, error) { result, err := client.Send(Request{ meta: meta{ @@ -12457,6 +12569,38 @@ func (client *Client) EditChatInviteLink(req *EditChatInviteLinkRequest) (*ChatI return UnmarshalChatInviteLink(result.Data) } +type EditChatSubscriptionInviteLinkRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Invite link to be edited + InviteLink string `json:"invite_link"` + // Invite link name; 0-32 characters + Name string `json:"name"` +} + +// Edits a subscription invite link for a channel chat. Requires can_invite_users right in the chat for own links and owner privileges for other links +func (client *Client) EditChatSubscriptionInviteLink(req *EditChatSubscriptionInviteLinkRequest) (*ChatInviteLink, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editChatSubscriptionInviteLink", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "invite_link": req.InviteLink, + "name": req.Name, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatInviteLink(result.Data) +} + type GetChatInviteLinkRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -12558,6 +12702,8 @@ type GetChatInviteLinkMembersRequest struct { ChatId int64 `json:"chat_id"` // Invite link for which to return chat members InviteLink string `json:"invite_link"` + // Pass true if the link is a subscription link and only members with expired subscription must be returned + OnlyWithExpiredSubscription bool `json:"only_with_expired_subscription"` // A chat member from which to return next chat members; pass null to get results from the beginning OffsetMember *ChatInviteLinkMember `json:"offset_member"` // The maximum number of chat members to return; up to 100 @@ -12573,6 +12719,7 @@ func (client *Client) GetChatInviteLinkMembers(req *GetChatInviteLinkMembersRequ Data: map[string]interface{}{ "chat_id": req.ChatId, "invite_link": req.InviteLink, + "only_with_expired_subscription": req.OnlyWithExpiredSubscription, "offset_member": req.OffsetMember, "limit": req.Limit, }, @@ -17637,9 +17784,11 @@ type ToggleSupergroupSignMessagesRequest struct { SupergroupId int64 `json:"supergroup_id"` // New value of sign_messages SignMessages bool `json:"sign_messages"` + // New value of show_message_sender + ShowMessageSender bool `json:"show_message_sender"` } -// Toggles whether sender signature is added to sent messages in a channel; requires can_change_info member right +// Toggles whether sender signature or link to the account is added to sent messages in a channel; requires can_change_info member right func (client *Client) ToggleSupergroupSignMessages(req *ToggleSupergroupSignMessagesRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -17648,6 +17797,7 @@ func (client *Client) ToggleSupergroupSignMessages(req *ToggleSupergroupSignMess Data: map[string]interface{}{ "supergroup_id": req.SupergroupId, "sign_messages": req.SignMessages, + "show_message_sender": req.ShowMessageSender, }, }) if err != nil { @@ -21396,6 +21546,8 @@ func (client *Client) GetStarGiftPaymentOptions(req *GetStarGiftPaymentOptionsRe type GetStarTransactionsRequest struct { // Identifier of the owner of the Telegram Stars; can be the identifier of the current user, identifier of an owned bot, or identifier of a channel chat with supergroupFullInfo.can_get_star_revenue_statistics == true OwnerId MessageSender `json:"owner_id"` + // If non-empty, only transactions related to the Star Subscription will be returned + SubscriptionId string `json:"subscription_id"` // Direction of the transactions to receive; pass null to get all transactions Direction StarTransactionDirection `json:"direction"` // Offset of the first transaction to return as received from the previous request; use empty string to get the first chunk of results @@ -21412,6 +21564,7 @@ func (client *Client) GetStarTransactions(req *GetStarTransactionsRequest) (*Sta }, Data: map[string]interface{}{ "owner_id": req.OwnerId, + "subscription_id": req.SubscriptionId, "direction": req.Direction, "offset": req.Offset, "limit": req.Limit, @@ -21428,6 +21581,35 @@ func (client *Client) GetStarTransactions(req *GetStarTransactionsRequest) (*Sta return UnmarshalStarTransactions(result.Data) } +type GetStarSubscriptionsRequest struct { + // Pass true to receive only expiring subscriptions for which there are no enough Telegram Stars to extend + OnlyExpiring bool `json:"only_expiring"` + // Offset of the first subscription to return as received from the previous request; use empty string to get the first chunk of results + Offset string `json:"offset"` +} + +// Returns the list of Telegram Star subscriptions for the current user +func (client *Client) GetStarSubscriptions(req *GetStarSubscriptionsRequest) (*StarSubscriptions, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getStarSubscriptions", + }, + Data: map[string]interface{}{ + "only_expiring": req.OnlyExpiring, + "offset": req.Offset, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStarSubscriptions(result.Data) +} + type CanPurchaseFromStoreRequest struct { // Transaction purpose Purpose StorePaymentPurpose `json:"purpose"` @@ -21518,6 +21700,61 @@ func (client *Client) AssignGooglePlayTransaction(req *AssignGooglePlayTransacti return UnmarshalOk(result.Data) } +type EditStarSubscriptionRequest struct { + // Identifier of the subscription to change + SubscriptionId string `json:"subscription_id"` + // New value of is_canceled + IsCanceled bool `json:"is_canceled"` +} + +// Cancels or reenables Telegram Star subscription to a channel +func (client *Client) EditStarSubscription(req *EditStarSubscriptionRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editStarSubscription", + }, + Data: map[string]interface{}{ + "subscription_id": req.SubscriptionId, + "is_canceled": req.IsCanceled, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ReuseStarSubscriptionRequest struct { + // Identifier of the subscription + SubscriptionId string `json:"subscription_id"` +} + +// Reuses an active subscription and joins the subscribed chat again +func (client *Client) ReuseStarSubscription(req *ReuseStarSubscriptionRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reuseStarSubscription", + }, + Data: map[string]interface{}{ + "subscription_id": req.SubscriptionId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type GetBusinessFeaturesRequest struct { // Source of the request; pass null if the method is called from settings or some non-standard source Source BusinessFeature `json:"source"` @@ -23117,6 +23354,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateSavedMessagesTags: return UnmarshalUpdateSavedMessagesTags(result.Data) + case TypeUpdateActiveLiveLocationMessages: + return UnmarshalUpdateActiveLiveLocationMessages(result.Data) + case TypeUpdateOwnedStarCount: return UnmarshalUpdateOwnedStarCount(result.Data) diff --git a/client/type.go b/client/type.go index 23751f9..68e1553 100755 --- a/client/type.go +++ b/client/type.go @@ -24,6 +24,8 @@ const ( ClassChatPhotoStickerType = "ChatPhotoStickerType" ClassInputChatPhoto = "InputChatPhoto" ClassStarTransactionDirection = "StarTransactionDirection" + ClassBotTransactionPurpose = "BotTransactionPurpose" + ClassChannelTransactionPurpose = "ChannelTransactionPurpose" ClassStarTransactionPartner = "StarTransactionPartner" ClassPremiumGiveawayParticipantStatus = "PremiumGiveawayParticipantStatus" ClassPremiumGiveawayInfo = "PremiumGiveawayInfo" @@ -227,6 +229,9 @@ const ( ClassChatPhotos = "ChatPhotos" ClassChatPermissions = "ChatPermissions" ClassChatAdministratorRights = "ChatAdministratorRights" + ClassStarSubscriptionPricing = "StarSubscriptionPricing" + ClassStarSubscription = "StarSubscription" + ClassStarSubscriptions = "StarSubscriptions" ClassProductInfo = "ProductInfo" ClassPremiumPaymentOption = "PremiumPaymentOption" ClassPremiumStatePaymentOption = "PremiumStatePaymentOption" @@ -258,6 +263,7 @@ const ( ClassChatInviteLinkCounts = "ChatInviteLinkCounts" ClassChatInviteLinkMember = "ChatInviteLinkMember" ClassChatInviteLinkMembers = "ChatInviteLinkMembers" + ClassChatInviteLinkSubscriptionInfo = "ChatInviteLinkSubscriptionInfo" ClassChatInviteLinkInfo = "ChatInviteLinkInfo" ClassChatJoinRequest = "ChatJoinRequest" ClassChatJoinRequests = "ChatJoinRequests" @@ -273,6 +279,7 @@ const ( ClassMessageViewer = "MessageViewer" ClassMessageViewers = "MessageViewers" ClassForwardSource = "ForwardSource" + ClassPaidReactor = "PaidReactor" ClassMessageForwardInfo = "MessageForwardInfo" ClassMessageImportInfo = "MessageImportInfo" ClassMessageReplyInfo = "MessageReplyInfo" @@ -687,6 +694,9 @@ const ( TypeInputChatPhotoSticker = "inputChatPhotoSticker" TypeChatPermissions = "chatPermissions" TypeChatAdministratorRights = "chatAdministratorRights" + TypeStarSubscriptionPricing = "starSubscriptionPricing" + TypeStarSubscription = "starSubscription" + TypeStarSubscriptions = "starSubscriptions" TypeProductInfo = "productInfo" TypePremiumPaymentOption = "premiumPaymentOption" TypePremiumStatePaymentOption = "premiumStatePaymentOption" @@ -697,12 +707,18 @@ const ( TypeStarPaymentOptions = "starPaymentOptions" TypeStarTransactionDirectionIncoming = "starTransactionDirectionIncoming" TypeStarTransactionDirectionOutgoing = "starTransactionDirectionOutgoing" + TypeBotTransactionPurposePaidMedia = "botTransactionPurposePaidMedia" + TypeBotTransactionPurposeInvoicePayment = "botTransactionPurposeInvoicePayment" + TypeChannelTransactionPurposePaidMedia = "channelTransactionPurposePaidMedia" + TypeChannelTransactionPurposeJoin = "channelTransactionPurposeJoin" + TypeChannelTransactionPurposeReaction = "channelTransactionPurposeReaction" TypeStarTransactionPartnerTelegram = "starTransactionPartnerTelegram" TypeStarTransactionPartnerAppStore = "starTransactionPartnerAppStore" TypeStarTransactionPartnerGooglePlay = "starTransactionPartnerGooglePlay" TypeStarTransactionPartnerFragment = "starTransactionPartnerFragment" TypeStarTransactionPartnerTelegramAds = "starTransactionPartnerTelegramAds" TypeStarTransactionPartnerBot = "starTransactionPartnerBot" + TypeStarTransactionPartnerBusiness = "starTransactionPartnerBusiness" TypeStarTransactionPartnerChannel = "starTransactionPartnerChannel" TypeStarTransactionPartnerUser = "starTransactionPartnerUser" TypeStarTransactionPartnerUnsupported = "starTransactionPartnerUnsupported" @@ -760,6 +776,7 @@ const ( TypeInviteLinkChatTypeBasicGroup = "inviteLinkChatTypeBasicGroup" TypeInviteLinkChatTypeSupergroup = "inviteLinkChatTypeSupergroup" TypeInviteLinkChatTypeChannel = "inviteLinkChatTypeChannel" + TypeChatInviteLinkSubscriptionInfo = "chatInviteLinkSubscriptionInfo" TypeChatInviteLinkInfo = "chatInviteLinkInfo" TypeChatJoinRequest = "chatJoinRequest" TypeChatJoinRequests = "chatJoinRequests" @@ -791,6 +808,8 @@ const ( TypeForwardSource = "forwardSource" TypeReactionTypeEmoji = "reactionTypeEmoji" TypeReactionTypeCustomEmoji = "reactionTypeCustomEmoji" + TypeReactionTypePaid = "reactionTypePaid" + TypePaidReactor = "paidReactor" TypeMessageForwardInfo = "messageForwardInfo" TypeMessageImportInfo = "messageImportInfo" TypeMessageReplyInfo = "messageReplyInfo" @@ -1512,6 +1531,7 @@ const ( TypeChatEventIsAllHistoryAvailableToggled = "chatEventIsAllHistoryAvailableToggled" TypeChatEventHasAggressiveAntiSpamEnabledToggled = "chatEventHasAggressiveAntiSpamEnabledToggled" TypeChatEventSignMessagesToggled = "chatEventSignMessagesToggled" + TypeChatEventShowMessageSenderToggled = "chatEventShowMessageSenderToggled" TypeChatEventInviteLinkEdited = "chatEventInviteLinkEdited" TypeChatEventInviteLinkRevoked = "chatEventInviteLinkRevoked" TypeChatEventInviteLinkDeleted = "chatEventInviteLinkDeleted" @@ -1620,6 +1640,7 @@ const ( TypeTelegramPaymentPurposePremiumGiveaway = "telegramPaymentPurposePremiumGiveaway" TypeTelegramPaymentPurposeStars = "telegramPaymentPurposeStars" TypeTelegramPaymentPurposeGiftedStars = "telegramPaymentPurposeGiftedStars" + TypeTelegramPaymentPurposeJoinChat = "telegramPaymentPurposeJoinChat" TypeDeviceTokenFirebaseCloudMessaging = "deviceTokenFirebaseCloudMessaging" TypeDeviceTokenApplePush = "deviceTokenApplePush" TypeDeviceTokenApplePushVoIP = "deviceTokenApplePushVoIP" @@ -1805,6 +1826,7 @@ const ( TypeInternalLinkTypeBotStart = "internalLinkTypeBotStart" TypeInternalLinkTypeBotStartInGroup = "internalLinkTypeBotStartInGroup" TypeInternalLinkTypeBusinessChat = "internalLinkTypeBusinessChat" + TypeInternalLinkTypeBuyStars = "internalLinkTypeBuyStars" TypeInternalLinkTypeChangePhoneNumber = "internalLinkTypeChangePhoneNumber" TypeInternalLinkTypeChatBoost = "internalLinkTypeChatBoost" TypeInternalLinkTypeChatFolderInvite = "internalLinkTypeChatFolderInvite" @@ -1922,6 +1944,7 @@ const ( TypeSuggestedActionGiftPremiumForChristmas = "suggestedActionGiftPremiumForChristmas" TypeSuggestedActionSetBirthdate = "suggestedActionSetBirthdate" TypeSuggestedActionExtendPremium = "suggestedActionExtendPremium" + TypeSuggestedActionExtendStarSubscriptions = "suggestedActionExtendStarSubscriptions" TypeCount = "count" TypeText = "text" TypeSeconds = "seconds" @@ -2093,6 +2116,7 @@ const ( TypeUpdateAvailableMessageEffects = "updateAvailableMessageEffects" TypeUpdateDefaultReactionType = "updateDefaultReactionType" TypeUpdateSavedMessagesTags = "updateSavedMessagesTags" + TypeUpdateActiveLiveLocationMessages = "updateActiveLiveLocationMessages" TypeUpdateOwnedStarCount = "updateOwnedStarCount" TypeUpdateChatRevenueAmount = "updateChatRevenueAmount" TypeUpdateStarRevenueStatus = "updateStarRevenueStatus" @@ -2225,6 +2249,16 @@ type StarTransactionDirection interface { StarTransactionDirectionType() string } +// Describes purpose of a transaction with a bot +type BotTransactionPurpose interface { + BotTransactionPurposeType() string +} + +// Describes purpose of a transaction with a channel +type ChannelTransactionPurpose interface { + ChannelTransactionPurposeType() string +} + // Describes source or recipient of a transaction with Telegram Stars type StarTransactionPartner interface { StarTransactionPartnerType() string @@ -7122,6 +7156,97 @@ func (*ChatAdministratorRights) GetType() string { return TypeChatAdministratorRights } +// Describes subscription plan paid in Telegram Stars +type StarSubscriptionPricing struct { + meta + // The number of seconds between consecutive Telegram Star debiting + Period int32 `json:"period"` + // The amount of Telegram Stars that must be paid for each period + StarCount int64 `json:"star_count"` +} + +func (entity *StarSubscriptionPricing) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarSubscriptionPricing + + return json.Marshal((*stub)(entity)) +} + +func (*StarSubscriptionPricing) GetClass() string { + return ClassStarSubscriptionPricing +} + +func (*StarSubscriptionPricing) GetType() string { + return TypeStarSubscriptionPricing +} + +// Contains information about subscription to a channel chat paid in Telegram Stars +type StarSubscription struct { + meta + // Unique identifier of the subscription + Id string `json:"id"` + // Identifier of the channel chat that is subscribed + ChatId int64 `json:"chat_id"` + // Point in time (Unix timestamp) when the subscription will expire or expired + ExpirationDate int32 `json:"expiration_date"` + // True, if the subscription is active and the user can use the method reuseStarSubscription to join the subscribed chat again + CanReuse bool `json:"can_reuse"` + // True, if the subscription was canceled + IsCanceled bool `json:"is_canceled"` + // True, if the subscription expires soon and there are no enough Telegram Stars on the user's balance to extend it + IsExpiring bool `json:"is_expiring"` + // The invite link that can be used to renew the subscription if it has been expired; may be empty, if the link isn't available anymore + InviteLink string `json:"invite_link"` + // The subscription plan + Pricing *StarSubscriptionPricing `json:"pricing"` +} + +func (entity *StarSubscription) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarSubscription + + return json.Marshal((*stub)(entity)) +} + +func (*StarSubscription) GetClass() string { + return ClassStarSubscription +} + +func (*StarSubscription) GetType() string { + return TypeStarSubscription +} + +// Represents a list of Telegram Star subscriptions +type StarSubscriptions struct { + meta + // The amount of owned Telegram Stars + StarCount int64 `json:"star_count"` + // List of subbscriptions for Telegram Stars + Subscriptions []*StarSubscription `json:"subscriptions"` + // The number of Telegram Stars required to buy to extend subscriptions expiring soon + RequiredStarCount int64 `json:"required_star_count"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` +} + +func (entity *StarSubscriptions) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarSubscriptions + + return json.Marshal((*stub)(entity)) +} + +func (*StarSubscriptions) GetClass() string { + return ClassStarSubscriptions +} + +func (*StarSubscriptions) GetType() string { + return TypeStarSubscriptions +} + // Contains information about a product that can be paid with invoice type ProductInfo struct { meta @@ -7462,6 +7587,180 @@ func (*StarTransactionDirectionOutgoing) StarTransactionDirectionType() string { return TypeStarTransactionDirectionOutgoing } +// Paid media were bought +type BotTransactionPurposePaidMedia struct { + meta + // The bought media if the trancastion wasn't refunded + Media []PaidMedia `json:"media"` +} + +func (entity *BotTransactionPurposePaidMedia) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BotTransactionPurposePaidMedia + + return json.Marshal((*stub)(entity)) +} + +func (*BotTransactionPurposePaidMedia) GetClass() string { + return ClassBotTransactionPurpose +} + +func (*BotTransactionPurposePaidMedia) GetType() string { + return TypeBotTransactionPurposePaidMedia +} + +func (*BotTransactionPurposePaidMedia) BotTransactionPurposeType() string { + return TypeBotTransactionPurposePaidMedia +} + +func (botTransactionPurposePaidMedia *BotTransactionPurposePaidMedia) UnmarshalJSON(data []byte) error { + var tmp struct { + Media []json.RawMessage `json:"media"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldMedia, _ := UnmarshalListOfPaidMedia(tmp.Media) + botTransactionPurposePaidMedia.Media = fieldMedia + + return nil +} + +// User bought a product from the bot +type BotTransactionPurposeInvoicePayment struct { + meta + // Information about the bought product; may be null if not applicable + ProductInfo *ProductInfo `json:"product_info"` + // Invoice payload; for bots only + InvoicePayload []byte `json:"invoice_payload"` +} + +func (entity *BotTransactionPurposeInvoicePayment) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BotTransactionPurposeInvoicePayment + + return json.Marshal((*stub)(entity)) +} + +func (*BotTransactionPurposeInvoicePayment) GetClass() string { + return ClassBotTransactionPurpose +} + +func (*BotTransactionPurposeInvoicePayment) GetType() string { + return TypeBotTransactionPurposeInvoicePayment +} + +func (*BotTransactionPurposeInvoicePayment) BotTransactionPurposeType() string { + return TypeBotTransactionPurposeInvoicePayment +} + +// Paid media were bought +type ChannelTransactionPurposePaidMedia struct { + meta + // Identifier of the corresponding message with paid media; can be an identifier of a deleted message + MessageId int64 `json:"message_id"` + // The bought media if the trancastion wasn't refunded + Media []PaidMedia `json:"media"` +} + +func (entity *ChannelTransactionPurposePaidMedia) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChannelTransactionPurposePaidMedia + + return json.Marshal((*stub)(entity)) +} + +func (*ChannelTransactionPurposePaidMedia) GetClass() string { + return ClassChannelTransactionPurpose +} + +func (*ChannelTransactionPurposePaidMedia) GetType() string { + return TypeChannelTransactionPurposePaidMedia +} + +func (*ChannelTransactionPurposePaidMedia) ChannelTransactionPurposeType() string { + return TypeChannelTransactionPurposePaidMedia +} + +func (channelTransactionPurposePaidMedia *ChannelTransactionPurposePaidMedia) UnmarshalJSON(data []byte) error { + var tmp struct { + MessageId int64 `json:"message_id"` + Media []json.RawMessage `json:"media"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + channelTransactionPurposePaidMedia.MessageId = tmp.MessageId + + fieldMedia, _ := UnmarshalListOfPaidMedia(tmp.Media) + channelTransactionPurposePaidMedia.Media = fieldMedia + + return nil +} + +// User joined the channel and subscribed to regular payments in Telegram Stars +type ChannelTransactionPurposeJoin struct { + meta + // The number of seconds between consecutive Telegram Star debiting + Period int32 `json:"period"` +} + +func (entity *ChannelTransactionPurposeJoin) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChannelTransactionPurposeJoin + + return json.Marshal((*stub)(entity)) +} + +func (*ChannelTransactionPurposeJoin) GetClass() string { + return ClassChannelTransactionPurpose +} + +func (*ChannelTransactionPurposeJoin) GetType() string { + return TypeChannelTransactionPurposeJoin +} + +func (*ChannelTransactionPurposeJoin) ChannelTransactionPurposeType() string { + return TypeChannelTransactionPurposeJoin +} + +// User paid for a reaction +type ChannelTransactionPurposeReaction struct { + meta + // Identifier of the reacted message; can be an identifier of a deleted message + MessageId int64 `json:"message_id"` +} + +func (entity *ChannelTransactionPurposeReaction) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChannelTransactionPurposeReaction + + return json.Marshal((*stub)(entity)) +} + +func (*ChannelTransactionPurposeReaction) GetClass() string { + return ClassChannelTransactionPurpose +} + +func (*ChannelTransactionPurposeReaction) GetType() string { + return TypeChannelTransactionPurposeReaction +} + +func (*ChannelTransactionPurposeReaction) ChannelTransactionPurposeType() string { + return TypeChannelTransactionPurposeReaction +} + // The transaction is a transaction with Telegram through a bot type StarTransactionPartnerTelegram struct{ meta @@ -7608,12 +7907,10 @@ func (*StarTransactionPartnerTelegramAds) StarTransactionPartnerType() string { // The transaction is a transaction with a bot type StarTransactionPartnerBot struct { meta - // Identifier of the bot for the user, or the user for the bot + // Identifier of the bot UserId int64 `json:"user_id"` - // Information about the bought product; may be null if not applicable - ProductInfo *ProductInfo `json:"product_info"` - // Invoice payload; for bots only - InvoicePayload []byte `json:"invoice_payload"` + // Purpose of the transaction + Purpose BotTransactionPurpose `json:"purpose"` } func (entity *StarTransactionPartnerBot) MarshalJSON() ([]byte, error) { @@ -7636,15 +7933,80 @@ func (*StarTransactionPartnerBot) StarTransactionPartnerType() string { return TypeStarTransactionPartnerBot } +func (starTransactionPartnerBot *StarTransactionPartnerBot) UnmarshalJSON(data []byte) error { + var tmp struct { + UserId int64 `json:"user_id"` + Purpose json.RawMessage `json:"purpose"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + starTransactionPartnerBot.UserId = tmp.UserId + + fieldPurpose, _ := UnmarshalBotTransactionPurpose(tmp.Purpose) + starTransactionPartnerBot.Purpose = fieldPurpose + + return nil +} + +// The transaction is a transaction with a business account +type StarTransactionPartnerBusiness struct { + meta + // Identifier of the business account user + UserId int64 `json:"user_id"` + // The bought media if the trancastion wasn't refunded + Media []PaidMedia `json:"media"` +} + +func (entity *StarTransactionPartnerBusiness) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionPartnerBusiness + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionPartnerBusiness) GetClass() string { + return ClassStarTransactionPartner +} + +func (*StarTransactionPartnerBusiness) GetType() string { + return TypeStarTransactionPartnerBusiness +} + +func (*StarTransactionPartnerBusiness) StarTransactionPartnerType() string { + return TypeStarTransactionPartnerBusiness +} + +func (starTransactionPartnerBusiness *StarTransactionPartnerBusiness) UnmarshalJSON(data []byte) error { + var tmp struct { + UserId int64 `json:"user_id"` + Media []json.RawMessage `json:"media"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + starTransactionPartnerBusiness.UserId = tmp.UserId + + fieldMedia, _ := UnmarshalListOfPaidMedia(tmp.Media) + starTransactionPartnerBusiness.Media = fieldMedia + + return nil +} + // The transaction is a transaction with a channel chat type StarTransactionPartnerChannel struct { meta // Identifier of the chat ChatId int64 `json:"chat_id"` - // Identifier of the corresponding message with paid media; can be an identifier of a deleted message - PaidMediaMessageId int64 `json:"paid_media_message_id"` - // Information about the bought media - Media []PaidMedia `json:"media"` + // Purpose of the transaction + Purpose ChannelTransactionPurpose `json:"purpose"` } func (entity *StarTransactionPartnerChannel) MarshalJSON() ([]byte, error) { @@ -7670,8 +8032,7 @@ func (*StarTransactionPartnerChannel) StarTransactionPartnerType() string { func (starTransactionPartnerChannel *StarTransactionPartnerChannel) UnmarshalJSON(data []byte) error { var tmp struct { ChatId int64 `json:"chat_id"` - PaidMediaMessageId int64 `json:"paid_media_message_id"` - Media []json.RawMessage `json:"media"` + Purpose json.RawMessage `json:"purpose"` } err := json.Unmarshal(data, &tmp) @@ -7680,10 +8041,9 @@ func (starTransactionPartnerChannel *StarTransactionPartnerChannel) UnmarshalJSO } starTransactionPartnerChannel.ChatId = tmp.ChatId - starTransactionPartnerChannel.PaidMediaMessageId = tmp.PaidMediaMessageId - fieldMedia, _ := UnmarshalListOfPaidMedia(tmp.Media) - starTransactionPartnerChannel.Media = fieldMedia + fieldPurpose, _ := UnmarshalChannelTransactionPurpose(tmp.Purpose) + starTransactionPartnerChannel.Purpose = fieldPurpose return nil } @@ -8378,6 +8738,8 @@ type BotInfo struct { MenuButton *BotMenuButton `json:"menu_button"` // List of the bot commands Commands []*BotCommand `json:"commands"` + // The HTTP link to the privacy policy of the bot. If empty, then /privacy command must be used if supported by the bot. If the command isn't supported, then https://telegram.org/privacy-tpa must be opened + PrivacyPolicyUrl string `json:"privacy_policy_url"` // Default administrator rights for adding the bot to basic group and supergroup chats; may be null DefaultGroupAdministratorRights *ChatAdministratorRights `json:"default_group_administrator_rights"` // Default administrator rights for adding the bot to channels; may be null @@ -8418,6 +8780,7 @@ func (botInfo *BotInfo) UnmarshalJSON(data []byte) error { Animation *Animation `json:"animation"` MenuButton *BotMenuButton `json:"menu_button"` Commands []*BotCommand `json:"commands"` + PrivacyPolicyUrl string `json:"privacy_policy_url"` DefaultGroupAdministratorRights *ChatAdministratorRights `json:"default_group_administrator_rights"` DefaultChannelAdministratorRights *ChatAdministratorRights `json:"default_channel_administrator_rights"` HasMediaPreviews bool `json:"has_media_previews"` @@ -8438,6 +8801,7 @@ func (botInfo *BotInfo) UnmarshalJSON(data []byte) error { botInfo.Animation = tmp.Animation botInfo.MenuButton = tmp.MenuButton botInfo.Commands = tmp.Commands + botInfo.PrivacyPolicyUrl = tmp.PrivacyPolicyUrl botInfo.DefaultGroupAdministratorRights = tmp.DefaultGroupAdministratorRights botInfo.DefaultChannelAdministratorRights = tmp.DefaultChannelAdministratorRights botInfo.HasMediaPreviews = tmp.HasMediaPreviews @@ -8736,8 +9100,10 @@ func (*ChatMemberStatusAdministrator) ChatMemberStatusType() string { } // The user is a member of the chat, without any additional privileges or restrictions -type ChatMemberStatusMember struct{ +type ChatMemberStatusMember struct { meta + // Point in time (Unix timestamp) when the user will be removed from the chat because of the expired subscription; 0 if never. Ignored in setChatMemberStatus + MemberUntilDate int32 `json:"member_until_date"` } func (entity *ChatMemberStatusMember) MarshalJSON() ([]byte, error) { @@ -9326,10 +9692,14 @@ type ChatInviteLink struct { EditDate int32 `json:"edit_date"` // Point in time (Unix timestamp) when the link will expire; 0 if never ExpirationDate int32 `json:"expiration_date"` + // Information about subscription plan that is applied to the users joining the chat by the link; may be null if the link doesn't require subscription + SubscriptionPricing *StarSubscriptionPricing `json:"subscription_pricing"` // The maximum number of members, which can join the chat using the link simultaneously; 0 if not limited. Always 0 if the link requires approval MemberLimit int32 `json:"member_limit"` // Number of chat members, which joined the chat using the link MemberCount int32 `json:"member_count"` + // Number of chat members, which joined the chat using the link, but have already left because of expired subscription; for subscription links only + ExpiredMemberCount int32 `json:"expired_member_count"` // Number of pending join requests created using this link PendingJoinRequestCount int32 `json:"pending_join_request_count"` // True, if the link only creates join request. If true, total number of joining members will be unlimited @@ -9560,6 +9930,33 @@ func (*InviteLinkChatTypeChannel) InviteLinkChatTypeType() string { return TypeInviteLinkChatTypeChannel } +// Contains information about subscription plan that must be paid by the user to use a chat invite link +type ChatInviteLinkSubscriptionInfo struct { + meta + // Information about subscription plan that must be paid by the user to use the link + Pricing *StarSubscriptionPricing `json:"pricing"` + // True, if the user has already paid for the subscription and can use joinChatByInviteLink to join the subscribed chat again + CanReuse bool `json:"can_reuse"` + // Identifier of the payment form to use for subscription payment; 0 if the subscription can't be paid + FormId JsonInt64 `json:"form_id"` +} + +func (entity *ChatInviteLinkSubscriptionInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatInviteLinkSubscriptionInfo + + return json.Marshal((*stub)(entity)) +} + +func (*ChatInviteLinkSubscriptionInfo) GetClass() string { + return ClassChatInviteLinkSubscriptionInfo +} + +func (*ChatInviteLinkSubscriptionInfo) GetType() string { + return TypeChatInviteLinkSubscriptionInfo +} + // Contains information about a chat invite link type ChatInviteLinkInfo struct { meta @@ -9581,6 +9978,8 @@ type ChatInviteLinkInfo struct { MemberCount int32 `json:"member_count"` // User identifiers of some chat members that may be known to the current user MemberUserIds []int64 `json:"member_user_ids"` + // Information about subscription plan that must be paid by the user to use the link; may be null if the link doesn't require subscription + SubscriptionInfo *ChatInviteLinkSubscriptionInfo `json:"subscription_info"` // True, if the link only creates join request CreatesJoinRequest bool `json:"creates_join_request"` // True, if the chat is a public supergroup or channel, i.e. it has a username or it is a location-based supergroup @@ -9620,6 +10019,7 @@ func (chatInviteLinkInfo *ChatInviteLinkInfo) UnmarshalJSON(data []byte) error { Description string `json:"description"` MemberCount int32 `json:"member_count"` MemberUserIds []int64 `json:"member_user_ids"` + SubscriptionInfo *ChatInviteLinkSubscriptionInfo `json:"subscription_info"` CreatesJoinRequest bool `json:"creates_join_request"` IsPublic bool `json:"is_public"` IsVerified bool `json:"is_verified"` @@ -9640,6 +10040,7 @@ func (chatInviteLinkInfo *ChatInviteLinkInfo) UnmarshalJSON(data []byte) error { chatInviteLinkInfo.Description = tmp.Description chatInviteLinkInfo.MemberCount = tmp.MemberCount chatInviteLinkInfo.MemberUserIds = tmp.MemberUserIds + chatInviteLinkInfo.SubscriptionInfo = tmp.SubscriptionInfo chatInviteLinkInfo.CreatesJoinRequest = tmp.CreatesJoinRequest chatInviteLinkInfo.IsPublic = tmp.IsPublic chatInviteLinkInfo.IsVerified = tmp.IsVerified @@ -9847,8 +10248,10 @@ type Supergroup struct { HasLinkedChat bool `json:"has_linked_chat"` // True, if the supergroup is connected to a location, i.e. the supergroup is a location-based supergroup HasLocation bool `json:"has_location"` - // True, if messages sent to the channel need to contain information about the sender. This field is only applicable to channels + // True, if messages sent to the channel contains name of the sender. This field is only applicable to channels SignMessages bool `json:"sign_messages"` + // True, if messages sent to the channel have information about the sender user. This field is only applicable to channels + ShowMessageSender bool `json:"show_message_sender"` // True, if users need to join the supergroup before they can send messages. Always true for channels and non-discussion supergroups JoinToSendMessages bool `json:"join_to_send_messages"` // True, if all users directly joining the supergroup need to be approved by supergroup administrators. Always false for channels and supergroups without username, location, or a linked chat @@ -9863,6 +10266,8 @@ type Supergroup struct { IsForum bool `json:"is_forum"` // True, if the supergroup or channel is verified IsVerified bool `json:"is_verified"` + // True, if content of media messages in the supergroup or channel chat must be hidden with 18+ spoiler + HasSensitiveContent bool `json:"has_sensitive_content"` // If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted RestrictionReason string `json:"restriction_reason"` // True, if many users reported this supergroup or channel as a scam @@ -9903,6 +10308,7 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { HasLinkedChat bool `json:"has_linked_chat"` HasLocation bool `json:"has_location"` SignMessages bool `json:"sign_messages"` + ShowMessageSender bool `json:"show_message_sender"` JoinToSendMessages bool `json:"join_to_send_messages"` JoinByRequest bool `json:"join_by_request"` IsSlowModeEnabled bool `json:"is_slow_mode_enabled"` @@ -9910,6 +10316,7 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { IsBroadcastGroup bool `json:"is_broadcast_group"` IsForum bool `json:"is_forum"` IsVerified bool `json:"is_verified"` + HasSensitiveContent bool `json:"has_sensitive_content"` RestrictionReason string `json:"restriction_reason"` IsScam bool `json:"is_scam"` IsFake bool `json:"is_fake"` @@ -9931,6 +10338,7 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { supergroup.HasLinkedChat = tmp.HasLinkedChat supergroup.HasLocation = tmp.HasLocation supergroup.SignMessages = tmp.SignMessages + supergroup.ShowMessageSender = tmp.ShowMessageSender supergroup.JoinToSendMessages = tmp.JoinToSendMessages supergroup.JoinByRequest = tmp.JoinByRequest supergroup.IsSlowModeEnabled = tmp.IsSlowModeEnabled @@ -9938,6 +10346,7 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { supergroup.IsBroadcastGroup = tmp.IsBroadcastGroup supergroup.IsForum = tmp.IsForum supergroup.IsVerified = tmp.IsVerified + supergroup.HasSensitiveContent = tmp.HasSensitiveContent supergroup.RestrictionReason = tmp.RestrictionReason supergroup.IsScam = tmp.IsScam supergroup.IsFake = tmp.IsFake @@ -9971,6 +10380,8 @@ type SupergroupFullInfo struct { SlowModeDelay int32 `json:"slow_mode_delay"` // 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 `json:"slow_mode_delay_expires_in"` + // True, if paid reaction can be enabled in the channel chat; for channels only + CanEnablePaidReaction bool `json:"can_enable_paid_reaction"` // True, if members of the chat can be retrieved via getSupergroupMembers or searchChatMembers CanGetMembers bool `json:"can_get_members"` // True, if non-administrators can receive only administrators and bots using getSupergroupMembers or searchChatMembers @@ -10738,6 +11149,87 @@ func (*ReactionTypeCustomEmoji) ReactionTypeType() string { return TypeReactionTypeCustomEmoji } +// The paid reaction in a channel chat +type ReactionTypePaid struct{ + meta +} + +func (entity *ReactionTypePaid) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReactionTypePaid + + return json.Marshal((*stub)(entity)) +} + +func (*ReactionTypePaid) GetClass() string { + return ClassReactionType +} + +func (*ReactionTypePaid) GetType() string { + return TypeReactionTypePaid +} + +func (*ReactionTypePaid) ReactionTypeType() string { + return TypeReactionTypePaid +} + +// Contains information about a user that added paid reactions +type PaidReactor struct { + meta + // Identifier of the user or chat that added the reactions; may be null for anonymous reactors that aren't the current user + SenderId MessageSender `json:"sender_id"` + // Number of Telegram Stars added + StarCount int32 `json:"star_count"` + // True, if the reactor is one of the most active reactors; can be false if the reactor is the current user + IsTop bool `json:"is_top"` + // True, if the paid reaction was added by the current user + IsMe bool `json:"is_me"` + // True, if the reactor is anonymous + IsAnonymous bool `json:"is_anonymous"` +} + +func (entity *PaidReactor) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PaidReactor + + return json.Marshal((*stub)(entity)) +} + +func (*PaidReactor) GetClass() string { + return ClassPaidReactor +} + +func (*PaidReactor) GetType() string { + return TypePaidReactor +} + +func (paidReactor *PaidReactor) UnmarshalJSON(data []byte) error { + var tmp struct { + SenderId json.RawMessage `json:"sender_id"` + StarCount int32 `json:"star_count"` + IsTop bool `json:"is_top"` + IsMe bool `json:"is_me"` + IsAnonymous bool `json:"is_anonymous"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + paidReactor.StarCount = tmp.StarCount + paidReactor.IsTop = tmp.IsTop + paidReactor.IsMe = tmp.IsMe + paidReactor.IsAnonymous = tmp.IsAnonymous + + fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) + paidReactor.SenderId = fieldSenderId + + return nil +} + // Contains information about a forwarded message type MessageForwardInfo struct { meta @@ -10938,6 +11430,10 @@ type MessageReactions struct { Reactions []*MessageReaction `json:"reactions"` // True, if the reactions are tags and Telegram Premium users can filter messages by them AreTags bool `json:"are_tags"` + // Information about top users that added the paid reaction + PaidReactors []*PaidReactor `json:"paid_reactors"` + // True, if the list of added reactions is available using getMessageAddedReactions + CanGetAddedReactions bool `json:"can_get_added_reactions"` } func (entity *MessageReactions) MarshalJSON() ([]byte, error) { @@ -11539,6 +12035,8 @@ type Message struct { MediaAlbumId JsonInt64 `json:"media_album_id"` // Unique identifier of the effect added to the message; 0 if none EffectId JsonInt64 `json:"effect_id"` + // True, if media content of the message must be hidden with 18+ spoiler + HasSensitiveContent bool `json:"has_sensitive_content"` // If non-empty, contains a human-readable description of the reason why access to this message must be restricted RestrictionReason string `json:"restriction_reason"` // Content of the message @@ -11597,6 +12095,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { AuthorSignature string `json:"author_signature"` MediaAlbumId JsonInt64 `json:"media_album_id"` EffectId JsonInt64 `json:"effect_id"` + HasSensitiveContent bool `json:"has_sensitive_content"` RestrictionReason string `json:"restriction_reason"` Content json.RawMessage `json:"content"` ReplyMarkup json.RawMessage `json:"reply_markup"` @@ -11634,6 +12133,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { message.AuthorSignature = tmp.AuthorSignature message.MediaAlbumId = tmp.MediaAlbumId message.EffectId = tmp.EffectId + message.HasSensitiveContent = tmp.HasSensitiveContent message.RestrictionReason = tmp.RestrictionReason fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) @@ -12175,7 +12675,7 @@ type SponsoredMessage struct { IsRecommended bool `json:"is_recommended"` // True, if the message can be reported to Telegram moderators through reportChatSponsoredMessage CanBeReported bool `json:"can_be_reported"` - // Content of the message. Currently, can be only of the type messageText + // Content of the message. Currently, can be only of the types messageText, messageAnimation, messagePhoto, or messageVideo Content MessageContent `json:"content"` // Information about the sponsor of the message Sponsor *MessageSponsor `json:"sponsor"` @@ -13451,7 +13951,7 @@ func (chatPosition *ChatPosition) UnmarshalJSON(data []byte) error { return nil } -// All reactions are available in the chat +// All reactions are available in the chat, excluding the paid reaction and custom reactions in channel chats type ChatAvailableReactionsAll struct { meta // The maximum allowed number of reactions per message; 1-11 @@ -18141,6 +18641,8 @@ type LinkPreviewTypeBackground struct { meta // Document with the background; may be null for filled backgrounds Document *Document `json:"document"` + // Type of the background; may be null if unknown + BackgroundType BackgroundType `json:"background_type"` } func (entity *LinkPreviewTypeBackground) MarshalJSON() ([]byte, error) { @@ -18163,6 +18665,25 @@ func (*LinkPreviewTypeBackground) LinkPreviewTypeType() string { return TypeLinkPreviewTypeBackground } +func (linkPreviewTypeBackground *LinkPreviewTypeBackground) UnmarshalJSON(data []byte) error { + var tmp struct { + Document *Document `json:"document"` + BackgroundType json.RawMessage `json:"background_type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + linkPreviewTypeBackground.Document = tmp.Document + + fieldBackgroundType, _ := UnmarshalBackgroundType(tmp.BackgroundType) + linkPreviewTypeBackground.BackgroundType = fieldBackgroundType + + return nil +} + // The link is a link to boost a channel chat type LinkPreviewTypeChannelBoost struct { meta @@ -18511,10 +19032,10 @@ func (*LinkPreviewTypeShareableChatFolder) LinkPreviewTypeType() string { return TypeLinkPreviewTypeShareableChatFolder } -// The link is a link to a sticker message +// The link is a link to a sticker type LinkPreviewTypeSticker struct { meta - // The sticker + // The sticker. It can be an arbitrary WEBP image and can have dimensions bigger than 512 Sticker *Sticker `json:"sticker"` } @@ -26630,8 +27151,6 @@ type MessageProperties struct { CanBeSharedInStory bool `json:"can_be_shared_in_story"` // True, if scheduling state of the message can be edited CanEditSchedulingState bool `json:"can_edit_scheduling_state"` - // True, if the list of added reactions is available using getMessageAddedReactions - CanGetAddedReactions bool `json:"can_get_added_reactions"` // True, if code for message embedding can be received using getMessageEmbeddingCode CanGetEmbeddingCode bool `json:"can_get_embedding_code"` // True, if a link can be generated for the message using getMessageLink @@ -35221,6 +35740,33 @@ func (*ChatEventSignMessagesToggled) ChatEventActionType() string { return TypeChatEventSignMessagesToggled } +// The show_message_sender setting of a channel was toggled +type ChatEventShowMessageSenderToggled struct { + meta + // New value of show_message_sender + ShowMessageSender bool `json:"show_message_sender"` +} + +func (entity *ChatEventShowMessageSenderToggled) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventShowMessageSenderToggled + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventShowMessageSenderToggled) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventShowMessageSenderToggled) GetType() string { + return TypeChatEventShowMessageSenderToggled +} + +func (*ChatEventShowMessageSenderToggled) ChatEventActionType() string { + return TypeChatEventShowMessageSenderToggled +} + // A chat invite link was edited type ChatEventInviteLinkEdited struct { meta @@ -38349,6 +38895,33 @@ func (*TelegramPaymentPurposeGiftedStars) TelegramPaymentPurposeType() string { return TypeTelegramPaymentPurposeGiftedStars } +// The user joins a chat and subscribes to regular payments in Telegram Stars +type TelegramPaymentPurposeJoinChat struct { + meta + // Invite link to use + InviteLink string `json:"invite_link"` +} + +func (entity *TelegramPaymentPurposeJoinChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TelegramPaymentPurposeJoinChat + + return json.Marshal((*stub)(entity)) +} + +func (*TelegramPaymentPurposeJoinChat) GetClass() string { + return ClassTelegramPaymentPurpose +} + +func (*TelegramPaymentPurposeJoinChat) GetType() string { + return TypeTelegramPaymentPurposeJoinChat +} + +func (*TelegramPaymentPurposeJoinChat) TelegramPaymentPurposeType() string { + return TypeTelegramPaymentPurposeJoinChat +} + // A token for Firebase Cloud Messaging type DeviceTokenFirebaseCloudMessaging struct { meta @@ -43365,7 +43938,7 @@ func (*InternalLinkTypeActiveSessions) InternalLinkTypeType() string { return TypeInternalLinkTypeActiveSessions } -// The link is a link to an attachment menu bot to be opened in the specified or a chosen chat. Process given target_chat to open the chat. Then, call searchPublicChat with the given bot username, check that the user is a bot and can be added to attachment menu. Then, use getAttachmentMenuBot to receive information about the bot. If the bot isn't added to attachment menu, then show a disclaimer about Mini Apps being third-party apps, ask the user to accept their Terms of service and confirm adding the bot to side and attachment menu. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. If the attachment menu bot can't be used in the opened chat, show an error to the user. If the bot is added to attachment menu and can be used in the chat, then use openWebApp with the given URL +// The link is a link to an attachment menu bot to be opened in the specified or a chosen chat. Process given target_chat to open the chat. Then, call searchPublicChat with the given bot username, check that the user is a bot and can be added to attachment menu. Then, use getAttachmentMenuBot to receive information about the bot. If the bot isn't added to attachment menu, then show a disclaimer about Mini Apps being third-party applications, ask the user to accept their Terms of service and confirm adding the bot to side and attachment menu. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. If the attachment menu bot can't be used in the opened chat, show an error to the user. If the bot is added to attachment menu and can be used in the chat, then use openWebApp with the given URL type InternalLinkTypeAttachmentMenuBot struct { meta // Target chat to be opened @@ -43589,7 +44162,36 @@ func (*InternalLinkTypeBusinessChat) InternalLinkTypeType() string { return TypeInternalLinkTypeBusinessChat } -// The link is a link to the change phone number section of the app +// The link is a link to the Telegram Star purchase section of the application +type InternalLinkTypeBuyStars struct { + meta + // The number of Telegram Stars that must be owned by the user + StarCount int64 `json:"star_count"` + // Purpose of Telegram Star purchase. Arbitrary string specified by the server, for example, "subs" if the Telegram Stars are required to extend channel subscriptions + Purpose string `json:"purpose"` +} + +func (entity *InternalLinkTypeBuyStars) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeBuyStars + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeBuyStars) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeBuyStars) GetType() string { + return TypeInternalLinkTypeBuyStars +} + +func (*InternalLinkTypeBuyStars) InternalLinkTypeType() string { + return TypeInternalLinkTypeBuyStars +} + +// The link is a link to the change phone number section of the application type InternalLinkTypeChangePhoneNumber struct{ meta } @@ -43668,7 +44270,7 @@ func (*InternalLinkTypeChatFolderInvite) InternalLinkTypeType() string { return TypeInternalLinkTypeChatFolderInvite } -// The link is a link to the folder section of the app settings +// The link is a link to the folder section of the application settings type InternalLinkTypeChatFolderSettings struct{ meta } @@ -43720,7 +44322,7 @@ func (*InternalLinkTypeChatInvite) InternalLinkTypeType() string { return TypeInternalLinkTypeChatInvite } -// The link is a link to the default message auto-delete timer settings section of the app settings +// The link is a link to the default message auto-delete timer settings section of the application settings type InternalLinkTypeDefaultMessageAutoDeleteTimerSettings struct{ meta } @@ -43745,7 +44347,7 @@ func (*InternalLinkTypeDefaultMessageAutoDeleteTimerSettings) InternalLinkTypeTy return TypeInternalLinkTypeDefaultMessageAutoDeleteTimerSettings } -// The link is a link to the edit profile section of the app settings +// The link is a link to the edit profile section of the application settings type InternalLinkTypeEditProfileSettings struct{ meta } @@ -43882,7 +44484,7 @@ func (*InternalLinkTypeLanguagePack) InternalLinkTypeType() string { return TypeInternalLinkTypeLanguagePack } -// The link is a link to the language section of the app settings +// The link is a link to the language section of the application settings type InternalLinkTypeLanguageSettings struct{ meta } @@ -43907,7 +44509,7 @@ func (*InternalLinkTypeLanguageSettings) InternalLinkTypeType() string { return TypeInternalLinkTypeLanguageSettings } -// The link is a link to the main Web App of a bot. Call searchPublicChat with the given bot username, check that the user is a bot and has the main Web App. If the bot can be added to attachment menu, then use getAttachmentMenuBot to receive information about the bot, then if the bot isn't added to side menu, show a disclaimer about Mini Apps being third-party apps, ask the user to accept their Terms of service and confirm adding the bot to side and attachment menu, then if the user accepts the terms and confirms adding, use toggleBotIsAddedToAttachmentMenu to add the bot. Then, use getMainWebApp with the given start parameter and open the returned URL as a Web App +// The link is a link to the main Web App of a bot. Call searchPublicChat with the given bot username, check that the user is a bot and has the main Web App. If the bot can be added to attachment menu, then use getAttachmentMenuBot to receive information about the bot, then if the bot isn't added to side menu, show a disclaimer about Mini Apps being third-party applications, ask the user to accept their Terms of service and confirm adding the bot to side and attachment menu, then if the user accepts the terms and confirms adding, use toggleBotIsAddedToAttachmentMenu to add the bot. Then, use getMainWebApp with the given start parameter and open the returned URL as a Web App type InternalLinkTypeMainWebApp struct { meta // Username of the bot @@ -44139,7 +44741,7 @@ func (*InternalLinkTypePremiumGiftCode) InternalLinkTypeType() string { return TypeInternalLinkTypePremiumGiftCode } -// The link is a link to the privacy and security section of the app settings +// The link is a link to the privacy and security section of the application settings type InternalLinkTypePrivacyAndSecuritySettings struct{ meta } @@ -44407,7 +45009,7 @@ func (*InternalLinkTypeTheme) InternalLinkTypeType() string { return TypeInternalLinkTypeTheme } -// The link is a link to the theme section of the app settings +// The link is a link to the theme section of the application settings type InternalLinkTypeThemeSettings struct{ meta } @@ -44573,7 +45175,7 @@ func (*InternalLinkTypeVideoChat) InternalLinkTypeType() string { return TypeInternalLinkTypeVideoChat } -// The link is a link to a Web App. Call searchPublicChat with the given bot username, check that the user is a bot, then call searchWebApp with the received bot and the given web_app_short_name. Process received foundWebApp by showing a confirmation dialog if needed. If the bot can be added to attachment or side menu, but isn't added yet, then show a disclaimer about Mini Apps being third-party apps instead of the dialog and ask the user to accept their Terms of service. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. Then, call getWebAppLinkUrl and open the returned URL as a Web App +// The link is a link to a Web App. Call searchPublicChat with the given bot username, check that the user is a bot, then call searchWebApp with the received bot and the given web_app_short_name. Process received foundWebApp by showing a confirmation dialog if needed. If the bot can be added to attachment or side menu, but isn't added yet, then show a disclaimer about Mini Apps being third-party applications instead of the dialog and ask the user to accept their Terms of service. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. Then, call getWebAppLinkUrl and open the returned URL as a Web App type InternalLinkTypeWebApp struct { meta // Username of the bot that owns the Web App @@ -46806,6 +47408,31 @@ func (*SuggestedActionExtendPremium) SuggestedActionType() string { return TypeSuggestedActionExtendPremium } +// Suggests the user to extend their expiring Telegram Star subscriptions. Call getStarSubscriptions with only_expiring == true to get the number of expiring subscriptions and the number of required to buy Telegram Stars +type SuggestedActionExtendStarSubscriptions struct{ + meta +} + +func (entity *SuggestedActionExtendStarSubscriptions) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedActionExtendStarSubscriptions + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedActionExtendStarSubscriptions) GetClass() string { + return ClassSuggestedAction +} + +func (*SuggestedActionExtendStarSubscriptions) GetType() string { + return TypeSuggestedActionExtendStarSubscriptions +} + +func (*SuggestedActionExtendStarSubscriptions) SuggestedActionType() string { + return TypeSuggestedActionExtendStarSubscriptions +} + // Contains a counter type Count struct { meta @@ -52571,6 +53198,33 @@ func (*UpdateSavedMessagesTags) UpdateType() string { return TypeUpdateSavedMessagesTags } +// The list of messages with active live location that need to be updated by the application has changed. The list is persistent across application restarts only if the message database is used +type UpdateActiveLiveLocationMessages struct { + meta + // The list of messages with active live locations + Messages []*Message `json:"messages"` +} + +func (entity *UpdateActiveLiveLocationMessages) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateActiveLiveLocationMessages + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateActiveLiveLocationMessages) GetClass() string { + return ClassUpdate +} + +func (*UpdateActiveLiveLocationMessages) GetType() string { + return TypeUpdateActiveLiveLocationMessages +} + +func (*UpdateActiveLiveLocationMessages) UpdateType() string { + return TypeUpdateActiveLiveLocationMessages +} + // The number of Telegram Stars owned by the current user has changed type UpdateOwnedStarCount struct { meta diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 87e7ed3..40cab92 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -693,6 +693,77 @@ func UnmarshalListOfStarTransactionDirection(dataList []json.RawMessage) ([]Star return list, nil } +func UnmarshalBotTransactionPurpose(data json.RawMessage) (BotTransactionPurpose, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeBotTransactionPurposePaidMedia: + return UnmarshalBotTransactionPurposePaidMedia(data) + + case TypeBotTransactionPurposeInvoicePayment: + return UnmarshalBotTransactionPurposeInvoicePayment(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfBotTransactionPurpose(dataList []json.RawMessage) ([]BotTransactionPurpose, error) { + list := []BotTransactionPurpose{} + + for _, data := range dataList { + entity, err := UnmarshalBotTransactionPurpose(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalChannelTransactionPurpose(data json.RawMessage) (ChannelTransactionPurpose, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeChannelTransactionPurposePaidMedia: + return UnmarshalChannelTransactionPurposePaidMedia(data) + + case TypeChannelTransactionPurposeJoin: + return UnmarshalChannelTransactionPurposeJoin(data) + + case TypeChannelTransactionPurposeReaction: + return UnmarshalChannelTransactionPurposeReaction(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfChannelTransactionPurpose(dataList []json.RawMessage) ([]ChannelTransactionPurpose, error) { + list := []ChannelTransactionPurpose{} + + for _, data := range dataList { + entity, err := UnmarshalChannelTransactionPurpose(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalStarTransactionPartner(data json.RawMessage) (StarTransactionPartner, error) { var meta meta @@ -720,6 +791,9 @@ func UnmarshalStarTransactionPartner(data json.RawMessage) (StarTransactionPartn case TypeStarTransactionPartnerBot: return UnmarshalStarTransactionPartnerBot(data) + case TypeStarTransactionPartnerBusiness: + return UnmarshalStarTransactionPartnerBusiness(data) + case TypeStarTransactionPartnerChannel: return UnmarshalStarTransactionPartnerChannel(data) @@ -1178,6 +1252,9 @@ func UnmarshalReactionType(data json.RawMessage) (ReactionType, error) { case TypeReactionTypeCustomEmoji: return UnmarshalReactionTypeCustomEmoji(data) + case TypeReactionTypePaid: + return UnmarshalReactionTypePaid(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -4815,6 +4892,9 @@ func UnmarshalChatEventAction(data json.RawMessage) (ChatEventAction, error) { case TypeChatEventSignMessagesToggled: return UnmarshalChatEventSignMessagesToggled(data) + case TypeChatEventShowMessageSenderToggled: + return UnmarshalChatEventShowMessageSenderToggled(data) + case TypeChatEventInviteLinkEdited: return UnmarshalChatEventInviteLinkEdited(data) @@ -5324,6 +5404,9 @@ func UnmarshalTelegramPaymentPurpose(data json.RawMessage) (TelegramPaymentPurpo case TypeTelegramPaymentPurposeGiftedStars: return UnmarshalTelegramPaymentPurposeGiftedStars(data) + case TypeTelegramPaymentPurposeJoinChat: + return UnmarshalTelegramPaymentPurposeJoinChat(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -6463,6 +6546,9 @@ func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { case TypeInternalLinkTypeBusinessChat: return UnmarshalInternalLinkTypeBusinessChat(data) + case TypeInternalLinkTypeBuyStars: + return UnmarshalInternalLinkTypeBuyStars(data) + case TypeInternalLinkTypeChangePhoneNumber: return UnmarshalInternalLinkTypeChangePhoneNumber(data) @@ -7006,6 +7092,9 @@ func UnmarshalSuggestedAction(data json.RawMessage) (SuggestedAction, error) { case TypeSuggestedActionExtendPremium: return UnmarshalSuggestedActionExtendPremium(data) + case TypeSuggestedActionExtendStarSubscriptions: + return UnmarshalSuggestedActionExtendStarSubscriptions(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -7758,6 +7847,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateSavedMessagesTags: return UnmarshalUpdateSavedMessagesTags(data) + case TypeUpdateActiveLiveLocationMessages: + return UnmarshalUpdateActiveLiveLocationMessages(data) + case TypeUpdateOwnedStarCount: return UnmarshalUpdateOwnedStarCount(data) @@ -8979,6 +9071,30 @@ func UnmarshalChatAdministratorRights(data json.RawMessage) (*ChatAdministratorR return &resp, err } +func UnmarshalStarSubscriptionPricing(data json.RawMessage) (*StarSubscriptionPricing, error) { + var resp StarSubscriptionPricing + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarSubscription(data json.RawMessage) (*StarSubscription, error) { + var resp StarSubscription + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarSubscriptions(data json.RawMessage) (*StarSubscriptions, error) { + var resp StarSubscriptions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalProductInfo(data json.RawMessage) (*ProductInfo, error) { var resp ProductInfo @@ -9059,6 +9175,46 @@ func UnmarshalStarTransactionDirectionOutgoing(data json.RawMessage) (*StarTrans return &resp, err } +func UnmarshalBotTransactionPurposePaidMedia(data json.RawMessage) (*BotTransactionPurposePaidMedia, error) { + var resp BotTransactionPurposePaidMedia + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBotTransactionPurposeInvoicePayment(data json.RawMessage) (*BotTransactionPurposeInvoicePayment, error) { + var resp BotTransactionPurposeInvoicePayment + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChannelTransactionPurposePaidMedia(data json.RawMessage) (*ChannelTransactionPurposePaidMedia, error) { + var resp ChannelTransactionPurposePaidMedia + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChannelTransactionPurposeJoin(data json.RawMessage) (*ChannelTransactionPurposeJoin, error) { + var resp ChannelTransactionPurposeJoin + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChannelTransactionPurposeReaction(data json.RawMessage) (*ChannelTransactionPurposeReaction, error) { + var resp ChannelTransactionPurposeReaction + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarTransactionPartnerTelegram(data json.RawMessage) (*StarTransactionPartnerTelegram, error) { var resp StarTransactionPartnerTelegram @@ -9107,6 +9263,14 @@ func UnmarshalStarTransactionPartnerBot(data json.RawMessage) (*StarTransactionP return &resp, err } +func UnmarshalStarTransactionPartnerBusiness(data json.RawMessage) (*StarTransactionPartnerBusiness, error) { + var resp StarTransactionPartnerBusiness + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarTransactionPartnerChannel(data json.RawMessage) (*StarTransactionPartnerChannel, error) { var resp StarTransactionPartnerChannel @@ -9563,6 +9727,14 @@ func UnmarshalInviteLinkChatTypeChannel(data json.RawMessage) (*InviteLinkChatTy return &resp, err } +func UnmarshalChatInviteLinkSubscriptionInfo(data json.RawMessage) (*ChatInviteLinkSubscriptionInfo, error) { + var resp ChatInviteLinkSubscriptionInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatInviteLinkInfo(data json.RawMessage) (*ChatInviteLinkInfo, error) { var resp ChatInviteLinkInfo @@ -9811,6 +9983,22 @@ func UnmarshalReactionTypeCustomEmoji(data json.RawMessage) (*ReactionTypeCustom return &resp, err } +func UnmarshalReactionTypePaid(data json.RawMessage) (*ReactionTypePaid, error) { + var resp ReactionTypePaid + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPaidReactor(data json.RawMessage) (*PaidReactor, error) { + var resp PaidReactor + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageForwardInfo(data json.RawMessage) (*MessageForwardInfo, error) { var resp MessageForwardInfo @@ -15579,6 +15767,14 @@ func UnmarshalChatEventSignMessagesToggled(data json.RawMessage) (*ChatEventSign return &resp, err } +func UnmarshalChatEventShowMessageSenderToggled(data json.RawMessage) (*ChatEventShowMessageSenderToggled, error) { + var resp ChatEventShowMessageSenderToggled + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatEventInviteLinkEdited(data json.RawMessage) (*ChatEventInviteLinkEdited, error) { var resp ChatEventInviteLinkEdited @@ -16443,6 +16639,14 @@ func UnmarshalTelegramPaymentPurposeGiftedStars(data json.RawMessage) (*Telegram return &resp, err } +func UnmarshalTelegramPaymentPurposeJoinChat(data json.RawMessage) (*TelegramPaymentPurposeJoinChat, error) { + var resp TelegramPaymentPurposeJoinChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalDeviceTokenFirebaseCloudMessaging(data json.RawMessage) (*DeviceTokenFirebaseCloudMessaging, error) { var resp DeviceTokenFirebaseCloudMessaging @@ -17923,6 +18127,14 @@ func UnmarshalInternalLinkTypeBusinessChat(data json.RawMessage) (*InternalLinkT return &resp, err } +func UnmarshalInternalLinkTypeBuyStars(data json.RawMessage) (*InternalLinkTypeBuyStars, error) { + var resp InternalLinkTypeBuyStars + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInternalLinkTypeChangePhoneNumber(data json.RawMessage) (*InternalLinkTypeChangePhoneNumber, error) { var resp InternalLinkTypeChangePhoneNumber @@ -18859,6 +19071,14 @@ func UnmarshalSuggestedActionExtendPremium(data json.RawMessage) (*SuggestedActi return &resp, err } +func UnmarshalSuggestedActionExtendStarSubscriptions(data json.RawMessage) (*SuggestedActionExtendStarSubscriptions, error) { + var resp SuggestedActionExtendStarSubscriptions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalCount(data json.RawMessage) (*Count, error) { var resp Count @@ -20227,6 +20447,14 @@ func UnmarshalUpdateSavedMessagesTags(data json.RawMessage) (*UpdateSavedMessage return &resp, err } +func UnmarshalUpdateActiveLiveLocationMessages(data json.RawMessage) (*UpdateActiveLiveLocationMessages, error) { + var resp UpdateActiveLiveLocationMessages + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateOwnedStarCount(data json.RawMessage) (*UpdateOwnedStarCount, error) { var resp UpdateOwnedStarCount @@ -20998,6 +21226,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatAdministratorRights: return UnmarshalChatAdministratorRights(data) + case TypeStarSubscriptionPricing: + return UnmarshalStarSubscriptionPricing(data) + + case TypeStarSubscription: + return UnmarshalStarSubscription(data) + + case TypeStarSubscriptions: + return UnmarshalStarSubscriptions(data) + case TypeProductInfo: return UnmarshalProductInfo(data) @@ -21028,6 +21265,21 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarTransactionDirectionOutgoing: return UnmarshalStarTransactionDirectionOutgoing(data) + case TypeBotTransactionPurposePaidMedia: + return UnmarshalBotTransactionPurposePaidMedia(data) + + case TypeBotTransactionPurposeInvoicePayment: + return UnmarshalBotTransactionPurposeInvoicePayment(data) + + case TypeChannelTransactionPurposePaidMedia: + return UnmarshalChannelTransactionPurposePaidMedia(data) + + case TypeChannelTransactionPurposeJoin: + return UnmarshalChannelTransactionPurposeJoin(data) + + case TypeChannelTransactionPurposeReaction: + return UnmarshalChannelTransactionPurposeReaction(data) + case TypeStarTransactionPartnerTelegram: return UnmarshalStarTransactionPartnerTelegram(data) @@ -21046,6 +21298,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarTransactionPartnerBot: return UnmarshalStarTransactionPartnerBot(data) + case TypeStarTransactionPartnerBusiness: + return UnmarshalStarTransactionPartnerBusiness(data) + case TypeStarTransactionPartnerChannel: return UnmarshalStarTransactionPartnerChannel(data) @@ -21217,6 +21472,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInviteLinkChatTypeChannel: return UnmarshalInviteLinkChatTypeChannel(data) + case TypeChatInviteLinkSubscriptionInfo: + return UnmarshalChatInviteLinkSubscriptionInfo(data) + case TypeChatInviteLinkInfo: return UnmarshalChatInviteLinkInfo(data) @@ -21310,6 +21568,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeReactionTypeCustomEmoji: return UnmarshalReactionTypeCustomEmoji(data) + case TypeReactionTypePaid: + return UnmarshalReactionTypePaid(data) + + case TypePaidReactor: + return UnmarshalPaidReactor(data) + case TypeMessageForwardInfo: return UnmarshalMessageForwardInfo(data) @@ -23473,6 +23737,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatEventSignMessagesToggled: return UnmarshalChatEventSignMessagesToggled(data) + case TypeChatEventShowMessageSenderToggled: + return UnmarshalChatEventShowMessageSenderToggled(data) + case TypeChatEventInviteLinkEdited: return UnmarshalChatEventInviteLinkEdited(data) @@ -23797,6 +24064,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeTelegramPaymentPurposeGiftedStars: return UnmarshalTelegramPaymentPurposeGiftedStars(data) + case TypeTelegramPaymentPurposeJoinChat: + return UnmarshalTelegramPaymentPurposeJoinChat(data) + case TypeDeviceTokenFirebaseCloudMessaging: return UnmarshalDeviceTokenFirebaseCloudMessaging(data) @@ -24352,6 +24622,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInternalLinkTypeBusinessChat: return UnmarshalInternalLinkTypeBusinessChat(data) + case TypeInternalLinkTypeBuyStars: + return UnmarshalInternalLinkTypeBuyStars(data) + case TypeInternalLinkTypeChangePhoneNumber: return UnmarshalInternalLinkTypeChangePhoneNumber(data) @@ -24703,6 +24976,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSuggestedActionExtendPremium: return UnmarshalSuggestedActionExtendPremium(data) + case TypeSuggestedActionExtendStarSubscriptions: + return UnmarshalSuggestedActionExtendStarSubscriptions(data) + case TypeCount: return UnmarshalCount(data) @@ -25216,6 +25492,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateSavedMessagesTags: return UnmarshalUpdateSavedMessagesTags(data) + case TypeUpdateActiveLiveLocationMessages: + return UnmarshalUpdateActiveLiveLocationMessages(data) + case TypeUpdateOwnedStarCount: return UnmarshalUpdateOwnedStarCount(data) diff --git a/data/td_api.tl b/data/td_api.tl index b6cdc87..f75837f 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -802,6 +802,30 @@ chatPermissions can_send_basic_messages:Bool can_send_audios:Bool can_send_docum chatAdministratorRights can_manage_chat:Bool can_change_info:Bool can_post_messages:Bool can_edit_messages:Bool can_delete_messages:Bool can_invite_users:Bool can_restrict_members:Bool can_pin_messages:Bool can_manage_topics:Bool can_promote_members:Bool can_manage_video_chats:Bool can_post_stories:Bool can_edit_stories:Bool can_delete_stories:Bool is_anonymous:Bool = ChatAdministratorRights; +//@description Describes subscription plan paid in Telegram Stars +//@period The number of seconds between consecutive Telegram Star debiting +//@star_count The amount of Telegram Stars that must be paid for each period +starSubscriptionPricing period:int32 star_count:int53 = StarSubscriptionPricing; + +//@description Contains information about subscription to a channel chat paid in Telegram Stars +//@id Unique identifier of the subscription +//@chat_id Identifier of the channel chat that is subscribed +//@expiration_date Point in time (Unix timestamp) when the subscription will expire or expired +//@can_reuse True, if the subscription is active and the user can use the method reuseStarSubscription to join the subscribed chat again +//@is_canceled True, if the subscription was canceled +//@is_expiring True, if the subscription expires soon and there are no enough Telegram Stars on the user's balance to extend it +//@invite_link The invite link that can be used to renew the subscription if it has been expired; may be empty, if the link isn't available anymore +//@pricing The subscription plan +starSubscription id:string chat_id:int53 expiration_date:int32 can_reuse:Bool is_canceled:Bool is_expiring:Bool invite_link:string pricing:starSubscriptionPricing = StarSubscription; + +//@description Represents a list of Telegram Star subscriptions +//@star_count The amount of owned Telegram Stars +//@subscriptions List of subbscriptions for Telegram Stars +//@required_star_count The number of Telegram Stars required to buy to extend subscriptions expiring soon +//@next_offset The offset for the next request. If empty, then there are no more results +starSubscriptions star_count:int53 subscriptions:vector required_star_count:int53 next_offset:string = StarSubscriptions; + + //@description Contains information about a product that can be paid with invoice //@title Product title //@param_description Product description @@ -868,6 +892,33 @@ starTransactionDirectionIncoming = StarTransactionDirection; starTransactionDirectionOutgoing = StarTransactionDirection; +//@class BotTransactionPurpose @description Describes purpose of a transaction with a bot + +//@description Paid media were bought @media The bought media if the trancastion wasn't refunded +botTransactionPurposePaidMedia media:vector = BotTransactionPurpose; + +//@description User bought a product from the bot +//@product_info Information about the bought product; may be null if not applicable +//@invoice_payload Invoice payload; for bots only +botTransactionPurposeInvoicePayment product_info:productInfo invoice_payload:bytes = BotTransactionPurpose; + + +//@class ChannelTransactionPurpose @description Describes purpose of a transaction with a channel + +//@description Paid media were bought +//@message_id Identifier of the corresponding message with paid media; can be an identifier of a deleted message +//@media The bought media if the trancastion wasn't refunded +channelTransactionPurposePaidMedia message_id:int53 media:vector = ChannelTransactionPurpose; + +//@description User joined the channel and subscribed to regular payments in Telegram Stars +//@period The number of seconds between consecutive Telegram Star debiting +channelTransactionPurposeJoin period:int32 = ChannelTransactionPurpose; + +//@description User paid for a reaction +//@message_id Identifier of the reacted message; can be an identifier of a deleted message +channelTransactionPurposeReaction message_id:int53 = ChannelTransactionPurpose; + + //@class StarTransactionPartner @description Describes source or recipient of a transaction with Telegram Stars //@description The transaction is a transaction with Telegram through a bot @@ -885,17 +936,14 @@ starTransactionPartnerFragment withdrawal_state:RevenueWithdrawalState = StarTra //@description The transaction is a transaction with Telegram Ad platform starTransactionPartnerTelegramAds = StarTransactionPartner; -//@description The transaction is a transaction with a bot -//@user_id Identifier of the bot for the user, or the user for the bot -//@product_info Information about the bought product; may be null if not applicable -//@invoice_payload Invoice payload; for bots only -starTransactionPartnerBot user_id:int53 product_info:productInfo invoice_payload:bytes = StarTransactionPartner; +//@description The transaction is a transaction with a bot @user_id Identifier of the bot @purpose Purpose of the transaction +starTransactionPartnerBot user_id:int53 purpose:BotTransactionPurpose = StarTransactionPartner; -//@description The transaction is a transaction with a channel chat -//@chat_id Identifier of the chat -//@paid_media_message_id Identifier of the corresponding message with paid media; can be an identifier of a deleted message -//@media Information about the bought media -starTransactionPartnerChannel chat_id:int53 paid_media_message_id:int53 media:vector = StarTransactionPartner; +//@description The transaction is a transaction with a business account @user_id Identifier of the business account user @media The bought media if the trancastion wasn't refunded +starTransactionPartnerBusiness user_id:int53 media:vector = StarTransactionPartner; + +//@description The transaction is a transaction with a channel chat @chat_id Identifier of the chat @purpose Purpose of the transaction +starTransactionPartnerChannel chat_id:int53 purpose:ChannelTransactionPurpose = StarTransactionPartner; //@description The transaction is a gift of Telegram Stars from another user //@user_id Identifier of the user; 0 if the gift was anonymous @@ -1036,6 +1084,7 @@ user id:int53 access_hash:int64 first_name:string last_name:string usernames:use //@animation Animation shown in the chat with the bot if the chat is empty; may be null //@menu_button Information about a button to show instead of the bot commands menu button; may be null if ordinary bot commands menu must be shown //@commands List of the bot commands +//@privacy_policy_url The HTTP link to the privacy policy of the bot. If empty, then /privacy command must be used if supported by the bot. If the command isn't supported, then https://telegram.org/privacy-tpa must be opened //@default_group_administrator_rights Default administrator rights for adding the bot to basic group and supergroup chats; may be null //@default_channel_administrator_rights Default administrator rights for adding the bot to channels; may be null //@has_media_previews True, if the bot has media previews @@ -1043,7 +1092,7 @@ user id:int53 access_hash:int64 first_name:string last_name:string usernames:use //@edit_description_link The internal link, which can be used to edit bot description; may be null //@edit_description_media_link The internal link, which can be used to edit the photo or animation shown in the chat with the bot if the chat is empty; may be null //@edit_settings_link The internal link, which can be used to edit bot settings; may be null -botInfo short_description:string description:string photo:photo animation:animation menu_button:botMenuButton commands:vector default_group_administrator_rights:chatAdministratorRights default_channel_administrator_rights:chatAdministratorRights has_media_previews:Bool edit_commands_link:InternalLinkType edit_description_link:InternalLinkType edit_description_media_link:InternalLinkType edit_settings_link:InternalLinkType = BotInfo; +botInfo short_description:string description:string photo:photo animation:animation menu_button:botMenuButton commands:vector privacy_policy_url:string default_group_administrator_rights:chatAdministratorRights default_channel_administrator_rights:chatAdministratorRights has_media_previews:Bool edit_commands_link:InternalLinkType edit_description_link:InternalLinkType edit_description_media_link:InternalLinkType edit_settings_link:InternalLinkType = BotInfo; //@description Contains full information about a user //@personal_photo User profile photo set by the current user for the contact; may be null. If null and user.profile_photo is null, then the photo is empty; otherwise, it is unknown. @@ -1101,7 +1150,8 @@ chatMemberStatusCreator custom_title:string is_anonymous:Bool is_member:Bool = C chatMemberStatusAdministrator custom_title:string can_be_edited:Bool rights:chatAdministratorRights = ChatMemberStatus; //@description The user is a member of the chat, without any additional privileges or restrictions -chatMemberStatusMember = ChatMemberStatus; +//@member_until_date Point in time (Unix timestamp) when the user will be removed from the chat because of the expired subscription; 0 if never. Ignored in setChatMemberStatus +chatMemberStatusMember member_until_date:int32 = ChatMemberStatus; //@description The user is under certain restrictions in the chat. Not supported in basic groups and channels //@is_member True, if the user is a member of the chat @@ -1186,13 +1236,15 @@ supergroupMembersFilterBots = SupergroupMembersFilter; //@date Point in time (Unix timestamp) when the link was created //@edit_date Point in time (Unix timestamp) when the link was last edited; 0 if never or unknown //@expiration_date Point in time (Unix timestamp) when the link will expire; 0 if never +//@subscription_pricing Information about subscription plan that is applied to the users joining the chat by the link; may be null if the link doesn't require subscription //@member_limit The maximum number of members, which can join the chat using the link simultaneously; 0 if not limited. Always 0 if the link requires approval //@member_count Number of chat members, which joined the chat using the link +//@expired_member_count Number of chat members, which joined the chat using the link, but have already left because of expired subscription; for subscription links only //@pending_join_request_count Number of pending join requests created using this link //@creates_join_request True, if the link only creates join request. If true, total number of joining members will be unlimited //@is_primary True, if the link is primary. Primary invite link can't have name, expiration date, or usage limit. There is exactly one primary invite link for each administrator with can_invite_users right at a given time //@is_revoked True, if the link was revoked -chatInviteLink invite_link:string name:string creator_user_id:int53 date:int32 edit_date:int32 expiration_date:int32 member_limit:int32 member_count:int32 pending_join_request_count:int32 creates_join_request:Bool is_primary:Bool is_revoked:Bool = ChatInviteLink; +chatInviteLink invite_link:string name:string creator_user_id:int53 date:int32 edit_date:int32 expiration_date:int32 subscription_pricing:starSubscriptionPricing member_limit:int32 member_count:int32 expired_member_count:int32 pending_join_request_count:int32 creates_join_request:Bool is_primary:Bool is_revoked:Bool = ChatInviteLink; //@description Contains a list of chat invite links @total_count Approximate total number of chat invite links found @invite_links List of invite links chatInviteLinks total_count:int32 invite_links:vector = ChatInviteLinks; @@ -1229,6 +1281,12 @@ inviteLinkChatTypeSupergroup = InviteLinkChatType; inviteLinkChatTypeChannel = InviteLinkChatType; +//@description Contains information about subscription plan that must be paid by the user to use a chat invite link +//@pricing Information about subscription plan that must be paid by the user to use the link +//@can_reuse True, if the user has already paid for the subscription and can use joinChatByInviteLink to join the subscribed chat again +//@form_id Identifier of the payment form to use for subscription payment; 0 if the subscription can't be paid +chatInviteLinkSubscriptionInfo pricing:starSubscriptionPricing can_reuse:Bool form_id:int64 = ChatInviteLinkSubscriptionInfo; + //@description Contains information about a chat invite link //@chat_id Chat identifier of the invite link; 0 if the user has no access to the chat before joining //@accessible_for If non-zero, the amount of time for which read access to the chat will remain available, in seconds @@ -1239,12 +1297,13 @@ inviteLinkChatTypeChannel = InviteLinkChatType; //@param_description Chat description //@member_count Number of members in the chat //@member_user_ids User identifiers of some chat members that may be known to the current user +//@subscription_info Information about subscription plan that must be paid by the user to use the link; may be null if the link doesn't require subscription //@creates_join_request True, if the link only creates join request //@is_public True, if the chat is a public supergroup or channel, i.e. it has a username or it is a location-based supergroup //@is_verified True, if the chat is verified //@is_scam True, if many users reported this chat as a scam //@is_fake True, if many users reported this chat as a fake account -chatInviteLinkInfo chat_id:int53 accessible_for:int32 type:InviteLinkChatType title:string photo:chatPhotoInfo accent_color_id:int32 description:string member_count:int32 member_user_ids:vector creates_join_request:Bool is_public:Bool is_verified:Bool is_scam:Bool is_fake:Bool = ChatInviteLinkInfo; +chatInviteLinkInfo chat_id:int53 accessible_for:int32 type:InviteLinkChatType title:string photo:chatPhotoInfo accent_color_id:int32 description:string member_count:int32 member_user_ids:vector subscription_info:chatInviteLinkSubscriptionInfo creates_join_request:Bool is_public:Bool is_verified:Bool is_scam:Bool is_fake:Bool = ChatInviteLinkInfo; //@description Describes a user that sent a join request and waits for administrator approval @user_id User identifier @date Point in time (Unix timestamp) when the user sent the join request @bio A short bio of the user @@ -1293,7 +1352,8 @@ basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int53 memb //@boost_level Approximate boost level for the chat //@has_linked_chat True, if the channel has a discussion group, or the supergroup is the designated discussion group for a channel //@has_location True, if the supergroup is connected to a location, i.e. the supergroup is a location-based supergroup -//@sign_messages True, if messages sent to the channel need to contain information about the sender. This field is only applicable to channels +//@sign_messages True, if messages sent to the channel contains name of the sender. This field is only applicable to channels +//@show_message_sender True, if messages sent to the channel have information about the sender user. This field is only applicable to channels //@join_to_send_messages True, if users need to join the supergroup before they can send messages. Always true for channels and non-discussion supergroups //@join_by_request True, if all users directly joining the supergroup need to be approved by supergroup administrators. Always false for channels and supergroups without username, location, or a linked chat //@is_slow_mode_enabled True, if the slow mode is enabled in the supergroup @@ -1301,12 +1361,13 @@ basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int53 memb //@is_broadcast_group True, if the supergroup is a broadcast group, i.e. only administrators can send messages and there is no limit on the number of members //@is_forum True, if the supergroup is a forum with topics //@is_verified True, if the supergroup or channel is verified +//@has_sensitive_content True, if content of media messages in the supergroup or channel chat must be hidden with 18+ spoiler //@restriction_reason If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted //@is_scam True, if many users reported this supergroup or channel as a scam //@is_fake True, if many users reported this supergroup or channel as a fake account //@has_active_stories True, if the supergroup or channel has non-expired stories available to the current user //@has_unread_active_stories True, if the supergroup or channel has unread non-expired stories available to the current user -supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 boost_level:int32 has_linked_chat:Bool has_location:Bool sign_messages:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool is_verified:Bool restriction_reason:string is_scam:Bool is_fake:Bool has_active_stories:Bool has_unread_active_stories:Bool = Supergroup; +supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 boost_level:int32 has_linked_chat:Bool has_location:Bool sign_messages:Bool show_message_sender:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool is_verified:Bool has_sensitive_content:Bool restriction_reason:string is_scam:Bool is_fake:Bool has_active_stories:Bool has_unread_active_stories:Bool = Supergroup; //@description Contains full information about a supergroup or channel //@photo Chat photo; may be null if empty or unknown. If non-null, then it is the same photo as in chat.photo @@ -1318,6 +1379,7 @@ supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:Chat //@linked_chat_id 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 //@slow_mode_delay Delay between consecutive sent messages for non-administrator supergroup members, in seconds //@slow_mode_delay_expires_in 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 +//@can_enable_paid_reaction True, if paid reaction can be enabled in the channel chat; for channels only //@can_get_members True, if members of the chat can be retrieved via getSupergroupMembers or searchChatMembers //@has_hidden_members True, if non-administrators can receive only administrators and bots using getSupergroupMembers or searchChatMembers //@can_hide_members True, if non-administrators and non-bots can be hidden in responses to getSupergroupMembers and searchChatMembers for non-administrators @@ -1342,7 +1404,7 @@ supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:Chat //@bot_commands List of commands of bots in the group //@upgraded_from_basic_group_id Identifier of the basic group from which supergroup was upgraded; 0 if none //@upgraded_from_max_message_id Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none -supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_get_revenue_statistics:Bool can_get_star_revenue_statistics:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool can_have_sponsored_messages:Bool has_aggressive_anti_spam_enabled:Bool has_paid_media_allowed:Bool has_pinned_stories:Bool my_boost_count:int32 unrestrict_boost_count:int32 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; +supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_enable_paid_reaction:Bool can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_get_revenue_statistics:Bool can_get_star_revenue_statistics:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool can_have_sponsored_messages:Bool has_aggressive_anti_spam_enabled:Bool has_paid_media_allowed:Bool has_pinned_stories:Bool my_boost_count:int32 unrestrict_boost_count:int32 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; //@class SecretChatState @description Describes the current secret chat state @@ -1452,6 +1514,17 @@ reactionTypeEmoji emoji:string = ReactionType; //@description A reaction with a custom emoji @custom_emoji_id Unique identifier of the custom emoji reactionTypeCustomEmoji custom_emoji_id:int64 = ReactionType; +//@description The paid reaction in a channel chat +reactionTypePaid = ReactionType; + + +//@description Contains information about a user that added paid reactions +//@sender_id Identifier of the user or chat that added the reactions; may be null for anonymous reactors that aren't the current user +//@star_count Number of Telegram Stars added +//@is_top True, if the reactor is one of the most active reactors; can be false if the reactor is the current user +//@is_me True, if the paid reaction was added by the current user +//@is_anonymous True, if the reactor is anonymous +paidReactor sender_id:MessageSender star_count:int32 is_top:Bool is_me:Bool is_anonymous:Bool = PaidReactor; //@description Contains information about a forwarded message //@origin Origin of the forwarded message @@ -1481,9 +1554,12 @@ messageReplyInfo reply_count:int32 recent_replier_ids:vector last //@recent_sender_ids Identifiers of at most 3 recent message senders, added the reaction; available in private, basic group and supergroup chats messageReaction type:ReactionType total_count:int32 is_chosen:Bool used_sender_id:MessageSender recent_sender_ids:vector = MessageReaction; -//@description Contains a list of reactions added to a message @reactions List of added reactions @are_tags True, if the reactions are tags and Telegram Premium users can filter messages by them -messageReactions reactions:vector are_tags:Bool = MessageReactions; - +//@description Contains a list of reactions added to a message +//@reactions List of added reactions +//@are_tags True, if the reactions are tags and Telegram Premium users can filter messages by them +//@paid_reactors Information about top users that added the paid reaction +//@can_get_added_reactions True, if the list of added reactions is available using getMessageAddedReactions +messageReactions reactions:vector are_tags:Bool paid_reactors:vector can_get_added_reactions:Bool = MessageReactions; //@description Contains information about interactions with a message //@view_count Number of times the message was viewed @@ -1620,10 +1696,11 @@ factCheck text:formattedText country_code:string = FactCheck; //@author_signature For channel posts and anonymous group messages, optional author signature //@media_album_id Unique identifier of an album this message belongs to; 0 if none. Only audios, documents, photos and videos can be grouped together in albums //@effect_id Unique identifier of the effect added to the message; 0 if none +//@has_sensitive_content True, if media content of the message must be hidden with 18+ spoiler //@restriction_reason If non-empty, contains a human-readable description of the reason why access to this message must be restricted //@content Content of the message //@reply_markup Reply markup for the message; may be null if none -message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool is_from_offline:Bool can_be_saved:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector fact_check:factCheck reply_to:MessageReplyTo message_thread_id:int53 saved_messages_topic_id:int53 self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 sender_business_bot_user_id:int53 sender_boost_count:int32 author_signature:string media_album_id:int64 effect_id:int64 restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; +message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool is_from_offline:Bool can_be_saved:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector fact_check:factCheck reply_to:MessageReplyTo message_thread_id:int53 saved_messages_topic_id:int53 self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 sender_business_bot_user_id:int53 sender_boost_count:int32 author_signature:string media_album_id:int64 effect_id:int64 has_sensitive_content:Bool restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; //@description Contains a list of messages @total_count Approximate total number of messages found @messages List of messages; messages may be null @@ -1698,7 +1775,7 @@ messageSponsor url:string photo:photo info:string = MessageSponsor; //@message_id Message identifier; unique for the chat to which the sponsored message belongs among both ordinary and sponsored messages //@is_recommended True, if the message needs to be labeled as "recommended" instead of "sponsored" //@can_be_reported True, if the message can be reported to Telegram moderators through reportChatSponsoredMessage -//@content Content of the message. Currently, can be only of the type messageText +//@content Content of the message. Currently, can be only of the types messageText, messageAnimation, messagePhoto, or messageVideo //@sponsor Information about the sponsor of the message //@title Title of the sponsored message //@button_text Text for the message action button @@ -1933,7 +2010,8 @@ chatPosition list:ChatList order:int64 is_pinned:Bool source:ChatSource = ChatPo //@class ChatAvailableReactions @description Describes reactions available in the chat -//@description All reactions are available in the chat @max_reaction_count The maximum allowed number of reactions per message; 1-11 +//@description All reactions are available in the chat, excluding the paid reaction and custom reactions in channel chats +//@max_reaction_count The maximum allowed number of reactions per message; 1-11 chatAvailableReactionsAll max_reaction_count:int32 = ChatAvailableReactions; //@description Only specific reactions are available in the chat @reactions The list of reactions @max_reaction_count The maximum allowed number of reactions per message; 1-11 @@ -2602,8 +2680,10 @@ linkPreviewTypeArticle photo:photo author:string = LinkPreviewType; //@author Author of the audio linkPreviewTypeAudio url:string mime_type:string audio:audio duration:int32 author:string = LinkPreviewType; -//@description The link is a link to a background. Link preview title and description are available only for filled backgrounds @document Document with the background; may be null for filled backgrounds -linkPreviewTypeBackground document:document = LinkPreviewType; +//@description The link is a link to a background. Link preview title and description are available only for filled backgrounds +//@document Document with the background; may be null for filled backgrounds +//@background_type Type of the background; may be null if unknown +linkPreviewTypeBackground document:document background_type:BackgroundType = LinkPreviewType; //@description The link is a link to boost a channel chat @photo Photo of the chat; may be null linkPreviewTypeChannelBoost photo:chatPhoto = LinkPreviewType; @@ -2659,7 +2739,7 @@ linkPreviewTypePremiumGiftCode = LinkPreviewType; //@description The link is a link to a shareable chat folder linkPreviewTypeShareableChatFolder = LinkPreviewType; -//@description The link is a link to a sticker message @sticker The sticker +//@description The link is a link to a sticker @sticker The sticker. It can be an arbitrary WEBP image and can have dimensions bigger than 512 linkPreviewTypeSticker sticker:sticker = LinkPreviewType; //@description The link is a link to a sticker set @stickers Up to 4 stickers from the sticker set @@ -3890,7 +3970,6 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool cop //@can_be_saved True, if content of the message can be saved locally or copied using inputMessageForwarded or forwardMessages with copy options //@can_be_shared_in_story True, if the message can be shared in a story using inputStoryAreaTypeMessage //@can_edit_scheduling_state True, if scheduling state of the message can be edited -//@can_get_added_reactions True, if the list of added reactions is available using getMessageAddedReactions //@can_get_embedding_code True, if code for message embedding can be received using getMessageEmbeddingCode //@can_get_link True, if a link can be generated for the message using getMessageLink //@can_get_media_timestamp_links True, if media timestamp links can be generated for media timestamp entities in the message text, caption or link preview description using getMessageLink @@ -3904,7 +3983,7 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool cop //@can_report_supergroup_spam True, if the message can be reported using reportSupergroupSpam //@can_set_fact_check True, if fact check for the message can be changed through setMessageFactCheck //@need_show_statistics True, if message statistics must be available from context menu of the message -messageProperties can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_paid:Bool can_be_pinned:Bool can_be_replied:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_shared_in_story:Bool can_edit_scheduling_state:Bool can_get_added_reactions:Bool can_get_embedding_code:Bool can_get_link:Bool can_get_media_timestamp_links:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_statistics:Bool can_get_viewers:Bool can_recognize_speech:Bool can_report_chat:Bool can_report_reactions:Bool can_report_supergroup_spam:Bool can_set_fact_check:Bool need_show_statistics:Bool = MessageProperties; +messageProperties can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_paid:Bool can_be_pinned:Bool can_be_replied:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_shared_in_story:Bool can_edit_scheduling_state:Bool can_get_embedding_code:Bool can_get_link:Bool can_get_media_timestamp_links:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_statistics:Bool can_get_viewers:Bool can_recognize_speech:Bool can_report_chat:Bool can_report_reactions:Bool can_report_supergroup_spam:Bool can_set_fact_check:Bool need_show_statistics:Bool = MessageProperties; //@class SearchMessagesFilter @description Represents a filter for message search results @@ -5284,6 +5363,9 @@ chatEventHasAggressiveAntiSpamEnabledToggled has_aggressive_anti_spam_enabled:Bo //@description The sign_messages setting of a channel was toggled @sign_messages New value of sign_messages chatEventSignMessagesToggled sign_messages:Bool = ChatEventAction; +//@description The show_message_sender setting of a channel was toggled @show_message_sender New value of show_message_sender +chatEventShowMessageSenderToggled show_message_sender:Bool = ChatEventAction; + //@description A chat invite link was edited @old_invite_link Previous information about the invite link @new_invite_link New information about the invite link chatEventInviteLinkEdited old_invite_link:chatInviteLink new_invite_link:chatInviteLink = ChatEventAction; @@ -5713,6 +5795,9 @@ telegramPaymentPurposeStars currency:string amount:int53 star_count:int53 = Tele //@star_count Number of bought Telegram Stars telegramPaymentPurposeGiftedStars user_id:int53 currency:string amount:int53 star_count:int53 = TelegramPaymentPurpose; +//@description The user joins a chat and subscribes to regular payments in Telegram Stars @invite_link Invite link to use +telegramPaymentPurposeJoinChat invite_link:string = TelegramPaymentPurpose; + //@class DeviceToken @description Represents a data needed to subscribe for push notifications through registerDevice method. To use specific push notification service, the correct application platform must be specified and a valid server authentication data must be uploaded at https://my.telegram.org @@ -6435,7 +6520,7 @@ internalLinkTypeActiveSessions = InternalLinkType; //@description The link is a link to an attachment menu bot to be opened in the specified or a chosen chat. Process given target_chat to open the chat. //-Then, call searchPublicChat with the given bot username, check that the user is a bot and can be added to attachment menu. Then, use getAttachmentMenuBot to receive information about the bot. -//-If the bot isn't added to attachment menu, then show a disclaimer about Mini Apps being third-party apps, ask the user to accept their Terms of service and confirm adding the bot to side and attachment menu. +//-If the bot isn't added to attachment menu, then show a disclaimer about Mini Apps being third-party applications, ask the user to accept their Terms of service and confirm adding the bot to side and attachment menu. //-If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. //-If the attachment menu bot can't be used in the opened chat, show an error to the user. If the bot is added to attachment menu and can be used in the chat, then use openWebApp with the given URL //@target_chat Target chat to be opened @@ -6481,7 +6566,12 @@ internalLinkTypeBotStartInGroup bot_username:string start_parameter:string admin //@link_name Name of the link internalLinkTypeBusinessChat link_name:string = InternalLinkType; -//@description The link is a link to the change phone number section of the app +//@description The link is a link to the Telegram Star purchase section of the application +//@star_count The number of Telegram Stars that must be owned by the user +//@purpose Purpose of Telegram Star purchase. Arbitrary string specified by the server, for example, "subs" if the Telegram Stars are required to extend channel subscriptions +internalLinkTypeBuyStars star_count:int53 purpose:string = InternalLinkType; + +//@description The link is a link to the change phone number section of the application internalLinkTypeChangePhoneNumber = InternalLinkType; //@description The link is a link to boost a Telegram chat. Call getChatBoostLinkInfo with the given URL to process the link. @@ -6495,7 +6585,7 @@ internalLinkTypeChatBoost url:string = InternalLinkType; //@invite_link Internal representation of the invite link internalLinkTypeChatFolderInvite invite_link:string = InternalLinkType; -//@description The link is a link to the folder section of the app settings +//@description The link is a link to the folder section of the application settings internalLinkTypeChatFolderSettings = InternalLinkType; //@description The link is a chat invite link. Call checkChatInviteLink with the given invite link to process the link. @@ -6503,10 +6593,10 @@ internalLinkTypeChatFolderSettings = InternalLinkType; //@invite_link Internal representation of the invite link internalLinkTypeChatInvite invite_link:string = InternalLinkType; -//@description The link is a link to the default message auto-delete timer settings section of the app settings +//@description The link is a link to the default message auto-delete timer settings section of the application settings internalLinkTypeDefaultMessageAutoDeleteTimerSettings = InternalLinkType; -//@description The link is a link to the edit profile section of the app settings +//@description The link is a link to the edit profile section of the application settings internalLinkTypeEditProfileSettings = InternalLinkType; //@description The link is a link to a game. Call searchPublicChat with the given bot username, check that the user is a bot, @@ -6529,12 +6619,12 @@ internalLinkTypeInvoice invoice_name:string = InternalLinkType; //@language_pack_id Language pack identifier internalLinkTypeLanguagePack language_pack_id:string = InternalLinkType; -//@description The link is a link to the language section of the app settings +//@description The link is a link to the language section of the application settings internalLinkTypeLanguageSettings = InternalLinkType; //@description The link is a link to the main Web App of a bot. Call searchPublicChat with the given bot username, check that the user is a bot and has the main Web App. //-If the bot can be added to attachment menu, then use getAttachmentMenuBot to receive information about the bot, then if the bot isn't added to side menu, -//-show a disclaimer about Mini Apps being third-party apps, ask the user to accept their Terms of service and confirm adding the bot to side and attachment menu, +//-show a disclaimer about Mini Apps being third-party applications, ask the user to accept their Terms of service and confirm adding the bot to side and attachment menu, //-then if the user accepts the terms and confirms adding, use toggleBotIsAddedToAttachmentMenu to add the bot. //-Then, use getMainWebApp with the given start parameter and open the returned URL as a Web App //@bot_username Username of the bot @@ -6579,7 +6669,7 @@ internalLinkTypePremiumGift referrer:string = InternalLinkType; //@code The Telegram Premium gift code internalLinkTypePremiumGiftCode code:string = InternalLinkType; -//@description The link is a link to the privacy and security section of the app settings +//@description The link is a link to the privacy and security section of the application settings internalLinkTypePrivacyAndSecuritySettings = InternalLinkType; //@description The link is a link to a proxy. Call addProxy with the given parameters to process the link and add the proxy @@ -6620,7 +6710,7 @@ internalLinkTypeStory story_sender_username:string story_id:int32 = InternalLink //@description The link is a link to a cloud theme. TDLib has no theme support yet @theme_name Name of the theme internalLinkTypeTheme theme_name:string = InternalLinkType; -//@description The link is a link to the theme section of the app settings +//@description The link is a link to the theme section of the application settings internalLinkTypeThemeSettings = InternalLinkType; //@description The link is an unknown tg: link. Call getDeepLinkInfo to process the link @link Link to be passed to getDeepLinkInfo @@ -6648,7 +6738,7 @@ internalLinkTypeUserToken token:string = InternalLinkType; internalLinkTypeVideoChat chat_username:string invite_hash:string is_live_stream:Bool = InternalLinkType; //@description The link is a link to a Web App. Call searchPublicChat with the given bot username, check that the user is a bot, then call searchWebApp with the received bot and the given web_app_short_name. -//-Process received foundWebApp by showing a confirmation dialog if needed. If the bot can be added to attachment or side menu, but isn't added yet, then show a disclaimer about Mini Apps being third-party apps +//-Process received foundWebApp by showing a confirmation dialog if needed. If the bot can be added to attachment or side menu, but isn't added yet, then show a disclaimer about Mini Apps being third-party applications //-instead of the dialog and ask the user to accept their Terms of service. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. //-Then, call getWebAppLinkUrl and open the returned URL as a Web App //@bot_username Username of the bot that owns the Web App @@ -6988,6 +7078,10 @@ suggestedActionSetBirthdate = SuggestedAction; //@description Suggests the user to extend their expiring Telegram Premium subscription @manage_premium_subscription_url A URL for managing Telegram Premium subscription suggestedActionExtendPremium manage_premium_subscription_url:string = SuggestedAction; +//@description Suggests the user to extend their expiring Telegram Star subscriptions. Call getStarSubscriptions with only_expiring == true +//-to get the number of expiring subscriptions and the number of required to buy Telegram Stars +suggestedActionExtendStarSubscriptions = SuggestedAction; + //@description Contains a counter @count Count count count:int32 = Count; @@ -7749,6 +7843,10 @@ updateDefaultReactionType reaction_type:ReactionType = Update; //@tags The new tags updateSavedMessagesTags saved_messages_topic_id:int53 tags:savedMessagesTags = Update; +//@description The list of messages with active live location that need to be updated by the application has changed. The list is persistent across application restarts only if the message database is used +//@messages The list of messages with active live locations +updateActiveLiveLocationMessages messages:vector = Update; + //@description The number of Telegram Stars owned by the current user has changed @star_count The new number of Telegram Stars owned updateOwnedStarCount star_count:int53 = Update; @@ -8476,9 +8574,6 @@ deleteAllCallMessages revoke:Bool = Ok; //@description Returns information about the recent locations of chat members that were sent to the chat. Returns up to 1 location message per user @chat_id Chat identifier @limit The maximum number of messages to be returned searchChatRecentLocationMessages chat_id:int53 limit:int32 = Messages; -//@description Returns all active live locations that need to be updated by the application. The list is persistent across application restarts only if the message database is used -getActiveLiveLocationMessages = Messages; - //@description Returns the last message sent in a chat no later than the specified date @chat_id Chat identifier @date Point in time (Unix timestamp) relative to which to search for messages getChatMessageByDate chat_id:int53 date:int32 = Message; @@ -8989,7 +9084,7 @@ clearRecentReactions = Ok; //@description Adds a reaction or a tag to a message. Use getMessageAvailableReactions to receive the list of available reactions for the message //@chat_id Identifier of the chat to which the message belongs //@message_id Identifier of the message -//@reaction_type Type of the reaction to add +//@reaction_type Type of the reaction to add. Use addPaidMessageReaction instead to add the paid reaction //@is_big Pass true if the reaction is added with a big animation //@update_recent_reactions Pass true if the reaction needs to be added to recent reactions; tags are never added to the list of recent reactions addMessageReaction chat_id:int53 message_id:int53 reaction_type:ReactionType is_big:Bool update_recent_reactions:Bool = Ok; @@ -8997,9 +9092,27 @@ addMessageReaction chat_id:int53 message_id:int53 reaction_type:ReactionType is_ //@description Removes a reaction from a message. A chosen reaction can always be removed //@chat_id Identifier of the chat to which the message belongs //@message_id Identifier of the message -//@reaction_type Type of the reaction to remove +//@reaction_type Type of the reaction to remove. The paid reaction can't be removed removeMessageReaction chat_id:int53 message_id:int53 reaction_type:ReactionType = Ok; +//@description Adds the paid message reaction to a message. Use getMessageAvailableReactions to receive the list of available reactions for the message +//@chat_id Identifier of the chat to which the message belongs +//@message_id Identifier of the message +//@star_count Number of Telegram Stars to be used for the reaction; 1-getOption("paid_reaction_star_count_max") +//@is_anonymous Pass true to make paid reaction of the user on the message anonymous; pass false to make the user's profile visible among top reactors +addPaidMessageReaction chat_id:int53 message_id:int53 star_count:int53 is_anonymous:Bool = Ok; + +//@description Removes all pending paid reactions on a message. Can be called within 5 seconds after the last addPaidMessageReaction call +//@chat_id Identifier of the chat to which the message belongs +//@message_id Identifier of the message +removePendingPaidMessageReactions chat_id:int53 message_id:int53 = Ok; + +//@description Changes whether the paid message reaction of the user to a message is anonymous. The message must have paid reaction added by the user +//@chat_id Identifier of the chat to which the message belongs +//@message_id Identifier of the message +//@is_anonymous Pass true to make paid reaction of the user on the message anonymous; pass false to make the user's profile visible among top reactors +togglePaidMessageReactionIsAnonymous chat_id:int53 message_id:int53 is_anonymous:Bool = Ok; + //@description Sets reactions on a message; for bots only //@chat_id Identifier of the chat to which the message belongs //@message_id Identifier of the message @@ -9009,13 +9122,13 @@ setMessageReactions chat_id:int53 message_id:int53 reaction_types:vector Date: Tue, 27 Aug 2024 22:08:45 +0800 Subject: [PATCH 24/54] Fix command parser --- client/extra.go | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/client/extra.go b/client/extra.go index 1a82ea9..61dd7fc 100644 --- a/client/extra.go +++ b/client/extra.go @@ -25,31 +25,19 @@ func IsCommand(text string) bool { func CheckCommand(text string, entities []*TextEntity) string { if IsCommand(text) { - // Check text entities and make bot happy! - if len(entities) >= 1 { - // Get first command - if entities[0].Type.TextEntityTypeType() == "textEntityTypeBotCommand" { - // e.g.: { "text": "/hello@world_bot", "textEntity": { offset: 0, length: 16 } } - // Result: "/hello" - if i := strings.Index(text[:entities[0].Length], "@"); i != -1 { - return text[:i] - } - return text[:entities[0].Length] - } - } else { - // Since userbot does not have bot command entities in Private Chat, so make userbot happy too! - // e.g.: ["/hello@world_bot", "/hello@", "/hello@123"] - // Result: "/hello" - if i := strings.Index(text, "@"); i != -1 { - return text[:i] - } - // e.g. ["/hello 123", "/hell o 123"] - // Result: "/hello", "/hell" - if i := strings.Index(text, " "); i != -1 { - return text[:i] - } - return text + // e.g.: ["/hello@world_bot", "/hello@", "/hello@123"] + // Result: "/hello" + if i := strings.Index(text, "@"); i != -1 { + return text[:i] } + + // e.g. ["/hello 123", "/hell o 123"] + // Result: "/hello", "/hell" + if i := strings.Index(text, " "); i != -1 { + return text[:i] + } + + return text } return "" } From ec1fb9c5e2cde46474c955a001f8253716abc018 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Sun, 15 Sep 2024 03:36:30 +0800 Subject: [PATCH 25/54] Update to TDLib 1.8.36 --- client/function.go | 152 ++++-- client/type.go | 1103 ++++++++++++++++++++++++++++++----------- client/unmarshaler.go | 433 +++++++++++----- data/td_api.tl | 336 ++++++++----- 4 files changed, 1472 insertions(+), 552 deletions(-) diff --git a/client/function.go b/client/function.go index 54cfddc..be058ef 100755 --- a/client/function.go +++ b/client/function.go @@ -1362,7 +1362,7 @@ type GetRepliedMessageRequest struct { MessageId int64 `json:"message_id"` } -// Returns information about a non-bundled message that is replied by a given message. Also, returns the pinned message, the game message, the invoice message, the message with a previously set same background, the giveaway message, and the topic creation message for messages of the types messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground, messagePremiumGiveawayCompleted and topic messages without non-bundled replied message respectively +// Returns information about a non-bundled message that is replied by a given message. Also, returns the pinned message, the game message, the invoice message, the message with a previously set same background, the giveaway message, and the topic creation message for messages of the types messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground, messageGiveawayCompleted and topic messages without non-bundled replied message respectively func (client *Client) GetRepliedMessage(req *GetRepliedMessageRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -2819,7 +2819,7 @@ type SearchSavedMessagesRequest struct { Limit int32 `json:"limit"` } -// Searches for messages tagged by the given reaction and with the given words in the Saved Messages chat; for Telegram Premium users only. Returns the results in reverse chronological order, i.e. in order of decreasing message_id For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit +// Searches for messages tagged by the given reaction and with the given words in the Saved Messages chat; for Telegram Premium users only. Returns the results in reverse chronological order, i.e. in order of decreasing message_id. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit func (client *Client) SearchSavedMessages(req *SearchSavedMessagesRequest) (*FoundChatMessages, error) { result, err := client.Send(Request{ meta: meta{ @@ -5041,7 +5041,7 @@ func CheckQuickReplyShortcutName(req *CheckQuickReplyShortcutNameRequest) (*Ok, func (client *Client) CheckQuickReplyShortcutName(req *CheckQuickReplyShortcutNameRequest) (*Ok, error) { return CheckQuickReplyShortcutName(req)} -// Loads quick reply shortcuts created by the current user. The loaded topics will be sent through updateQuickReplyShortcuts +// Loads quick reply shortcuts created by the current user. The loaded data will be sent through updateQuickReplyShortcut and updateQuickReplyShortcuts func (client *Client) LoadQuickReplyShortcuts() (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -5831,7 +5831,7 @@ type AddMessageReactionRequest struct { ChatId int64 `json:"chat_id"` // Identifier of the message MessageId int64 `json:"message_id"` - // Type of the reaction to add. Use addPaidMessageReaction instead to add the paid reaction + // Type of the reaction to add. Use addPendingPaidMessageReaction instead to add the paid reaction ReactionType ReactionType `json:"reaction_type"` // Pass true if the reaction is added with a big animation IsBig bool `json:"is_big"` @@ -5896,27 +5896,30 @@ func (client *Client) RemoveMessageReaction(req *RemoveMessageReactionRequest) ( return UnmarshalOk(result.Data) } -type AddPaidMessageReactionRequest struct { +type AddPendingPaidMessageReactionRequest struct { // Identifier of the chat to which the message belongs ChatId int64 `json:"chat_id"` // Identifier of the message MessageId int64 `json:"message_id"` - // Number of Telegram Stars to be used for the reaction; 1-getOption("paid_reaction_star_count_max") + // Number of Telegram Stars to be used for the reaction. The total number of pending paid reactions must not exceed getOption("paid_reaction_star_count_max") StarCount int64 `json:"star_count"` - // Pass true to make paid reaction of the user on the message anonymous; pass false to make the user's profile visible among top reactors + // Pass true if the user didn't choose anonymity explicitly, for example, the reaction is set from the message bubble + UseDefaultIsAnonymous bool `json:"use_default_is_anonymous"` + // Pass true to make paid reaction of the user on the message anonymous; pass false to make the user's profile visible among top reactors. Ignored if use_default_is_anonymous == true IsAnonymous bool `json:"is_anonymous"` } -// Adds the paid message reaction to a message. Use getMessageAvailableReactions to receive the list of available reactions for the message -func (client *Client) AddPaidMessageReaction(req *AddPaidMessageReactionRequest) (*Ok, error) { +// Adds the paid message reaction to a message. Use getMessageAvailableReactions to check whether the reaction is available for the message +func (client *Client) AddPendingPaidMessageReaction(req *AddPendingPaidMessageReactionRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "addPaidMessageReaction", + Type: "addPendingPaidMessageReaction", }, Data: map[string]interface{}{ "chat_id": req.ChatId, "message_id": req.MessageId, "star_count": req.StarCount, + "use_default_is_anonymous": req.UseDefaultIsAnonymous, "is_anonymous": req.IsAnonymous, }, }) @@ -5931,6 +5934,35 @@ func (client *Client) AddPaidMessageReaction(req *AddPaidMessageReactionRequest) return UnmarshalOk(result.Data) } +type CommitPendingPaidMessageReactionsRequest struct { + // Identifier of the chat to which the message belongs + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` +} + +// Applies all pending paid reactions on a message +func (client *Client) CommitPendingPaidMessageReactions(req *CommitPendingPaidMessageReactionsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "commitPendingPaidMessageReactions", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type RemovePendingPaidMessageReactionsRequest struct { // Identifier of the chat to which the message belongs ChatId int64 `json:"chat_id"` @@ -5938,7 +5970,7 @@ type RemovePendingPaidMessageReactionsRequest struct { MessageId int64 `json:"message_id"` } -// Removes all pending paid reactions on a message. Can be called within 5 seconds after the last addPaidMessageReaction call +// Removes all pending paid reactions on a message func (client *Client) RemovePendingPaidMessageReactions(req *RemovePendingPaidMessageReactionsRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -7030,18 +7062,18 @@ func (client *Client) AnswerInlineQuery(req *AnswerInlineQueryRequest) (*Ok, err return UnmarshalOk(result.Data) } -type GetPopularWebAppBotsRequest struct { +type GetGrossingWebAppBotsRequest struct { // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results Offset string `json:"offset"` // The maximum number of bots to be returned; up to 100 Limit int32 `json:"limit"` } -// Returns popular Web App bots -func (client *Client) GetPopularWebAppBots(req *GetPopularWebAppBotsRequest) (*FoundUsers, error) { +// Returns the most grossing Web App bots +func (client *Client) GetGrossingWebAppBots(req *GetGrossingWebAppBotsRequest) (*FoundUsers, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getPopularWebAppBots", + Type: "getGrossingWebAppBots", }, Data: map[string]interface{}{ "offset": req.Offset, @@ -9178,7 +9210,7 @@ type SetChatMessageAutoDeleteTimeRequest struct { MessageAutoDeleteTime int32 `json:"message_auto_delete_time"` } -// Changes the message auto-delete or self-destruct (for secret chats) time in a chat. Requires change_info administrator right in basic groups, supergroups and channels Message auto-delete time can't be changed in a chat with the current user (Saved Messages) and the chat 777000 (Telegram). +// Changes the message auto-delete or self-destruct (for secret chats) time in a chat. Requires change_info administrator right in basic groups, supergroups and channels. Message auto-delete time can't be changed in a chat with the current user (Saved Messages) and the chat 777000 (Telegram). func (client *Client) SetChatMessageAutoDeleteTime(req *SetChatMessageAutoDeleteTimeRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -10967,7 +10999,7 @@ type GetChatPostedToChatPageStoriesRequest struct { ChatId int64 `json:"chat_id"` // Identifier of the story starting from which stories must be returned; use 0 to get results from pinned and the newest story FromStoryId int32 `json:"from_story_id"` - // The maximum number of stories to be returned For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit + // The maximum number of stories to be returned. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit Limit int32 `json:"limit"` } @@ -10999,7 +11031,7 @@ type GetChatArchivedStoriesRequest struct { ChatId int64 `json:"chat_id"` // Identifier of the story starting from which stories must be returned; use 0 to get results from the last story FromStoryId int32 `json:"from_story_id"` - // The maximum number of stories to be returned For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit + // The maximum number of stories to be returned. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit Limit int32 `json:"limit"` } @@ -12543,7 +12575,7 @@ type EditChatInviteLinkRequest struct { CreatesJoinRequest bool `json:"creates_join_request"` } -// Edits a non-primary invite link for a chat. Available for basic groups, supergroups, and channels. If the link creates a subscription, then expiration_date, member_limit and creates_join_request must not be used Requires administrator privileges and can_invite_users right in the chat for own links and owner privileges for other links +// Edits a non-primary invite link for a chat. Available for basic groups, supergroups, and channels. If the link creates a subscription, then expiration_date, member_limit and creates_join_request must not be used. Requires administrator privileges and can_invite_users right in the chat for own links and owner privileges for other links func (client *Client) EditChatInviteLink(req *EditChatInviteLinkRequest) (*ChatInviteLink, error) { result, err := client.Send(Request{ meta: meta{ @@ -14853,6 +14885,32 @@ func (client *Client) GetStickerSet(req *GetStickerSetRequest) (*StickerSet, err return UnmarshalStickerSet(result.Data) } +type GetStickerSetNameRequest struct { + // Identifier of the sticker set + SetId JsonInt64 `json:"set_id"` +} + +// Returns name of a sticker set by its identifier +func (client *Client) GetStickerSetName(req *GetStickerSetNameRequest) (*Text, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getStickerSetName", + }, + Data: map[string]interface{}{ + "set_id": req.SetId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalText(result.Data) +} + type SearchStickerSetRequest struct { // Name of the sticker set Name string `json:"name"` @@ -21358,7 +21416,7 @@ type GetPremiumGiftCodePaymentOptionsRequest struct { BoostedChatId int64 `json:"boosted_chat_id"` } -// Returns available options for Telegram Premium gift code or giveaway creation +// Returns available options for Telegram Premium gift code or Telegram Premium giveaway creation func (client *Client) GetPremiumGiftCodePaymentOptions(req *GetPremiumGiftCodePaymentOptionsRequest) (*PremiumGiftCodePaymentOptions, error) { result, err := client.Send(Request{ meta: meta{ @@ -21431,22 +21489,28 @@ func (client *Client) ApplyPremiumGiftCode(req *ApplyPremiumGiftCodeRequest) (*O return UnmarshalOk(result.Data) } -type LaunchPrepaidPremiumGiveawayRequest struct { +type LaunchPrepaidGiveawayRequest struct { // Unique identifier of the prepaid giveaway GiveawayId JsonInt64 `json:"giveaway_id"` // Giveaway parameters - Parameters *PremiumGiveawayParameters `json:"parameters"` + Parameters *GiveawayParameters `json:"parameters"` + // The number of users to receive giveaway prize + WinnerCount int32 `json:"winner_count"` + // The number of Telegram Stars to be distributed through the giveaway; pass 0 for Telegram Premium giveaways + StarCount int64 `json:"star_count"` } -// Launches a prepaid Telegram Premium giveaway -func (client *Client) LaunchPrepaidPremiumGiveaway(req *LaunchPrepaidPremiumGiveawayRequest) (*Ok, error) { +// Launches a prepaid giveaway +func (client *Client) LaunchPrepaidGiveaway(req *LaunchPrepaidGiveawayRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "launchPrepaidPremiumGiveaway", + Type: "launchPrepaidGiveaway", }, Data: map[string]interface{}{ "giveaway_id": req.GiveawayId, "parameters": req.Parameters, + "winner_count": req.WinnerCount, + "star_count": req.StarCount, }, }) if err != nil { @@ -21460,18 +21524,18 @@ func (client *Client) LaunchPrepaidPremiumGiveaway(req *LaunchPrepaidPremiumGive return UnmarshalOk(result.Data) } -type GetPremiumGiveawayInfoRequest struct { +type GetGiveawayInfoRequest struct { // Identifier of the channel chat which started the giveaway ChatId int64 `json:"chat_id"` // Identifier of the giveaway or a giveaway winners message in the chat MessageId int64 `json:"message_id"` } -// Returns information about a Telegram Premium giveaway -func (client *Client) GetPremiumGiveawayInfo(req *GetPremiumGiveawayInfoRequest) (PremiumGiveawayInfo, error) { +// Returns information about a giveaway +func (client *Client) GetGiveawayInfo(req *GetGiveawayInfoRequest) (GiveawayInfo, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getPremiumGiveawayInfo", + Type: "getGiveawayInfo", }, Data: map[string]interface{}{ "chat_id": req.ChatId, @@ -21487,11 +21551,11 @@ func (client *Client) GetPremiumGiveawayInfo(req *GetPremiumGiveawayInfoRequest) } switch result.Type { - case TypePremiumGiveawayInfoOngoing: - return UnmarshalPremiumGiveawayInfoOngoing(result.Data) + case TypeGiveawayInfoOngoing: + return UnmarshalGiveawayInfoOngoing(result.Data) - case TypePremiumGiveawayInfoCompleted: - return UnmarshalPremiumGiveawayInfoCompleted(result.Data) + case TypeGiveawayInfoCompleted: + return UnmarshalGiveawayInfoCompleted(result.Data) default: return nil, errors.New("invalid type") @@ -21543,6 +21607,25 @@ func (client *Client) GetStarGiftPaymentOptions(req *GetStarGiftPaymentOptionsRe return UnmarshalStarPaymentOptions(result.Data) } +// Returns available options for Telegram Star giveaway creation +func (client *Client) GetStarGiveawayPaymentOptions() (*StarGiveawayPaymentOptions, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getStarGiveawayPaymentOptions", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStarGiveawayPaymentOptions(result.Data) +} + type GetStarTransactionsRequest struct { // Identifier of the owner of the Telegram Stars; can be the identifier of the current user, identifier of an owned bot, or identifier of a channel chat with supergroupFullInfo.can_get_star_revenue_statistics == true OwnerId MessageSender `json:"owner_id"` @@ -23450,6 +23533,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateMessageReactions: return UnmarshalUpdateMessageReactions(result.Data) + case TypeUpdatePaidMediaPurchased: + return UnmarshalUpdatePaidMediaPurchased(result.Data) + default: return nil, errors.New("invalid type") } diff --git a/client/type.go b/client/type.go index 68e1553..dcfb917 100755 --- a/client/type.go +++ b/client/type.go @@ -25,10 +25,11 @@ const ( ClassInputChatPhoto = "InputChatPhoto" ClassStarTransactionDirection = "StarTransactionDirection" ClassBotTransactionPurpose = "BotTransactionPurpose" - ClassChannelTransactionPurpose = "ChannelTransactionPurpose" + ClassChatTransactionPurpose = "ChatTransactionPurpose" ClassStarTransactionPartner = "StarTransactionPartner" - ClassPremiumGiveawayParticipantStatus = "PremiumGiveawayParticipantStatus" - ClassPremiumGiveawayInfo = "PremiumGiveawayInfo" + ClassGiveawayParticipantStatus = "GiveawayParticipantStatus" + ClassGiveawayInfo = "GiveawayInfo" + ClassGiveawayPrize = "GiveawayPrize" ClassChatMemberStatus = "ChatMemberStatus" ClassChatMembersFilter = "ChatMembersFilter" ClassSupergroupMembersFilter = "SupergroupMembersFilter" @@ -240,6 +241,9 @@ const ( ClassPremiumGiftCodeInfo = "PremiumGiftCodeInfo" ClassStarPaymentOption = "StarPaymentOption" ClassStarPaymentOptions = "StarPaymentOptions" + ClassStarGiveawayWinnerOption = "StarGiveawayWinnerOption" + ClassStarGiveawayPaymentOption = "StarGiveawayPaymentOption" + ClassStarGiveawayPaymentOptions = "StarGiveawayPaymentOptions" ClassStarTransaction = "StarTransaction" ClassStarTransactions = "StarTransactions" ClassAccentColor = "AccentColor" @@ -374,7 +378,7 @@ const ( ClassValidatedOrderInfo = "ValidatedOrderInfo" ClassPaymentResult = "PaymentResult" ClassPaymentReceipt = "PaymentReceipt" - ClassPremiumGiveawayParameters = "PremiumGiveawayParameters" + ClassGiveawayParameters = "GiveawayParameters" ClassDatedFile = "DatedFile" ClassDate = "Date" ClassPersonalDetails = "PersonalDetails" @@ -431,7 +435,7 @@ const ( ClassBotMediaPreviewInfo = "BotMediaPreviewInfo" ClassChatBoostLevelFeatures = "ChatBoostLevelFeatures" ClassChatBoostFeatures = "ChatBoostFeatures" - ClassPrepaidPremiumGiveaway = "PrepaidPremiumGiveaway" + ClassPrepaidGiveaway = "PrepaidGiveaway" ClassChatBoostStatus = "ChatBoostStatus" ClassChatBoost = "ChatBoost" ClassFoundChatBoosts = "FoundChatBoosts" @@ -705,13 +709,17 @@ const ( TypePremiumGiftCodeInfo = "premiumGiftCodeInfo" TypeStarPaymentOption = "starPaymentOption" TypeStarPaymentOptions = "starPaymentOptions" + TypeStarGiveawayWinnerOption = "starGiveawayWinnerOption" + TypeStarGiveawayPaymentOption = "starGiveawayPaymentOption" + TypeStarGiveawayPaymentOptions = "starGiveawayPaymentOptions" TypeStarTransactionDirectionIncoming = "starTransactionDirectionIncoming" TypeStarTransactionDirectionOutgoing = "starTransactionDirectionOutgoing" TypeBotTransactionPurposePaidMedia = "botTransactionPurposePaidMedia" TypeBotTransactionPurposeInvoicePayment = "botTransactionPurposeInvoicePayment" - TypeChannelTransactionPurposePaidMedia = "channelTransactionPurposePaidMedia" - TypeChannelTransactionPurposeJoin = "channelTransactionPurposeJoin" - TypeChannelTransactionPurposeReaction = "channelTransactionPurposeReaction" + TypeChatTransactionPurposePaidMedia = "chatTransactionPurposePaidMedia" + TypeChatTransactionPurposeJoin = "chatTransactionPurposeJoin" + TypeChatTransactionPurposeReaction = "chatTransactionPurposeReaction" + TypeChatTransactionPurposeGiveaway = "chatTransactionPurposeGiveaway" TypeStarTransactionPartnerTelegram = "starTransactionPartnerTelegram" TypeStarTransactionPartnerAppStore = "starTransactionPartnerAppStore" TypeStarTransactionPartnerGooglePlay = "starTransactionPartnerGooglePlay" @@ -719,18 +727,20 @@ const ( TypeStarTransactionPartnerTelegramAds = "starTransactionPartnerTelegramAds" TypeStarTransactionPartnerBot = "starTransactionPartnerBot" TypeStarTransactionPartnerBusiness = "starTransactionPartnerBusiness" - TypeStarTransactionPartnerChannel = "starTransactionPartnerChannel" + TypeStarTransactionPartnerChat = "starTransactionPartnerChat" TypeStarTransactionPartnerUser = "starTransactionPartnerUser" TypeStarTransactionPartnerUnsupported = "starTransactionPartnerUnsupported" TypeStarTransaction = "starTransaction" TypeStarTransactions = "starTransactions" - TypePremiumGiveawayParticipantStatusEligible = "premiumGiveawayParticipantStatusEligible" - TypePremiumGiveawayParticipantStatusParticipating = "premiumGiveawayParticipantStatusParticipating" - TypePremiumGiveawayParticipantStatusAlreadyWasMember = "premiumGiveawayParticipantStatusAlreadyWasMember" - TypePremiumGiveawayParticipantStatusAdministrator = "premiumGiveawayParticipantStatusAdministrator" - TypePremiumGiveawayParticipantStatusDisallowedCountry = "premiumGiveawayParticipantStatusDisallowedCountry" - TypePremiumGiveawayInfoOngoing = "premiumGiveawayInfoOngoing" - TypePremiumGiveawayInfoCompleted = "premiumGiveawayInfoCompleted" + TypeGiveawayParticipantStatusEligible = "giveawayParticipantStatusEligible" + TypeGiveawayParticipantStatusParticipating = "giveawayParticipantStatusParticipating" + TypeGiveawayParticipantStatusAlreadyWasMember = "giveawayParticipantStatusAlreadyWasMember" + TypeGiveawayParticipantStatusAdministrator = "giveawayParticipantStatusAdministrator" + TypeGiveawayParticipantStatusDisallowedCountry = "giveawayParticipantStatusDisallowedCountry" + TypeGiveawayInfoOngoing = "giveawayInfoOngoing" + TypeGiveawayInfoCompleted = "giveawayInfoCompleted" + TypeGiveawayPrizePremium = "giveawayPrizePremium" + TypeGiveawayPrizeStars = "giveawayPrizeStars" TypeAccentColor = "accentColor" TypeProfileAccentColors = "profileAccentColors" TypeProfileAccentColor = "profileAccentColor" @@ -1025,6 +1035,8 @@ const ( TypeLinkPreviewTypeEmbeddedAnimationPlayer = "linkPreviewTypeEmbeddedAnimationPlayer" TypeLinkPreviewTypeEmbeddedAudioPlayer = "linkPreviewTypeEmbeddedAudioPlayer" TypeLinkPreviewTypeEmbeddedVideoPlayer = "linkPreviewTypeEmbeddedVideoPlayer" + TypeLinkPreviewTypeExternalAudio = "linkPreviewTypeExternalAudio" + TypeLinkPreviewTypeExternalVideo = "linkPreviewTypeExternalVideo" TypeLinkPreviewTypeInvoice = "linkPreviewTypeInvoice" TypeLinkPreviewTypeMessage = "linkPreviewTypeMessage" TypeLinkPreviewTypePhoto = "linkPreviewTypePhoto" @@ -1082,7 +1094,7 @@ const ( TypePaidMediaPhoto = "paidMediaPhoto" TypePaidMediaVideo = "paidMediaVideo" TypePaidMediaUnsupported = "paidMediaUnsupported" - TypePremiumGiveawayParameters = "premiumGiveawayParameters" + TypeGiveawayParameters = "giveawayParameters" TypeDatedFile = "datedFile" TypePassportElementTypePersonalDetails = "passportElementTypePersonalDetails" TypePassportElementTypePassport = "passportElementTypePassport" @@ -1213,11 +1225,12 @@ const ( TypeMessagePaymentRefunded = "messagePaymentRefunded" TypeMessageGiftedPremium = "messageGiftedPremium" TypeMessagePremiumGiftCode = "messagePremiumGiftCode" - TypeMessagePremiumGiveawayCreated = "messagePremiumGiveawayCreated" - TypeMessagePremiumGiveaway = "messagePremiumGiveaway" - TypeMessagePremiumGiveawayCompleted = "messagePremiumGiveawayCompleted" - TypeMessagePremiumGiveawayWinners = "messagePremiumGiveawayWinners" + TypeMessageGiveawayCreated = "messageGiveawayCreated" + TypeMessageGiveaway = "messageGiveaway" + TypeMessageGiveawayCompleted = "messageGiveawayCompleted" + TypeMessageGiveawayWinners = "messageGiveawayWinners" TypeMessageGiftedStars = "messageGiftedStars" + TypeMessageGiveawayPrizeStars = "messageGiveawayPrizeStars" TypeMessageContactRegistered = "messageContactRegistered" TypeMessageUsersShared = "messageUsersShared" TypeMessageChatShared = "messageChatShared" @@ -1389,7 +1402,7 @@ const ( TypeChatBoostSourceGiftCode = "chatBoostSourceGiftCode" TypeChatBoostSourceGiveaway = "chatBoostSourceGiveaway" TypeChatBoostSourcePremium = "chatBoostSourcePremium" - TypePrepaidPremiumGiveaway = "prepaidPremiumGiveaway" + TypePrepaidGiveaway = "prepaidGiveaway" TypeChatBoostStatus = "chatBoostStatus" TypeChatBoost = "chatBoost" TypeFoundChatBoosts = "foundChatBoosts" @@ -1509,6 +1522,7 @@ const ( TypeChatEventMemberLeft = "chatEventMemberLeft" TypeChatEventMemberPromoted = "chatEventMemberPromoted" TypeChatEventMemberRestricted = "chatEventMemberRestricted" + TypeChatEventMemberSubscriptionExtended = "chatEventMemberSubscriptionExtended" TypeChatEventAvailableReactionsChanged = "chatEventAvailableReactionsChanged" TypeChatEventBackgroundChanged = "chatEventBackgroundChanged" TypeChatEventDescriptionChanged = "chatEventDescriptionChanged" @@ -1634,12 +1648,14 @@ const ( TypeStorePaymentPurposeGiftedPremium = "storePaymentPurposeGiftedPremium" TypeStorePaymentPurposePremiumGiftCodes = "storePaymentPurposePremiumGiftCodes" TypeStorePaymentPurposePremiumGiveaway = "storePaymentPurposePremiumGiveaway" + TypeStorePaymentPurposeStarGiveaway = "storePaymentPurposeStarGiveaway" TypeStorePaymentPurposeStars = "storePaymentPurposeStars" TypeStorePaymentPurposeGiftedStars = "storePaymentPurposeGiftedStars" TypeTelegramPaymentPurposePremiumGiftCodes = "telegramPaymentPurposePremiumGiftCodes" TypeTelegramPaymentPurposePremiumGiveaway = "telegramPaymentPurposePremiumGiveaway" TypeTelegramPaymentPurposeStars = "telegramPaymentPurposeStars" TypeTelegramPaymentPurposeGiftedStars = "telegramPaymentPurposeGiftedStars" + TypeTelegramPaymentPurposeStarGiveaway = "telegramPaymentPurposeStarGiveaway" TypeTelegramPaymentPurposeJoinChat = "telegramPaymentPurposeJoinChat" TypeDeviceTokenFirebaseCloudMessaging = "deviceTokenFirebaseCloudMessaging" TypeDeviceTokenApplePush = "deviceTokenApplePush" @@ -1707,7 +1723,7 @@ const ( TypePushMessageContentPhoto = "pushMessageContentPhoto" TypePushMessageContentPoll = "pushMessageContentPoll" TypePushMessageContentPremiumGiftCode = "pushMessageContentPremiumGiftCode" - TypePushMessageContentPremiumGiveaway = "pushMessageContentPremiumGiveaway" + TypePushMessageContentGiveaway = "pushMessageContentGiveaway" TypePushMessageContentScreenshotTaken = "pushMessageContentScreenshotTaken" TypePushMessageContentSticker = "pushMessageContentSticker" TypePushMessageContentStory = "pushMessageContentStory" @@ -2148,6 +2164,7 @@ const ( TypeUpdateChatBoost = "updateChatBoost" TypeUpdateMessageReaction = "updateMessageReaction" TypeUpdateMessageReactions = "updateMessageReactions" + TypeUpdatePaidMediaPurchased = "updatePaidMediaPurchased" TypeUpdates = "updates" TypeLogStreamDefault = "logStreamDefault" TypeLogStreamFile = "logStreamFile" @@ -2254,9 +2271,9 @@ type BotTransactionPurpose interface { BotTransactionPurposeType() string } -// Describes purpose of a transaction with a channel -type ChannelTransactionPurpose interface { - ChannelTransactionPurposeType() string +// Describes purpose of a transaction with a supergroup or a channel +type ChatTransactionPurpose interface { + ChatTransactionPurposeType() string } // Describes source or recipient of a transaction with Telegram Stars @@ -2264,14 +2281,19 @@ type StarTransactionPartner interface { StarTransactionPartnerType() string } -// Contains information about status of a user in a Telegram Premium giveaway -type PremiumGiveawayParticipantStatus interface { - PremiumGiveawayParticipantStatusType() string +// Contains information about status of a user in a giveaway +type GiveawayParticipantStatus interface { + GiveawayParticipantStatusType() string } -// Contains information about Telegram Premium giveaway -type PremiumGiveawayInfo interface { - PremiumGiveawayInfoType() string +// Contains information about a giveaway +type GiveawayInfo interface { + GiveawayInfoType() string +} + +// Contains information about a giveaway prize +type GiveawayPrize interface { + GiveawayPrizeType() string } // Provides information about the status of a member in a chat @@ -7363,7 +7385,7 @@ func (*PremiumStatePaymentOption) GetType() string { return TypePremiumStatePaymentOption } -// Describes an option for creating Telegram Premium gift codes. Use telegramPaymentPurposePremiumGiftCodes for out-of-store payments +// Describes an option for creating Telegram Premium gift codes or Telegram Premium giveaway. Use telegramPaymentPurposePremiumGiftCodes or telegramPaymentPurposePremiumGiveaway for out-of-store payments type PremiumGiftCodePaymentOption struct { meta // ISO 4217 currency code for Telegram Premium gift code payment @@ -7371,7 +7393,7 @@ type PremiumGiftCodePaymentOption struct { // The amount to pay, in the smallest units of the currency Amount int64 `json:"amount"` // Number of users which will be able to activate the gift codes - UserCount int32 `json:"user_count"` + WinnerCount int32 `json:"winner_count"` // Number of months the Telegram Premium subscription will be active MonthCount int32 `json:"month_count"` // Identifier of the store product associated with the option; may be empty if none @@ -7396,7 +7418,7 @@ func (*PremiumGiftCodePaymentOption) GetType() string { return TypePremiumGiftCodePaymentOption } -// Contains a list of options for creating Telegram Premium gift codes +// Contains a list of options for creating Telegram Premium gift codes or Telegram Premium giveaway type PremiumGiftCodePaymentOptions struct { meta // The list of options @@ -7537,6 +7559,93 @@ func (*StarPaymentOptions) GetType() string { return TypeStarPaymentOptions } +// Describes an option for the number of winners of a Telegram Star giveaway +type StarGiveawayWinnerOption struct { + meta + // The number of users that will be chosen as winners + WinnerCount int32 `json:"winner_count"` + // The number of Telegram Stars that will be won by the winners of the giveaway + WonStarCount int64 `json:"won_star_count"` + // True, if the option must be chosen by default + IsDefault bool `json:"is_default"` +} + +func (entity *StarGiveawayWinnerOption) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarGiveawayWinnerOption + + return json.Marshal((*stub)(entity)) +} + +func (*StarGiveawayWinnerOption) GetClass() string { + return ClassStarGiveawayWinnerOption +} + +func (*StarGiveawayWinnerOption) GetType() string { + return TypeStarGiveawayWinnerOption +} + +// Describes an option for creating Telegram Star giveaway. Use telegramPaymentPurposeStarGiveaway for out-of-store payments +type StarGiveawayPaymentOption struct { + meta + // ISO 4217 currency code for the payment + Currency string `json:"currency"` + // The amount to pay, in the smallest units of the currency + Amount int64 `json:"amount"` + // Number of Telegram Stars that will be distributed among winners + StarCount int64 `json:"star_count"` + // Identifier of the store product associated with the option; may be empty if none + StoreProductId string `json:"store_product_id"` + // Number of times the chat will be boosted for one year if the option is chosen + YearlyBoostCount int32 `json:"yearly_boost_count"` + // Allowed options for the number of giveaway winners + WinnerOptions []*StarGiveawayWinnerOption `json:"winner_options"` + // True, if the option must be chosen by default + IsDefault bool `json:"is_default"` + // True, if the option must be shown only in the full list of payment options + IsAdditional bool `json:"is_additional"` +} + +func (entity *StarGiveawayPaymentOption) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarGiveawayPaymentOption + + return json.Marshal((*stub)(entity)) +} + +func (*StarGiveawayPaymentOption) GetClass() string { + return ClassStarGiveawayPaymentOption +} + +func (*StarGiveawayPaymentOption) GetType() string { + return TypeStarGiveawayPaymentOption +} + +// Contains a list of options for creating Telegram Star giveaway +type StarGiveawayPaymentOptions struct { + meta + // The list of options + Options []*StarGiveawayPaymentOption `json:"options"` +} + +func (entity *StarGiveawayPaymentOptions) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarGiveawayPaymentOptions + + return json.Marshal((*stub)(entity)) +} + +func (*StarGiveawayPaymentOptions) GetClass() string { + return ClassStarGiveawayPaymentOptions +} + +func (*StarGiveawayPaymentOptions) GetType() string { + return TypeStarGiveawayPaymentOptions +} + // The transaction is incoming and increases the number of owned Telegram Stars type StarTransactionDirectionIncoming struct{ meta @@ -7592,6 +7701,8 @@ type BotTransactionPurposePaidMedia struct { meta // The bought media if the trancastion wasn't refunded Media []PaidMedia `json:"media"` + // Bot-provided payload; for bots only + Payload string `json:"payload"` } func (entity *BotTransactionPurposePaidMedia) MarshalJSON() ([]byte, error) { @@ -7617,6 +7728,7 @@ func (*BotTransactionPurposePaidMedia) BotTransactionPurposeType() string { func (botTransactionPurposePaidMedia *BotTransactionPurposePaidMedia) UnmarshalJSON(data []byte) error { var tmp struct { Media []json.RawMessage `json:"media"` + Payload string `json:"payload"` } err := json.Unmarshal(data, &tmp) @@ -7624,6 +7736,8 @@ func (botTransactionPurposePaidMedia *BotTransactionPurposePaidMedia) UnmarshalJ return err } + botTransactionPurposePaidMedia.Payload = tmp.Payload + fieldMedia, _ := UnmarshalListOfPaidMedia(tmp.Media) botTransactionPurposePaidMedia.Media = fieldMedia @@ -7660,35 +7774,35 @@ func (*BotTransactionPurposeInvoicePayment) BotTransactionPurposeType() string { } // Paid media were bought -type ChannelTransactionPurposePaidMedia struct { +type ChatTransactionPurposePaidMedia struct { meta - // Identifier of the corresponding message with paid media; can be an identifier of a deleted message + // Identifier of the corresponding message with paid media; can be 0 or an identifier of a deleted message MessageId int64 `json:"message_id"` // The bought media if the trancastion wasn't refunded Media []PaidMedia `json:"media"` } -func (entity *ChannelTransactionPurposePaidMedia) MarshalJSON() ([]byte, error) { +func (entity *ChatTransactionPurposePaidMedia) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ChannelTransactionPurposePaidMedia + type stub ChatTransactionPurposePaidMedia return json.Marshal((*stub)(entity)) } -func (*ChannelTransactionPurposePaidMedia) GetClass() string { - return ClassChannelTransactionPurpose +func (*ChatTransactionPurposePaidMedia) GetClass() string { + return ClassChatTransactionPurpose } -func (*ChannelTransactionPurposePaidMedia) GetType() string { - return TypeChannelTransactionPurposePaidMedia +func (*ChatTransactionPurposePaidMedia) GetType() string { + return TypeChatTransactionPurposePaidMedia } -func (*ChannelTransactionPurposePaidMedia) ChannelTransactionPurposeType() string { - return TypeChannelTransactionPurposePaidMedia +func (*ChatTransactionPurposePaidMedia) ChatTransactionPurposeType() string { + return TypeChatTransactionPurposePaidMedia } -func (channelTransactionPurposePaidMedia *ChannelTransactionPurposePaidMedia) UnmarshalJSON(data []byte) error { +func (chatTransactionPurposePaidMedia *ChatTransactionPurposePaidMedia) UnmarshalJSON(data []byte) error { var tmp struct { MessageId int64 `json:"message_id"` Media []json.RawMessage `json:"media"` @@ -7699,66 +7813,93 @@ func (channelTransactionPurposePaidMedia *ChannelTransactionPurposePaidMedia) Un return err } - channelTransactionPurposePaidMedia.MessageId = tmp.MessageId + chatTransactionPurposePaidMedia.MessageId = tmp.MessageId fieldMedia, _ := UnmarshalListOfPaidMedia(tmp.Media) - channelTransactionPurposePaidMedia.Media = fieldMedia + chatTransactionPurposePaidMedia.Media = fieldMedia return nil } // User joined the channel and subscribed to regular payments in Telegram Stars -type ChannelTransactionPurposeJoin struct { +type ChatTransactionPurposeJoin struct { meta // The number of seconds between consecutive Telegram Star debiting Period int32 `json:"period"` } -func (entity *ChannelTransactionPurposeJoin) MarshalJSON() ([]byte, error) { +func (entity *ChatTransactionPurposeJoin) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ChannelTransactionPurposeJoin + type stub ChatTransactionPurposeJoin return json.Marshal((*stub)(entity)) } -func (*ChannelTransactionPurposeJoin) GetClass() string { - return ClassChannelTransactionPurpose +func (*ChatTransactionPurposeJoin) GetClass() string { + return ClassChatTransactionPurpose } -func (*ChannelTransactionPurposeJoin) GetType() string { - return TypeChannelTransactionPurposeJoin +func (*ChatTransactionPurposeJoin) GetType() string { + return TypeChatTransactionPurposeJoin } -func (*ChannelTransactionPurposeJoin) ChannelTransactionPurposeType() string { - return TypeChannelTransactionPurposeJoin +func (*ChatTransactionPurposeJoin) ChatTransactionPurposeType() string { + return TypeChatTransactionPurposeJoin } // User paid for a reaction -type ChannelTransactionPurposeReaction struct { +type ChatTransactionPurposeReaction struct { meta - // Identifier of the reacted message; can be an identifier of a deleted message + // Identifier of the reacted message; can be 0 or an identifier of a deleted message MessageId int64 `json:"message_id"` } -func (entity *ChannelTransactionPurposeReaction) MarshalJSON() ([]byte, error) { +func (entity *ChatTransactionPurposeReaction) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ChannelTransactionPurposeReaction + type stub ChatTransactionPurposeReaction return json.Marshal((*stub)(entity)) } -func (*ChannelTransactionPurposeReaction) GetClass() string { - return ClassChannelTransactionPurpose +func (*ChatTransactionPurposeReaction) GetClass() string { + return ClassChatTransactionPurpose } -func (*ChannelTransactionPurposeReaction) GetType() string { - return TypeChannelTransactionPurposeReaction +func (*ChatTransactionPurposeReaction) GetType() string { + return TypeChatTransactionPurposeReaction } -func (*ChannelTransactionPurposeReaction) ChannelTransactionPurposeType() string { - return TypeChannelTransactionPurposeReaction +func (*ChatTransactionPurposeReaction) ChatTransactionPurposeType() string { + return TypeChatTransactionPurposeReaction +} + +// User received Telegram Stars from a giveaway +type ChatTransactionPurposeGiveaway struct { + meta + // Identifier of the message with giveaway; can be 0 or an identifier of a deleted message + GiveawayMessageId int64 `json:"giveaway_message_id"` +} + +func (entity *ChatTransactionPurposeGiveaway) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatTransactionPurposeGiveaway + + return json.Marshal((*stub)(entity)) +} + +func (*ChatTransactionPurposeGiveaway) GetClass() string { + return ClassChatTransactionPurpose +} + +func (*ChatTransactionPurposeGiveaway) GetType() string { + return TypeChatTransactionPurposeGiveaway +} + +func (*ChatTransactionPurposeGiveaway) ChatTransactionPurposeType() string { + return TypeChatTransactionPurposeGiveaway } // The transaction is a transaction with Telegram through a bot @@ -8000,36 +8141,36 @@ func (starTransactionPartnerBusiness *StarTransactionPartnerBusiness) UnmarshalJ return nil } -// The transaction is a transaction with a channel chat -type StarTransactionPartnerChannel struct { +// The transaction is a transaction with a supergroup or a channel chat +type StarTransactionPartnerChat struct { meta // Identifier of the chat ChatId int64 `json:"chat_id"` // Purpose of the transaction - Purpose ChannelTransactionPurpose `json:"purpose"` + Purpose ChatTransactionPurpose `json:"purpose"` } -func (entity *StarTransactionPartnerChannel) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionPartnerChat) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub StarTransactionPartnerChannel + type stub StarTransactionPartnerChat return json.Marshal((*stub)(entity)) } -func (*StarTransactionPartnerChannel) GetClass() string { +func (*StarTransactionPartnerChat) GetClass() string { return ClassStarTransactionPartner } -func (*StarTransactionPartnerChannel) GetType() string { - return TypeStarTransactionPartnerChannel +func (*StarTransactionPartnerChat) GetType() string { + return TypeStarTransactionPartnerChat } -func (*StarTransactionPartnerChannel) StarTransactionPartnerType() string { - return TypeStarTransactionPartnerChannel +func (*StarTransactionPartnerChat) StarTransactionPartnerType() string { + return TypeStarTransactionPartnerChat } -func (starTransactionPartnerChannel *StarTransactionPartnerChannel) UnmarshalJSON(data []byte) error { +func (starTransactionPartnerChat *StarTransactionPartnerChat) UnmarshalJSON(data []byte) error { var tmp struct { ChatId int64 `json:"chat_id"` Purpose json.RawMessage `json:"purpose"` @@ -8040,10 +8181,10 @@ func (starTransactionPartnerChannel *StarTransactionPartnerChannel) UnmarshalJSO return err } - starTransactionPartnerChannel.ChatId = tmp.ChatId + starTransactionPartnerChat.ChatId = tmp.ChatId - fieldPurpose, _ := UnmarshalChannelTransactionPurpose(tmp.Purpose) - starTransactionPartnerChannel.Purpose = fieldPurpose + fieldPurpose, _ := UnmarshalChatTransactionPurpose(tmp.Purpose) + starTransactionPartnerChat.Purpose = fieldPurpose return nil } @@ -8186,168 +8327,168 @@ func (*StarTransactions) GetType() string { } // The user is eligible for the giveaway -type PremiumGiveawayParticipantStatusEligible struct{ +type GiveawayParticipantStatusEligible struct{ meta } -func (entity *PremiumGiveawayParticipantStatusEligible) MarshalJSON() ([]byte, error) { +func (entity *GiveawayParticipantStatusEligible) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub PremiumGiveawayParticipantStatusEligible + type stub GiveawayParticipantStatusEligible return json.Marshal((*stub)(entity)) } -func (*PremiumGiveawayParticipantStatusEligible) GetClass() string { - return ClassPremiumGiveawayParticipantStatus +func (*GiveawayParticipantStatusEligible) GetClass() string { + return ClassGiveawayParticipantStatus } -func (*PremiumGiveawayParticipantStatusEligible) GetType() string { - return TypePremiumGiveawayParticipantStatusEligible +func (*GiveawayParticipantStatusEligible) GetType() string { + return TypeGiveawayParticipantStatusEligible } -func (*PremiumGiveawayParticipantStatusEligible) PremiumGiveawayParticipantStatusType() string { - return TypePremiumGiveawayParticipantStatusEligible +func (*GiveawayParticipantStatusEligible) GiveawayParticipantStatusType() string { + return TypeGiveawayParticipantStatusEligible } // The user participates in the giveaway -type PremiumGiveawayParticipantStatusParticipating struct{ +type GiveawayParticipantStatusParticipating struct{ meta } -func (entity *PremiumGiveawayParticipantStatusParticipating) MarshalJSON() ([]byte, error) { +func (entity *GiveawayParticipantStatusParticipating) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub PremiumGiveawayParticipantStatusParticipating + type stub GiveawayParticipantStatusParticipating return json.Marshal((*stub)(entity)) } -func (*PremiumGiveawayParticipantStatusParticipating) GetClass() string { - return ClassPremiumGiveawayParticipantStatus +func (*GiveawayParticipantStatusParticipating) GetClass() string { + return ClassGiveawayParticipantStatus } -func (*PremiumGiveawayParticipantStatusParticipating) GetType() string { - return TypePremiumGiveawayParticipantStatusParticipating +func (*GiveawayParticipantStatusParticipating) GetType() string { + return TypeGiveawayParticipantStatusParticipating } -func (*PremiumGiveawayParticipantStatusParticipating) PremiumGiveawayParticipantStatusType() string { - return TypePremiumGiveawayParticipantStatusParticipating +func (*GiveawayParticipantStatusParticipating) GiveawayParticipantStatusType() string { + return TypeGiveawayParticipantStatusParticipating } // The user can't participate in the giveaway, because they have already been member of the chat -type PremiumGiveawayParticipantStatusAlreadyWasMember struct { +type GiveawayParticipantStatusAlreadyWasMember struct { meta // Point in time (Unix timestamp) when the user joined the chat JoinedChatDate int32 `json:"joined_chat_date"` } -func (entity *PremiumGiveawayParticipantStatusAlreadyWasMember) MarshalJSON() ([]byte, error) { +func (entity *GiveawayParticipantStatusAlreadyWasMember) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub PremiumGiveawayParticipantStatusAlreadyWasMember + type stub GiveawayParticipantStatusAlreadyWasMember return json.Marshal((*stub)(entity)) } -func (*PremiumGiveawayParticipantStatusAlreadyWasMember) GetClass() string { - return ClassPremiumGiveawayParticipantStatus +func (*GiveawayParticipantStatusAlreadyWasMember) GetClass() string { + return ClassGiveawayParticipantStatus } -func (*PremiumGiveawayParticipantStatusAlreadyWasMember) GetType() string { - return TypePremiumGiveawayParticipantStatusAlreadyWasMember +func (*GiveawayParticipantStatusAlreadyWasMember) GetType() string { + return TypeGiveawayParticipantStatusAlreadyWasMember } -func (*PremiumGiveawayParticipantStatusAlreadyWasMember) PremiumGiveawayParticipantStatusType() string { - return TypePremiumGiveawayParticipantStatusAlreadyWasMember +func (*GiveawayParticipantStatusAlreadyWasMember) GiveawayParticipantStatusType() string { + return TypeGiveawayParticipantStatusAlreadyWasMember } // The user can't participate in the giveaway, because they are an administrator in one of the chats that created the giveaway -type PremiumGiveawayParticipantStatusAdministrator struct { +type GiveawayParticipantStatusAdministrator struct { meta // Identifier of the chat administered by the user ChatId int64 `json:"chat_id"` } -func (entity *PremiumGiveawayParticipantStatusAdministrator) MarshalJSON() ([]byte, error) { +func (entity *GiveawayParticipantStatusAdministrator) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub PremiumGiveawayParticipantStatusAdministrator + type stub GiveawayParticipantStatusAdministrator return json.Marshal((*stub)(entity)) } -func (*PremiumGiveawayParticipantStatusAdministrator) GetClass() string { - return ClassPremiumGiveawayParticipantStatus +func (*GiveawayParticipantStatusAdministrator) GetClass() string { + return ClassGiveawayParticipantStatus } -func (*PremiumGiveawayParticipantStatusAdministrator) GetType() string { - return TypePremiumGiveawayParticipantStatusAdministrator +func (*GiveawayParticipantStatusAdministrator) GetType() string { + return TypeGiveawayParticipantStatusAdministrator } -func (*PremiumGiveawayParticipantStatusAdministrator) PremiumGiveawayParticipantStatusType() string { - return TypePremiumGiveawayParticipantStatusAdministrator +func (*GiveawayParticipantStatusAdministrator) GiveawayParticipantStatusType() string { + return TypeGiveawayParticipantStatusAdministrator } // The user can't participate in the giveaway, because they phone number is from a disallowed country -type PremiumGiveawayParticipantStatusDisallowedCountry struct { +type GiveawayParticipantStatusDisallowedCountry struct { meta // A two-letter ISO 3166-1 alpha-2 country code of the user's country UserCountryCode string `json:"user_country_code"` } -func (entity *PremiumGiveawayParticipantStatusDisallowedCountry) MarshalJSON() ([]byte, error) { +func (entity *GiveawayParticipantStatusDisallowedCountry) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub PremiumGiveawayParticipantStatusDisallowedCountry + type stub GiveawayParticipantStatusDisallowedCountry return json.Marshal((*stub)(entity)) } -func (*PremiumGiveawayParticipantStatusDisallowedCountry) GetClass() string { - return ClassPremiumGiveawayParticipantStatus +func (*GiveawayParticipantStatusDisallowedCountry) GetClass() string { + return ClassGiveawayParticipantStatus } -func (*PremiumGiveawayParticipantStatusDisallowedCountry) GetType() string { - return TypePremiumGiveawayParticipantStatusDisallowedCountry +func (*GiveawayParticipantStatusDisallowedCountry) GetType() string { + return TypeGiveawayParticipantStatusDisallowedCountry } -func (*PremiumGiveawayParticipantStatusDisallowedCountry) PremiumGiveawayParticipantStatusType() string { - return TypePremiumGiveawayParticipantStatusDisallowedCountry +func (*GiveawayParticipantStatusDisallowedCountry) GiveawayParticipantStatusType() string { + return TypeGiveawayParticipantStatusDisallowedCountry } // Describes an ongoing giveaway -type PremiumGiveawayInfoOngoing struct { +type GiveawayInfoOngoing struct { meta // Point in time (Unix timestamp) when the giveaway was created CreationDate int32 `json:"creation_date"` // Status of the current user in the giveaway - Status PremiumGiveawayParticipantStatus `json:"status"` + Status GiveawayParticipantStatus `json:"status"` // True, if the giveaway has ended and results are being prepared IsEnded bool `json:"is_ended"` } -func (entity *PremiumGiveawayInfoOngoing) MarshalJSON() ([]byte, error) { +func (entity *GiveawayInfoOngoing) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub PremiumGiveawayInfoOngoing + type stub GiveawayInfoOngoing return json.Marshal((*stub)(entity)) } -func (*PremiumGiveawayInfoOngoing) GetClass() string { - return ClassPremiumGiveawayInfo +func (*GiveawayInfoOngoing) GetClass() string { + return ClassGiveawayInfo } -func (*PremiumGiveawayInfoOngoing) GetType() string { - return TypePremiumGiveawayInfoOngoing +func (*GiveawayInfoOngoing) GetType() string { + return TypeGiveawayInfoOngoing } -func (*PremiumGiveawayInfoOngoing) PremiumGiveawayInfoType() string { - return TypePremiumGiveawayInfoOngoing +func (*GiveawayInfoOngoing) GiveawayInfoType() string { + return TypeGiveawayInfoOngoing } -func (premiumGiveawayInfoOngoing *PremiumGiveawayInfoOngoing) UnmarshalJSON(data []byte) error { +func (giveawayInfoOngoing *GiveawayInfoOngoing) UnmarshalJSON(data []byte) error { var tmp struct { CreationDate int32 `json:"creation_date"` Status json.RawMessage `json:"status"` @@ -8359,17 +8500,17 @@ func (premiumGiveawayInfoOngoing *PremiumGiveawayInfoOngoing) UnmarshalJSON(data return err } - premiumGiveawayInfoOngoing.CreationDate = tmp.CreationDate - premiumGiveawayInfoOngoing.IsEnded = tmp.IsEnded + giveawayInfoOngoing.CreationDate = tmp.CreationDate + giveawayInfoOngoing.IsEnded = tmp.IsEnded - fieldStatus, _ := UnmarshalPremiumGiveawayParticipantStatus(tmp.Status) - premiumGiveawayInfoOngoing.Status = fieldStatus + fieldStatus, _ := UnmarshalGiveawayParticipantStatus(tmp.Status) + giveawayInfoOngoing.Status = fieldStatus return nil } // Describes a completed giveaway -type PremiumGiveawayInfoCompleted struct { +type GiveawayInfoCompleted struct { meta // Point in time (Unix timestamp) when the giveaway was created CreationDate int32 `json:"creation_date"` @@ -8377,32 +8518,90 @@ type PremiumGiveawayInfoCompleted struct { ActualWinnersSelectionDate int32 `json:"actual_winners_selection_date"` // True, if the giveaway was canceled and was fully refunded WasRefunded bool `json:"was_refunded"` + // True, if the cuurent user is a winner of the giveaway + IsWinner bool `json:"is_winner"` // Number of winners in the giveaway WinnerCount int32 `json:"winner_count"` - // Number of winners, which activated their gift codes + // Number of winners, which activated their gift codes; for Telegram Premium giveaways only ActivationCount int32 `json:"activation_count"` - // Telegram Premium gift code that was received by the current user; empty if the user isn't a winner in the giveaway + // Telegram Premium gift code that was received by the current user; empty if the user isn't a winner in the giveaway or the giveaway isn't a Telegram Premium giveaway GiftCode string `json:"gift_code"` + // The amount of Telegram Stars won by the current user; 0 if the user isn't a winner in the giveaway or the giveaway isn't a Telegram Star giveaway + WonStarCount int64 `json:"won_star_count"` } -func (entity *PremiumGiveawayInfoCompleted) MarshalJSON() ([]byte, error) { +func (entity *GiveawayInfoCompleted) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub PremiumGiveawayInfoCompleted + type stub GiveawayInfoCompleted return json.Marshal((*stub)(entity)) } -func (*PremiumGiveawayInfoCompleted) GetClass() string { - return ClassPremiumGiveawayInfo +func (*GiveawayInfoCompleted) GetClass() string { + return ClassGiveawayInfo } -func (*PremiumGiveawayInfoCompleted) GetType() string { - return TypePremiumGiveawayInfoCompleted +func (*GiveawayInfoCompleted) GetType() string { + return TypeGiveawayInfoCompleted } -func (*PremiumGiveawayInfoCompleted) PremiumGiveawayInfoType() string { - return TypePremiumGiveawayInfoCompleted +func (*GiveawayInfoCompleted) GiveawayInfoType() string { + return TypeGiveawayInfoCompleted +} + +// The giveaway sends Telegram Premium subscriptions to the winners +type GiveawayPrizePremium struct { + meta + // Number of months the Telegram Premium subscription will be active after code activation + MonthCount int32 `json:"month_count"` +} + +func (entity *GiveawayPrizePremium) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiveawayPrizePremium + + return json.Marshal((*stub)(entity)) +} + +func (*GiveawayPrizePremium) GetClass() string { + return ClassGiveawayPrize +} + +func (*GiveawayPrizePremium) GetType() string { + return TypeGiveawayPrizePremium +} + +func (*GiveawayPrizePremium) GiveawayPrizeType() string { + return TypeGiveawayPrizePremium +} + +// The giveaway sends Telegram Stars to the winners +type GiveawayPrizeStars struct { + meta + // Number of Telegram Stars that will be shared by all winners + StarCount int64 `json:"star_count"` +} + +func (entity *GiveawayPrizeStars) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiveawayPrizeStars + + return json.Marshal((*stub)(entity)) +} + +func (*GiveawayPrizeStars) GetClass() string { + return ClassGiveawayPrize +} + +func (*GiveawayPrizeStars) GetType() string { + return TypeGiveawayPrizeStars +} + +func (*GiveawayPrizeStars) GiveawayPrizeType() string { + return TypeGiveawayPrizeStars } // Contains information about supported accent color for user/chat name, background of empty chat photo, replies to messages and link previews @@ -11772,7 +11971,7 @@ type MessageReplyToMessage struct { Origin MessageOrigin `json:"origin"` // Point in time (Unix timestamp) when the message was sent if the message was from another chat or topic; 0 for messages from the same chat OriginSendDate int32 `json:"origin_send_date"` - // Media content of the message if the message was from another chat or topic; may be null for messages from the same chat and messages without media. Can be only one of the following types: messageAnimation, messageAudio, messageContact, messageDice, messageDocument, messageGame, messageInvoice, messageLocation, messagePaidMedia, messagePhoto, messagePoll, messagePremiumGiveaway, messagePremiumGiveawayWinners, messageSticker, messageStory, messageText (for link preview), messageVenue, messageVideo, messageVideoNote, or messageVoiceNote + // Media content of the message if the message was from another chat or topic; may be null for messages from the same chat and messages without media. Can be only one of the following types: messageAnimation, messageAudio, messageContact, messageDice, messageDocument, messageGame, messageGiveaway, messageGiveawayWinners, messageInvoice, messageLocation, messagePaidMedia, messagePhoto, messagePoll, messageSticker, messageStory, messageText (for link preview), messageVenue, messageVideo, messageVideoNote, or messageVoiceNote Content MessageContent `json:"content"` } @@ -18519,8 +18718,6 @@ type LinkPreviewTypeAnimation struct { meta // The animation Animation *Animation `json:"animation"` - // Author of the animation - Author string `json:"author"` } func (entity *LinkPreviewTypeAnimation) MarshalJSON() ([]byte, error) { @@ -18548,8 +18745,6 @@ type LinkPreviewTypeApp struct { meta // Photo for the app Photo *Photo `json:"photo"` - // Author of the app - Author string `json:"author"` } func (entity *LinkPreviewTypeApp) MarshalJSON() ([]byte, error) { @@ -18577,8 +18772,6 @@ type LinkPreviewTypeArticle struct { meta // Article's main photo; may be null Photo *Photo `json:"photo"` - // Author of the article - Author string `json:"author"` } func (entity *LinkPreviewTypeArticle) MarshalJSON() ([]byte, error) { @@ -18604,16 +18797,8 @@ func (*LinkPreviewTypeArticle) LinkPreviewTypeType() string { // The link is a link to an audio type LinkPreviewTypeAudio struct { meta - // URL of the audio; may be empty if none - Url string `json:"url"` - // MIME type of the audio file - MimeType string `json:"mime_type"` - // The audio description; may be null if unknown + // The audio description Audio *Audio `json:"audio"` - // Duration of the audio, in seconds; 0 if unknown - Duration int32 `json:"duration"` - // Author of the audio - Author string `json:"author"` } func (entity *LinkPreviewTypeAudio) MarshalJSON() ([]byte, error) { @@ -18768,8 +18953,6 @@ type LinkPreviewTypeDocument struct { meta // The document description Document *Document `json:"document"` - // Author of the document - Author string `json:"author"` } func (entity *LinkPreviewTypeDocument) MarshalJSON() ([]byte, error) { @@ -18801,8 +18984,6 @@ type LinkPreviewTypeEmbeddedAnimationPlayer struct { Thumbnail *Photo `json:"thumbnail"` // Duration of the animation, in seconds Duration int32 `json:"duration"` - // Author of the animation - Author string `json:"author"` // Expected width of the embedded player Width int32 `json:"width"` // Expected height of the embedded player @@ -18838,8 +19019,6 @@ type LinkPreviewTypeEmbeddedAudioPlayer struct { Thumbnail *Photo `json:"thumbnail"` // Duration of the audio, in seconds Duration int32 `json:"duration"` - // Author of the audio - Author string `json:"author"` // Expected width of the embedded player Width int32 `json:"width"` // Expected height of the embedded player @@ -18875,8 +19054,6 @@ type LinkPreviewTypeEmbeddedVideoPlayer struct { Thumbnail *Photo `json:"thumbnail"` // Duration of the video, in seconds Duration int32 `json:"duration"` - // Author of the video - Author string `json:"author"` // Expected width of the embedded player Width int32 `json:"width"` // Expected height of the embedded player @@ -18903,6 +19080,72 @@ func (*LinkPreviewTypeEmbeddedVideoPlayer) LinkPreviewTypeType() string { return TypeLinkPreviewTypeEmbeddedVideoPlayer } +// The link is a link to an audio file +type LinkPreviewTypeExternalAudio struct { + meta + // URL of the audio file + Url string `json:"url"` + // MIME type of the audio file + MimeType string `json:"mime_type"` + // Duration of the audio, in seconds; 0 if unknown + Duration int32 `json:"duration"` +} + +func (entity *LinkPreviewTypeExternalAudio) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeExternalAudio + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeExternalAudio) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeExternalAudio) GetType() string { + return TypeLinkPreviewTypeExternalAudio +} + +func (*LinkPreviewTypeExternalAudio) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeExternalAudio +} + +// The link is a link to a video file +type LinkPreviewTypeExternalVideo struct { + meta + // URL of the video file + Url string `json:"url"` + // MIME type of the video file + MimeType string `json:"mime_type"` + // Expected width of the video preview; 0 if unknown + Width int32 `json:"width"` + // Expected height of the video preview; 0 if unknown + Height int32 `json:"height"` + // Duration of the video, in seconds; 0 if unknown + Duration int32 `json:"duration"` +} + +func (entity *LinkPreviewTypeExternalVideo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeExternalVideo + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeExternalVideo) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeExternalVideo) GetType() string { + return TypeLinkPreviewTypeExternalVideo +} + +func (*LinkPreviewTypeExternalVideo) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeExternalVideo +} + // The link is a link to an invoice type LinkPreviewTypeInvoice struct{ meta @@ -18958,8 +19201,6 @@ type LinkPreviewTypePhoto struct { meta // The photo Photo *Photo `json:"photo"` - // Author of the photo - Author string `json:"author"` } func (entity *LinkPreviewTypePhoto) MarshalJSON() ([]byte, error) { @@ -19228,20 +19469,8 @@ func (*LinkPreviewTypeUser) LinkPreviewTypeType() string { // The link is a link to a video type LinkPreviewTypeVideo struct { meta - // URL of the video; may be empty if none - Url string `json:"url"` - // MIME type of the video file - MimeType string `json:"mime_type"` - // The video description; may be null if unknown + // The video description Video *Video `json:"video"` - // Expected width of the preview - Width int32 `json:"width"` - // Expected height of the preview - Height int32 `json:"height"` - // Duration of the video, in seconds; 0 if unknown - Duration int32 `json:"duration"` - // Author of the video - Author string `json:"author"` } func (entity *LinkPreviewTypeVideo) MarshalJSON() ([]byte, error) { @@ -19387,6 +19616,8 @@ type LinkPreview struct { Title string `json:"title"` // Description of the content Description *FormattedText `json:"description"` + // Author of the content + Author string `json:"author"` // Type of the link preview Type LinkPreviewType `json:"type"` // True, if size of media in the preview can be changed @@ -19426,6 +19657,7 @@ func (linkPreview *LinkPreview) UnmarshalJSON(data []byte) error { SiteName string `json:"site_name"` Title string `json:"title"` Description *FormattedText `json:"description"` + Author string `json:"author"` Type json.RawMessage `json:"type"` HasLargeMedia bool `json:"has_large_media"` ShowLargeMedia bool `json:"show_large_media"` @@ -19445,6 +19677,7 @@ func (linkPreview *LinkPreview) UnmarshalJSON(data []byte) error { linkPreview.SiteName = tmp.SiteName linkPreview.Title = tmp.Title linkPreview.Description = tmp.Description + linkPreview.Author = tmp.Author linkPreview.HasLargeMedia = tmp.HasLargeMedia linkPreview.ShowLargeMedia = tmp.ShowLargeMedia linkPreview.ShowMediaAboveDescription = tmp.ShowMediaAboveDescription @@ -19749,6 +19982,8 @@ type ThemeParameters struct { SecondaryBackgroundColor int32 `json:"secondary_background_color"` // A color of the header background in the RGB24 format HeaderBackgroundColor int32 `json:"header_background_color"` + // A color of the bottom bar background in the RGB24 format + BottomBarBackgroundColor int32 `json:"bottom_bar_background_color"` // A color of the section background in the RGB24 format SectionBackgroundColor int32 `json:"section_background_color"` // A color of the section separator in the RGB24 format @@ -20698,10 +20933,10 @@ func (*PaidMediaUnsupported) PaidMediaType() string { return TypePaidMediaUnsupported } -// Describes parameters of a Telegram Premium giveaway -type PremiumGiveawayParameters struct { +// Describes parameters of a giveaway +type GiveawayParameters struct { meta - // Identifier of the supergroup or channel chat, which will be automatically boosted by the winners of the giveaway for duration of the Premium subscription. If the chat is a channel, then can_post_messages right is required in the channel, otherwise, the user must be an administrator in the supergroup + // Identifier of the supergroup or channel chat, which will be automatically boosted by the winners of the giveaway for duration of the Telegram Premium subscription, or for the specified time. If the chat is a channel, then can_post_messages right is required in the channel, otherwise, the user must be an administrator in the supergroup BoostedChatId int64 `json:"boosted_chat_id"` // Identifiers of other supergroup or channel chats that must be subscribed by the users to be eligible for the giveaway. There can be up to getOption("giveaway_additional_chat_count_max") additional chats AdditionalChatIds []int64 `json:"additional_chat_ids"` @@ -20717,20 +20952,20 @@ type PremiumGiveawayParameters struct { PrizeDescription string `json:"prize_description"` } -func (entity *PremiumGiveawayParameters) MarshalJSON() ([]byte, error) { +func (entity *GiveawayParameters) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub PremiumGiveawayParameters + type stub GiveawayParameters return json.Marshal((*stub)(entity)) } -func (*PremiumGiveawayParameters) GetClass() string { - return ClassPremiumGiveawayParameters +func (*GiveawayParameters) GetClass() string { + return ClassGiveawayParameters } -func (*PremiumGiveawayParameters) GetType() string { - return TypePremiumGiveawayParameters +func (*GiveawayParameters) GetType() string { + return TypeGiveawayParameters } // File with the date it was uploaded @@ -24755,99 +24990,126 @@ func (messagePremiumGiftCode *MessagePremiumGiftCode) UnmarshalJSON(data []byte) return nil } -// A Telegram Premium giveaway was created for the chat. Use telegramPaymentPurposePremiumGiveaway or storePaymentPurposePremiumGiveaway to create a giveaway -type MessagePremiumGiveawayCreated struct{ +// A giveaway was created for the chat. Use telegramPaymentPurposePremiumGiveaway, storePaymentPurposePremiumGiveaway, telegramPaymentPurposeStarGiveaway, or storePaymentPurposeStarGiveaway to create a giveaway +type MessageGiveawayCreated struct { meta + // Number of Telegram Stars that will be shared by winners of the giveaway; 0 for Telegram Premium giveaways + StarCount int64 `json:"star_count"` } -func (entity *MessagePremiumGiveawayCreated) MarshalJSON() ([]byte, error) { +func (entity *MessageGiveawayCreated) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub MessagePremiumGiveawayCreated + type stub MessageGiveawayCreated return json.Marshal((*stub)(entity)) } -func (*MessagePremiumGiveawayCreated) GetClass() string { +func (*MessageGiveawayCreated) GetClass() string { return ClassMessageContent } -func (*MessagePremiumGiveawayCreated) GetType() string { - return TypeMessagePremiumGiveawayCreated +func (*MessageGiveawayCreated) GetType() string { + return TypeMessageGiveawayCreated } -func (*MessagePremiumGiveawayCreated) MessageContentType() string { - return TypeMessagePremiumGiveawayCreated +func (*MessageGiveawayCreated) MessageContentType() string { + return TypeMessageGiveawayCreated } -// A Telegram Premium giveaway -type MessagePremiumGiveaway struct { +// A giveaway +type MessageGiveaway struct { meta // Giveaway parameters - Parameters *PremiumGiveawayParameters `json:"parameters"` + Parameters *GiveawayParameters `json:"parameters"` // Number of users which will receive Telegram Premium subscription gift codes WinnerCount int32 `json:"winner_count"` - // Number of months the Telegram Premium subscription will be active after code activation - MonthCount int32 `json:"month_count"` + // Prize of the giveaway + Prize GiveawayPrize `json:"prize"` // A sticker to be shown in the message; may be null if unknown Sticker *Sticker `json:"sticker"` } -func (entity *MessagePremiumGiveaway) MarshalJSON() ([]byte, error) { +func (entity *MessageGiveaway) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub MessagePremiumGiveaway + type stub MessageGiveaway return json.Marshal((*stub)(entity)) } -func (*MessagePremiumGiveaway) GetClass() string { +func (*MessageGiveaway) GetClass() string { return ClassMessageContent } -func (*MessagePremiumGiveaway) GetType() string { - return TypeMessagePremiumGiveaway +func (*MessageGiveaway) GetType() string { + return TypeMessageGiveaway } -func (*MessagePremiumGiveaway) MessageContentType() string { - return TypeMessagePremiumGiveaway +func (*MessageGiveaway) MessageContentType() string { + return TypeMessageGiveaway } -// A Telegram Premium giveaway without public winners has been completed for the chat -type MessagePremiumGiveawayCompleted struct { +func (messageGiveaway *MessageGiveaway) UnmarshalJSON(data []byte) error { + var tmp struct { + Parameters *GiveawayParameters `json:"parameters"` + WinnerCount int32 `json:"winner_count"` + Prize json.RawMessage `json:"prize"` + Sticker *Sticker `json:"sticker"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageGiveaway.Parameters = tmp.Parameters + messageGiveaway.WinnerCount = tmp.WinnerCount + messageGiveaway.Sticker = tmp.Sticker + + fieldPrize, _ := UnmarshalGiveawayPrize(tmp.Prize) + messageGiveaway.Prize = fieldPrize + + return nil +} + +// A giveaway without public winners has been completed for the chat +type MessageGiveawayCompleted struct { meta // Identifier of the message with the giveaway; can be 0 if the message was deleted GiveawayMessageId int64 `json:"giveaway_message_id"` // Number of winners in the giveaway WinnerCount int32 `json:"winner_count"` - // Number of undistributed prizes + // True, if the giveaway is a Telegram Star giveaway + IsStarGiveaway bool `json:"is_star_giveaway"` + // Number of undistributed prizes; for Telegram Premium giveaways only UnclaimedPrizeCount int32 `json:"unclaimed_prize_count"` } -func (entity *MessagePremiumGiveawayCompleted) MarshalJSON() ([]byte, error) { +func (entity *MessageGiveawayCompleted) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub MessagePremiumGiveawayCompleted + type stub MessageGiveawayCompleted return json.Marshal((*stub)(entity)) } -func (*MessagePremiumGiveawayCompleted) GetClass() string { +func (*MessageGiveawayCompleted) GetClass() string { return ClassMessageContent } -func (*MessagePremiumGiveawayCompleted) GetType() string { - return TypeMessagePremiumGiveawayCompleted +func (*MessageGiveawayCompleted) GetType() string { + return TypeMessageGiveawayCompleted } -func (*MessagePremiumGiveawayCompleted) MessageContentType() string { - return TypeMessagePremiumGiveawayCompleted +func (*MessageGiveawayCompleted) MessageContentType() string { + return TypeMessageGiveawayCompleted } -// A Telegram Premium giveaway with public winners has been completed for the chat -type MessagePremiumGiveawayWinners struct { +// A giveaway with public winners has been completed for the chat +type MessageGiveawayWinners struct { meta - // Identifier of the channel chat, which was automatically boosted by the winners of the giveaway for duration of the Premium subscription + // Identifier of the supergroup or channel chat, which was automatically boosted by the winners of the giveaway BoostedChatId int64 `json:"boosted_chat_id"` // Identifier of the message with the giveaway in the boosted chat GiveawayMessageId int64 `json:"giveaway_message_id"` @@ -24859,36 +25121,73 @@ type MessagePremiumGiveawayWinners struct { OnlyNewMembers bool `json:"only_new_members"` // True, if the giveaway was canceled and was fully refunded WasRefunded bool `json:"was_refunded"` - // Number of months the Telegram Premium subscription will be active after code activation - MonthCount int32 `json:"month_count"` + // Prize of the giveaway + Prize GiveawayPrize `json:"prize"` // Additional description of the giveaway prize PrizeDescription string `json:"prize_description"` // Total number of winners in the giveaway WinnerCount int32 `json:"winner_count"` // Up to 100 user identifiers of the winners of the giveaway WinnerUserIds []int64 `json:"winner_user_ids"` - // Number of undistributed prizes + // Number of undistributed prizes; for Telegram Premium giveaways only UnclaimedPrizeCount int32 `json:"unclaimed_prize_count"` } -func (entity *MessagePremiumGiveawayWinners) MarshalJSON() ([]byte, error) { +func (entity *MessageGiveawayWinners) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub MessagePremiumGiveawayWinners + type stub MessageGiveawayWinners return json.Marshal((*stub)(entity)) } -func (*MessagePremiumGiveawayWinners) GetClass() string { +func (*MessageGiveawayWinners) GetClass() string { return ClassMessageContent } -func (*MessagePremiumGiveawayWinners) GetType() string { - return TypeMessagePremiumGiveawayWinners +func (*MessageGiveawayWinners) GetType() string { + return TypeMessageGiveawayWinners } -func (*MessagePremiumGiveawayWinners) MessageContentType() string { - return TypeMessagePremiumGiveawayWinners +func (*MessageGiveawayWinners) MessageContentType() string { + return TypeMessageGiveawayWinners +} + +func (messageGiveawayWinners *MessageGiveawayWinners) UnmarshalJSON(data []byte) error { + var tmp struct { + BoostedChatId int64 `json:"boosted_chat_id"` + GiveawayMessageId int64 `json:"giveaway_message_id"` + AdditionalChatCount int32 `json:"additional_chat_count"` + ActualWinnersSelectionDate int32 `json:"actual_winners_selection_date"` + OnlyNewMembers bool `json:"only_new_members"` + WasRefunded bool `json:"was_refunded"` + Prize json.RawMessage `json:"prize"` + PrizeDescription string `json:"prize_description"` + WinnerCount int32 `json:"winner_count"` + WinnerUserIds []int64 `json:"winner_user_ids"` + UnclaimedPrizeCount int32 `json:"unclaimed_prize_count"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageGiveawayWinners.BoostedChatId = tmp.BoostedChatId + messageGiveawayWinners.GiveawayMessageId = tmp.GiveawayMessageId + messageGiveawayWinners.AdditionalChatCount = tmp.AdditionalChatCount + messageGiveawayWinners.ActualWinnersSelectionDate = tmp.ActualWinnersSelectionDate + messageGiveawayWinners.OnlyNewMembers = tmp.OnlyNewMembers + messageGiveawayWinners.WasRefunded = tmp.WasRefunded + messageGiveawayWinners.PrizeDescription = tmp.PrizeDescription + messageGiveawayWinners.WinnerCount = tmp.WinnerCount + messageGiveawayWinners.WinnerUserIds = tmp.WinnerUserIds + messageGiveawayWinners.UnclaimedPrizeCount = tmp.UnclaimedPrizeCount + + fieldPrize, _ := UnmarshalGiveawayPrize(tmp.Prize) + messageGiveawayWinners.Prize = fieldPrize + + return nil } // Telegram Stars were gifted to a user @@ -24934,6 +25233,43 @@ func (*MessageGiftedStars) MessageContentType() string { return TypeMessageGiftedStars } +// A Telegram Stars were received by the cuurent user from a giveaway +type MessageGiveawayPrizeStars struct { + meta + // Number of Telegram Stars that were received + StarCount int64 `json:"star_count"` + // Identifier of the transaction for Telegram Stars credit + TransactionId string `json:"transaction_id"` + // Identifier of the supergroup or channel chat, which was automatically boosted by the winners of the giveaway + BoostedChatId int64 `json:"boosted_chat_id"` + // Identifier of the message with the giveaway in the boosted chat; can be 0 if the message was deleted + GiveawayMessageId int64 `json:"giveaway_message_id"` + // True, if the corresponding winner wasn't chosen and the Telegram Stars were received by the owner of the boosted chat + IsUnclaimed bool `json:"is_unclaimed"` + // A sticker to be shown in the message; may be null if unknown + Sticker *Sticker `json:"sticker"` +} + +func (entity *MessageGiveawayPrizeStars) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageGiveawayPrizeStars + + return json.Marshal((*stub)(entity)) +} + +func (*MessageGiveawayPrizeStars) GetClass() string { + return ClassMessageContent +} + +func (*MessageGiveawayPrizeStars) GetType() string { + return TypeMessageGiveawayPrizeStars +} + +func (*MessageGiveawayPrizeStars) MessageContentType() string { + return TypeMessageGiveawayPrizeStars +} + // A contact has registered with Telegram type MessageContactRegistered struct{ meta @@ -26163,7 +26499,7 @@ func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { return nil } -// Options to be used when a message content is copied without reference to the original sender. Service messages, messages with messageInvoice, messagePaidMedia, messagePremiumGiveaway, or messagePremiumGiveawayWinners content can't be copied +// Options to be used when a message content is copied without reference to the original sender. Service messages, messages with messageInvoice, messagePaidMedia, messageGiveaway, or messageGiveawayWinners content can't be copied type MessageCopyOptions struct { meta // True, if content of the message needs to be copied without reference to the original sender. Always true if the message is forwarded to a secret chat or is local @@ -26430,6 +26766,8 @@ type InputMessagePaidMedia struct { Caption *FormattedText `json:"caption"` // True, if the caption must be shown above the video; otherwise, the caption must be shown below the video; not supported in secret chats ShowCaptionAboveMedia bool `json:"show_caption_above_media"` + // Bot-provided data for the paid media; bots only + Payload string `json:"payload"` } func (entity *InputMessagePaidMedia) MarshalJSON() ([]byte, error) { @@ -27129,6 +27467,8 @@ func (*InputMessageForwarded) InputMessageContentType() string { // Contains properties of a message and describes actions that can be done with the message right now type MessageProperties struct { meta + // True, if content of the message can be copied to a secret chat using inputMessageForwarded or forwardMessages with copy options + CanBeCopiedToSecretChat bool `json:"can_be_copied_to_secret_chat"` // True, if the message can be deleted only for the current user while other users will continue to see it using the method deleteMessages with revoke == false CanBeDeletedOnlyForSelf bool `json:"can_be_deleted_only_for_self"` // True, if the message can be deleted for all users using the method deleteMessages with revoke == true @@ -30654,16 +30994,18 @@ func (*ChatBoostSourceGiftCode) ChatBoostSourceType() string { return TypeChatBoostSourceGiftCode } -// The chat created a Telegram Premium giveaway +// The chat created a giveaway type ChatBoostSourceGiveaway struct { meta // Identifier of a user that won in the giveaway; 0 if none UserId int64 `json:"user_id"` - // The created Telegram Premium gift code if it was used by the user or can be claimed by the current user; an empty string otherwise + // The created Telegram Premium gift code if it was used by the user or can be claimed by the current user; an empty string otherwise; for Telegram Premium giveways only GiftCode string `json:"gift_code"` + // Number of Telegram Stars distributed among winners of the giveaway + StarCount int64 `json:"star_count"` // Identifier of the corresponding giveaway message; can be an identifier of a deleted message GiveawayMessageId int64 `json:"giveaway_message_id"` - // True, if the winner for the corresponding Telegram Premium subscription wasn't chosen, because there were not enough participants + // True, if the winner for the corresponding giveaway prize wasn't chosen, because there were not enough participants IsUnclaimed bool `json:"is_unclaimed"` } @@ -30714,33 +31056,60 @@ func (*ChatBoostSourcePremium) ChatBoostSourceType() string { return TypeChatBoostSourcePremium } -// Describes a prepaid Telegram Premium giveaway -type PrepaidPremiumGiveaway struct { +// Describes a prepaid giveaway +type PrepaidGiveaway struct { meta // Unique identifier of the prepaid giveaway Id JsonInt64 `json:"id"` - // Number of users which will receive Telegram Premium subscription gift codes + // Number of users which will receive giveaway prize WinnerCount int32 `json:"winner_count"` - // Number of months the Telegram Premium subscription will be active after code activation - MonthCount int32 `json:"month_count"` + // Prize of the giveaway + Prize GiveawayPrize `json:"prize"` + // The number of boosts received by the chat from the giveaway; for Telegram Star giveaways only + BoostCount int32 `json:"boost_count"` // Point in time (Unix timestamp) when the giveaway was paid PaymentDate int32 `json:"payment_date"` } -func (entity *PrepaidPremiumGiveaway) MarshalJSON() ([]byte, error) { +func (entity *PrepaidGiveaway) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub PrepaidPremiumGiveaway + type stub PrepaidGiveaway return json.Marshal((*stub)(entity)) } -func (*PrepaidPremiumGiveaway) GetClass() string { - return ClassPrepaidPremiumGiveaway +func (*PrepaidGiveaway) GetClass() string { + return ClassPrepaidGiveaway } -func (*PrepaidPremiumGiveaway) GetType() string { - return TypePrepaidPremiumGiveaway +func (*PrepaidGiveaway) GetType() string { + return TypePrepaidGiveaway +} + +func (prepaidGiveaway *PrepaidGiveaway) UnmarshalJSON(data []byte) error { + var tmp struct { + Id JsonInt64 `json:"id"` + WinnerCount int32 `json:"winner_count"` + Prize json.RawMessage `json:"prize"` + BoostCount int32 `json:"boost_count"` + PaymentDate int32 `json:"payment_date"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + prepaidGiveaway.Id = tmp.Id + prepaidGiveaway.WinnerCount = tmp.WinnerCount + prepaidGiveaway.BoostCount = tmp.BoostCount + prepaidGiveaway.PaymentDate = tmp.PaymentDate + + fieldPrize, _ := UnmarshalGiveawayPrize(tmp.Prize) + prepaidGiveaway.Prize = fieldPrize + + return nil } // Describes current boost status of a chat @@ -30765,7 +31134,7 @@ type ChatBoostStatus struct { // A percentage of Telegram Premium subscribers joined the chat; always 0 if the current user isn't an administrator in the chat PremiumMemberPercentage float64 `json:"premium_member_percentage"` // The list of prepaid giveaways available for the chat; only for chat administrators - PrepaidGiveaways []*PrepaidPremiumGiveaway `json:"prepaid_giveaways"` + PrepaidGiveaways []*PrepaidGiveaway `json:"prepaid_giveaways"` } func (entity *ChatBoostStatus) MarshalJSON() ([]byte, error) { @@ -35084,6 +35453,60 @@ func (chatEventMemberRestricted *ChatEventMemberRestricted) UnmarshalJSON(data [ return nil } +// A chat member extended their subscription to the chat +type ChatEventMemberSubscriptionExtended struct { + meta + // Affected chat member user identifier + UserId int64 `json:"user_id"` + // Previous status of the chat member + OldStatus ChatMemberStatus `json:"old_status"` + // New status of the chat member + NewStatus ChatMemberStatus `json:"new_status"` +} + +func (entity *ChatEventMemberSubscriptionExtended) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventMemberSubscriptionExtended + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventMemberSubscriptionExtended) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventMemberSubscriptionExtended) GetType() string { + return TypeChatEventMemberSubscriptionExtended +} + +func (*ChatEventMemberSubscriptionExtended) ChatEventActionType() string { + return TypeChatEventMemberSubscriptionExtended +} + +func (chatEventMemberSubscriptionExtended *ChatEventMemberSubscriptionExtended) UnmarshalJSON(data []byte) error { + var tmp struct { + UserId int64 `json:"user_id"` + OldStatus json.RawMessage `json:"old_status"` + NewStatus json.RawMessage `json:"new_status"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + chatEventMemberSubscriptionExtended.UserId = tmp.UserId + + fieldOldStatus, _ := UnmarshalChatMemberStatus(tmp.OldStatus) + chatEventMemberSubscriptionExtended.OldStatus = fieldOldStatus + + fieldNewStatus, _ := UnmarshalChatMemberStatus(tmp.NewStatus) + chatEventMemberSubscriptionExtended.NewStatus = fieldNewStatus + + return nil +} + // The chat available reactions were changed type ChatEventAvailableReactionsChanged struct { meta @@ -36326,6 +36749,8 @@ type ChatEventLogFilters struct { VideoChatChanges bool `json:"video_chat_changes"` // True, if forum-related actions need to be returned ForumChanges bool `json:"forum_changes"` + // True, if subscription extensions need to be returned + SubscriptionExtensions bool `json:"subscription_extensions"` } func (entity *ChatEventLogFilters) MarshalJSON() ([]byte, error) { @@ -38670,7 +39095,7 @@ func (*StorePaymentPurposePremiumGiftCodes) StorePaymentPurposeType() string { type StorePaymentPurposePremiumGiveaway struct { meta // Giveaway parameters - Parameters *PremiumGiveawayParameters `json:"parameters"` + Parameters *GiveawayParameters `json:"parameters"` // ISO 4217 currency code of the payment currency Currency string `json:"currency"` // Paid amount, in the smallest units of the currency @@ -38697,6 +39122,41 @@ func (*StorePaymentPurposePremiumGiveaway) StorePaymentPurposeType() string { return TypeStorePaymentPurposePremiumGiveaway } +// The user creating a Telegram Star giveaway +type StorePaymentPurposeStarGiveaway struct { + meta + // Giveaway parameters + Parameters *GiveawayParameters `json:"parameters"` + // ISO 4217 currency code of the payment currency + Currency string `json:"currency"` + // Paid amount, in the smallest units of the currency + Amount int64 `json:"amount"` + // The number of users to receive Telegram Stars + WinnerCount int32 `json:"winner_count"` + // The number of Telegram Stars to be distributed through the giveaway + StarCount int64 `json:"star_count"` +} + +func (entity *StorePaymentPurposeStarGiveaway) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StorePaymentPurposeStarGiveaway + + return json.Marshal((*stub)(entity)) +} + +func (*StorePaymentPurposeStarGiveaway) GetClass() string { + return ClassStorePaymentPurpose +} + +func (*StorePaymentPurposeStarGiveaway) GetType() string { + return TypeStorePaymentPurposeStarGiveaway +} + +func (*StorePaymentPurposeStarGiveaway) StorePaymentPurposeType() string { + return TypeStorePaymentPurposeStarGiveaway +} + // The user buying Telegram Stars type StorePaymentPurposeStars struct { meta @@ -38800,7 +39260,7 @@ func (*TelegramPaymentPurposePremiumGiftCodes) TelegramPaymentPurposeType() stri type TelegramPaymentPurposePremiumGiveaway struct { meta // Giveaway parameters - Parameters *PremiumGiveawayParameters `json:"parameters"` + Parameters *GiveawayParameters `json:"parameters"` // ISO 4217 currency code of the payment currency Currency string `json:"currency"` // Paid amount, in the smallest units of the currency @@ -38895,6 +39355,41 @@ func (*TelegramPaymentPurposeGiftedStars) TelegramPaymentPurposeType() string { return TypeTelegramPaymentPurposeGiftedStars } +// The user creating a Telegram Star giveaway +type TelegramPaymentPurposeStarGiveaway struct { + meta + // Giveaway parameters + Parameters *GiveawayParameters `json:"parameters"` + // ISO 4217 currency code of the payment currency + Currency string `json:"currency"` + // Paid amount, in the smallest units of the currency + Amount int64 `json:"amount"` + // The number of users to receive Telegram Stars + WinnerCount int32 `json:"winner_count"` + // The number of Telegram Stars to be distributed through the giveaway + StarCount int64 `json:"star_count"` +} + +func (entity *TelegramPaymentPurposeStarGiveaway) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TelegramPaymentPurposeStarGiveaway + + return json.Marshal((*stub)(entity)) +} + +func (*TelegramPaymentPurposeStarGiveaway) GetClass() string { + return ClassTelegramPaymentPurpose +} + +func (*TelegramPaymentPurposeStarGiveaway) GetType() string { + return TypeTelegramPaymentPurposeStarGiveaway +} + +func (*TelegramPaymentPurposeStarGiveaway) TelegramPaymentPurposeType() string { + return TypeTelegramPaymentPurposeStarGiveaway +} + // The user joins a chat and subscribes to regular payments in Telegram Stars type TelegramPaymentPurposeJoinChat struct { meta @@ -40769,35 +41264,56 @@ func (*PushMessageContentPremiumGiftCode) PushMessageContentType() string { return TypePushMessageContentPremiumGiftCode } -// A message with a Telegram Premium giveaway -type PushMessageContentPremiumGiveaway struct { +// A message with a giveaway +type PushMessageContentGiveaway struct { meta - // Number of users which will receive Telegram Premium subscription gift codes; 0 for pinned message + // Number of users which will receive giveaway prizes; 0 for pinned message WinnerCount int32 `json:"winner_count"` - // Number of months the Telegram Premium subscription will be active after code activation; 0 for pinned message - MonthCount int32 `json:"month_count"` + // Prize of the giveaway; may be null for pinned message + Prize GiveawayPrize `json:"prize"` // True, if the message is a pinned message with the specified content IsPinned bool `json:"is_pinned"` } -func (entity *PushMessageContentPremiumGiveaway) MarshalJSON() ([]byte, error) { +func (entity *PushMessageContentGiveaway) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub PushMessageContentPremiumGiveaway + type stub PushMessageContentGiveaway return json.Marshal((*stub)(entity)) } -func (*PushMessageContentPremiumGiveaway) GetClass() string { +func (*PushMessageContentGiveaway) GetClass() string { return ClassPushMessageContent } -func (*PushMessageContentPremiumGiveaway) GetType() string { - return TypePushMessageContentPremiumGiveaway +func (*PushMessageContentGiveaway) GetType() string { + return TypePushMessageContentGiveaway } -func (*PushMessageContentPremiumGiveaway) PushMessageContentType() string { - return TypePushMessageContentPremiumGiveaway +func (*PushMessageContentGiveaway) PushMessageContentType() string { + return TypePushMessageContentGiveaway +} + +func (pushMessageContentGiveaway *PushMessageContentGiveaway) UnmarshalJSON(data []byte) error { + var tmp struct { + WinnerCount int32 `json:"winner_count"` + Prize json.RawMessage `json:"prize"` + IsPinned bool `json:"is_pinned"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + pushMessageContentGiveaway.WinnerCount = tmp.WinnerCount + pushMessageContentGiveaway.IsPinned = tmp.IsPinned + + fieldPrize, _ := UnmarshalGiveawayPrize(tmp.Prize) + pushMessageContentGiveaway.Prize = fieldPrize + + return nil } // A screenshot of a message in the chat has been taken @@ -42870,7 +43386,7 @@ func (*CanSendMessageToUserResultUserRestrictsNewChats) CanSendMessageToUserResu // Contains information about the period of inactivity after which the current user's account will automatically be deleted type AccountTtl struct { meta - // Number of days of inactivity before the account will be flagged for deletion; 30-366 days + // Number of days of inactivity before the account will be flagged for deletion; 30-730 days Days int32 `json:"days"` } @@ -44017,7 +44533,7 @@ func (*InternalLinkTypeAuthenticationCode) InternalLinkTypeType() string { return TypeInternalLinkTypeAuthenticationCode } -// The link is a link to a background. Call searchBackground with the given background name to process the link If background is found and the user wants to apply it, then call setDefaultBackground +// The link is a link to a background. Call searchBackground with the given background name to process the link. If background is found and the user wants to apply it, then call setDefaultBackground type InternalLinkTypeBackground struct { meta // Name of the background @@ -44818,7 +45334,7 @@ func (internalLinkTypeProxy *InternalLinkTypeProxy) UnmarshalJSON(data []byte) e return nil } -// The link is a link to a chat by its username. Call searchPublicChat with the given chat username to process the link If the chat is found, open its profile information screen or the chat itself. If draft text isn't empty and the chat is a private chat with a regular user, then put the draft text in the input field +// The link is a link to a chat by its username. Call searchPublicChat with the given chat username to process the link. If the chat is found, open its profile information screen or the chat itself. If draft text isn't empty and the chat is a private chat with a regular user, then put the draft text in the input field type InternalLinkTypePublicChat struct { meta // Username of the chat @@ -48431,6 +48947,8 @@ type ChatRevenueAmount struct { BalanceAmount JsonInt64 `json:"balance_amount"` // Amount of the cryptocurrency available for withdrawal, in the smallest units of the cryptocurrency AvailableAmount JsonInt64 `json:"available_amount"` + // True, if Telegram Stars can be withdrawn now or later + WithdrawalEnabled bool `json:"withdrawal_enabled"` } func (entity *ChatRevenueAmount) MarshalJSON() ([]byte, error) { @@ -53498,7 +54016,7 @@ func (updateSuggestedActions *UpdateSuggestedActions) UnmarshalJSON(data []byte) return nil } -// Download or upload file speed for the user was limited, but it can be restored by subscription to Telegram Premium. The notification can be postponed until a being downloaded or uploaded file is visible to the user Use getOption("premium_download_speedup") or getOption("premium_upload_speedup") to get expected speedup after subscription to Telegram Premium +// Download or upload file speed for the user was limited, but it can be restored by subscription to Telegram Premium. The notification can be postponed until a being downloaded or uploaded file is visible to the user. Use getOption("premium_download_speedup") or getOption("premium_upload_speedup") to get expected speedup after subscription to Telegram Premium type UpdateSpeedLimitNotification struct { meta // True, if upload speed was limited; false, if download speed was limited @@ -54416,6 +54934,35 @@ func (*UpdateMessageReactions) UpdateType() string { return TypeUpdateMessageReactions } +// Paid media were purchased by a user; for bots only +type UpdatePaidMediaPurchased struct { + meta + // User identifier + UserId int64 `json:"user_id"` + // Bot-specified payload for the paid media + Payload string `json:"payload"` +} + +func (entity *UpdatePaidMediaPurchased) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdatePaidMediaPurchased + + return json.Marshal((*stub)(entity)) +} + +func (*UpdatePaidMediaPurchased) GetClass() string { + return ClassUpdate +} + +func (*UpdatePaidMediaPurchased) GetType() string { + return TypeUpdatePaidMediaPurchased +} + +func (*UpdatePaidMediaPurchased) UpdateType() string { + return TypeUpdatePaidMediaPurchased +} + // Contains a list of updates type Updates struct { meta diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 40cab92..ddf4f8d 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -727,7 +727,7 @@ func UnmarshalListOfBotTransactionPurpose(dataList []json.RawMessage) ([]BotTran return list, nil } -func UnmarshalChannelTransactionPurpose(data json.RawMessage) (ChannelTransactionPurpose, error) { +func UnmarshalChatTransactionPurpose(data json.RawMessage) (ChatTransactionPurpose, error) { var meta meta err := json.Unmarshal(data, &meta) @@ -736,25 +736,28 @@ func UnmarshalChannelTransactionPurpose(data json.RawMessage) (ChannelTransactio } switch meta.Type { - case TypeChannelTransactionPurposePaidMedia: - return UnmarshalChannelTransactionPurposePaidMedia(data) + case TypeChatTransactionPurposePaidMedia: + return UnmarshalChatTransactionPurposePaidMedia(data) - case TypeChannelTransactionPurposeJoin: - return UnmarshalChannelTransactionPurposeJoin(data) + case TypeChatTransactionPurposeJoin: + return UnmarshalChatTransactionPurposeJoin(data) - case TypeChannelTransactionPurposeReaction: - return UnmarshalChannelTransactionPurposeReaction(data) + case TypeChatTransactionPurposeReaction: + return UnmarshalChatTransactionPurposeReaction(data) + + case TypeChatTransactionPurposeGiveaway: + return UnmarshalChatTransactionPurposeGiveaway(data) default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } } -func UnmarshalListOfChannelTransactionPurpose(dataList []json.RawMessage) ([]ChannelTransactionPurpose, error) { - list := []ChannelTransactionPurpose{} +func UnmarshalListOfChatTransactionPurpose(dataList []json.RawMessage) ([]ChatTransactionPurpose, error) { + list := []ChatTransactionPurpose{} for _, data := range dataList { - entity, err := UnmarshalChannelTransactionPurpose(data) + entity, err := UnmarshalChatTransactionPurpose(data) if err != nil { return nil, err } @@ -794,8 +797,8 @@ func UnmarshalStarTransactionPartner(data json.RawMessage) (StarTransactionPartn case TypeStarTransactionPartnerBusiness: return UnmarshalStarTransactionPartnerBusiness(data) - case TypeStarTransactionPartnerChannel: - return UnmarshalStarTransactionPartnerChannel(data) + case TypeStarTransactionPartnerChat: + return UnmarshalStarTransactionPartnerChat(data) case TypeStarTransactionPartnerUser: return UnmarshalStarTransactionPartnerUser(data) @@ -822,7 +825,7 @@ func UnmarshalListOfStarTransactionPartner(dataList []json.RawMessage) ([]StarTr return list, nil } -func UnmarshalPremiumGiveawayParticipantStatus(data json.RawMessage) (PremiumGiveawayParticipantStatus, error) { +func UnmarshalGiveawayParticipantStatus(data json.RawMessage) (GiveawayParticipantStatus, error) { var meta meta err := json.Unmarshal(data, &meta) @@ -831,31 +834,31 @@ func UnmarshalPremiumGiveawayParticipantStatus(data json.RawMessage) (PremiumGiv } switch meta.Type { - case TypePremiumGiveawayParticipantStatusEligible: - return UnmarshalPremiumGiveawayParticipantStatusEligible(data) + case TypeGiveawayParticipantStatusEligible: + return UnmarshalGiveawayParticipantStatusEligible(data) - case TypePremiumGiveawayParticipantStatusParticipating: - return UnmarshalPremiumGiveawayParticipantStatusParticipating(data) + case TypeGiveawayParticipantStatusParticipating: + return UnmarshalGiveawayParticipantStatusParticipating(data) - case TypePremiumGiveawayParticipantStatusAlreadyWasMember: - return UnmarshalPremiumGiveawayParticipantStatusAlreadyWasMember(data) + case TypeGiveawayParticipantStatusAlreadyWasMember: + return UnmarshalGiveawayParticipantStatusAlreadyWasMember(data) - case TypePremiumGiveawayParticipantStatusAdministrator: - return UnmarshalPremiumGiveawayParticipantStatusAdministrator(data) + case TypeGiveawayParticipantStatusAdministrator: + return UnmarshalGiveawayParticipantStatusAdministrator(data) - case TypePremiumGiveawayParticipantStatusDisallowedCountry: - return UnmarshalPremiumGiveawayParticipantStatusDisallowedCountry(data) + case TypeGiveawayParticipantStatusDisallowedCountry: + return UnmarshalGiveawayParticipantStatusDisallowedCountry(data) default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } } -func UnmarshalListOfPremiumGiveawayParticipantStatus(dataList []json.RawMessage) ([]PremiumGiveawayParticipantStatus, error) { - list := []PremiumGiveawayParticipantStatus{} +func UnmarshalListOfGiveawayParticipantStatus(dataList []json.RawMessage) ([]GiveawayParticipantStatus, error) { + list := []GiveawayParticipantStatus{} for _, data := range dataList { - entity, err := UnmarshalPremiumGiveawayParticipantStatus(data) + entity, err := UnmarshalGiveawayParticipantStatus(data) if err != nil { return nil, err } @@ -865,7 +868,7 @@ func UnmarshalListOfPremiumGiveawayParticipantStatus(dataList []json.RawMessage) return list, nil } -func UnmarshalPremiumGiveawayInfo(data json.RawMessage) (PremiumGiveawayInfo, error) { +func UnmarshalGiveawayInfo(data json.RawMessage) (GiveawayInfo, error) { var meta meta err := json.Unmarshal(data, &meta) @@ -874,22 +877,56 @@ func UnmarshalPremiumGiveawayInfo(data json.RawMessage) (PremiumGiveawayInfo, er } switch meta.Type { - case TypePremiumGiveawayInfoOngoing: - return UnmarshalPremiumGiveawayInfoOngoing(data) + case TypeGiveawayInfoOngoing: + return UnmarshalGiveawayInfoOngoing(data) - case TypePremiumGiveawayInfoCompleted: - return UnmarshalPremiumGiveawayInfoCompleted(data) + case TypeGiveawayInfoCompleted: + return UnmarshalGiveawayInfoCompleted(data) default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } } -func UnmarshalListOfPremiumGiveawayInfo(dataList []json.RawMessage) ([]PremiumGiveawayInfo, error) { - list := []PremiumGiveawayInfo{} +func UnmarshalListOfGiveawayInfo(dataList []json.RawMessage) ([]GiveawayInfo, error) { + list := []GiveawayInfo{} for _, data := range dataList { - entity, err := UnmarshalPremiumGiveawayInfo(data) + entity, err := UnmarshalGiveawayInfo(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalGiveawayPrize(data json.RawMessage) (GiveawayPrize, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeGiveawayPrizePremium: + return UnmarshalGiveawayPrizePremium(data) + + case TypeGiveawayPrizeStars: + return UnmarshalGiveawayPrizeStars(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfGiveawayPrize(dataList []json.RawMessage) ([]GiveawayPrize, error) { + list := []GiveawayPrize{} + + for _, data := range dataList { + entity, err := UnmarshalGiveawayPrize(data) if err != nil { return nil, err } @@ -2378,6 +2415,12 @@ func UnmarshalLinkPreviewType(data json.RawMessage) (LinkPreviewType, error) { case TypeLinkPreviewTypeEmbeddedVideoPlayer: return UnmarshalLinkPreviewTypeEmbeddedVideoPlayer(data) + case TypeLinkPreviewTypeExternalAudio: + return UnmarshalLinkPreviewTypeExternalAudio(data) + + case TypeLinkPreviewTypeExternalVideo: + return UnmarshalLinkPreviewTypeExternalVideo(data) + case TypeLinkPreviewTypeInvoice: return UnmarshalLinkPreviewTypeInvoice(data) @@ -3195,21 +3238,24 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessagePremiumGiftCode: return UnmarshalMessagePremiumGiftCode(data) - case TypeMessagePremiumGiveawayCreated: - return UnmarshalMessagePremiumGiveawayCreated(data) + case TypeMessageGiveawayCreated: + return UnmarshalMessageGiveawayCreated(data) - case TypeMessagePremiumGiveaway: - return UnmarshalMessagePremiumGiveaway(data) + case TypeMessageGiveaway: + return UnmarshalMessageGiveaway(data) - case TypeMessagePremiumGiveawayCompleted: - return UnmarshalMessagePremiumGiveawayCompleted(data) + case TypeMessageGiveawayCompleted: + return UnmarshalMessageGiveawayCompleted(data) - case TypeMessagePremiumGiveawayWinners: - return UnmarshalMessagePremiumGiveawayWinners(data) + case TypeMessageGiveawayWinners: + return UnmarshalMessageGiveawayWinners(data) case TypeMessageGiftedStars: return UnmarshalMessageGiftedStars(data) + case TypeMessageGiveawayPrizeStars: + return UnmarshalMessageGiveawayPrizeStars(data) + case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) @@ -4826,6 +4872,9 @@ func UnmarshalChatEventAction(data json.RawMessage) (ChatEventAction, error) { case TypeChatEventMemberRestricted: return UnmarshalChatEventMemberRestricted(data) + case TypeChatEventMemberSubscriptionExtended: + return UnmarshalChatEventMemberSubscriptionExtended(data) + case TypeChatEventAvailableReactionsChanged: return UnmarshalChatEventAvailableReactionsChanged(data) @@ -5358,6 +5407,9 @@ func UnmarshalStorePaymentPurpose(data json.RawMessage) (StorePaymentPurpose, er case TypeStorePaymentPurposePremiumGiveaway: return UnmarshalStorePaymentPurposePremiumGiveaway(data) + case TypeStorePaymentPurposeStarGiveaway: + return UnmarshalStorePaymentPurposeStarGiveaway(data) + case TypeStorePaymentPurposeStars: return UnmarshalStorePaymentPurposeStars(data) @@ -5404,6 +5456,9 @@ func UnmarshalTelegramPaymentPurpose(data json.RawMessage) (TelegramPaymentPurpo case TypeTelegramPaymentPurposeGiftedStars: return UnmarshalTelegramPaymentPurposeGiftedStars(data) + case TypeTelegramPaymentPurposeStarGiveaway: + return UnmarshalTelegramPaymentPurposeStarGiveaway(data) + case TypeTelegramPaymentPurposeJoinChat: return UnmarshalTelegramPaymentPurposeJoinChat(data) @@ -5898,8 +5953,8 @@ func UnmarshalPushMessageContent(data json.RawMessage) (PushMessageContent, erro case TypePushMessageContentPremiumGiftCode: return UnmarshalPushMessageContentPremiumGiftCode(data) - case TypePushMessageContentPremiumGiveaway: - return UnmarshalPushMessageContentPremiumGiveaway(data) + case TypePushMessageContentGiveaway: + return UnmarshalPushMessageContentGiveaway(data) case TypePushMessageContentScreenshotTaken: return UnmarshalPushMessageContentScreenshotTaken(data) @@ -7943,6 +7998,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateMessageReactions: return UnmarshalUpdateMessageReactions(data) + case TypeUpdatePaidMediaPurchased: + return UnmarshalUpdatePaidMediaPurchased(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -9159,6 +9217,30 @@ func UnmarshalStarPaymentOptions(data json.RawMessage) (*StarPaymentOptions, err return &resp, err } +func UnmarshalStarGiveawayWinnerOption(data json.RawMessage) (*StarGiveawayWinnerOption, error) { + var resp StarGiveawayWinnerOption + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarGiveawayPaymentOption(data json.RawMessage) (*StarGiveawayPaymentOption, error) { + var resp StarGiveawayPaymentOption + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarGiveawayPaymentOptions(data json.RawMessage) (*StarGiveawayPaymentOptions, error) { + var resp StarGiveawayPaymentOptions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarTransactionDirectionIncoming(data json.RawMessage) (*StarTransactionDirectionIncoming, error) { var resp StarTransactionDirectionIncoming @@ -9191,24 +9273,32 @@ func UnmarshalBotTransactionPurposeInvoicePayment(data json.RawMessage) (*BotTra return &resp, err } -func UnmarshalChannelTransactionPurposePaidMedia(data json.RawMessage) (*ChannelTransactionPurposePaidMedia, error) { - var resp ChannelTransactionPurposePaidMedia +func UnmarshalChatTransactionPurposePaidMedia(data json.RawMessage) (*ChatTransactionPurposePaidMedia, error) { + var resp ChatTransactionPurposePaidMedia err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalChannelTransactionPurposeJoin(data json.RawMessage) (*ChannelTransactionPurposeJoin, error) { - var resp ChannelTransactionPurposeJoin +func UnmarshalChatTransactionPurposeJoin(data json.RawMessage) (*ChatTransactionPurposeJoin, error) { + var resp ChatTransactionPurposeJoin err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalChannelTransactionPurposeReaction(data json.RawMessage) (*ChannelTransactionPurposeReaction, error) { - var resp ChannelTransactionPurposeReaction +func UnmarshalChatTransactionPurposeReaction(data json.RawMessage) (*ChatTransactionPurposeReaction, error) { + var resp ChatTransactionPurposeReaction + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatTransactionPurposeGiveaway(data json.RawMessage) (*ChatTransactionPurposeGiveaway, error) { + var resp ChatTransactionPurposeGiveaway err := json.Unmarshal(data, &resp) @@ -9271,8 +9361,8 @@ func UnmarshalStarTransactionPartnerBusiness(data json.RawMessage) (*StarTransac return &resp, err } -func UnmarshalStarTransactionPartnerChannel(data json.RawMessage) (*StarTransactionPartnerChannel, error) { - var resp StarTransactionPartnerChannel +func UnmarshalStarTransactionPartnerChat(data json.RawMessage) (*StarTransactionPartnerChat, error) { + var resp StarTransactionPartnerChat err := json.Unmarshal(data, &resp) @@ -9311,56 +9401,72 @@ func UnmarshalStarTransactions(data json.RawMessage) (*StarTransactions, error) return &resp, err } -func UnmarshalPremiumGiveawayParticipantStatusEligible(data json.RawMessage) (*PremiumGiveawayParticipantStatusEligible, error) { - var resp PremiumGiveawayParticipantStatusEligible +func UnmarshalGiveawayParticipantStatusEligible(data json.RawMessage) (*GiveawayParticipantStatusEligible, error) { + var resp GiveawayParticipantStatusEligible err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalPremiumGiveawayParticipantStatusParticipating(data json.RawMessage) (*PremiumGiveawayParticipantStatusParticipating, error) { - var resp PremiumGiveawayParticipantStatusParticipating +func UnmarshalGiveawayParticipantStatusParticipating(data json.RawMessage) (*GiveawayParticipantStatusParticipating, error) { + var resp GiveawayParticipantStatusParticipating err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalPremiumGiveawayParticipantStatusAlreadyWasMember(data json.RawMessage) (*PremiumGiveawayParticipantStatusAlreadyWasMember, error) { - var resp PremiumGiveawayParticipantStatusAlreadyWasMember +func UnmarshalGiveawayParticipantStatusAlreadyWasMember(data json.RawMessage) (*GiveawayParticipantStatusAlreadyWasMember, error) { + var resp GiveawayParticipantStatusAlreadyWasMember err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalPremiumGiveawayParticipantStatusAdministrator(data json.RawMessage) (*PremiumGiveawayParticipantStatusAdministrator, error) { - var resp PremiumGiveawayParticipantStatusAdministrator +func UnmarshalGiveawayParticipantStatusAdministrator(data json.RawMessage) (*GiveawayParticipantStatusAdministrator, error) { + var resp GiveawayParticipantStatusAdministrator err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalPremiumGiveawayParticipantStatusDisallowedCountry(data json.RawMessage) (*PremiumGiveawayParticipantStatusDisallowedCountry, error) { - var resp PremiumGiveawayParticipantStatusDisallowedCountry +func UnmarshalGiveawayParticipantStatusDisallowedCountry(data json.RawMessage) (*GiveawayParticipantStatusDisallowedCountry, error) { + var resp GiveawayParticipantStatusDisallowedCountry err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalPremiumGiveawayInfoOngoing(data json.RawMessage) (*PremiumGiveawayInfoOngoing, error) { - var resp PremiumGiveawayInfoOngoing +func UnmarshalGiveawayInfoOngoing(data json.RawMessage) (*GiveawayInfoOngoing, error) { + var resp GiveawayInfoOngoing err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalPremiumGiveawayInfoCompleted(data json.RawMessage) (*PremiumGiveawayInfoCompleted, error) { - var resp PremiumGiveawayInfoCompleted +func UnmarshalGiveawayInfoCompleted(data json.RawMessage) (*GiveawayInfoCompleted, error) { + var resp GiveawayInfoCompleted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiveawayPrizePremium(data json.RawMessage) (*GiveawayPrizePremium, error) { + var resp GiveawayPrizePremium + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiveawayPrizeStars(data json.RawMessage) (*GiveawayPrizeStars, error) { + var resp GiveawayPrizeStars err := json.Unmarshal(data, &resp) @@ -11719,6 +11825,22 @@ func UnmarshalLinkPreviewTypeEmbeddedVideoPlayer(data json.RawMessage) (*LinkPre return &resp, err } +func UnmarshalLinkPreviewTypeExternalAudio(data json.RawMessage) (*LinkPreviewTypeExternalAudio, error) { + var resp LinkPreviewTypeExternalAudio + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeExternalVideo(data json.RawMessage) (*LinkPreviewTypeExternalVideo, error) { + var resp LinkPreviewTypeExternalVideo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalLinkPreviewTypeInvoice(data json.RawMessage) (*LinkPreviewTypeInvoice, error) { var resp LinkPreviewTypeInvoice @@ -12175,8 +12297,8 @@ func UnmarshalPaidMediaUnsupported(data json.RawMessage) (*PaidMediaUnsupported, return &resp, err } -func UnmarshalPremiumGiveawayParameters(data json.RawMessage) (*PremiumGiveawayParameters, error) { - var resp PremiumGiveawayParameters +func UnmarshalGiveawayParameters(data json.RawMessage) (*GiveawayParameters, error) { + var resp GiveawayParameters err := json.Unmarshal(data, &resp) @@ -13223,32 +13345,32 @@ func UnmarshalMessagePremiumGiftCode(data json.RawMessage) (*MessagePremiumGiftC return &resp, err } -func UnmarshalMessagePremiumGiveawayCreated(data json.RawMessage) (*MessagePremiumGiveawayCreated, error) { - var resp MessagePremiumGiveawayCreated +func UnmarshalMessageGiveawayCreated(data json.RawMessage) (*MessageGiveawayCreated, error) { + var resp MessageGiveawayCreated err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalMessagePremiumGiveaway(data json.RawMessage) (*MessagePremiumGiveaway, error) { - var resp MessagePremiumGiveaway +func UnmarshalMessageGiveaway(data json.RawMessage) (*MessageGiveaway, error) { + var resp MessageGiveaway err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalMessagePremiumGiveawayCompleted(data json.RawMessage) (*MessagePremiumGiveawayCompleted, error) { - var resp MessagePremiumGiveawayCompleted +func UnmarshalMessageGiveawayCompleted(data json.RawMessage) (*MessageGiveawayCompleted, error) { + var resp MessageGiveawayCompleted err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalMessagePremiumGiveawayWinners(data json.RawMessage) (*MessagePremiumGiveawayWinners, error) { - var resp MessagePremiumGiveawayWinners +func UnmarshalMessageGiveawayWinners(data json.RawMessage) (*MessageGiveawayWinners, error) { + var resp MessageGiveawayWinners err := json.Unmarshal(data, &resp) @@ -13263,6 +13385,14 @@ func UnmarshalMessageGiftedStars(data json.RawMessage) (*MessageGiftedStars, err return &resp, err } +func UnmarshalMessageGiveawayPrizeStars(data json.RawMessage) (*MessageGiveawayPrizeStars, error) { + var resp MessageGiveawayPrizeStars + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageContactRegistered(data json.RawMessage) (*MessageContactRegistered, error) { var resp MessageContactRegistered @@ -14631,8 +14761,8 @@ func UnmarshalChatBoostSourcePremium(data json.RawMessage) (*ChatBoostSourcePrem return &resp, err } -func UnmarshalPrepaidPremiumGiveaway(data json.RawMessage) (*PrepaidPremiumGiveaway, error) { - var resp PrepaidPremiumGiveaway +func UnmarshalPrepaidGiveaway(data json.RawMessage) (*PrepaidGiveaway, error) { + var resp PrepaidGiveaway err := json.Unmarshal(data, &resp) @@ -15591,6 +15721,14 @@ func UnmarshalChatEventMemberRestricted(data json.RawMessage) (*ChatEventMemberR return &resp, err } +func UnmarshalChatEventMemberSubscriptionExtended(data json.RawMessage) (*ChatEventMemberSubscriptionExtended, error) { + var resp ChatEventMemberSubscriptionExtended + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatEventAvailableReactionsChanged(data json.RawMessage) (*ChatEventAvailableReactionsChanged, error) { var resp ChatEventAvailableReactionsChanged @@ -16591,6 +16729,14 @@ func UnmarshalStorePaymentPurposePremiumGiveaway(data json.RawMessage) (*StorePa return &resp, err } +func UnmarshalStorePaymentPurposeStarGiveaway(data json.RawMessage) (*StorePaymentPurposeStarGiveaway, error) { + var resp StorePaymentPurposeStarGiveaway + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStorePaymentPurposeStars(data json.RawMessage) (*StorePaymentPurposeStars, error) { var resp StorePaymentPurposeStars @@ -16639,6 +16785,14 @@ func UnmarshalTelegramPaymentPurposeGiftedStars(data json.RawMessage) (*Telegram return &resp, err } +func UnmarshalTelegramPaymentPurposeStarGiveaway(data json.RawMessage) (*TelegramPaymentPurposeStarGiveaway, error) { + var resp TelegramPaymentPurposeStarGiveaway + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalTelegramPaymentPurposeJoinChat(data json.RawMessage) (*TelegramPaymentPurposeJoinChat, error) { var resp TelegramPaymentPurposeJoinChat @@ -17175,8 +17329,8 @@ func UnmarshalPushMessageContentPremiumGiftCode(data json.RawMessage) (*PushMess return &resp, err } -func UnmarshalPushMessageContentPremiumGiveaway(data json.RawMessage) (*PushMessageContentPremiumGiveaway, error) { - var resp PushMessageContentPremiumGiveaway +func UnmarshalPushMessageContentGiveaway(data json.RawMessage) (*PushMessageContentGiveaway, error) { + var resp PushMessageContentGiveaway err := json.Unmarshal(data, &resp) @@ -20703,6 +20857,14 @@ func UnmarshalUpdateMessageReactions(data json.RawMessage) (*UpdateMessageReacti return &resp, err } +func UnmarshalUpdatePaidMediaPurchased(data json.RawMessage) (*UpdatePaidMediaPurchased, error) { + var resp UpdatePaidMediaPurchased + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdates(data json.RawMessage) (*Updates, error) { var resp Updates @@ -21259,6 +21421,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarPaymentOptions: return UnmarshalStarPaymentOptions(data) + case TypeStarGiveawayWinnerOption: + return UnmarshalStarGiveawayWinnerOption(data) + + case TypeStarGiveawayPaymentOption: + return UnmarshalStarGiveawayPaymentOption(data) + + case TypeStarGiveawayPaymentOptions: + return UnmarshalStarGiveawayPaymentOptions(data) + case TypeStarTransactionDirectionIncoming: return UnmarshalStarTransactionDirectionIncoming(data) @@ -21271,14 +21442,17 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeBotTransactionPurposeInvoicePayment: return UnmarshalBotTransactionPurposeInvoicePayment(data) - case TypeChannelTransactionPurposePaidMedia: - return UnmarshalChannelTransactionPurposePaidMedia(data) + case TypeChatTransactionPurposePaidMedia: + return UnmarshalChatTransactionPurposePaidMedia(data) - case TypeChannelTransactionPurposeJoin: - return UnmarshalChannelTransactionPurposeJoin(data) + case TypeChatTransactionPurposeJoin: + return UnmarshalChatTransactionPurposeJoin(data) - case TypeChannelTransactionPurposeReaction: - return UnmarshalChannelTransactionPurposeReaction(data) + case TypeChatTransactionPurposeReaction: + return UnmarshalChatTransactionPurposeReaction(data) + + case TypeChatTransactionPurposeGiveaway: + return UnmarshalChatTransactionPurposeGiveaway(data) case TypeStarTransactionPartnerTelegram: return UnmarshalStarTransactionPartnerTelegram(data) @@ -21301,8 +21475,8 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarTransactionPartnerBusiness: return UnmarshalStarTransactionPartnerBusiness(data) - case TypeStarTransactionPartnerChannel: - return UnmarshalStarTransactionPartnerChannel(data) + case TypeStarTransactionPartnerChat: + return UnmarshalStarTransactionPartnerChat(data) case TypeStarTransactionPartnerUser: return UnmarshalStarTransactionPartnerUser(data) @@ -21316,26 +21490,32 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarTransactions: return UnmarshalStarTransactions(data) - case TypePremiumGiveawayParticipantStatusEligible: - return UnmarshalPremiumGiveawayParticipantStatusEligible(data) + case TypeGiveawayParticipantStatusEligible: + return UnmarshalGiveawayParticipantStatusEligible(data) - case TypePremiumGiveawayParticipantStatusParticipating: - return UnmarshalPremiumGiveawayParticipantStatusParticipating(data) + case TypeGiveawayParticipantStatusParticipating: + return UnmarshalGiveawayParticipantStatusParticipating(data) - case TypePremiumGiveawayParticipantStatusAlreadyWasMember: - return UnmarshalPremiumGiveawayParticipantStatusAlreadyWasMember(data) + case TypeGiveawayParticipantStatusAlreadyWasMember: + return UnmarshalGiveawayParticipantStatusAlreadyWasMember(data) - case TypePremiumGiveawayParticipantStatusAdministrator: - return UnmarshalPremiumGiveawayParticipantStatusAdministrator(data) + case TypeGiveawayParticipantStatusAdministrator: + return UnmarshalGiveawayParticipantStatusAdministrator(data) - case TypePremiumGiveawayParticipantStatusDisallowedCountry: - return UnmarshalPremiumGiveawayParticipantStatusDisallowedCountry(data) + case TypeGiveawayParticipantStatusDisallowedCountry: + return UnmarshalGiveawayParticipantStatusDisallowedCountry(data) - case TypePremiumGiveawayInfoOngoing: - return UnmarshalPremiumGiveawayInfoOngoing(data) + case TypeGiveawayInfoOngoing: + return UnmarshalGiveawayInfoOngoing(data) - case TypePremiumGiveawayInfoCompleted: - return UnmarshalPremiumGiveawayInfoCompleted(data) + case TypeGiveawayInfoCompleted: + return UnmarshalGiveawayInfoCompleted(data) + + case TypeGiveawayPrizePremium: + return UnmarshalGiveawayPrizePremium(data) + + case TypeGiveawayPrizeStars: + return UnmarshalGiveawayPrizeStars(data) case TypeAccentColor: return UnmarshalAccentColor(data) @@ -22219,6 +22399,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeLinkPreviewTypeEmbeddedVideoPlayer: return UnmarshalLinkPreviewTypeEmbeddedVideoPlayer(data) + case TypeLinkPreviewTypeExternalAudio: + return UnmarshalLinkPreviewTypeExternalAudio(data) + + case TypeLinkPreviewTypeExternalVideo: + return UnmarshalLinkPreviewTypeExternalVideo(data) + case TypeLinkPreviewTypeInvoice: return UnmarshalLinkPreviewTypeInvoice(data) @@ -22390,8 +22576,8 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePaidMediaUnsupported: return UnmarshalPaidMediaUnsupported(data) - case TypePremiumGiveawayParameters: - return UnmarshalPremiumGiveawayParameters(data) + case TypeGiveawayParameters: + return UnmarshalGiveawayParameters(data) case TypeDatedFile: return UnmarshalDatedFile(data) @@ -22783,21 +22969,24 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessagePremiumGiftCode: return UnmarshalMessagePremiumGiftCode(data) - case TypeMessagePremiumGiveawayCreated: - return UnmarshalMessagePremiumGiveawayCreated(data) + case TypeMessageGiveawayCreated: + return UnmarshalMessageGiveawayCreated(data) - case TypeMessagePremiumGiveaway: - return UnmarshalMessagePremiumGiveaway(data) + case TypeMessageGiveaway: + return UnmarshalMessageGiveaway(data) - case TypeMessagePremiumGiveawayCompleted: - return UnmarshalMessagePremiumGiveawayCompleted(data) + case TypeMessageGiveawayCompleted: + return UnmarshalMessageGiveawayCompleted(data) - case TypeMessagePremiumGiveawayWinners: - return UnmarshalMessagePremiumGiveawayWinners(data) + case TypeMessageGiveawayWinners: + return UnmarshalMessageGiveawayWinners(data) case TypeMessageGiftedStars: return UnmarshalMessageGiftedStars(data) + case TypeMessageGiveawayPrizeStars: + return UnmarshalMessageGiveawayPrizeStars(data) + case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) @@ -23311,8 +23500,8 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatBoostSourcePremium: return UnmarshalChatBoostSourcePremium(data) - case TypePrepaidPremiumGiveaway: - return UnmarshalPrepaidPremiumGiveaway(data) + case TypePrepaidGiveaway: + return UnmarshalPrepaidGiveaway(data) case TypeChatBoostStatus: return UnmarshalChatBoostStatus(data) @@ -23671,6 +23860,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatEventMemberRestricted: return UnmarshalChatEventMemberRestricted(data) + case TypeChatEventMemberSubscriptionExtended: + return UnmarshalChatEventMemberSubscriptionExtended(data) + case TypeChatEventAvailableReactionsChanged: return UnmarshalChatEventAvailableReactionsChanged(data) @@ -24046,6 +24238,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStorePaymentPurposePremiumGiveaway: return UnmarshalStorePaymentPurposePremiumGiveaway(data) + case TypeStorePaymentPurposeStarGiveaway: + return UnmarshalStorePaymentPurposeStarGiveaway(data) + case TypeStorePaymentPurposeStars: return UnmarshalStorePaymentPurposeStars(data) @@ -24064,6 +24259,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeTelegramPaymentPurposeGiftedStars: return UnmarshalTelegramPaymentPurposeGiftedStars(data) + case TypeTelegramPaymentPurposeStarGiveaway: + return UnmarshalTelegramPaymentPurposeStarGiveaway(data) + case TypeTelegramPaymentPurposeJoinChat: return UnmarshalTelegramPaymentPurposeJoinChat(data) @@ -24265,8 +24463,8 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePushMessageContentPremiumGiftCode: return UnmarshalPushMessageContentPremiumGiftCode(data) - case TypePushMessageContentPremiumGiveaway: - return UnmarshalPushMessageContentPremiumGiveaway(data) + case TypePushMessageContentGiveaway: + return UnmarshalPushMessageContentGiveaway(data) case TypePushMessageContentScreenshotTaken: return UnmarshalPushMessageContentScreenshotTaken(data) @@ -25588,6 +25786,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateMessageReactions: return UnmarshalUpdateMessageReactions(data) + case TypeUpdatePaidMediaPurchased: + return UnmarshalUpdatePaidMediaPurchased(data) + case TypeUpdates: return UnmarshalUpdates(data) diff --git a/data/td_api.tl b/data/td_api.tl index f75837f..8174884 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -849,16 +849,16 @@ premiumPaymentOption currency:string amount:int53 discount_percentage:int32 mont //@last_transaction_id Identifier of the last in-store transaction for the currently used option premiumStatePaymentOption payment_option:premiumPaymentOption is_current:Bool is_upgrade:Bool last_transaction_id:string = PremiumStatePaymentOption; -//@description Describes an option for creating Telegram Premium gift codes. Use telegramPaymentPurposePremiumGiftCodes for out-of-store payments +//@description Describes an option for creating Telegram Premium gift codes or Telegram Premium giveaway. Use telegramPaymentPurposePremiumGiftCodes or telegramPaymentPurposePremiumGiveaway for out-of-store payments //@currency ISO 4217 currency code for Telegram Premium gift code payment //@amount The amount to pay, in the smallest units of the currency -//@user_count Number of users which will be able to activate the gift codes +//@winner_count Number of users which will be able to activate the gift codes //@month_count Number of months the Telegram Premium subscription will be active //@store_product_id Identifier of the store product associated with the option; may be empty if none //@store_product_quantity Number of times the store product must be paid -premiumGiftCodePaymentOption currency:string amount:int53 user_count:int32 month_count:int32 store_product_id:string store_product_quantity:int32 = PremiumGiftCodePaymentOption; +premiumGiftCodePaymentOption currency:string amount:int53 winner_count:int32 month_count:int32 store_product_id:string store_product_quantity:int32 = PremiumGiftCodePaymentOption; -//@description Contains a list of options for creating Telegram Premium gift codes @options The list of options +//@description Contains a list of options for creating Telegram Premium gift codes or Telegram Premium giveaway @options The list of options premiumGiftCodePaymentOptions options:vector = PremiumGiftCodePaymentOptions; //@description Contains information about a Telegram Premium gift code @@ -882,6 +882,26 @@ starPaymentOption currency:string amount:int53 star_count:int53 store_product_id //@description Contains a list of options for buying Telegram Stars @options The list of options starPaymentOptions options:vector = StarPaymentOptions; +//@description Describes an option for the number of winners of a Telegram Star giveaway +//@winner_count The number of users that will be chosen as winners +//@won_star_count The number of Telegram Stars that will be won by the winners of the giveaway +//@is_default True, if the option must be chosen by default +starGiveawayWinnerOption winner_count:int32 won_star_count:int53 is_default:Bool = StarGiveawayWinnerOption; + +//@description Describes an option for creating Telegram Star giveaway. Use telegramPaymentPurposeStarGiveaway for out-of-store payments +//@currency ISO 4217 currency code for the payment +//@amount The amount to pay, in the smallest units of the currency +//@star_count Number of Telegram Stars that will be distributed among winners +//@store_product_id Identifier of the store product associated with the option; may be empty if none +//@yearly_boost_count Number of times the chat will be boosted for one year if the option is chosen +//@winner_options Allowed options for the number of giveaway winners +//@is_default True, if the option must be chosen by default +//@is_additional True, if the option must be shown only in the full list of payment options +starGiveawayPaymentOption currency:string amount:int53 star_count:int53 store_product_id:string yearly_boost_count:int32 winner_options:vector is_default:Bool is_additional:Bool = StarGiveawayPaymentOption; + +//@description Contains a list of options for creating Telegram Star giveaway @options The list of options +starGiveawayPaymentOptions options:vector = StarGiveawayPaymentOptions; + //@class StarTransactionDirection @description Describes direction of a transaction with Telegram Stars @@ -894,8 +914,8 @@ starTransactionDirectionOutgoing = StarTransactionDirection; //@class BotTransactionPurpose @description Describes purpose of a transaction with a bot -//@description Paid media were bought @media The bought media if the trancastion wasn't refunded -botTransactionPurposePaidMedia media:vector = BotTransactionPurpose; +//@description Paid media were bought @media The bought media if the trancastion wasn't refunded @payload Bot-provided payload; for bots only +botTransactionPurposePaidMedia media:vector payload:string = BotTransactionPurpose; //@description User bought a product from the bot //@product_info Information about the bought product; may be null if not applicable @@ -903,20 +923,23 @@ botTransactionPurposePaidMedia media:vector = BotTransactionPurpose; botTransactionPurposeInvoicePayment product_info:productInfo invoice_payload:bytes = BotTransactionPurpose; -//@class ChannelTransactionPurpose @description Describes purpose of a transaction with a channel +//@class ChatTransactionPurpose @description Describes purpose of a transaction with a supergroup or a channel //@description Paid media were bought -//@message_id Identifier of the corresponding message with paid media; can be an identifier of a deleted message +//@message_id Identifier of the corresponding message with paid media; can be 0 or an identifier of a deleted message //@media The bought media if the trancastion wasn't refunded -channelTransactionPurposePaidMedia message_id:int53 media:vector = ChannelTransactionPurpose; +chatTransactionPurposePaidMedia message_id:int53 media:vector = ChatTransactionPurpose; //@description User joined the channel and subscribed to regular payments in Telegram Stars //@period The number of seconds between consecutive Telegram Star debiting -channelTransactionPurposeJoin period:int32 = ChannelTransactionPurpose; +chatTransactionPurposeJoin period:int32 = ChatTransactionPurpose; //@description User paid for a reaction -//@message_id Identifier of the reacted message; can be an identifier of a deleted message -channelTransactionPurposeReaction message_id:int53 = ChannelTransactionPurpose; +//@message_id Identifier of the reacted message; can be 0 or an identifier of a deleted message +chatTransactionPurposeReaction message_id:int53 = ChatTransactionPurpose; + +//@description User received Telegram Stars from a giveaway @giveaway_message_id Identifier of the message with giveaway; can be 0 or an identifier of a deleted message +chatTransactionPurposeGiveaway giveaway_message_id:int53 = ChatTransactionPurpose; //@class StarTransactionPartner @description Describes source or recipient of a transaction with Telegram Stars @@ -942,8 +965,8 @@ starTransactionPartnerBot user_id:int53 purpose:BotTransactionPurpose = StarTran //@description The transaction is a transaction with a business account @user_id Identifier of the business account user @media The bought media if the trancastion wasn't refunded starTransactionPartnerBusiness user_id:int53 media:vector = StarTransactionPartner; -//@description The transaction is a transaction with a channel chat @chat_id Identifier of the chat @purpose Purpose of the transaction -starTransactionPartnerChannel chat_id:int53 purpose:ChannelTransactionPurpose = StarTransactionPartner; +//@description The transaction is a transaction with a supergroup or a channel chat @chat_id Identifier of the chat @purpose Purpose of the transaction +starTransactionPartnerChat chat_id:int53 purpose:ChatTransactionPurpose = StarTransactionPartner; //@description The transaction is a gift of Telegram Stars from another user //@user_id Identifier of the user; 0 if the gift was anonymous @@ -969,41 +992,52 @@ starTransaction id:string star_count:int53 is_refund:Bool date:int32 partner:Sta starTransactions star_count:int53 transactions:vector next_offset:string = StarTransactions; -//@class PremiumGiveawayParticipantStatus @description Contains information about status of a user in a Telegram Premium giveaway +//@class GiveawayParticipantStatus @description Contains information about status of a user in a giveaway //@description The user is eligible for the giveaway -premiumGiveawayParticipantStatusEligible = PremiumGiveawayParticipantStatus; +giveawayParticipantStatusEligible = GiveawayParticipantStatus; //@description The user participates in the giveaway -premiumGiveawayParticipantStatusParticipating = PremiumGiveawayParticipantStatus; +giveawayParticipantStatusParticipating = GiveawayParticipantStatus; //@description The user can't participate in the giveaway, because they have already been member of the chat //@joined_chat_date Point in time (Unix timestamp) when the user joined the chat -premiumGiveawayParticipantStatusAlreadyWasMember joined_chat_date:int32 = PremiumGiveawayParticipantStatus; +giveawayParticipantStatusAlreadyWasMember joined_chat_date:int32 = GiveawayParticipantStatus; //@description The user can't participate in the giveaway, because they are an administrator in one of the chats that created the giveaway @chat_id Identifier of the chat administered by the user -premiumGiveawayParticipantStatusAdministrator chat_id:int53 = PremiumGiveawayParticipantStatus; +giveawayParticipantStatusAdministrator chat_id:int53 = GiveawayParticipantStatus; //@description The user can't participate in the giveaway, because they phone number is from a disallowed country @user_country_code A two-letter ISO 3166-1 alpha-2 country code of the user's country -premiumGiveawayParticipantStatusDisallowedCountry user_country_code:string = PremiumGiveawayParticipantStatus; +giveawayParticipantStatusDisallowedCountry user_country_code:string = GiveawayParticipantStatus; -//@class PremiumGiveawayInfo @description Contains information about Telegram Premium giveaway +//@class GiveawayInfo @description Contains information about a giveaway //@description Describes an ongoing giveaway //@creation_date Point in time (Unix timestamp) when the giveaway was created //@status Status of the current user in the giveaway //@is_ended True, if the giveaway has ended and results are being prepared -premiumGiveawayInfoOngoing creation_date:int32 status:PremiumGiveawayParticipantStatus is_ended:Bool = PremiumGiveawayInfo; +giveawayInfoOngoing creation_date:int32 status:GiveawayParticipantStatus is_ended:Bool = GiveawayInfo; //@description Describes a completed giveaway //@creation_date Point in time (Unix timestamp) when the giveaway was created //@actual_winners_selection_date Point in time (Unix timestamp) when the winners were selected. May be bigger than winners selection date specified in parameters of the giveaway //@was_refunded True, if the giveaway was canceled and was fully refunded +//@is_winner True, if the cuurent user is a winner of the giveaway //@winner_count Number of winners in the giveaway -//@activation_count Number of winners, which activated their gift codes -//@gift_code Telegram Premium gift code that was received by the current user; empty if the user isn't a winner in the giveaway -premiumGiveawayInfoCompleted creation_date:int32 actual_winners_selection_date:int32 was_refunded:Bool winner_count:int32 activation_count:int32 gift_code:string = PremiumGiveawayInfo; +//@activation_count Number of winners, which activated their gift codes; for Telegram Premium giveaways only +//@gift_code Telegram Premium gift code that was received by the current user; empty if the user isn't a winner in the giveaway or the giveaway isn't a Telegram Premium giveaway +//@won_star_count The amount of Telegram Stars won by the current user; 0 if the user isn't a winner in the giveaway or the giveaway isn't a Telegram Star giveaway +giveawayInfoCompleted creation_date:int32 actual_winners_selection_date:int32 was_refunded:Bool is_winner:Bool winner_count:int32 activation_count:int32 gift_code:string won_star_count:int53 = GiveawayInfo; + + +//@class GiveawayPrize @description Contains information about a giveaway prize + +//@description The giveaway sends Telegram Premium subscriptions to the winners @month_count Number of months the Telegram Premium subscription will be active after code activation +giveawayPrizePremium month_count:int32 = GiveawayPrize; + +//@description The giveaway sends Telegram Stars to the winners @star_count Number of Telegram Stars that will be shared by all winners +giveawayPrizeStars star_count:int53 = GiveawayPrize; //@description Contains information about supported accent color for user/chat name, background of empty chat photo, replies to messages and link previews @@ -1629,9 +1663,9 @@ inputTextQuote text:formattedText position:int32 = InputTextQuote; //@origin Information about origin of the message if the message was from another chat or topic; may be null for messages from the same chat //@origin_send_date Point in time (Unix timestamp) when the message was sent if the message was from another chat or topic; 0 for messages from the same chat //@content Media content of the message if the message was from another chat or topic; may be null for messages from the same chat and messages without media. -//-Can be only one of the following types: messageAnimation, messageAudio, messageContact, messageDice, messageDocument, messageGame, messageInvoice, messageLocation, -//-messagePaidMedia, messagePhoto, messagePoll, messagePremiumGiveaway, messagePremiumGiveawayWinners, messageSticker, messageStory, messageText (for link preview), -//-messageVenue, messageVideo, messageVideoNote, or messageVoiceNote +//-Can be only one of the following types: messageAnimation, messageAudio, messageContact, messageDice, messageDocument, messageGame, messageGiveaway, messageGiveawayWinners, +//-messageInvoice, messageLocation, messagePaidMedia, messagePhoto, messagePoll, messageSticker, messageStory, messageText (for link preview), messageVenue, messageVideo, +//-messageVideoNote, or messageVoiceNote messageReplyToMessage chat_id:int53 message_id:int53 quote:textQuote origin:MessageOrigin origin_send_date:int32 content:MessageContent = MessageReplyTo; //@description Describes a story replied by a given message @story_sender_chat_id The identifier of the sender of the story @story_id The identifier of the story @@ -2663,22 +2697,17 @@ linkPreviewAlbumMediaVideo video:video = LinkPreviewAlbumMedia; //@description The link is a link to a media album consisting of photos and videos @media The list of album media @caption Album caption linkPreviewTypeAlbum media:vector caption:string = LinkPreviewType; -//@description The link is a link to an animation @animation The animation @author Author of the animation -linkPreviewTypeAnimation animation:animation author:string = LinkPreviewType; +//@description The link is a link to an animation @animation The animation +linkPreviewTypeAnimation animation:animation = LinkPreviewType; -//@description The link is a link to an app at App Store or Google Play @photo Photo for the app @author Author of the app -linkPreviewTypeApp photo:photo author:string = LinkPreviewType; +//@description The link is a link to an app at App Store or Google Play @photo Photo for the app +linkPreviewTypeApp photo:photo = LinkPreviewType; -//@description The link is a link to a web site @photo Article's main photo; may be null @author Author of the article -linkPreviewTypeArticle photo:photo author:string = LinkPreviewType; +//@description The link is a link to a web site @photo Article's main photo; may be null +linkPreviewTypeArticle photo:photo = LinkPreviewType; -//@description The link is a link to an audio -//@url URL of the audio; may be empty if none -//@mime_type MIME type of the audio file -//@audio The audio description; may be null if unknown -//@duration Duration of the audio, in seconds; 0 if unknown -//@author Author of the audio -linkPreviewTypeAudio url:string mime_type:string audio:audio duration:int32 author:string = LinkPreviewType; +//@description The link is a link to an audio @audio The audio description +linkPreviewTypeAudio audio:audio = LinkPreviewType; //@description The link is a link to a background. Link preview title and description are available only for filled backgrounds //@document Document with the background; may be null for filled backgrounds @@ -2694,35 +2723,46 @@ linkPreviewTypeChannelBoost photo:chatPhoto = LinkPreviewType; //@creates_join_request True, if the link only creates join request linkPreviewTypeChat type:InviteLinkChatType photo:chatPhoto creates_join_request:Bool = LinkPreviewType; -//@description The link is a link to a general file @document The document description @author Author of the document -linkPreviewTypeDocument document:document author:string = LinkPreviewType; +//@description The link is a link to a general file @document The document description +linkPreviewTypeDocument document:document = LinkPreviewType; //@description The link is a link to an animation player //@url URL of the external animation player //@thumbnail Thumbnail of the animation; may be null if unknown //@duration Duration of the animation, in seconds -//@author Author of the animation //@width Expected width of the embedded player //@height Expected height of the embedded player -linkPreviewTypeEmbeddedAnimationPlayer url:string thumbnail:photo duration:int32 author:string width:int32 height:int32 = LinkPreviewType; +linkPreviewTypeEmbeddedAnimationPlayer url:string thumbnail:photo duration:int32 width:int32 height:int32 = LinkPreviewType; //@description The link is a link to an audio player //@url URL of the external audio player //@thumbnail Thumbnail of the audio; may be null if unknown //@duration Duration of the audio, in seconds -//@author Author of the audio //@width Expected width of the embedded player //@height Expected height of the embedded player -linkPreviewTypeEmbeddedAudioPlayer url:string thumbnail:photo duration:int32 author:string width:int32 height:int32 = LinkPreviewType; +linkPreviewTypeEmbeddedAudioPlayer url:string thumbnail:photo duration:int32 width:int32 height:int32 = LinkPreviewType; //@description The link is a link to a video player //@url URL of the external video player //@thumbnail Thumbnail of the video; may be null if unknown //@duration Duration of the video, in seconds -//@author Author of the video //@width Expected width of the embedded player //@height Expected height of the embedded player -linkPreviewTypeEmbeddedVideoPlayer url:string thumbnail:photo duration:int32 author:string width:int32 height:int32 = LinkPreviewType; +linkPreviewTypeEmbeddedVideoPlayer url:string thumbnail:photo duration:int32 width:int32 height:int32 = LinkPreviewType; + +//@description The link is a link to an audio file +//@url URL of the audio file +//@mime_type MIME type of the audio file +//@duration Duration of the audio, in seconds; 0 if unknown +linkPreviewTypeExternalAudio url:string mime_type:string duration:int32 = LinkPreviewType; + +//@description The link is a link to a video file +//@url URL of the video file +//@mime_type MIME type of the video file +//@width Expected width of the video preview; 0 if unknown +//@height Expected height of the video preview; 0 if unknown +//@duration Duration of the video, in seconds; 0 if unknown +linkPreviewTypeExternalVideo url:string mime_type:string width:int32 height:int32 duration:int32 = LinkPreviewType; //@description The link is a link to an invoice linkPreviewTypeInvoice = LinkPreviewType; @@ -2730,8 +2770,8 @@ linkPreviewTypeInvoice = LinkPreviewType; //@description The link is a link to a text or a poll Telegram message linkPreviewTypeMessage = LinkPreviewType; -//@description The link is a link to a photo @photo The photo @author Author of the photo -linkPreviewTypePhoto photo:photo author:string = LinkPreviewType; +//@description The link is a link to a photo @photo The photo +linkPreviewTypePhoto photo:photo = LinkPreviewType; //@description The link is a link to a Telegram Premium gift code linkPreviewTypePremiumGiftCode = LinkPreviewType; @@ -2760,15 +2800,8 @@ linkPreviewTypeUnsupported = LinkPreviewType; //@description The link is a link to a user @photo Photo of the user; may be null if none @is_bot True, if the user is a bot linkPreviewTypeUser photo:chatPhoto is_bot:Bool = LinkPreviewType; -//@description The link is a link to a video -//@url URL of the video; may be empty if none -//@mime_type MIME type of the video file -//@video The video description; may be null if unknown -//@width Expected width of the preview -//@height Expected height of the preview -//@duration Duration of the video, in seconds; 0 if unknown -//@author Author of the video -linkPreviewTypeVideo url:string mime_type:string video:video width:int32 height:int32 duration:int32 author:string = LinkPreviewType; +//@description The link is a link to a video @video The video description +linkPreviewTypeVideo video:video = LinkPreviewType; //@description The link is a link to a video chat //@photo Photo of the chat with the video chat; may be null if none @@ -2791,6 +2824,7 @@ linkPreviewTypeWebApp photo:photo = LinkPreviewType; //@site_name Short name of the site (e.g., Google Docs, App Store) //@title Title of the content //@param_description Description of the content +//@author Author of the content //@type Type of the link preview //@has_large_media True, if size of media in the preview can be changed //@show_large_media True, if large media preview must be shown; otherwise, the media preview must be shown small and only the first frame must be shown for videos @@ -2798,7 +2832,7 @@ linkPreviewTypeWebApp photo:photo = LinkPreviewType; //@skip_confirmation True, if there is no need to show an ordinary open URL confirmation, when opening the URL from the preview, because the URL is shown in the message text in clear //@show_above_text True, if the link preview must be shown above message text; otherwise, the link preview must be shown below the message text //@instant_view_version Version of instant view (currently, can be 1 or 2) for the web page; 0 if none -linkPreview url:string display_url:string site_name:string title:string description:formattedText type:LinkPreviewType has_large_media:Bool show_large_media:Bool show_media_above_description:Bool skip_confirmation:Bool show_above_text:Bool instant_view_version:int32 = LinkPreview; +linkPreview url:string display_url:string site_name:string title:string description:formattedText author:string type:LinkPreviewType has_large_media:Bool show_large_media:Bool show_media_above_description:Bool skip_confirmation:Bool show_above_text:Bool instant_view_version:int32 = LinkPreview; //@description Contains information about a country @@ -2867,6 +2901,7 @@ locationAddress country_code:string state:string city:string street:string = Loc //@background_color A color of the background in the RGB24 format //@secondary_background_color A secondary color for the background in the RGB24 format //@header_background_color A color of the header background in the RGB24 format +//@bottom_bar_background_color A color of the bottom bar background in the RGB24 format //@section_background_color A color of the section background in the RGB24 format //@section_separator_color A color of the section separator in the RGB24 format //@text_color A color of text in the RGB24 format @@ -2878,7 +2913,7 @@ locationAddress country_code:string state:string city:string street:string = Loc //@link_color A color of links in the RGB24 format //@button_color A color of the buttons in the RGB24 format //@button_text_color A color of text on the buttons in the RGB24 format -themeParameters background_color:int32 secondary_background_color:int32 header_background_color:int32 section_background_color:int32 section_separator_color:int32 text_color:int32 accent_text_color:int32 section_header_text_color:int32 subtitle_text_color:int32 destructive_text_color:int32 hint_color:int32 link_color:int32 button_color:int32 button_text_color:int32 = ThemeParameters; +themeParameters background_color:int32 secondary_background_color:int32 header_background_color:int32 bottom_bar_background_color:int32 section_background_color:int32 section_separator_color:int32 text_color:int32 accent_text_color:int32 section_header_text_color:int32 subtitle_text_color:int32 destructive_text_color:int32 hint_color:int32 link_color:int32 button_color:int32 button_text_color:int32 = ThemeParameters; //@description Portion of the price of a product (e.g., "delivery cost", "tax amount") @label Label for this portion of the product price @amount Currency amount in the smallest units of the currency @@ -3042,9 +3077,9 @@ paidMediaVideo video:video = PaidMedia; paidMediaUnsupported = PaidMedia; -//@description Describes parameters of a Telegram Premium giveaway -//@boosted_chat_id Identifier of the supergroup or channel chat, which will be automatically boosted by the winners of the giveaway for duration of the Premium subscription. -//-If the chat is a channel, then can_post_messages right is required in the channel, otherwise, the user must be an administrator in the supergroup +//@description Describes parameters of a giveaway +//@boosted_chat_id Identifier of the supergroup or channel chat, which will be automatically boosted by the winners of the giveaway for duration of the Telegram Premium subscription, +//-or for the specified time. If the chat is a channel, then can_post_messages right is required in the channel, otherwise, the user must be an administrator in the supergroup //@additional_chat_ids Identifiers of other supergroup or channel chats that must be subscribed by the users to be eligible for the giveaway. There can be up to getOption("giveaway_additional_chat_count_max") additional chats //@winners_selection_date Point in time (Unix timestamp) when the giveaway is expected to be performed; must be 60-getOption("giveaway_duration_max") seconds in the future in scheduled giveaways //@only_new_members True, if only new members of the chats will be eligible for the giveaway @@ -3052,7 +3087,7 @@ paidMediaUnsupported = PaidMedia; //@country_codes The list of two-letter ISO 3166-1 alpha-2 codes of countries, users from which will be eligible for the giveaway. If empty, then all users can participate in the giveaway. //-There can be up to getOption("giveaway_country_count_max") chosen countries. Users with phone number that was bought at https://fragment.com can participate in any giveaway and the country code "FT" must not be specified in the list //@prize_description Additional description of the giveaway prize; 0-128 characters -premiumGiveawayParameters boosted_chat_id:int53 additional_chat_ids:vector winners_selection_date:int32 only_new_members:Bool has_public_winners:Bool country_codes:vector prize_description:string = PremiumGiveawayParameters; +giveawayParameters boosted_chat_id:int53 additional_chat_ids:vector winners_selection_date:int32 only_new_members:Bool has_public_winners:Bool country_codes:vector prize_description:string = GiveawayParameters; //@description File with the date it was uploaded @file The file @date Point in time (Unix timestamp) when the file was uploaded @@ -3598,35 +3633,37 @@ messageGiftedPremium gifter_user_id:int53 receiver_user_id:int53 currency:string //@code The gift code messagePremiumGiftCode creator_id:MessageSender is_from_giveaway:Bool is_unclaimed:Bool currency:string amount:int53 cryptocurrency:string cryptocurrency_amount:int64 month_count:int32 sticker:sticker code:string = MessageContent; -//@description A Telegram Premium giveaway was created for the chat. Use telegramPaymentPurposePremiumGiveaway or storePaymentPurposePremiumGiveaway to create a giveaway -messagePremiumGiveawayCreated = MessageContent; +//@description A giveaway was created for the chat. Use telegramPaymentPurposePremiumGiveaway, storePaymentPurposePremiumGiveaway, telegramPaymentPurposeStarGiveaway, or storePaymentPurposeStarGiveaway to create a giveaway +//@star_count Number of Telegram Stars that will be shared by winners of the giveaway; 0 for Telegram Premium giveaways +messageGiveawayCreated star_count:int53 = MessageContent; -//@description A Telegram Premium giveaway +//@description A giveaway //@parameters Giveaway parameters //@winner_count Number of users which will receive Telegram Premium subscription gift codes -//@month_count Number of months the Telegram Premium subscription will be active after code activation +//@prize Prize of the giveaway //@sticker A sticker to be shown in the message; may be null if unknown -messagePremiumGiveaway parameters:premiumGiveawayParameters winner_count:int32 month_count:int32 sticker:sticker = MessageContent; +messageGiveaway parameters:giveawayParameters winner_count:int32 prize:GiveawayPrize sticker:sticker = MessageContent; -//@description A Telegram Premium giveaway without public winners has been completed for the chat +//@description A giveaway without public winners has been completed for the chat //@giveaway_message_id Identifier of the message with the giveaway; can be 0 if the message was deleted //@winner_count Number of winners in the giveaway -//@unclaimed_prize_count Number of undistributed prizes -messagePremiumGiveawayCompleted giveaway_message_id:int53 winner_count:int32 unclaimed_prize_count:int32 = MessageContent; +//@is_star_giveaway True, if the giveaway is a Telegram Star giveaway +//@unclaimed_prize_count Number of undistributed prizes; for Telegram Premium giveaways only +messageGiveawayCompleted giveaway_message_id:int53 winner_count:int32 is_star_giveaway:Bool unclaimed_prize_count:int32 = MessageContent; -//@description A Telegram Premium giveaway with public winners has been completed for the chat -//@boosted_chat_id Identifier of the channel chat, which was automatically boosted by the winners of the giveaway for duration of the Premium subscription +//@description A giveaway with public winners has been completed for the chat +//@boosted_chat_id Identifier of the supergroup or channel chat, which was automatically boosted by the winners of the giveaway //@giveaway_message_id Identifier of the message with the giveaway in the boosted chat //@additional_chat_count Number of other chats that participated in the giveaway //@actual_winners_selection_date Point in time (Unix timestamp) when the winners were selected. May be bigger than winners selection date specified in parameters of the giveaway //@only_new_members True, if only new members of the chats were eligible for the giveaway //@was_refunded True, if the giveaway was canceled and was fully refunded -//@month_count Number of months the Telegram Premium subscription will be active after code activation +//@prize Prize of the giveaway //@prize_description Additional description of the giveaway prize //@winner_count Total number of winners in the giveaway //@winner_user_ids Up to 100 user identifiers of the winners of the giveaway -//@unclaimed_prize_count Number of undistributed prizes -messagePremiumGiveawayWinners boosted_chat_id:int53 giveaway_message_id:int53 additional_chat_count:int32 actual_winners_selection_date:int32 only_new_members:Bool was_refunded:Bool month_count:int32 prize_description:string winner_count:int32 winner_user_ids:vector unclaimed_prize_count:int32 = MessageContent; +//@unclaimed_prize_count Number of undistributed prizes; for Telegram Premium giveaways only +messageGiveawayWinners boosted_chat_id:int53 giveaway_message_id:int53 additional_chat_count:int32 actual_winners_selection_date:int32 only_new_members:Bool was_refunded:Bool prize:GiveawayPrize prize_description:string winner_count:int32 winner_user_ids:vector unclaimed_prize_count:int32 = MessageContent; //@description Telegram Stars were gifted to a user //@gifter_user_id The identifier of a user that gifted Telegram Stars; 0 if the gift was anonymous or is outgoing @@ -3640,6 +3677,15 @@ messagePremiumGiveawayWinners boosted_chat_id:int53 giveaway_message_id:int53 ad //@sticker A sticker to be shown in the message; may be null if unknown messageGiftedStars gifter_user_id:int53 receiver_user_id:int53 currency:string amount:int53 cryptocurrency:string cryptocurrency_amount:int64 star_count:int53 transaction_id:string sticker:sticker = MessageContent; +//@description A Telegram Stars were received by the cuurent user from a giveaway +//@star_count Number of Telegram Stars that were received +//@transaction_id Identifier of the transaction for Telegram Stars credit +//@boosted_chat_id Identifier of the supergroup or channel chat, which was automatically boosted by the winners of the giveaway +//@giveaway_message_id Identifier of the message with the giveaway in the boosted chat; can be 0 if the message was deleted +//@is_unclaimed True, if the corresponding winner wasn't chosen and the Telegram Stars were received by the owner of the boosted chat +//@sticker A sticker to be shown in the message; may be null if unknown +messageGiveawayPrizeStars star_count:int53 transaction_id:string boosted_chat_id:int53 giveaway_message_id:int53 is_unclaimed:Bool sticker:sticker = MessageContent; + //@description A contact has registered with Telegram messageContactRegistered = MessageContent; @@ -3797,7 +3843,7 @@ messageSelfDestructTypeImmediately = MessageSelfDestructType; //@only_preview Pass true to get a fake message instead of actually sending them messageSendOptions disable_notification:Bool from_background:Bool protect_content:Bool update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState effect_id:int64 sending_id:int32 only_preview:Bool = MessageSendOptions; -//@description Options to be used when a message content is copied without reference to the original sender. Service messages, messages with messageInvoice, messagePaidMedia, messagePremiumGiveaway, or messagePremiumGiveawayWinners content can't be copied +//@description Options to be used when a message content is copied without reference to the original sender. Service messages, messages with messageInvoice, messagePaidMedia, messageGiveaway, or messageGiveawayWinners content can't be copied //@send_copy True, if content of the message needs to be copied without reference to the original sender. Always true if the message is forwarded to a secret chat or is local //@replace_caption True, if media caption of the message copy needs to be replaced. Ignored if send_copy is false //@new_caption New message caption; pass null to copy message without caption. Ignored if replace_caption is false @@ -3847,7 +3893,8 @@ inputMessageDocument document:InputFile thumbnail:inputThumbnail disable_content //@paid_media The content of the paid media //@caption Message caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters //@show_caption_above_media True, if the caption must be shown above the video; otherwise, the caption must be shown below the video; not supported in secret chats -inputMessagePaidMedia star_count:int53 paid_media:vector caption:formattedText show_caption_above_media:Bool = InputMessageContent; +//@payload Bot-provided data for the paid media; bots only +inputMessagePaidMedia star_count:int53 paid_media:vector caption:formattedText show_caption_above_media:Bool payload:string = InputMessageContent; //@description A photo message //@photo Photo to send. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20 @@ -3958,6 +4005,7 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool cop //@description Contains properties of a message and describes actions that can be done with the message right now +//@can_be_copied_to_secret_chat True, if content of the message can be copied to a secret chat using inputMessageForwarded or forwardMessages with copy options //@can_be_deleted_only_for_self True, if the message can be deleted only for the current user while other users will continue to see it using the method deleteMessages with revoke == false //@can_be_deleted_for_all_users True, if the message can be deleted for all users using the method deleteMessages with revoke == true //@can_be_edited True, if the message can be edited using the methods editMessageText, editMessageMedia, editMessageCaption, or editMessageReplyMarkup. @@ -3983,7 +4031,7 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool cop //@can_report_supergroup_spam True, if the message can be reported using reportSupergroupSpam //@can_set_fact_check True, if fact check for the message can be changed through setMessageFactCheck //@need_show_statistics True, if message statistics must be available from context menu of the message -messageProperties can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_paid:Bool can_be_pinned:Bool can_be_replied:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_shared_in_story:Bool can_edit_scheduling_state:Bool can_get_embedding_code:Bool can_get_link:Bool can_get_media_timestamp_links:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_statistics:Bool can_get_viewers:Bool can_recognize_speech:Bool can_report_chat:Bool can_report_reactions:Bool can_report_supergroup_spam:Bool can_set_fact_check:Bool need_show_statistics:Bool = MessageProperties; +messageProperties can_be_copied_to_secret_chat:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_paid:Bool can_be_pinned:Bool can_be_replied:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_shared_in_story:Bool can_edit_scheduling_state:Bool can_get_embedding_code:Bool can_get_link:Bool can_get_media_timestamp_links:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_statistics:Bool can_get_viewers:Bool can_recognize_speech:Bool can_report_chat:Bool can_report_reactions:Bool can_report_supergroup_spam:Bool can_set_fact_check:Bool need_show_statistics:Bool = MessageProperties; //@class SearchMessagesFilter @description Represents a filter for message search results @@ -4543,24 +4591,26 @@ chatBoostFeatures features:vector min_profile_background //@gift_code The created Telegram Premium gift code, which is known only if this is a gift code for the current user, or it has already been claimed chatBoostSourceGiftCode user_id:int53 gift_code:string = ChatBoostSource; -//@description The chat created a Telegram Premium giveaway +//@description The chat created a giveaway //@user_id Identifier of a user that won in the giveaway; 0 if none -//@gift_code The created Telegram Premium gift code if it was used by the user or can be claimed by the current user; an empty string otherwise +//@gift_code The created Telegram Premium gift code if it was used by the user or can be claimed by the current user; an empty string otherwise; for Telegram Premium giveways only +//@star_count Number of Telegram Stars distributed among winners of the giveaway //@giveaway_message_id Identifier of the corresponding giveaway message; can be an identifier of a deleted message -//@is_unclaimed True, if the winner for the corresponding Telegram Premium subscription wasn't chosen, because there were not enough participants -chatBoostSourceGiveaway user_id:int53 gift_code:string giveaway_message_id:int53 is_unclaimed:Bool = ChatBoostSource; +//@is_unclaimed True, if the winner for the corresponding giveaway prize wasn't chosen, because there were not enough participants +chatBoostSourceGiveaway user_id:int53 gift_code:string star_count:int53 giveaway_message_id:int53 is_unclaimed:Bool = ChatBoostSource; //@description A user with Telegram Premium subscription or gifted Telegram Premium boosted the chat //@user_id Identifier of the user chatBoostSourcePremium user_id:int53 = ChatBoostSource; -//@description Describes a prepaid Telegram Premium giveaway +//@description Describes a prepaid giveaway //@id Unique identifier of the prepaid giveaway -//@winner_count Number of users which will receive Telegram Premium subscription gift codes -//@month_count Number of months the Telegram Premium subscription will be active after code activation +//@winner_count Number of users which will receive giveaway prize +//@prize Prize of the giveaway +//@boost_count The number of boosts received by the chat from the giveaway; for Telegram Star giveaways only //@payment_date Point in time (Unix timestamp) when the giveaway was paid -prepaidPremiumGiveaway id:int64 winner_count:int32 month_count:int32 payment_date:int32 = PrepaidPremiumGiveaway; +prepaidGiveaway id:int64 winner_count:int32 prize:GiveawayPrize boost_count:int32 payment_date:int32 = PrepaidGiveaway; //@description Describes current boost status of a chat //@boost_url An HTTP URL, which can be used to boost the chat @@ -4573,7 +4623,7 @@ prepaidPremiumGiveaway id:int64 winner_count:int32 month_count:int32 payment_dat //@premium_member_count Approximate number of Telegram Premium subscribers joined the chat; always 0 if the current user isn't an administrator in the chat //@premium_member_percentage A percentage of Telegram Premium subscribers joined the chat; always 0 if the current user isn't an administrator in the chat //@prepaid_giveaways The list of prepaid giveaways available for the chat; only for chat administrators -chatBoostStatus boost_url:string applied_slot_ids:vector level:int32 gift_code_boost_count:int32 boost_count:int32 current_level_boost_count:int32 next_level_boost_count:int32 premium_member_count:int32 premium_member_percentage:double prepaid_giveaways:vector = ChatBoostStatus; +chatBoostStatus boost_url:string applied_slot_ids:vector level:int32 gift_code_boost_count:int32 boost_count:int32 current_level_boost_count:int32 next_level_boost_count:int32 premium_member_count:int32 premium_member_percentage:double prepaid_giveaways:vector = ChatBoostStatus; //@description Describes a boost applied to a chat //@id Unique identifier of the boost @@ -5289,6 +5339,9 @@ chatEventMemberPromoted user_id:int53 old_status:ChatMemberStatus new_status:Cha //@description A chat member was restricted/unrestricted or banned/unbanned, or the list of their restrictions has changed @member_id Affected chat member identifier @old_status Previous status of the chat member @new_status New status of the chat member chatEventMemberRestricted member_id:MessageSender old_status:ChatMemberStatus new_status:ChatMemberStatus = ChatEventAction; +//@description A chat member extended their subscription to the chat @user_id Affected chat member user identifier @old_status Previous status of the chat member @new_status New status of the chat member +chatEventMemberSubscriptionExtended user_id:int53 old_status:ChatMemberStatus new_status:ChatMemberStatus = ChatEventAction; + //@description The chat available reactions were changed @old_available_reactions Previous chat available reactions @new_available_reactions New chat available reactions chatEventAvailableReactionsChanged old_available_reactions:ChatAvailableReactions new_available_reactions:ChatAvailableReactions = ChatEventAction; @@ -5435,7 +5488,8 @@ chatEvents events:vector = ChatEvents; //@invite_link_changes True, if changes to invite links need to be returned //@video_chat_changes True, if video chat actions need to be returned //@forum_changes True, if forum-related actions need to be returned -chatEventLogFilters message_edits:Bool message_deletions:Bool message_pins:Bool member_joins:Bool member_leaves:Bool member_invites:Bool member_promotions:Bool member_restrictions:Bool info_changes:Bool setting_changes:Bool invite_link_changes:Bool video_chat_changes:Bool forum_changes:Bool = ChatEventLogFilters; +//@subscription_extensions True, if subscription extensions need to be returned +chatEventLogFilters message_edits:Bool message_deletions:Bool message_pins:Bool member_joins:Bool member_leaves:Bool member_invites:Bool member_promotions:Bool member_restrictions:Bool info_changes:Bool setting_changes:Bool invite_link_changes:Bool video_chat_changes:Bool forum_changes:Bool subscription_extensions:Bool = ChatEventLogFilters; //@class LanguagePackStringValue @description Represents the value of a string in a language pack @@ -5748,7 +5802,15 @@ storePaymentPurposePremiumGiftCodes boosted_chat_id:int53 currency:string amount //@parameters Giveaway parameters //@currency ISO 4217 currency code of the payment currency //@amount Paid amount, in the smallest units of the currency -storePaymentPurposePremiumGiveaway parameters:premiumGiveawayParameters currency:string amount:int53 = StorePaymentPurpose; +storePaymentPurposePremiumGiveaway parameters:giveawayParameters currency:string amount:int53 = StorePaymentPurpose; + +//@description The user creating a Telegram Star giveaway +//@parameters Giveaway parameters +//@currency ISO 4217 currency code of the payment currency +//@amount Paid amount, in the smallest units of the currency +//@winner_count The number of users to receive Telegram Stars +//@star_count The number of Telegram Stars to be distributed through the giveaway +storePaymentPurposeStarGiveaway parameters:giveawayParameters currency:string amount:int53 winner_count:int32 star_count:int53 = StorePaymentPurpose; //@description The user buying Telegram Stars //@currency ISO 4217 currency code of the payment currency @@ -5780,7 +5842,7 @@ telegramPaymentPurposePremiumGiftCodes boosted_chat_id:int53 currency:string amo //@amount Paid amount, in the smallest units of the currency //@winner_count Number of users which will be able to activate the gift codes //@month_count Number of months the Telegram Premium subscription will be active for the users -telegramPaymentPurposePremiumGiveaway parameters:premiumGiveawayParameters currency:string amount:int53 winner_count:int32 month_count:int32 = TelegramPaymentPurpose; +telegramPaymentPurposePremiumGiveaway parameters:giveawayParameters currency:string amount:int53 winner_count:int32 month_count:int32 = TelegramPaymentPurpose; //@description The user buying Telegram Stars //@currency ISO 4217 currency code of the payment currency @@ -5795,6 +5857,14 @@ telegramPaymentPurposeStars currency:string amount:int53 star_count:int53 = Tele //@star_count Number of bought Telegram Stars telegramPaymentPurposeGiftedStars user_id:int53 currency:string amount:int53 star_count:int53 = TelegramPaymentPurpose; +//@description The user creating a Telegram Star giveaway +//@parameters Giveaway parameters +//@currency ISO 4217 currency code of the payment currency +//@amount Paid amount, in the smallest units of the currency +//@winner_count The number of users to receive Telegram Stars +//@star_count The number of Telegram Stars to be distributed through the giveaway +telegramPaymentPurposeStarGiveaway parameters:giveawayParameters currency:string amount:int53 winner_count:int32 star_count:int53 = TelegramPaymentPurpose; + //@description The user joins a chat and subscribes to regular payments in Telegram Stars @invite_link Invite link to use telegramPaymentPurposeJoinChat invite_link:string = TelegramPaymentPurpose; @@ -6061,11 +6131,11 @@ pushMessageContentPoll question:string is_regular:Bool is_pinned:Bool = PushMess //@description A message with a Telegram Premium gift code created for the user @month_count Number of months the Telegram Premium subscription will be active after code activation pushMessageContentPremiumGiftCode month_count:int32 = PushMessageContent; -//@description A message with a Telegram Premium giveaway -//@winner_count Number of users which will receive Telegram Premium subscription gift codes; 0 for pinned message -//@month_count Number of months the Telegram Premium subscription will be active after code activation; 0 for pinned message +//@description A message with a giveaway +//@winner_count Number of users which will receive giveaway prizes; 0 for pinned message +//@prize Prize of the giveaway; may be null for pinned message //@is_pinned True, if the message is a pinned message with the specified content -pushMessageContentPremiumGiveaway winner_count:int32 month_count:int32 is_pinned:Bool = PushMessageContent; +pushMessageContentGiveaway winner_count:int32 prize:GiveawayPrize is_pinned:Bool = PushMessageContent; //@description A screenshot of a message in the chat has been taken pushMessageContentScreenshotTaken = PushMessageContent; @@ -6354,7 +6424,7 @@ canSendMessageToUserResultUserIsDeleted = CanSendMessageToUserResult; canSendMessageToUserResultUserRestrictsNewChats = CanSendMessageToUserResult; -//@description Contains information about the period of inactivity after which the current user's account will automatically be deleted @days Number of days of inactivity before the account will be flagged for deletion; 30-366 days +//@description Contains information about the period of inactivity after which the current user's account will automatically be deleted @days Number of days of inactivity before the account will be flagged for deletion; 30-730 days accountTtl days:int32 = AccountTtl; @@ -6531,7 +6601,7 @@ internalLinkTypeAttachmentMenuBot target_chat:TargetChat bot_username:string url //@description The link contains an authentication code. Call checkAuthenticationCode with the code if the current authorization state is authorizationStateWaitCode @code The authentication code internalLinkTypeAuthenticationCode code:string = InternalLinkType; -//@description The link is a link to a background. Call searchBackground with the given background name to process the link +//@description The link is a link to a background. Call searchBackground with the given background name to process the link. //-If background is found and the user wants to apply it, then call setDefaultBackground //@background_name Name of the background internalLinkTypeBackground background_name:string = InternalLinkType; @@ -6678,7 +6748,7 @@ internalLinkTypePrivacyAndSecuritySettings = InternalLinkType; //@type Type of the proxy internalLinkTypeProxy server:string port:int32 type:ProxyType = InternalLinkType; -//@description The link is a link to a chat by its username. Call searchPublicChat with the given chat username to process the link +//@description The link is a link to a chat by its username. Call searchPublicChat with the given chat username to process the link. //-If the chat is found, open its profile information screen or the chat itself. //-If draft text isn't empty and the chat is a private chat with a regular user, then put the draft text in the input field //@chat_username Username of the chat @@ -7252,7 +7322,8 @@ chatStatisticsChannel period:dateRange member_count:statisticalValue mean_messag //@total_amount Total amount of the cryptocurrency earned, in the smallest units of the cryptocurrency //@balance_amount Amount of the cryptocurrency that isn't withdrawn yet, in the smallest units of the cryptocurrency //@available_amount Amount of the cryptocurrency available for withdrawal, in the smallest units of the cryptocurrency -chatRevenueAmount cryptocurrency:string total_amount:int64 balance_amount:int64 available_amount:int64 = ChatRevenueAmount; +//@withdrawal_enabled True, if Telegram Stars can be withdrawn now or later +chatRevenueAmount cryptocurrency:string total_amount:int64 balance_amount:int64 available_amount:int64 withdrawal_enabled:Bool = ChatRevenueAmount; //@description A detailed statistics about revenue earned from sponsored messages in a chat //@revenue_by_hour_graph A graph containing amount of revenue in a given hour @@ -7882,7 +7953,7 @@ updateAnimationSearchParameters provider:string emojis:vector = Update; //@description The list of suggested to the user actions has changed @added_actions Added suggested actions @removed_actions Removed suggested actions updateSuggestedActions added_actions:vector removed_actions:vector = Update; -//@description Download or upload file speed for the user was limited, but it can be restored by subscription to Telegram Premium. The notification can be postponed until a being downloaded or uploaded file is visible to the user +//@description Download or upload file speed for the user was limited, but it can be restored by subscription to Telegram Premium. The notification can be postponed until a being downloaded or uploaded file is visible to the user. //-Use getOption("premium_download_speedup") or getOption("premium_upload_speedup") to get expected speedup after subscription to Telegram Premium //@is_upload True, if upload speed was limited; false, if download speed was limited updateSpeedLimitNotification is_upload:Bool = Update; @@ -8022,6 +8093,11 @@ updateMessageReaction chat_id:int53 message_id:int53 actor_id:MessageSender date //@reactions The list of reactions added to the message updateMessageReactions chat_id:int53 message_id:int53 date:int32 reactions:vector = Update; +//@description Paid media were purchased by a user; for bots only +//@user_id User identifier +//@payload Bot-specified payload for the paid media +updatePaidMediaPurchased user_id:int53 payload:string = Update; + //@description Contains a list of updates @updates List of updates updates updates:vector = Updates; @@ -8274,7 +8350,7 @@ getMessageLocally chat_id:int53 message_id:int53 = Message; //@description Returns information about a non-bundled message that is replied by a given message. Also, returns the pinned message, the game message, the invoice message, //-the message with a previously set same background, the giveaway message, and the topic creation message for messages of the types -//-messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground, messagePremiumGiveawayCompleted and topic messages without non-bundled replied message respectively +//-messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground, messageGiveawayCompleted and topic messages without non-bundled replied message respectively //@chat_id Identifier of the chat the message belongs to //@message_id Identifier of the reply message getRepliedMessage chat_id:int53 message_id:int53 = Message; @@ -8512,7 +8588,7 @@ searchMessages chat_list:ChatList only_in_channels:Bool query:string offset:stri searchSecretMessages chat_id:int53 query:string offset:string limit:int32 filter:SearchMessagesFilter = FoundMessages; //@description Searches for messages tagged by the given reaction and with the given words in the Saved Messages chat; for Telegram Premium users only. -//-Returns the results in reverse chronological order, i.e. in order of decreasing message_id +//-Returns the results in reverse chronological order, i.e. in order of decreasing message_id. //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit //@saved_messages_topic_id If not 0, only messages in the specified Saved Messages topic will be considered; pass 0 to consider all messages //@tag Tag to search for; pass null to return all suitable messages @@ -8944,7 +9020,7 @@ setBusinessMessageIsPinned business_connection_id:string chat_id:int53 message_i //@description Checks validness of a name for a quick reply shortcut. Can be called synchronously @name The name of the shortcut; 1-32 characters checkQuickReplyShortcutName name:string = Ok; -//@description Loads quick reply shortcuts created by the current user. The loaded topics will be sent through updateQuickReplyShortcuts +//@description Loads quick reply shortcuts created by the current user. The loaded data will be sent through updateQuickReplyShortcut and updateQuickReplyShortcuts loadQuickReplyShortcuts = Ok; //@description Changes name of a quick reply shortcut @shortcut_id Unique identifier of the quick reply shortcut @name New name for the shortcut. Use checkQuickReplyShortcutName to check its validness @@ -9084,7 +9160,7 @@ clearRecentReactions = Ok; //@description Adds a reaction or a tag to a message. Use getMessageAvailableReactions to receive the list of available reactions for the message //@chat_id Identifier of the chat to which the message belongs //@message_id Identifier of the message -//@reaction_type Type of the reaction to add. Use addPaidMessageReaction instead to add the paid reaction +//@reaction_type Type of the reaction to add. Use addPendingPaidMessageReaction instead to add the paid reaction //@is_big Pass true if the reaction is added with a big animation //@update_recent_reactions Pass true if the reaction needs to be added to recent reactions; tags are never added to the list of recent reactions addMessageReaction chat_id:int53 message_id:int53 reaction_type:ReactionType is_big:Bool update_recent_reactions:Bool = Ok; @@ -9095,16 +9171,18 @@ addMessageReaction chat_id:int53 message_id:int53 reaction_type:ReactionType is_ //@reaction_type Type of the reaction to remove. The paid reaction can't be removed removeMessageReaction chat_id:int53 message_id:int53 reaction_type:ReactionType = Ok; -//@description Adds the paid message reaction to a message. Use getMessageAvailableReactions to receive the list of available reactions for the message +//@description Adds the paid message reaction to a message. Use getMessageAvailableReactions to check whether the reaction is available for the message //@chat_id Identifier of the chat to which the message belongs //@message_id Identifier of the message -//@star_count Number of Telegram Stars to be used for the reaction; 1-getOption("paid_reaction_star_count_max") -//@is_anonymous Pass true to make paid reaction of the user on the message anonymous; pass false to make the user's profile visible among top reactors -addPaidMessageReaction chat_id:int53 message_id:int53 star_count:int53 is_anonymous:Bool = Ok; +//@star_count Number of Telegram Stars to be used for the reaction. The total number of pending paid reactions must not exceed getOption("paid_reaction_star_count_max") +//@use_default_is_anonymous Pass true if the user didn't choose anonymity explicitly, for example, the reaction is set from the message bubble +//@is_anonymous Pass true to make paid reaction of the user on the message anonymous; pass false to make the user's profile visible among top reactors. Ignored if use_default_is_anonymous == true +addPendingPaidMessageReaction chat_id:int53 message_id:int53 star_count:int53 use_default_is_anonymous:Bool is_anonymous:Bool = Ok; -//@description Removes all pending paid reactions on a message. Can be called within 5 seconds after the last addPaidMessageReaction call -//@chat_id Identifier of the chat to which the message belongs -//@message_id Identifier of the message +//@description Applies all pending paid reactions on a message @chat_id Identifier of the chat to which the message belongs @message_id Identifier of the message +commitPendingPaidMessageReactions chat_id:int53 message_id:int53 = Ok; + +//@description Removes all pending paid reactions on a message @chat_id Identifier of the chat to which the message belongs @message_id Identifier of the message removePendingPaidMessageReactions chat_id:int53 message_id:int53 = Ok; //@description Changes whether the paid message reaction of the user to a message is anonymous. The message must have paid reaction added by the user @@ -9277,10 +9355,10 @@ getInlineQueryResults bot_user_id:int53 chat_id:int53 user_location:location que answerInlineQuery inline_query_id:int64 is_personal:Bool button:inlineQueryResultsButton results:vector cache_time:int32 next_offset:string = Ok; -//@description Returns popular Web App bots +//@description Returns the most grossing Web App bots //@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results //@limit The maximum number of bots to be returned; up to 100 -getPopularWebAppBots offset:string limit:int32 = FoundUsers; +getGrossingWebAppBots offset:string limit:int32 = FoundUsers; //@description Returns information about a Web App by its short name. Returns a 404 error if the Web App is not found //@bot_user_id Identifier of the target bot @@ -9588,7 +9666,7 @@ setChatAccentColor chat_id:int53 accent_color_id:int32 background_custom_emoji_i //@profile_background_custom_emoji_id Identifier of a custom emoji to be shown on the chat's profile photo background; 0 if none. Use chatBoostLevelFeatures.can_set_profile_background_custom_emoji to check whether a custom emoji can be set setChatProfileAccentColor chat_id:int53 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 = Ok; -//@description Changes the message auto-delete or self-destruct (for secret chats) time in a chat. Requires change_info administrator right in basic groups, supergroups and channels +//@description Changes the message auto-delete or self-destruct (for secret chats) time in a chat. Requires change_info administrator right in basic groups, supergroups and channels. //-Message auto-delete time can't be changed in a chat with the current user (Saved Messages) and the chat 777000 (Telegram). //@chat_id Chat identifier //@message_auto_delete_time New time value, in seconds; unless the chat is secret, it must be from 0 up to 365 * 86400 and be divisible by 86400. If 0, then messages aren't deleted automatically @@ -9873,7 +9951,7 @@ getChatActiveStories chat_id:int53 = ChatActiveStories; //-Then, stories are returned in reverse chronological order (i.e., in order of decreasing story_id). For optimal performance, the number of returned stories is chosen by TDLib //@chat_id Chat identifier //@from_story_id Identifier of the story starting from which stories must be returned; use 0 to get results from pinned and the newest story -//@limit The maximum number of stories to be returned +//@limit The maximum number of stories to be returned. //-For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit getChatPostedToChatPageStories chat_id:int53 from_story_id:int32 limit:int32 = Stories; @@ -9881,7 +9959,7 @@ getChatPostedToChatPageStories chat_id:int53 from_story_id:int32 limit:int32 = S //-The stories are returned in reverse chronological order (i.e., in order of decreasing story_id). For optimal performance, the number of returned stories is chosen by TDLib //@chat_id Chat identifier //@from_story_id Identifier of the story starting from which stories must be returned; use 0 to get results from the last story -//@limit The maximum number of stories to be returned +//@limit The maximum number of stories to be returned. //-For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit getChatArchivedStories chat_id:int53 from_story_id:int32 limit:int32 = Stories; @@ -10149,7 +10227,7 @@ createChatInviteLink chat_id:int53 name:string expiration_date:int32 member_limi createChatSubscriptionInviteLink chat_id:int53 name:string subscription_pricing:starSubscriptionPricing = ChatInviteLink; //@description Edits a non-primary invite link for a chat. Available for basic groups, supergroups, and channels. -//-If the link creates a subscription, then expiration_date, member_limit and creates_join_request must not be used +//-If the link creates a subscription, then expiration_date, member_limit and creates_join_request must not be used. //-Requires administrator privileges and can_invite_users right in the chat for own links and owner privileges for other links //@chat_id Chat identifier //@invite_link Invite link to be edited @@ -10518,6 +10596,9 @@ getAttachedStickerSets file_id:int32 = StickerSets; //@description Returns information about a sticker set by its identifier @set_id Identifier of the sticker set getStickerSet set_id:int64 = StickerSet; +//@description Returns name of a sticker set by its identifier @set_id Identifier of the sticker set +getStickerSetName set_id:int64 = Text; + //@description Searches for a sticker set by its name @name Name of the sticker set searchStickerSet name:string = StickerSet; @@ -11506,7 +11587,7 @@ clickPremiumSubscriptionButton = Ok; //@description Returns state of Telegram Premium subscription and promotion videos for Premium features getPremiumState = PremiumState; -//@description Returns available options for Telegram Premium gift code or giveaway creation +//@description Returns available options for Telegram Premium gift code or Telegram Premium giveaway creation //@boosted_chat_id Identifier of the supergroup or channel chat, which will be automatically boosted by receivers of the gift codes and which is administered by the user; 0 if none getPremiumGiftCodePaymentOptions boosted_chat_id:int53 = PremiumGiftCodePaymentOptions; @@ -11516,15 +11597,17 @@ checkPremiumGiftCode code:string = PremiumGiftCodeInfo; //@description Applies a Telegram Premium gift code @code The code to apply applyPremiumGiftCode code:string = Ok; -//@description Launches a prepaid Telegram Premium giveaway +//@description Launches a prepaid giveaway //@giveaway_id Unique identifier of the prepaid giveaway //@parameters Giveaway parameters -launchPrepaidPremiumGiveaway giveaway_id:int64 parameters:premiumGiveawayParameters = Ok; +//@winner_count The number of users to receive giveaway prize +//@star_count The number of Telegram Stars to be distributed through the giveaway; pass 0 for Telegram Premium giveaways +launchPrepaidGiveaway giveaway_id:int64 parameters:giveawayParameters winner_count:int32 star_count:int53 = Ok; -//@description Returns information about a Telegram Premium giveaway +//@description Returns information about a giveaway //@chat_id Identifier of the channel chat which started the giveaway //@message_id Identifier of the giveaway or a giveaway winners message in the chat -getPremiumGiveawayInfo chat_id:int53 message_id:int53 = PremiumGiveawayInfo; +getGiveawayInfo chat_id:int53 message_id:int53 = GiveawayInfo; //@description Returns available options for Telegram Stars purchase getStarPaymentOptions = StarPaymentOptions; @@ -11532,6 +11615,9 @@ getStarPaymentOptions = StarPaymentOptions; //@description Returns available options for Telegram Stars gifting @user_id Identifier of the user that will receive Telegram Stars; pass 0 to get options for an unspecified user getStarGiftPaymentOptions user_id:int53 = StarPaymentOptions; +//@description Returns available options for Telegram Star giveaway creation +getStarGiveawayPaymentOptions = StarGiveawayPaymentOptions; + //@description Returns the list of Telegram Star transactions for the specified owner //@owner_id Identifier of the owner of the Telegram Stars; can be the identifier of the current user, identifier of an owned bot, //-or identifier of a channel chat with supergroupFullInfo.can_get_star_revenue_statistics == true From 8454bd8c86af37d9a7d7db4d1611bca82e7a4c22 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Sun, 6 Oct 2024 02:49:26 +0800 Subject: [PATCH 26/54] Update to TDLib 1.8.37 --- client/function.go | 266 +++++++++++++++-- client/type.go | 678 +++++++++++++++++++++++++++++++++++++++--- client/unmarshaler.go | 329 +++++++++++++++++++- data/td_api.tl | 271 ++++++++++++----- 4 files changed, 1392 insertions(+), 152 deletions(-) diff --git a/client/function.go b/client/function.go index be058ef..ca360f0 100755 --- a/client/function.go +++ b/client/function.go @@ -1304,7 +1304,7 @@ type GetMessageRequest struct { MessageId int64 `json:"message_id"` } -// Returns information about a message +// Returns information about a message. Returns a 404 error if the message doesn't exist func (client *Client) GetMessage(req *GetMessageRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -1333,7 +1333,7 @@ type GetMessageLocallyRequest struct { MessageId int64 `json:"message_id"` } -// Returns information about a message, if it is available without sending network request. This is an offline request +// Returns information about a message, if it is available without sending network request. Returns a 404 error if message isn't available locally. This is an offline request func (client *Client) GetMessageLocally(req *GetMessageLocallyRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -1362,7 +1362,7 @@ type GetRepliedMessageRequest struct { MessageId int64 `json:"message_id"` } -// Returns information about a non-bundled message that is replied by a given message. Also, returns the pinned message, the game message, the invoice message, the message with a previously set same background, the giveaway message, and the topic creation message for messages of the types messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground, messageGiveawayCompleted and topic messages without non-bundled replied message respectively +// Returns information about a non-bundled message that is replied by a given message. Also, returns the pinned message, the game message, the invoice message, the message with a previously set same background, the giveaway message, and the topic creation message for messages of the types messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground, messageGiveawayCompleted and topic messages without non-bundled replied message respectively. Returns a 404 error if the message doesn't exist func (client *Client) GetRepliedMessage(req *GetRepliedMessageRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -1389,7 +1389,7 @@ type GetChatPinnedMessageRequest struct { ChatId int64 `json:"chat_id"` } -// Returns information about a newest pinned message in the chat +// Returns information about a newest pinned message in the chat. Returns a 404 error if the message doesn't exist func (client *Client) GetChatPinnedMessage(req *GetChatPinnedMessageRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -1833,7 +1833,7 @@ type SearchChatsNearbyRequest struct { Location *Location `json:"location"` } -// Returns a list of users and location-based supergroups nearby. The list of users nearby will be updated for 60 seconds after the request by the updates updateUsersNearby. The request must be sent again every 25 seconds with adjusted location to not miss new chats +// Returns a list of users and location-based supergroups nearby. The method was disabled and returns an empty list of chats now func (client *Client) SearchChatsNearby(req *SearchChatsNearbyRequest) (*ChatsNearby, error) { result, err := client.Send(Request{ meta: meta{ @@ -3180,7 +3180,7 @@ type GetChatMessageByDateRequest struct { Date int32 `json:"date"` } -// Returns the last message sent in a chat no later than the specified date +// Returns the last message sent in a chat no later than the specified date. Returns a 404 error if such message doesn't exist func (client *Client) GetChatMessageByDate(req *GetChatMessageByDateRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -3405,9 +3405,13 @@ type ClickChatSponsoredMessageRequest struct { ChatId int64 `json:"chat_id"` // Identifier of the sponsored message MessageId int64 `json:"message_id"` + // Pass true if the media was clicked in the sponsored message + IsMediaClick bool `json:"is_media_click"` + // Pass true if the user expanded the video from the sponsored message fullscreen before the click + FromFullscreen bool `json:"from_fullscreen"` } -// Informs TDLib that the user opened the sponsored chat via the button, the name, the photo, or a mention in the sponsored message +// Informs TDLib that the user opened the sponsored chat via the button, the name, the chat photo, a mention in the sponsored message text, or the media in the sponsored message func (client *Client) ClickChatSponsoredMessage(req *ClickChatSponsoredMessageRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -3416,6 +3420,8 @@ func (client *Client) ClickChatSponsoredMessage(req *ClickChatSponsoredMessageRe Data: map[string]interface{}{ "chat_id": req.ChatId, "message_id": req.MessageId, + "is_media_click": req.IsMediaClick, + "from_fullscreen": req.FromFullscreen, }, }) if err != nil { @@ -4356,7 +4362,7 @@ type EditMessageCaptionRequest struct { ReplyMarkup ReplyMarkup `json:"reply_markup"` // New message content caption; 0-getOption("message_caption_length_max") characters; pass null to remove caption Caption *FormattedText `json:"caption"` - // Pass true to show the caption above the media; otherwise, the caption will be shown below the media. Can be true only for animation, photo, and video messages + // Pass true to show the caption above the media; otherwise, the caption will be shown below the media. May be true only for animation, photo, and video messages ShowCaptionAboveMedia bool `json:"show_caption_above_media"` } @@ -4529,7 +4535,7 @@ type EditInlineMessageCaptionRequest struct { ReplyMarkup ReplyMarkup `json:"reply_markup"` // New message content caption; pass null to remove caption; 0-getOption("message_caption_length_max") characters Caption *FormattedText `json:"caption"` - // Pass true to show the caption above the media; otherwise, the caption will be shown below the media. Can be true only for animation, photo, and video messages + // Pass true to show the caption above the media; otherwise, the caption will be shown below the media. May be true only for animation, photo, and video messages ShowCaptionAboveMedia bool `json:"show_caption_above_media"` } @@ -4875,7 +4881,7 @@ type EditBusinessMessageCaptionRequest struct { ReplyMarkup ReplyMarkup `json:"reply_markup"` // New message content caption; pass null to remove caption; 0-getOption("message_caption_length_max") characters Caption *FormattedText `json:"caption"` - // Pass true to show the caption above the media; otherwise, the caption will be shown below the media. Can be true only for animation, photo, and video messages + // Pass true to show the caption above the media; otherwise, the caption will be shown below the media. May be true only for animation, photo, and video messages ShowCaptionAboveMedia bool `json:"show_caption_above_media"` } @@ -6466,7 +6472,7 @@ type CleanFileNameRequest struct { FileName string `json:"file_name"` } -// Removes potentially dangerous characters from the name of a file. The encoding of the file name is supposed to be UTF-8. Returns an empty string on failure. Can be called synchronously +// Removes potentially dangerous characters from the name of a file. Returns an empty string on failure. Can be called synchronously func CleanFileName(req *CleanFileNameRequest) (*Text, error) { result, err := Execute(Request{ meta: meta{ @@ -6488,7 +6494,7 @@ func CleanFileName(req *CleanFileNameRequest) (*Text, error) { } // deprecated -// Removes potentially dangerous characters from the name of a file. The encoding of the file name is supposed to be UTF-8. Returns an empty string on failure. Can be called synchronously +// Removes potentially dangerous characters from the name of a file. Returns an empty string on failure. Can be called synchronously func (client *Client) CleanFileName(req *CleanFileNameRequest) (*Text, error) { return CleanFileName(req)} @@ -11296,14 +11302,14 @@ type ReportStoryRequest struct { StorySenderChatId int64 `json:"story_sender_chat_id"` // The identifier of the story to report StoryId int32 `json:"story_id"` - // The reason for reporting the story - Reason ReportReason `json:"reason"` - // Additional report details; 0-1024 characters + // Option identifier chosen by the user; leave empty for the initial request + OptionId []byte `json:"option_id"` + // Additional report details; 0-1024 characters; leave empty for the initial request Text string `json:"text"` } // Reports a story to the Telegram moderators -func (client *Client) ReportStory(req *ReportStoryRequest) (*Ok, error) { +func (client *Client) ReportStory(req *ReportStoryRequest) (ReportStoryResult, error) { result, err := client.Send(Request{ meta: meta{ Type: "reportStory", @@ -11311,7 +11317,7 @@ func (client *Client) ReportStory(req *ReportStoryRequest) (*Ok, error) { Data: map[string]interface{}{ "story_sender_chat_id": req.StorySenderChatId, "story_id": req.StoryId, - "reason": req.Reason, + "option_id": req.OptionId, "text": req.Text, }, }) @@ -11323,7 +11329,19 @@ func (client *Client) ReportStory(req *ReportStoryRequest) (*Ok, error) { return nil, buildResponseError(result.Data) } - return UnmarshalOk(result.Data) + switch result.Type { + case TypeReportStoryResultOk: + return UnmarshalReportStoryResultOk(result.Data) + + case TypeReportStoryResultOptionRequired: + return UnmarshalReportStoryResultOptionRequired(result.Data) + + case TypeReportStoryResultTextRequired: + return UnmarshalReportStoryResultTextRequired(result.Data) + + default: + return nil, errors.New("invalid type") + } } // Activates stealth mode for stories, which hides all views of stories from the current user in the last "story_stealth_mode_past_period" seconds and for the next "story_stealth_mode_future_period" seconds; for Telegram Premium users only @@ -11915,7 +11933,7 @@ func (client *Client) CancelDownloadFile(req *CancelDownloadFileRequest) (*Ok, e type GetSuggestedFileNameRequest struct { // Identifier of the file FileId int32 `json:"file_id"` - // Directory in which the file is supposed to be saved + // Directory in which the file is expected to be saved Directory string `json:"directory"` } @@ -11978,7 +11996,7 @@ type CancelPreliminaryUploadFileRequest struct { FileId int32 `json:"file_id"` } -// Stops the preliminary uploading of a file. Supported only for files uploaded by using preliminaryUploadFile. For other files the behavior is undefined +// Stops the preliminary uploading of a file. Supported only for files uploaded by using preliminaryUploadFile func (client *Client) CancelPreliminaryUploadFile(req *CancelPreliminaryUploadFileRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -13289,7 +13307,7 @@ type CreateVideoChatRequest struct { ChatId int64 `json:"chat_id"` // Group call title; if empty, chat title will be used Title string `json:"title"` - // Point in time (Unix timestamp) when the group call is supposed to be started by an administrator; 0 to start the video chat immediately. The date must be at least 10 seconds and at most 8 days in the future + // Point in time (Unix timestamp) when the group call is expected to be started by an administrator; 0 to start the video chat immediately. The date must be at least 10 seconds and at most 8 days in the future StartDate int32 `json:"start_date"` // Pass true to create an RTMP stream instead of an ordinary video chat; requires owner privileges IsRtmpStream bool `json:"is_rtmp_stream"` @@ -18101,7 +18119,7 @@ func (client *Client) ToggleSupergroupIsBroadcastGroup(req *ToggleSupergroupIsBr type ReportSupergroupSpamRequest struct { // Supergroup identifier SupergroupId int64 `json:"supergroup_id"` - // Identifiers of messages to report. Use messageProperties.can_be_reported to check whether the message can be reported + // Identifiers of messages to report. Use messageProperties.can_report_supergroup_spam to check whether the message can be reported MessageIds []int64 `json:"message_ids"` } @@ -18465,6 +18483,153 @@ func (client *Client) DeleteSavedCredentials() (*Ok, error) { return UnmarshalOk(result.Data) } +// Returns gifts that can be sent to other users +func (client *Client) GetAvailableGifts() (*Gifts, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getAvailableGifts", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGifts(result.Data) +} + +type SendGiftRequest struct { + // Identifier of the gift to send + GiftId JsonInt64 `json:"gift_id"` + // Identifier of the user that will receive the gift + UserId int64 `json:"user_id"` + // Text to show along with the gift; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed + Text *FormattedText `json:"text"` + // Pass true to show the current user as sender and gift text only to the gift receiver; otherwise, everyone will be able to see them + IsPrivate bool `json:"is_private"` +} + +// Send a gift to another user +func (client *Client) SendGift(req *SendGiftRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendGift", + }, + Data: map[string]interface{}{ + "gift_id": req.GiftId, + "user_id": req.UserId, + "text": req.Text, + "is_private": req.IsPrivate, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SellGiftRequest struct { + // Identifier of the user that sent the gift + SenderUserId int64 `json:"sender_user_id"` + // Identifier of the message with the gift in the chat with the user + MessageId int64 `json:"message_id"` +} + +// Sells a gift received by the current user for Telegram Stars +func (client *Client) SellGift(req *SellGiftRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sellGift", + }, + Data: map[string]interface{}{ + "sender_user_id": req.SenderUserId, + "message_id": req.MessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ToggleGiftIsSavedRequest struct { + // Identifier of the user that sent the gift + SenderUserId int64 `json:"sender_user_id"` + // Identifier of the message with the gift in the chat with the user + MessageId int64 `json:"message_id"` + // Pass true to display the gift on the user's profile page; pass false to remove it from the profile page + IsSaved bool `json:"is_saved"` +} + +// Toggles whether a gift is shown on the current user's profile page +func (client *Client) ToggleGiftIsSaved(req *ToggleGiftIsSavedRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleGiftIsSaved", + }, + Data: map[string]interface{}{ + "sender_user_id": req.SenderUserId, + "message_id": req.MessageId, + "is_saved": req.IsSaved, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetUserGiftsRequest struct { + // Identifier of the user + UserId int64 `json:"user_id"` + // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results + Offset string `json:"offset"` + // The maximum number of gifts to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned objects is chosen by TDLib and can be smaller than the specified limit + Limit int32 `json:"limit"` +} + +// Returns gifts saved to profile by the given user +func (client *Client) GetUserGifts(req *GetUserGiftsRequest) (*UserGifts, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getUserGifts", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalUserGifts(result.Data) +} + type CreateInvoiceLinkRequest struct { // Information about the invoice of the type inputMessageInvoice Invoice InputMessageContent `json:"invoice"` @@ -18498,7 +18663,7 @@ type RefundStarPaymentRequest struct { TelegramPaymentChargeId string `json:"telegram_payment_charge_id"` } -// Refunds a previously done payment in Telegram Stars +// Refunds a previously done payment in Telegram Stars; for bots only func (client *Client) RefundStarPayment(req *RefundStarPaymentRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -19487,24 +19652,24 @@ func (client *Client) RemoveChatActionBar(req *RemoveChatActionBarRequest) (*Ok, type ReportChatRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` - // Identifiers of reported messages; may be empty to report the whole chat. Use messageProperties.can_be_reported to check whether the message can be reported + // Option identifier chosen by the user; leave empty for the initial request + OptionId []byte `json:"option_id"` + // Identifiers of reported messages. Use messageProperties.can_report_chat to check whether the message can be reported MessageIds []int64 `json:"message_ids"` - // The reason for reporting the chat - Reason ReportReason `json:"reason"` - // Additional report details; 0-1024 characters + // Additional report details if asked by the server; 0-1024 characters; leave empty for the initial request Text string `json:"text"` } // Reports a chat to the Telegram moderators. A chat can be reported only from the chat action bar, or if chat.can_be_reported -func (client *Client) ReportChat(req *ReportChatRequest) (*Ok, error) { +func (client *Client) ReportChat(req *ReportChatRequest) (ReportChatResult, error) { result, err := client.Send(Request{ meta: meta{ Type: "reportChat", }, Data: map[string]interface{}{ "chat_id": req.ChatId, + "option_id": req.OptionId, "message_ids": req.MessageIds, - "reason": req.Reason, "text": req.Text, }, }) @@ -19516,7 +19681,22 @@ func (client *Client) ReportChat(req *ReportChatRequest) (*Ok, error) { return nil, buildResponseError(result.Data) } - return UnmarshalOk(result.Data) + switch result.Type { + case TypeReportChatResultOk: + return UnmarshalReportChatResultOk(result.Data) + + case TypeReportChatResultOptionRequired: + return UnmarshalReportChatResultOptionRequired(result.Data) + + case TypeReportChatResultTextRequired: + return UnmarshalReportChatResultTextRequired(result.Data) + + case TypeReportChatResultMessagesRequired: + return UnmarshalReportChatResultMessagesRequired(result.Data) + + default: + return nil, errors.New("invalid type") + } } type ReportChatPhotoRequest struct { @@ -21347,6 +21527,32 @@ func (client *Client) GetPremiumStickerExamples() (*Stickers, error) { return UnmarshalStickers(result.Data) } +type GetPremiumInfoStickerRequest struct { + // Number of months the Telegram Premium subscription will be active + MonthCount int32 `json:"month_count"` +} + +// Returns the sticker to be used as representation of the Telegram Premium subscription +func (client *Client) GetPremiumInfoSticker(req *GetPremiumInfoStickerRequest) (*Sticker, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getPremiumInfoSticker", + }, + Data: map[string]interface{}{ + "month_count": req.MonthCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalSticker(result.Data) +} + type ViewPremiumFeatureRequest struct { // The viewed premium feature Feature PremiumFeature `json:"feature"` diff --git a/client/type.go b/client/type.go index dcfb917..0305533 100755 --- a/client/type.go +++ b/client/type.go @@ -26,6 +26,7 @@ const ( ClassStarTransactionDirection = "StarTransactionDirection" ClassBotTransactionPurpose = "BotTransactionPurpose" ClassChatTransactionPurpose = "ChatTransactionPurpose" + ClassUserTransactionPurpose = "UserTransactionPurpose" ClassStarTransactionPartner = "StarTransactionPartner" ClassGiveawayParticipantStatus = "GiveawayParticipantStatus" ClassGiveawayInfo = "GiveawayInfo" @@ -141,6 +142,8 @@ const ( ClassCanSendMessageToUserResult = "CanSendMessageToUserResult" ClassSessionType = "SessionType" ClassReportReason = "ReportReason" + ClassReportChatResult = "ReportChatResult" + ClassReportStoryResult = "ReportStoryResult" ClassTargetChat = "TargetChat" ClassInternalLinkType = "InternalLinkType" ClassBlockList = "BlockList" @@ -199,6 +202,7 @@ const ( ClassGame = "Game" ClassWebApp = "WebApp" ClassPoll = "Poll" + ClassAlternativeVideo = "AlternativeVideo" ClassBackground = "Background" ClassBackgrounds = "Backgrounds" ClassChatBackground = "ChatBackground" @@ -244,6 +248,10 @@ const ( ClassStarGiveawayWinnerOption = "StarGiveawayWinnerOption" ClassStarGiveawayPaymentOption = "StarGiveawayPaymentOption" ClassStarGiveawayPaymentOptions = "StarGiveawayPaymentOptions" + ClassGift = "Gift" + ClassGifts = "Gifts" + ClassUserGift = "UserGift" + ClassUserGifts = "UserGifts" ClassStarTransaction = "StarTransaction" ClassStarTransactions = "StarTransactions" ClassAccentColor = "AccentColor" @@ -308,7 +316,7 @@ const ( ClassMessageSponsor = "MessageSponsor" ClassSponsoredMessage = "SponsoredMessage" ClassSponsoredMessages = "SponsoredMessages" - ClassReportChatSponsoredMessageOption = "ReportChatSponsoredMessageOption" + ClassReportOption = "ReportOption" ClassFileDownload = "FileDownload" ClassDownloadedFileCounts = "DownloadedFileCounts" ClassFoundFileDownloads = "FoundFileDownloads" @@ -654,6 +662,7 @@ const ( TypeGame = "game" TypeWebApp = "webApp" TypePoll = "poll" + TypeAlternativeVideo = "alternativeVideo" TypeBackground = "background" TypeBackgrounds = "backgrounds" TypeChatBackground = "chatBackground" @@ -712,6 +721,10 @@ const ( TypeStarGiveawayWinnerOption = "starGiveawayWinnerOption" TypeStarGiveawayPaymentOption = "starGiveawayPaymentOption" TypeStarGiveawayPaymentOptions = "starGiveawayPaymentOptions" + TypeGift = "gift" + TypeGifts = "gifts" + TypeUserGift = "userGift" + TypeUserGifts = "userGifts" TypeStarTransactionDirectionIncoming = "starTransactionDirectionIncoming" TypeStarTransactionDirectionOutgoing = "starTransactionDirectionOutgoing" TypeBotTransactionPurposePaidMedia = "botTransactionPurposePaidMedia" @@ -720,6 +733,9 @@ const ( TypeChatTransactionPurposeJoin = "chatTransactionPurposeJoin" TypeChatTransactionPurposeReaction = "chatTransactionPurposeReaction" TypeChatTransactionPurposeGiveaway = "chatTransactionPurposeGiveaway" + TypeUserTransactionPurposeGiftedStars = "userTransactionPurposeGiftedStars" + TypeUserTransactionPurposeGiftSell = "userTransactionPurposeGiftSell" + TypeUserTransactionPurposeGiftSend = "userTransactionPurposeGiftSend" TypeStarTransactionPartnerTelegram = "starTransactionPartnerTelegram" TypeStarTransactionPartnerAppStore = "starTransactionPartnerAppStore" TypeStarTransactionPartnerGooglePlay = "starTransactionPartnerGooglePlay" @@ -863,7 +879,7 @@ const ( TypeMessageSponsor = "messageSponsor" TypeSponsoredMessage = "sponsoredMessage" TypeSponsoredMessages = "sponsoredMessages" - TypeReportChatSponsoredMessageOption = "reportChatSponsoredMessageOption" + TypeReportOption = "reportOption" TypeReportChatSponsoredMessageResultOk = "reportChatSponsoredMessageResultOk" TypeReportChatSponsoredMessageResultFailed = "reportChatSponsoredMessageResultFailed" TypeReportChatSponsoredMessageResultOptionRequired = "reportChatSponsoredMessageResultOptionRequired" @@ -941,6 +957,7 @@ const ( TypeInlineKeyboardButtonTypeSwitchInline = "inlineKeyboardButtonTypeSwitchInline" TypeInlineKeyboardButtonTypeBuy = "inlineKeyboardButtonTypeBuy" TypeInlineKeyboardButtonTypeUser = "inlineKeyboardButtonTypeUser" + TypeInlineKeyboardButtonTypeCopyText = "inlineKeyboardButtonTypeCopyText" TypeInlineKeyboardButton = "inlineKeyboardButton" TypeReplyMarkupRemoveKeyboard = "replyMarkupRemoveKeyboard" TypeReplyMarkupForceReply = "replyMarkupForceReply" @@ -1231,6 +1248,7 @@ const ( TypeMessageGiveawayWinners = "messageGiveawayWinners" TypeMessageGiftedStars = "messageGiftedStars" TypeMessageGiveawayPrizeStars = "messageGiveawayPrizeStars" + TypeMessageGift = "messageGift" TypeMessageContactRegistered = "messageContactRegistered" TypeMessageUsersShared = "messageUsersShared" TypeMessageChatShared = "messageChatShared" @@ -1724,6 +1742,7 @@ const ( TypePushMessageContentPoll = "pushMessageContentPoll" TypePushMessageContentPremiumGiftCode = "pushMessageContentPremiumGiftCode" TypePushMessageContentGiveaway = "pushMessageContentGiveaway" + TypePushMessageContentGift = "pushMessageContentGift" TypePushMessageContentScreenshotTaken = "pushMessageContentScreenshotTaken" TypePushMessageContentSticker = "pushMessageContentSticker" TypePushMessageContentStory = "pushMessageContentStory" @@ -1831,6 +1850,13 @@ const ( TypeReportReasonIllegalDrugs = "reportReasonIllegalDrugs" TypeReportReasonPersonalDetails = "reportReasonPersonalDetails" TypeReportReasonCustom = "reportReasonCustom" + TypeReportChatResultOk = "reportChatResultOk" + TypeReportChatResultOptionRequired = "reportChatResultOptionRequired" + TypeReportChatResultTextRequired = "reportChatResultTextRequired" + TypeReportChatResultMessagesRequired = "reportChatResultMessagesRequired" + TypeReportStoryResultOk = "reportStoryResultOk" + TypeReportStoryResultOptionRequired = "reportStoryResultOptionRequired" + TypeReportStoryResultTextRequired = "reportStoryResultTextRequired" TypeTargetChatCurrent = "targetChatCurrent" TypeTargetChatChosen = "targetChatChosen" TypeTargetChatInternalLink = "targetChatInternalLink" @@ -2276,6 +2302,11 @@ type ChatTransactionPurpose interface { ChatTransactionPurposeType() string } +// Describes purpose of a transaction with a user +type UserTransactionPurpose interface { + UserTransactionPurposeType() string +} + // Describes source or recipient of a transaction with Telegram Stars type StarTransactionPartner interface { StarTransactionPartnerType() string @@ -2851,6 +2882,16 @@ type ReportReason interface { ReportReasonType() string } +// Describes result of chat report +type ReportChatResult interface { + ReportChatResultType() string +} + +// Describes result of story report +type ReportStoryResult interface { + ReportStoryResultType() string +} + // Describes the target chat to be opened type TargetChat interface { TargetChatType() string @@ -3285,7 +3326,7 @@ type AuthenticationCodeTypeFirebaseIos struct { meta // Receipt of successful application token validation to compare with receipt from push notification Receipt string `json:"receipt"` - // Time after the next authentication method is supposed to be used if verification push notification isn't received, in seconds + // Time after the next authentication method is expected to be used if verification push notification isn't received, in seconds PushTimeout int32 `json:"push_timeout"` // Length of the code Length int32 `json:"length"` @@ -4318,14 +4359,14 @@ func (*InputFileLocal) InputFileType() string { return TypeInputFileLocal } -// A file generated by the application +// A file generated by the application. The application must handle updates updateFileGenerationStart and updateFileGenerationStop to generate the file when asked by TDLib type InputFileGenerated struct { meta - // Local path to a file from which the file is generated; may be empty if there is no such file + // Local path to a file from which the file is generated. The path doesn't have to be a valid path and is used by TDLib only to detect name and MIME type of the generated file OriginalPath string `json:"original_path"` // String specifying the conversion applied to the original file; must be persistent across application restarts. Conversions beginning with '#' are reserved for internal TDLib usage Conversion string `json:"conversion"` - // Expected size of the generated file, in bytes; 0 if unknown + // Expected size of the generated file, in bytes; pass 0 if unknown ExpectedSize int64 `json:"expected_size"` } @@ -5199,7 +5240,7 @@ type Audio struct { MimeType string `json:"mime_type"` // The minithumbnail of the album cover; may be null AlbumCoverMinithumbnail *Minithumbnail `json:"album_cover_minithumbnail"` - // The thumbnail of the album cover in JPEG format; as defined by the sender. The full size thumbnail is supposed to be extracted from the downloaded audio file; may be null + // The thumbnail of the album cover in JPEG format; as defined by the sender. The full size thumbnail is expected to be extracted from the downloaded audio file; may be null AlbumCoverThumbnail *Thumbnail `json:"album_cover_thumbnail"` // Album cover variants to use if the downloaded audio file contains no album cover. Provided thumbnail dimensions are approximate ExternalAlbumCovers []*Thumbnail `json:"external_album_covers"` @@ -5374,7 +5415,7 @@ type Video struct { MimeType string `json:"mime_type"` // True, if stickers were added to the video. The list of corresponding sticker sets can be received using getAttachedStickerSets HasStickers bool `json:"has_stickers"` - // True, if the video is supposed to be streamed + // True, if the video is expected to be streamed SupportsStreaming bool `json:"supports_streaming"` // Video minithumbnail; may be null Minithumbnail *Minithumbnail `json:"minithumbnail"` @@ -5786,6 +5827,37 @@ func (poll *Poll) UnmarshalJSON(data []byte) error { return nil } +// Describes an alternative reencoded quality of a video file +type AlternativeVideo struct { + meta + // Video width + Width int32 `json:"width"` + // Video height + Height int32 `json:"height"` + // Codec used for video file encoding, for example, "h264", "h265", or "av1" + Codec string `json:"codec"` + // HLS file describing the video + HlsFile *File `json:"hls_file"` + // File containing the video + Video *File `json:"video"` +} + +func (entity *AlternativeVideo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AlternativeVideo + + return json.Marshal((*stub)(entity)) +} + +func (*AlternativeVideo) GetClass() string { + return ClassAlternativeVideo +} + +func (*AlternativeVideo) GetType() string { + return TypeAlternativeVideo +} + // Describes a chat background type Background struct { meta @@ -7305,7 +7377,7 @@ type PremiumPaymentOption struct { Amount int64 `json:"amount"` // The discount associated with this option, as a percentage DiscountPercentage int32 `json:"discount_percentage"` - // Number of months the Telegram Premium subscription will be active + // Number of months the Telegram Premium subscription will be active. Use getPremiumInfoSticker to get the sticker to be used as representation of the Telegram Premium subscription MonthCount int32 `json:"month_count"` // Identifier of the store product associated with the option StoreProductId string `json:"store_product_id"` @@ -7646,6 +7718,126 @@ func (*StarGiveawayPaymentOptions) GetType() string { return TypeStarGiveawayPaymentOptions } +// Describes a gift that can be sent to another user +type Gift struct { + meta + // Unique identifier of the gift + Id JsonInt64 `json:"id"` + // The sticker representing the gift + Sticker *Sticker `json:"sticker"` + // Number of Telegram Stars that must be paid for the gift + StarCount int64 `json:"star_count"` + // Number of Telegram Stars that can be claimed by the receiver instead of the gift by default. If the gift was paid with just bought Telegram Stars, then full value can be claimed + DefaultSellStarCount int64 `json:"default_sell_star_count"` + // Number of remaining times the gift can be purchased by all users; 0 if not limited + RemainingCount int32 `json:"remaining_count"` + // Number of total times the gift can be purchased by all users; 0 if not limited + TotalCount int32 `json:"total_count"` +} + +func (entity *Gift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Gift + + return json.Marshal((*stub)(entity)) +} + +func (*Gift) GetClass() string { + return ClassGift +} + +func (*Gift) GetType() string { + return TypeGift +} + +// Contains a list of gifts that can be sent to another user +type Gifts struct { + meta + // The list of gifts + Gifts []*Gift `json:"gifts"` +} + +func (entity *Gifts) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Gifts + + return json.Marshal((*stub)(entity)) +} + +func (*Gifts) GetClass() string { + return ClassGifts +} + +func (*Gifts) GetType() string { + return TypeGifts +} + +// Represents a gift received by a user +type UserGift struct { + meta + // Identifier of the user that sent the gift; 0 if unknown + SenderUserId int64 `json:"sender_user_id"` + // Message added to the gift + Text *FormattedText `json:"text"` + // True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone are able to see them + IsPrivate bool `json:"is_private"` + // True, if the gift is displayed on the user's profile page; may be false only for the receiver of the gift + IsSaved bool `json:"is_saved"` + // Point in time (Unix timestamp) when the gift was sent + Date int32 `json:"date"` + // The gift + Gift *Gift `json:"gift"` + // Identifier of the message with the gift in the chat with the sender of the gift; can be 0 or an identifier of a deleted message; only for the gift receiver + MessageId int64 `json:"message_id"` + // Number of Telegram Stars that can be claimed by the receiver instead of the gift; only for the gift receiver + SellStarCount int64 `json:"sell_star_count"` +} + +func (entity *UserGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserGift + + return json.Marshal((*stub)(entity)) +} + +func (*UserGift) GetClass() string { + return ClassUserGift +} + +func (*UserGift) GetType() string { + return TypeUserGift +} + +// Represents a list of gifts received by a user +type UserGifts struct { + meta + // The total number of received gifts + TotalCount int32 `json:"total_count"` + // The list of gifts + Gifts []*UserGift `json:"gifts"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` +} + +func (entity *UserGifts) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserGifts + + return json.Marshal((*stub)(entity)) +} + +func (*UserGifts) GetClass() string { + return ClassUserGifts +} + +func (*UserGifts) GetType() string { + return TypeUserGifts +} + // The transaction is incoming and increases the number of owned Telegram Stars type StarTransactionDirectionIncoming struct{ meta @@ -7902,6 +8094,87 @@ func (*ChatTransactionPurposeGiveaway) ChatTransactionPurposeType() string { return TypeChatTransactionPurposeGiveaway } +// A user gifted Telegram Stars +type UserTransactionPurposeGiftedStars struct { + meta + // A sticker to be shown in the transaction information; may be null if unknown + Sticker *Sticker `json:"sticker"` +} + +func (entity *UserTransactionPurposeGiftedStars) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserTransactionPurposeGiftedStars + + return json.Marshal((*stub)(entity)) +} + +func (*UserTransactionPurposeGiftedStars) GetClass() string { + return ClassUserTransactionPurpose +} + +func (*UserTransactionPurposeGiftedStars) GetType() string { + return TypeUserTransactionPurposeGiftedStars +} + +func (*UserTransactionPurposeGiftedStars) UserTransactionPurposeType() string { + return TypeUserTransactionPurposeGiftedStars +} + +// The current user sold a gift received from another user +type UserTransactionPurposeGiftSell struct { + meta + // The gift + Gift *Gift `json:"gift"` +} + +func (entity *UserTransactionPurposeGiftSell) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserTransactionPurposeGiftSell + + return json.Marshal((*stub)(entity)) +} + +func (*UserTransactionPurposeGiftSell) GetClass() string { + return ClassUserTransactionPurpose +} + +func (*UserTransactionPurposeGiftSell) GetType() string { + return TypeUserTransactionPurposeGiftSell +} + +func (*UserTransactionPurposeGiftSell) UserTransactionPurposeType() string { + return TypeUserTransactionPurposeGiftSell +} + +// The current user sent a gift to another user +type UserTransactionPurposeGiftSend struct { + meta + // The gift + Gift *Gift `json:"gift"` +} + +func (entity *UserTransactionPurposeGiftSend) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserTransactionPurposeGiftSend + + return json.Marshal((*stub)(entity)) +} + +func (*UserTransactionPurposeGiftSend) GetClass() string { + return ClassUserTransactionPurpose +} + +func (*UserTransactionPurposeGiftSend) GetType() string { + return TypeUserTransactionPurposeGiftSend +} + +func (*UserTransactionPurposeGiftSend) UserTransactionPurposeType() string { + return TypeUserTransactionPurposeGiftSend +} + // The transaction is a transaction with Telegram through a bot type StarTransactionPartnerTelegram struct{ meta @@ -8189,13 +8462,13 @@ func (starTransactionPartnerChat *StarTransactionPartnerChat) UnmarshalJSON(data return nil } -// The transaction is a gift of Telegram Stars from another user +// The transaction is a transcation with another user type StarTransactionPartnerUser struct { meta - // Identifier of the user; 0 if the gift was anonymous + // Identifier of the user; 0 if the user was anonymous UserId int64 `json:"user_id"` - // A sticker to be shown in the transaction information; may be null if unknown - Sticker *Sticker `json:"sticker"` + // Purpose of the transaction + Purpose UserTransactionPurpose `json:"purpose"` } func (entity *StarTransactionPartnerUser) MarshalJSON() ([]byte, error) { @@ -8218,6 +8491,25 @@ func (*StarTransactionPartnerUser) StarTransactionPartnerType() string { return TypeStarTransactionPartnerUser } +func (starTransactionPartnerUser *StarTransactionPartnerUser) UnmarshalJSON(data []byte) error { + var tmp struct { + UserId int64 `json:"user_id"` + Purpose json.RawMessage `json:"purpose"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + starTransactionPartnerUser.UserId = tmp.UserId + + fieldPurpose, _ := UnmarshalUserTransactionPurpose(tmp.Purpose) + starTransactionPartnerUser.Purpose = fieldPurpose + + return nil +} + // The transaction is a transaction with unknown partner type StarTransactionPartnerUnsupported struct{ meta @@ -8518,7 +8810,7 @@ type GiveawayInfoCompleted struct { ActualWinnersSelectionDate int32 `json:"actual_winners_selection_date"` // True, if the giveaway was canceled and was fully refunded WasRefunded bool `json:"was_refunded"` - // True, if the cuurent user is a winner of the giveaway + // True, if the current user is a winner of the giveaway IsWinner bool `json:"is_winner"` // Number of winners in the giveaway WinnerCount int32 `json:"winner_count"` @@ -9057,6 +9349,8 @@ type UserFullInfo struct { PersonalChatId int64 `json:"personal_chat_id"` // The list of available options for gifting Telegram Premium to the user PremiumGiftOptions []*PremiumPaymentOption `json:"premium_gift_options"` + // Number of gifts saved to profile by the user + GiftCount int32 `json:"gift_count"` // Number of group chats where both the other user and the current user are a member; 0 for the current user GroupInCommonCount int32 `json:"group_in_common_count"` // Information about business settings for Telegram Business accounts; may be null if none @@ -9100,6 +9394,7 @@ func (userFullInfo *UserFullInfo) UnmarshalJSON(data []byte) error { Birthdate *Birthdate `json:"birthdate"` PersonalChatId int64 `json:"personal_chat_id"` PremiumGiftOptions []*PremiumPaymentOption `json:"premium_gift_options"` + GiftCount int32 `json:"gift_count"` GroupInCommonCount int32 `json:"group_in_common_count"` BusinessInfo *BusinessInfo `json:"business_info"` BotInfo *BotInfo `json:"bot_info"` @@ -9126,6 +9421,7 @@ func (userFullInfo *UserFullInfo) UnmarshalJSON(data []byte) error { userFullInfo.Birthdate = tmp.Birthdate userFullInfo.PersonalChatId = tmp.PersonalChatId userFullInfo.PremiumGiftOptions = tmp.PremiumGiftOptions + userFullInfo.GiftCount = tmp.GiftCount userFullInfo.GroupInCommonCount = tmp.GroupInCommonCount userFullInfo.BusinessInfo = tmp.BusinessInfo userFullInfo.BotInfo = tmp.BotInfo @@ -11380,7 +11676,7 @@ type PaidReactor struct { SenderId MessageSender `json:"sender_id"` // Number of Telegram Stars added StarCount int32 `json:"star_count"` - // True, if the reactor is one of the most active reactors; can be false if the reactor is the current user + // True, if the reactor is one of the most active reactors; may be false if the reactor is the current user IsTop bool `json:"is_top"` // True, if the paid reaction was added by the current user IsMe bool `json:"is_me"` @@ -12186,7 +12482,7 @@ type Message struct { IsPinned bool `json:"is_pinned"` // True, if the message was sent because of a scheduled action by the message sender, for example, as away, or greeting service message IsFromOffline bool `json:"is_from_offline"` - // True, if content of the message can be saved locally or copied + // True, if content of the message can be saved locally or copied using inputMessageForwarded or forwardMessages with copy options CanBeSaved bool `json:"can_be_saved"` // True, if media timestamp entities refers to a media in this message as opposed to a media in the replied message HasTimestampedMedia bool `json:"has_timestamped_media"` @@ -12874,7 +13170,7 @@ type SponsoredMessage struct { IsRecommended bool `json:"is_recommended"` // True, if the message can be reported to Telegram moderators through reportChatSponsoredMessage CanBeReported bool `json:"can_be_reported"` - // Content of the message. Currently, can be only of the types messageText, messageAnimation, messagePhoto, or messageVideo + // Content of the message. Currently, can be only of the types messageText, messageAnimation, messagePhoto, or messageVideo. Video messages can be viewed fullscreen Content MessageContent `json:"content"` // Information about the sponsor of the message Sponsor *MessageSponsor `json:"sponsor"` @@ -12966,8 +13262,8 @@ func (*SponsoredMessages) GetType() string { return TypeSponsoredMessages } -// Describes an option to report a sponsored message -type ReportChatSponsoredMessageOption struct { +// Describes an option to report an entity to Telegram +type ReportOption struct { meta // Unique identifier of the option Id []byte `json:"id"` @@ -12975,20 +13271,20 @@ type ReportChatSponsoredMessageOption struct { Text string `json:"text"` } -func (entity *ReportChatSponsoredMessageOption) MarshalJSON() ([]byte, error) { +func (entity *ReportOption) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ReportChatSponsoredMessageOption + type stub ReportOption return json.Marshal((*stub)(entity)) } -func (*ReportChatSponsoredMessageOption) GetClass() string { - return ClassReportChatSponsoredMessageOption +func (*ReportOption) GetClass() string { + return ClassReportOption } -func (*ReportChatSponsoredMessageOption) GetType() string { - return TypeReportChatSponsoredMessageOption +func (*ReportOption) GetType() string { + return TypeReportOption } // The message was reported successfully @@ -13047,7 +13343,7 @@ type ReportChatSponsoredMessageResultOptionRequired struct { // Title for the option choice Title string `json:"title"` // List of available options - Options []*ReportChatSponsoredMessageOption `json:"options"` + Options []*ReportOption `json:"options"` } func (entity *ReportChatSponsoredMessageResultOptionRequired) MarshalJSON() ([]byte, error) { @@ -15503,6 +15799,33 @@ func (*InlineKeyboardButtonTypeUser) InlineKeyboardButtonTypeType() string { return TypeInlineKeyboardButtonTypeUser } +// A button that copies specified text to clipboard +type InlineKeyboardButtonTypeCopyText struct { + meta + // The text to copy to clipboard + Text string `json:"text"` +} + +func (entity *InlineKeyboardButtonTypeCopyText) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InlineKeyboardButtonTypeCopyText + + return json.Marshal((*stub)(entity)) +} + +func (*InlineKeyboardButtonTypeCopyText) GetClass() string { + return ClassInlineKeyboardButtonType +} + +func (*InlineKeyboardButtonTypeCopyText) GetType() string { + return TypeInlineKeyboardButtonTypeCopyText +} + +func (*InlineKeyboardButtonTypeCopyText) InlineKeyboardButtonTypeType() string { + return TypeInlineKeyboardButtonTypeCopyText +} + // Represents a single button in an inline keyboard type InlineKeyboardButton struct { meta @@ -15608,7 +15931,7 @@ type ReplyMarkupShowKeyboard struct { meta // A list of rows of bot keyboard buttons Rows [][]*KeyboardButton `json:"rows"` - // True, if the keyboard is supposed to always be shown when the ordinary keyboard is hidden + // True, if the keyboard is expected to always be shown when the ordinary keyboard is hidden IsPersistent bool `json:"is_persistent"` // True, if the application needs to resize the keyboard vertically ResizeKeyboard bool `json:"resize_keyboard"` @@ -23366,6 +23689,8 @@ type MessageVideo struct { meta // The video description Video *Video `json:"video"` + // Alternative qualities of the video + AlternativeVideos []*AlternativeVideo `json:"alternative_videos"` // Video caption Caption *FormattedText `json:"caption"` // True, if the caption must be shown above the video; otherwise, the caption must be shown below the video @@ -23956,7 +24281,7 @@ type MessageVideoChatScheduled struct { meta // Identifier of the video chat. The video chat can be received through the method getGroupCall GroupCallId int32 `json:"group_call_id"` - // Point in time (Unix timestamp) when the group call is supposed to be started by an administrator + // Point in time (Unix timestamp) when the group call is expected to be started by an administrator StartDate int32 `json:"start_date"` } @@ -25233,7 +25558,7 @@ func (*MessageGiftedStars) MessageContentType() string { return TypeMessageGiftedStars } -// A Telegram Stars were received by the cuurent user from a giveaway +// A Telegram Stars were received by the current user from a giveaway type MessageGiveawayPrizeStars struct { meta // Number of Telegram Stars that were received @@ -25270,6 +25595,43 @@ func (*MessageGiveawayPrizeStars) MessageContentType() string { return TypeMessageGiveawayPrizeStars } +// A gift was received or sent by the current user +type MessageGift struct { + meta + // The gift + Gift *Gift `json:"gift"` + // Message added to the gift + Text *FormattedText `json:"text"` + // Number of Telegram Stars that can be claimed by the receiver instead of the gift + SellStarCount int64 `json:"sell_star_count"` + // True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone will be able to see them + IsPrivate bool `json:"is_private"` + // True, if the gift is displayed on the user's profile page; only for the receiver of the gift + IsSaved bool `json:"is_saved"` + // True, if the gift was converted to Telegram Stars; only for the receiver of the gift + WasConverted bool `json:"was_converted"` +} + +func (entity *MessageGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageGift + + return json.Marshal((*stub)(entity)) +} + +func (*MessageGift) GetClass() string { + return ClassMessageContent +} + +func (*MessageGift) GetType() string { + return TypeMessageGift +} + +func (*MessageGift) MessageContentType() string { + return TypeMessageGift +} + // A contact has registered with Telegram type MessageContactRegistered struct{ meta @@ -26241,7 +26603,7 @@ type InputPaidMediaTypeVideo struct { meta // Duration of the video, in seconds Duration int32 `json:"duration"` - // True, if the video is supposed to be streamed + // True, if the video is expected to be streamed SupportsStreaming bool `json:"supports_streaming"` } @@ -26508,7 +26870,7 @@ type MessageCopyOptions struct { ReplaceCaption bool `json:"replace_caption"` // New message caption; pass null to copy message without caption. Ignored if replace_caption is false NewCaption *FormattedText `json:"new_caption"` - // True, if new caption must be shown above the animation; otherwise, new caption must be shown below the animation; not supported in secret chats. Ignored if replace_caption is false + // True, if new caption must be shown above the media; otherwise, new caption must be shown below the media; not supported in secret chats. Ignored if replace_caption is false NewShowCaptionAboveMedia bool `json:"new_show_caption_above_media"` } @@ -26764,7 +27126,7 @@ type InputMessagePaidMedia struct { PaidMedia []*InputPaidMedia `json:"paid_media"` // Message caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters Caption *FormattedText `json:"caption"` - // True, if the caption must be shown above the video; otherwise, the caption must be shown below the video; not supported in secret chats + // True, if the caption must be shown above the media; otherwise, the caption must be shown below the media; not supported in secret chats ShowCaptionAboveMedia bool `json:"show_caption_above_media"` // Bot-provided data for the paid media; bots only Payload string `json:"payload"` @@ -26931,7 +27293,7 @@ func (inputMessageSticker *InputMessageSticker) UnmarshalJSON(data []byte) error // A video message type InputMessageVideo struct { meta - // Video to be sent + // Video to be sent. The video is expected to be reencoded to MPEG4 format with H.264 codec by the sender Video InputFile `json:"video"` // Video thumbnail; pass null to skip thumbnail uploading Thumbnail *InputThumbnail `json:"thumbnail"` @@ -26943,7 +27305,7 @@ type InputMessageVideo struct { Width int32 `json:"width"` // Video height Height int32 `json:"height"` - // True, if the video is supposed to be streamed + // True, if the video is expected to be streamed SupportsStreaming bool `json:"supports_streaming"` // Video caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters Caption *FormattedText `json:"caption"` @@ -29683,7 +30045,7 @@ type StoryVideo struct { Minithumbnail *Minithumbnail `json:"minithumbnail"` // Video thumbnail in JPEG or MPEG4 format; may be null Thumbnail *Thumbnail `json:"thumbnail"` - // Size of file prefix, which is supposed to be preloaded, in bytes + // Size of file prefix, which is expected to be preloaded, in bytes PreloadPrefixSize int32 `json:"preload_prefix_size"` // Timestamp of the frame used as video thumbnail CoverFrameTimestamp float64 `json:"cover_frame_timestamp"` @@ -29739,7 +30101,7 @@ type StoryContentVideo struct { meta // The video in MPEG4 format Video *StoryVideo `json:"video"` - // Alternative version of the video in MPEG4 format, encoded by x264 codec; may be null + // Alternative version of the video in MPEG4 format, encoded with H.264 codec; may be null AlternativeVideo *StoryVideo `json:"alternative_video"` } @@ -29839,7 +30201,7 @@ func (inputStoryContentPhoto *InputStoryContentPhoto) UnmarshalJSON(data []byte) // A video story type InputStoryContentVideo struct { meta - // Video to be sent. The video size must be 720x1280. The video must be streamable and stored in MPEG4 format, after encoding with x265 codec and key frames added each second + // Video to be sent. The video size must be 720x1280. The video must be streamable and stored in MPEG4 format, after encoding with H.265 codec and key frames added each second Video InputFile `json:"video"` // File identifiers of the stickers added to the video, if applicable AddedStickerFileIds []int32 `json:"added_sticker_file_ids"` @@ -32064,7 +32426,7 @@ type GroupCall struct { Id int32 `json:"id"` // Group call title Title string `json:"title"` - // Point in time (Unix timestamp) when the group call is supposed to be started by an administrator; 0 if it is already active or was ended + // Point in time (Unix timestamp) when the group call is expected to be started by an administrator; 0 if it is already active or was ended ScheduledStartDate int32 `json:"scheduled_start_date"` // True, if the group call is scheduled and the current user will receive a notification when the group call starts EnabledStartNotification bool `json:"enabled_start_notification"` @@ -41316,6 +41678,33 @@ func (pushMessageContentGiveaway *PushMessageContentGiveaway) UnmarshalJSON(data return nil } +// A message with a gift +type PushMessageContentGift struct { + meta + // Number of Telegram Stars that sender paid for the gift + StarCount int64 `json:"star_count"` +} + +func (entity *PushMessageContentGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentGift + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentGift) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentGift) GetType() string { + return TypePushMessageContentGift +} + +func (*PushMessageContentGift) PushMessageContentType() string { + return TypePushMessageContentGift +} + // A screenshot of a message in the chat has been taken type PushMessageContentScreenshotTaken struct{ meta @@ -44328,6 +44717,197 @@ func (*ReportReasonCustom) ReportReasonType() string { return TypeReportReasonCustom } +// The chat was reported successfully +type ReportChatResultOk struct{ + meta +} + +func (entity *ReportChatResultOk) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReportChatResultOk + + return json.Marshal((*stub)(entity)) +} + +func (*ReportChatResultOk) GetClass() string { + return ClassReportChatResult +} + +func (*ReportChatResultOk) GetType() string { + return TypeReportChatResultOk +} + +func (*ReportChatResultOk) ReportChatResultType() string { + return TypeReportChatResultOk +} + +// The user must choose an option to report the chat and repeat request with the chosen option +type ReportChatResultOptionRequired struct { + meta + // Title for the option choice + Title string `json:"title"` + // List of available options + Options []*ReportOption `json:"options"` +} + +func (entity *ReportChatResultOptionRequired) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReportChatResultOptionRequired + + return json.Marshal((*stub)(entity)) +} + +func (*ReportChatResultOptionRequired) GetClass() string { + return ClassReportChatResult +} + +func (*ReportChatResultOptionRequired) GetType() string { + return TypeReportChatResultOptionRequired +} + +func (*ReportChatResultOptionRequired) ReportChatResultType() string { + return TypeReportChatResultOptionRequired +} + +// The user must add additional text details to the report +type ReportChatResultTextRequired struct { + meta + // Option identifier for the next reportChat request + OptionId []byte `json:"option_id"` + // True, if the user can skip text adding + IsOptional bool `json:"is_optional"` +} + +func (entity *ReportChatResultTextRequired) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReportChatResultTextRequired + + return json.Marshal((*stub)(entity)) +} + +func (*ReportChatResultTextRequired) GetClass() string { + return ClassReportChatResult +} + +func (*ReportChatResultTextRequired) GetType() string { + return TypeReportChatResultTextRequired +} + +func (*ReportChatResultTextRequired) ReportChatResultType() string { + return TypeReportChatResultTextRequired +} + +// The user must choose messages to report and repeat the reportChat request with the chosen messages +type ReportChatResultMessagesRequired struct{ + meta +} + +func (entity *ReportChatResultMessagesRequired) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReportChatResultMessagesRequired + + return json.Marshal((*stub)(entity)) +} + +func (*ReportChatResultMessagesRequired) GetClass() string { + return ClassReportChatResult +} + +func (*ReportChatResultMessagesRequired) GetType() string { + return TypeReportChatResultMessagesRequired +} + +func (*ReportChatResultMessagesRequired) ReportChatResultType() string { + return TypeReportChatResultMessagesRequired +} + +// The story was reported successfully +type ReportStoryResultOk struct{ + meta +} + +func (entity *ReportStoryResultOk) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReportStoryResultOk + + return json.Marshal((*stub)(entity)) +} + +func (*ReportStoryResultOk) GetClass() string { + return ClassReportStoryResult +} + +func (*ReportStoryResultOk) GetType() string { + return TypeReportStoryResultOk +} + +func (*ReportStoryResultOk) ReportStoryResultType() string { + return TypeReportStoryResultOk +} + +// The user must choose an option to report the story and repeat request with the chosen option +type ReportStoryResultOptionRequired struct { + meta + // Title for the option choice + Title string `json:"title"` + // List of available options + Options []*ReportOption `json:"options"` +} + +func (entity *ReportStoryResultOptionRequired) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReportStoryResultOptionRequired + + return json.Marshal((*stub)(entity)) +} + +func (*ReportStoryResultOptionRequired) GetClass() string { + return ClassReportStoryResult +} + +func (*ReportStoryResultOptionRequired) GetType() string { + return TypeReportStoryResultOptionRequired +} + +func (*ReportStoryResultOptionRequired) ReportStoryResultType() string { + return TypeReportStoryResultOptionRequired +} + +// The user must add additional text details to the report +type ReportStoryResultTextRequired struct { + meta + // Option identifier for the next reportStory request + OptionId []byte `json:"option_id"` + // True, if the user can skip text adding + IsOptional bool `json:"is_optional"` +} + +func (entity *ReportStoryResultTextRequired) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReportStoryResultTextRequired + + return json.Marshal((*stub)(entity)) +} + +func (*ReportStoryResultTextRequired) GetClass() string { + return ClassReportStoryResult +} + +func (*ReportStoryResultTextRequired) GetType() string { + return TypeReportStoryResultTextRequired +} + +func (*ReportStoryResultTextRequired) ReportStoryResultType() string { + return TypeReportStoryResultTextRequired +} + // The currently opened chat needs to be kept type TargetChatCurrent struct{ meta @@ -44560,7 +45140,7 @@ func (*InternalLinkTypeBackground) InternalLinkTypeType() string { return TypeInternalLinkTypeBackground } -// The link is a link to a Telegram bot, which is supposed to be added to a channel chat as an administrator. Call searchPublicChat with the given bot username and check that the user is a bot, ask the current user to select a channel chat to add the bot to as an administrator. Then, call getChatMember to receive the current bot rights in the chat and if the bot already is an administrator, check that the current user can edit its administrator rights and combine received rights with the requested administrator rights. Then, show confirmation box to the user, and call setChatMemberStatus with the chosen chat and confirmed rights +// The link is a link to a Telegram bot, which is expected to be added to a channel chat as an administrator. Call searchPublicChat with the given bot username and check that the user is a bot, ask the current user to select a channel chat to add the bot to as an administrator. Then, call getChatMember to receive the current bot rights in the chat and if the bot already is an administrator, check that the current user can edit its administrator rights and combine received rights with the requested administrator rights. Then, show confirmation box to the user, and call setChatMemberStatus with the chosen chat and confirmed rights type InternalLinkTypeBotAddToChannel struct { meta // Username of the bot @@ -44620,7 +45200,7 @@ func (*InternalLinkTypeBotStart) InternalLinkTypeType() string { return TypeInternalLinkTypeBotStart } -// The link is a link to a Telegram bot, which is supposed to be added to a group chat. Call searchPublicChat with the given bot username, check that the user is a bot and can be added to groups, ask the current user to select a basic group or a supergroup chat to add the bot to, taking into account that bots can be added to a public supergroup only by administrators of the supergroup. If administrator rights are provided by the link, call getChatMember to receive the current bot rights in the chat and if the bot already is an administrator, check that the current user can edit its administrator rights, combine received rights with the requested administrator rights, show confirmation box to the user, and call setChatMemberStatus with the chosen chat and confirmed administrator rights. Before call to setChatMemberStatus it may be required to upgrade the chosen basic group chat to a supergroup chat. Then, if start_parameter isn't empty, call sendBotStartMessage with the given start parameter and the chosen chat; otherwise, just send /start message with bot's username added to the chat +// The link is a link to a Telegram bot, which is expected to be added to a group chat. Call searchPublicChat with the given bot username, check that the user is a bot and can be added to groups, ask the current user to select a basic group or a supergroup chat to add the bot to, taking into account that bots can be added to a public supergroup only by administrators of the supergroup. If administrator rights are provided by the link, call getChatMember to receive the current bot rights in the chat and if the bot already is an administrator, check that the current user can edit its administrator rights, combine received rights with the requested administrator rights, show confirmation box to the user, and call setChatMemberStatus with the chosen chat and confirmed administrator rights. Before call to setChatMemberStatus it may be required to upgrade the chosen basic group chat to a supergroup chat. Then, if start_parameter isn't empty, call sendBotStartMessage with the given start parameter and the chosen chat; otherwise, just send /start message with bot's username added to the chat type InternalLinkTypeBotStartInGroup struct { meta // Username of the bot @@ -46863,11 +47443,11 @@ func (*AutoDownloadSettings) GetType() string { // Contains auto-download settings presets for the current user type AutoDownloadSettingsPresets struct { meta - // Preset with lowest settings; supposed to be used by default when roaming + // Preset with lowest settings; expected to be used by default when roaming Low *AutoDownloadSettings `json:"low"` - // Preset with medium settings; supposed to be used by default when using mobile data + // Preset with medium settings; expected to be used by default when using mobile data Medium *AutoDownloadSettings `json:"medium"` - // Preset with highest settings; supposed to be used by default when connected on Wi-Fi + // Preset with highest settings; expected to be used by default when connected on Wi-Fi High *AutoDownloadSettings `json:"high"` } @@ -47145,7 +47725,7 @@ func (*ConnectionStateConnecting) ConnectionStateType() string { return TypeConnectionStateConnecting } -// Downloading data supposed to be received while the application was offline +// Downloading data expected to be received while the application was offline type ConnectionStateUpdating struct{ meta } @@ -50248,7 +50828,7 @@ func (*UpdateMessageFactCheck) UpdateType() string { return TypeUpdateMessageFactCheck } -// A message with a live location was viewed. When the update is received, the application is supposed to update the live location +// A message with a live location was viewed. When the update is received, the application is expected to update the live location type UpdateMessageLiveLocationViewed struct { meta // Identifier of the chat with the live location message @@ -52252,16 +52832,16 @@ func (*UpdateFile) UpdateType() string { return TypeUpdateFile } -// The file generation process needs to be started by the application +// The file generation process needs to be started by the application. Use setFileGenerationProgress and finishFileGeneration to generate the file type UpdateFileGenerationStart struct { meta // Unique identifier for the generation process GenerationId JsonInt64 `json:"generation_id"` - // The path to a file from which a new file is generated; may be empty + // The original path specified by the application in inputFileGenerated OriginalPath string `json:"original_path"` - // The path to a file that must be created and where the new file is generated + // The path to a file that must be created and where the new file must be generated by the application. If the application has no access to the path, it can use writeGeneratedFilePart to generate the file DestinationPath string `json:"destination_path"` - // String specifying the conversion applied to the original file. If conversion is "#url#" than original_path contains an HTTP/HTTPS URL of a file, which must be downloaded by the application + // If the conversion is "#url#" than original_path contains an HTTP/HTTPS URL of a file that must be downloaded by the application. Otherwise, this is the conversion specified by the application in inputFileGenerated Conversion string `json:"conversion"` } diff --git a/client/unmarshaler.go b/client/unmarshaler.go index ddf4f8d..b779a08 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -767,6 +767,43 @@ func UnmarshalListOfChatTransactionPurpose(dataList []json.RawMessage) ([]ChatTr return list, nil } +func UnmarshalUserTransactionPurpose(data json.RawMessage) (UserTransactionPurpose, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeUserTransactionPurposeGiftedStars: + return UnmarshalUserTransactionPurposeGiftedStars(data) + + case TypeUserTransactionPurposeGiftSell: + return UnmarshalUserTransactionPurposeGiftSell(data) + + case TypeUserTransactionPurposeGiftSend: + return UnmarshalUserTransactionPurposeGiftSend(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfUserTransactionPurpose(dataList []json.RawMessage) ([]UserTransactionPurpose, error) { + list := []UserTransactionPurpose{} + + for _, data := range dataList { + entity, err := UnmarshalUserTransactionPurpose(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalStarTransactionPartner(data json.RawMessage) (StarTransactionPartner, error) { var meta meta @@ -1938,6 +1975,9 @@ func UnmarshalInlineKeyboardButtonType(data json.RawMessage) (InlineKeyboardButt case TypeInlineKeyboardButtonTypeUser: return UnmarshalInlineKeyboardButtonTypeUser(data) + case TypeInlineKeyboardButtonTypeCopyText: + return UnmarshalInlineKeyboardButtonTypeCopyText(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -3256,6 +3296,9 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessageGiveawayPrizeStars: return UnmarshalMessageGiveawayPrizeStars(data) + case TypeMessageGift: + return UnmarshalMessageGift(data) + case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) @@ -5956,6 +5999,9 @@ func UnmarshalPushMessageContent(data json.RawMessage) (PushMessageContent, erro case TypePushMessageContentGiveaway: return UnmarshalPushMessageContentGiveaway(data) + case TypePushMessageContentGift: + return UnmarshalPushMessageContentGift(data) + case TypePushMessageContentScreenshotTaken: return UnmarshalPushMessageContentScreenshotTaken(data) @@ -6531,6 +6577,83 @@ func UnmarshalListOfReportReason(dataList []json.RawMessage) ([]ReportReason, er return list, nil } +func UnmarshalReportChatResult(data json.RawMessage) (ReportChatResult, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeReportChatResultOk: + return UnmarshalReportChatResultOk(data) + + case TypeReportChatResultOptionRequired: + return UnmarshalReportChatResultOptionRequired(data) + + case TypeReportChatResultTextRequired: + return UnmarshalReportChatResultTextRequired(data) + + case TypeReportChatResultMessagesRequired: + return UnmarshalReportChatResultMessagesRequired(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfReportChatResult(dataList []json.RawMessage) ([]ReportChatResult, error) { + list := []ReportChatResult{} + + for _, data := range dataList { + entity, err := UnmarshalReportChatResult(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalReportStoryResult(data json.RawMessage) (ReportStoryResult, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeReportStoryResultOk: + return UnmarshalReportStoryResultOk(data) + + case TypeReportStoryResultOptionRequired: + return UnmarshalReportStoryResultOptionRequired(data) + + case TypeReportStoryResultTextRequired: + return UnmarshalReportStoryResultTextRequired(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfReportStoryResult(dataList []json.RawMessage) ([]ReportStoryResult, error) { + list := []ReportStoryResult{} + + for _, data := range dataList { + entity, err := UnmarshalReportStoryResult(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalTargetChat(data json.RawMessage) (TargetChat, error) { var meta meta @@ -8777,6 +8900,14 @@ func UnmarshalPoll(data json.RawMessage) (*Poll, error) { return &resp, err } +func UnmarshalAlternativeVideo(data json.RawMessage) (*AlternativeVideo, error) { + var resp AlternativeVideo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalBackground(data json.RawMessage) (*Background, error) { var resp Background @@ -9241,6 +9372,38 @@ func UnmarshalStarGiveawayPaymentOptions(data json.RawMessage) (*StarGiveawayPay return &resp, err } +func UnmarshalGift(data json.RawMessage) (*Gift, error) { + var resp Gift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGifts(data json.RawMessage) (*Gifts, error) { + var resp Gifts + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserGift(data json.RawMessage) (*UserGift, error) { + var resp UserGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserGifts(data json.RawMessage) (*UserGifts, error) { + var resp UserGifts + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarTransactionDirectionIncoming(data json.RawMessage) (*StarTransactionDirectionIncoming, error) { var resp StarTransactionDirectionIncoming @@ -9305,6 +9468,30 @@ func UnmarshalChatTransactionPurposeGiveaway(data json.RawMessage) (*ChatTransac return &resp, err } +func UnmarshalUserTransactionPurposeGiftedStars(data json.RawMessage) (*UserTransactionPurposeGiftedStars, error) { + var resp UserTransactionPurposeGiftedStars + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserTransactionPurposeGiftSell(data json.RawMessage) (*UserTransactionPurposeGiftSell, error) { + var resp UserTransactionPurposeGiftSell + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserTransactionPurposeGiftSend(data json.RawMessage) (*UserTransactionPurposeGiftSend, error) { + var resp UserTransactionPurposeGiftSend + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarTransactionPartnerTelegram(data json.RawMessage) (*StarTransactionPartnerTelegram, error) { var resp StarTransactionPartnerTelegram @@ -10449,8 +10636,8 @@ func UnmarshalSponsoredMessages(data json.RawMessage) (*SponsoredMessages, error return &resp, err } -func UnmarshalReportChatSponsoredMessageOption(data json.RawMessage) (*ReportChatSponsoredMessageOption, error) { - var resp ReportChatSponsoredMessageOption +func UnmarshalReportOption(data json.RawMessage) (*ReportOption, error) { + var resp ReportOption err := json.Unmarshal(data, &resp) @@ -11073,6 +11260,14 @@ func UnmarshalInlineKeyboardButtonTypeUser(data json.RawMessage) (*InlineKeyboar return &resp, err } +func UnmarshalInlineKeyboardButtonTypeCopyText(data json.RawMessage) (*InlineKeyboardButtonTypeCopyText, error) { + var resp InlineKeyboardButtonTypeCopyText + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInlineKeyboardButton(data json.RawMessage) (*InlineKeyboardButton, error) { var resp InlineKeyboardButton @@ -13393,6 +13588,14 @@ func UnmarshalMessageGiveawayPrizeStars(data json.RawMessage) (*MessageGiveawayP return &resp, err } +func UnmarshalMessageGift(data json.RawMessage) (*MessageGift, error) { + var resp MessageGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageContactRegistered(data json.RawMessage) (*MessageContactRegistered, error) { var resp MessageContactRegistered @@ -17337,6 +17540,14 @@ func UnmarshalPushMessageContentGiveaway(data json.RawMessage) (*PushMessageCont return &resp, err } +func UnmarshalPushMessageContentGift(data json.RawMessage) (*PushMessageContentGift, error) { + var resp PushMessageContentGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPushMessageContentScreenshotTaken(data json.RawMessage) (*PushMessageContentScreenshotTaken, error) { var resp PushMessageContentScreenshotTaken @@ -18193,6 +18404,62 @@ func UnmarshalReportReasonCustom(data json.RawMessage) (*ReportReasonCustom, err return &resp, err } +func UnmarshalReportChatResultOk(data json.RawMessage) (*ReportChatResultOk, error) { + var resp ReportChatResultOk + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReportChatResultOptionRequired(data json.RawMessage) (*ReportChatResultOptionRequired, error) { + var resp ReportChatResultOptionRequired + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReportChatResultTextRequired(data json.RawMessage) (*ReportChatResultTextRequired, error) { + var resp ReportChatResultTextRequired + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReportChatResultMessagesRequired(data json.RawMessage) (*ReportChatResultMessagesRequired, error) { + var resp ReportChatResultMessagesRequired + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReportStoryResultOk(data json.RawMessage) (*ReportStoryResultOk, error) { + var resp ReportStoryResultOk + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReportStoryResultOptionRequired(data json.RawMessage) (*ReportStoryResultOptionRequired, error) { + var resp ReportStoryResultOptionRequired + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReportStoryResultTextRequired(data json.RawMessage) (*ReportStoryResultTextRequired, error) { + var resp ReportStoryResultTextRequired + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalTargetChatCurrent(data json.RawMessage) (*TargetChatCurrent, error) { var resp TargetChatCurrent @@ -21256,6 +21523,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePoll: return UnmarshalPoll(data) + case TypeAlternativeVideo: + return UnmarshalAlternativeVideo(data) + case TypeBackground: return UnmarshalBackground(data) @@ -21430,6 +21700,18 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarGiveawayPaymentOptions: return UnmarshalStarGiveawayPaymentOptions(data) + case TypeGift: + return UnmarshalGift(data) + + case TypeGifts: + return UnmarshalGifts(data) + + case TypeUserGift: + return UnmarshalUserGift(data) + + case TypeUserGifts: + return UnmarshalUserGifts(data) + case TypeStarTransactionDirectionIncoming: return UnmarshalStarTransactionDirectionIncoming(data) @@ -21454,6 +21736,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatTransactionPurposeGiveaway: return UnmarshalChatTransactionPurposeGiveaway(data) + case TypeUserTransactionPurposeGiftedStars: + return UnmarshalUserTransactionPurposeGiftedStars(data) + + case TypeUserTransactionPurposeGiftSell: + return UnmarshalUserTransactionPurposeGiftSell(data) + + case TypeUserTransactionPurposeGiftSend: + return UnmarshalUserTransactionPurposeGiftSend(data) + case TypeStarTransactionPartnerTelegram: return UnmarshalStarTransactionPartnerTelegram(data) @@ -21883,8 +22174,8 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSponsoredMessages: return UnmarshalSponsoredMessages(data) - case TypeReportChatSponsoredMessageOption: - return UnmarshalReportChatSponsoredMessageOption(data) + case TypeReportOption: + return UnmarshalReportOption(data) case TypeReportChatSponsoredMessageResultOk: return UnmarshalReportChatSponsoredMessageResultOk(data) @@ -22117,6 +22408,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInlineKeyboardButtonTypeUser: return UnmarshalInlineKeyboardButtonTypeUser(data) + case TypeInlineKeyboardButtonTypeCopyText: + return UnmarshalInlineKeyboardButtonTypeCopyText(data) + case TypeInlineKeyboardButton: return UnmarshalInlineKeyboardButton(data) @@ -22987,6 +23281,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageGiveawayPrizeStars: return UnmarshalMessageGiveawayPrizeStars(data) + case TypeMessageGift: + return UnmarshalMessageGift(data) + case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) @@ -24466,6 +24763,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePushMessageContentGiveaway: return UnmarshalPushMessageContentGiveaway(data) + case TypePushMessageContentGift: + return UnmarshalPushMessageContentGift(data) + case TypePushMessageContentScreenshotTaken: return UnmarshalPushMessageContentScreenshotTaken(data) @@ -24787,6 +25087,27 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeReportReasonCustom: return UnmarshalReportReasonCustom(data) + case TypeReportChatResultOk: + return UnmarshalReportChatResultOk(data) + + case TypeReportChatResultOptionRequired: + return UnmarshalReportChatResultOptionRequired(data) + + case TypeReportChatResultTextRequired: + return UnmarshalReportChatResultTextRequired(data) + + case TypeReportChatResultMessagesRequired: + return UnmarshalReportChatResultMessagesRequired(data) + + case TypeReportStoryResultOk: + return UnmarshalReportStoryResultOk(data) + + case TypeReportStoryResultOptionRequired: + return UnmarshalReportStoryResultOptionRequired(data) + + case TypeReportStoryResultTextRequired: + return UnmarshalReportStoryResultTextRequired(data) + case TypeTargetChatCurrent: return UnmarshalTargetChatCurrent(data) diff --git a/data/td_api.tl b/data/td_api.tl index 8174884..8101cdc 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -65,7 +65,7 @@ authenticationCodeTypeFirebaseAndroid device_verification_parameters:FirebaseDev //@description A digit-only authentication code is delivered via Firebase Authentication to the official iOS application //@receipt Receipt of successful application token validation to compare with receipt from push notification -//@push_timeout Time after the next authentication method is supposed to be used if verification push notification isn't received, in seconds +//@push_timeout Time after the next authentication method is expected to be used if verification push notification isn't received, in seconds //@length Length of the code authenticationCodeTypeFirebaseIos receipt:string push_timeout:int32 length:int32 = AuthenticationCodeType; @@ -246,10 +246,10 @@ inputFileRemote id:string = InputFile; //@description A file defined by a local path @path Local path to the file inputFileLocal path:string = InputFile; -//@description A file generated by the application -//@original_path Local path to a file from which the file is generated; may be empty if there is no such file +//@description A file generated by the application. The application must handle updates updateFileGenerationStart and updateFileGenerationStop to generate the file when asked by TDLib +//@original_path Local path to a file from which the file is generated. The path doesn't have to be a valid path and is used by TDLib only to detect name and MIME type of the generated file //@conversion String specifying the conversion applied to the original file; must be persistent across application restarts. Conversions beginning with '#' are reserved for internal TDLib usage -//@expected_size Expected size of the generated file, in bytes; 0 if unknown +//@expected_size Expected size of the generated file, in bytes; pass 0 if unknown inputFileGenerated original_path:string conversion:string expected_size:int53 = InputFile; @@ -400,7 +400,7 @@ animation duration:int32 width:int32 height:int32 file_name:string mime_type:str //@file_name Original name of the file; as defined by the sender //@mime_type The MIME type of the file; as defined by the sender //@album_cover_minithumbnail The minithumbnail of the album cover; may be null -//@album_cover_thumbnail The thumbnail of the album cover in JPEG format; as defined by the sender. The full size thumbnail is supposed to be extracted from the downloaded audio file; may be null +//@album_cover_thumbnail The thumbnail of the album cover in JPEG format; as defined by the sender. The full size thumbnail is expected to be extracted from the downloaded audio file; may be null //@external_album_covers Album cover variants to use if the downloaded audio file contains no album cover. Provided thumbnail dimensions are approximate //@audio File containing the audio audio duration:int32 title:string performer:string file_name:string mime_type:string album_cover_minithumbnail:minithumbnail album_cover_thumbnail:thumbnail external_album_covers:vector audio:file = Audio; @@ -439,7 +439,7 @@ sticker id:int64 set_id:int64 width:int32 height:int32 emoji:string format:Stick //@file_name Original name of the file; as defined by the sender //@mime_type MIME type of the file; as defined by the sender //@has_stickers True, if stickers were added to the video. The list of corresponding sticker sets can be received using getAttachedStickerSets -//@supports_streaming True, if the video is supposed to be streamed +//@supports_streaming True, if the video is expected to be streamed //@minithumbnail Video minithumbnail; may be null //@thumbnail Video thumbnail in JPEG or MPEG4 format; as defined by the sender; may be null //@video File containing the video @@ -526,6 +526,15 @@ webApp short_name:string title:string description:string photo:photo animation:a poll id:int64 question:formattedText options:vector total_voter_count:int32 recent_voter_ids:vector is_anonymous:Bool type:PollType open_period:int32 close_date:int32 is_closed:Bool = Poll; +//@description Describes an alternative reencoded quality of a video file +//@width Video width +//@height Video height +//@codec Codec used for video file encoding, for example, "h264", "h265", or "av1" +//@hls_file HLS file describing the video +//@video File containing the video +alternativeVideo width:int32 height:int32 codec:string hls_file:file video:file = AlternativeVideo; + + //@description Describes a chat background //@id Unique background identifier //@is_default True, if this is one of default backgrounds @@ -837,7 +846,7 @@ productInfo title:string description:formattedText photo:photo = ProductInfo; //@currency ISO 4217 currency code for Telegram Premium subscription payment //@amount The amount to pay, in the smallest units of the currency //@discount_percentage The discount associated with this option, as a percentage -//@month_count Number of months the Telegram Premium subscription will be active +//@month_count Number of months the Telegram Premium subscription will be active. Use getPremiumInfoSticker to get the sticker to be used as representation of the Telegram Premium subscription //@store_product_id Identifier of the store product associated with the option //@payment_link An internal link to be opened for buying Telegram Premium to the user if store payment isn't possible; may be null if direct payment isn't available premiumPaymentOption currency:string amount:int53 discount_percentage:int32 month_count:int32 store_product_id:string payment_link:InternalLinkType = PremiumPaymentOption; @@ -902,6 +911,35 @@ starGiveawayPaymentOption currency:string amount:int53 star_count:int53 store_pr //@description Contains a list of options for creating Telegram Star giveaway @options The list of options starGiveawayPaymentOptions options:vector = StarGiveawayPaymentOptions; +//@description Describes a gift that can be sent to another user +//@id Unique identifier of the gift +//@sticker The sticker representing the gift +//@star_count Number of Telegram Stars that must be paid for the gift +//@default_sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the gift by default. If the gift was paid with just bought Telegram Stars, then full value can be claimed +//@remaining_count Number of remaining times the gift can be purchased by all users; 0 if not limited +//@total_count Number of total times the gift can be purchased by all users; 0 if not limited +gift id:int64 sticker:sticker star_count:int53 default_sell_star_count:int53 remaining_count:int32 total_count:int32 = Gift; + +//@description Contains a list of gifts that can be sent to another user @gifts The list of gifts +gifts gifts:vector = Gifts; + +//@description Represents a gift received by a user +//@sender_user_id Identifier of the user that sent the gift; 0 if unknown +//@text Message added to the gift +//@is_private True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone are able to see them +//@is_saved True, if the gift is displayed on the user's profile page; may be false only for the receiver of the gift +//@date Point in time (Unix timestamp) when the gift was sent +//@gift The gift +//@message_id Identifier of the message with the gift in the chat with the sender of the gift; can be 0 or an identifier of a deleted message; only for the gift receiver +//@sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the gift; only for the gift receiver +userGift sender_user_id:int53 text:formattedText is_private:Bool is_saved:Bool date:int32 gift:gift message_id:int53 sell_star_count:int53 = UserGift; + +//@description Represents a list of gifts received by a user +//@total_count The total number of received gifts +//@gifts The list of gifts +//@next_offset The offset for the next request. If empty, then there are no more results +userGifts total_count:int32 gifts:vector next_offset:string = UserGifts; + //@class StarTransactionDirection @description Describes direction of a transaction with Telegram Stars @@ -942,6 +980,18 @@ chatTransactionPurposeReaction message_id:int53 = ChatTransactionPurpose; chatTransactionPurposeGiveaway giveaway_message_id:int53 = ChatTransactionPurpose; +//@class UserTransactionPurpose @description Describes purpose of a transaction with a user + +//@description A user gifted Telegram Stars @sticker A sticker to be shown in the transaction information; may be null if unknown +userTransactionPurposeGiftedStars sticker:sticker = UserTransactionPurpose; + +//@description The current user sold a gift received from another user @gift The gift +userTransactionPurposeGiftSell gift:gift = UserTransactionPurpose; + +//@description The current user sent a gift to another user @gift The gift +userTransactionPurposeGiftSend gift:gift = UserTransactionPurpose; + + //@class StarTransactionPartner @description Describes source or recipient of a transaction with Telegram Stars //@description The transaction is a transaction with Telegram through a bot @@ -968,10 +1018,8 @@ starTransactionPartnerBusiness user_id:int53 media:vector = StarTrans //@description The transaction is a transaction with a supergroup or a channel chat @chat_id Identifier of the chat @purpose Purpose of the transaction starTransactionPartnerChat chat_id:int53 purpose:ChatTransactionPurpose = StarTransactionPartner; -//@description The transaction is a gift of Telegram Stars from another user -//@user_id Identifier of the user; 0 if the gift was anonymous -//@sticker A sticker to be shown in the transaction information; may be null if unknown -starTransactionPartnerUser user_id:int53 sticker:sticker = StarTransactionPartner; +//@description The transaction is a transcation with another user @user_id Identifier of the user; 0 if the user was anonymous @purpose Purpose of the transaction +starTransactionPartnerUser user_id:int53 purpose:UserTransactionPurpose = StarTransactionPartner; //@description The transaction is a transaction with unknown partner starTransactionPartnerUnsupported = StarTransactionPartner; @@ -1023,7 +1071,7 @@ giveawayInfoOngoing creation_date:int32 status:GiveawayParticipantStatus is_ende //@creation_date Point in time (Unix timestamp) when the giveaway was created //@actual_winners_selection_date Point in time (Unix timestamp) when the winners were selected. May be bigger than winners selection date specified in parameters of the giveaway //@was_refunded True, if the giveaway was canceled and was fully refunded -//@is_winner True, if the cuurent user is a winner of the giveaway +//@is_winner True, if the current user is a winner of the giveaway //@winner_count Number of winners in the giveaway //@activation_count Number of winners, which activated their gift codes; for Telegram Premium giveaways only //@gift_code Telegram Premium gift code that was received by the current user; empty if the user isn't a winner in the giveaway or the giveaway isn't a Telegram Premium giveaway @@ -1149,10 +1197,11 @@ botInfo short_description:string description:string photo:photo animation:animat //@birthdate Birthdate of the user; may be null if unknown //@personal_chat_id Identifier of the personal chat of the user; 0 if none //@premium_gift_options The list of available options for gifting Telegram Premium to the user +//@gift_count Number of gifts saved to profile by the user //@group_in_common_count Number of group chats where both the other user and the current user are a member; 0 for the current user //@business_info Information about business settings for Telegram Business accounts; may be null if none //@bot_info For bots, information about the bot; may be null if the user isn't a bot -userFullInfo personal_photo:chatPhoto photo:chatPhoto public_photo:chatPhoto block_list:BlockList can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool has_private_forwards:Bool has_restricted_voice_and_video_note_messages:Bool has_posted_to_profile_stories:Bool has_sponsored_messages_enabled:Bool need_phone_number_privacy_exception:Bool set_chat_background:Bool bio:formattedText birthdate:birthdate personal_chat_id:int53 premium_gift_options:vector group_in_common_count:int32 business_info:businessInfo bot_info:botInfo = UserFullInfo; +userFullInfo personal_photo:chatPhoto photo:chatPhoto public_photo:chatPhoto block_list:BlockList can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool has_private_forwards:Bool has_restricted_voice_and_video_note_messages:Bool has_posted_to_profile_stories:Bool has_sponsored_messages_enabled:Bool need_phone_number_privacy_exception:Bool set_chat_background:Bool bio:formattedText birthdate:birthdate personal_chat_id:int53 premium_gift_options:vector gift_count:int32 group_in_common_count:int32 business_info:businessInfo bot_info:botInfo = UserFullInfo; //@description Represents a list of users @total_count Approximate total number of users found @user_ids A list of user identifiers users total_count:int32 user_ids:vector = Users; @@ -1555,7 +1604,7 @@ reactionTypePaid = ReactionType; //@description Contains information about a user that added paid reactions //@sender_id Identifier of the user or chat that added the reactions; may be null for anonymous reactors that aren't the current user //@star_count Number of Telegram Stars added -//@is_top True, if the reactor is one of the most active reactors; can be false if the reactor is the current user +//@is_top True, if the reactor is one of the most active reactors; may be false if the reactor is the current user //@is_me True, if the paid reaction was added by the current user //@is_anonymous True, if the reactor is anonymous paidReactor sender_id:MessageSender star_count:int32 is_top:Bool is_me:Bool is_anonymous:Bool = PaidReactor; @@ -1706,7 +1755,7 @@ factCheck text:formattedText country_code:string = FactCheck; //@is_outgoing True, if the message is outgoing //@is_pinned True, if the message is pinned //@is_from_offline True, if the message was sent because of a scheduled action by the message sender, for example, as away, or greeting service message -//@can_be_saved True, if content of the message can be saved locally or copied +//@can_be_saved True, if content of the message can be saved locally or copied using inputMessageForwarded or forwardMessages with copy options //@has_timestamped_media True, if media timestamp entities refers to a media in this message as opposed to a media in the replied message //@is_channel_post True, if the message is a channel post. All messages to channels are channel posts, all other messages are not channel posts //@is_topic_message True, if the message is a forum topic message @@ -1809,7 +1858,7 @@ messageSponsor url:string photo:photo info:string = MessageSponsor; //@message_id Message identifier; unique for the chat to which the sponsored message belongs among both ordinary and sponsored messages //@is_recommended True, if the message needs to be labeled as "recommended" instead of "sponsored" //@can_be_reported True, if the message can be reported to Telegram moderators through reportChatSponsoredMessage -//@content Content of the message. Currently, can be only of the types messageText, messageAnimation, messagePhoto, or messageVideo +//@content Content of the message. Currently, can be only of the types messageText, messageAnimation, messagePhoto, or messageVideo. Video messages can be viewed fullscreen //@sponsor Information about the sponsor of the message //@title Title of the sponsored message //@button_text Text for the message action button @@ -1821,8 +1870,9 @@ sponsoredMessage message_id:int53 is_recommended:Bool can_be_reported:Bool conte //@description Contains a list of sponsored messages @messages List of sponsored messages @messages_between The minimum number of messages between shown sponsored messages, or 0 if only one sponsored message must be shown after all ordinary messages sponsoredMessages messages:vector messages_between:int32 = SponsoredMessages; -//@description Describes an option to report a sponsored message @id Unique identifier of the option @text Text of the option -reportChatSponsoredMessageOption id:bytes text:string = ReportChatSponsoredMessageOption; + +//@description Describes an option to report an entity to Telegram @id Unique identifier of the option @text Text of the option +reportOption id:bytes text:string = ReportOption; //@class ReportChatSponsoredMessageResult @description Describes result of sponsored message report @@ -1834,7 +1884,7 @@ reportChatSponsoredMessageResultOk = ReportChatSponsoredMessageResult; reportChatSponsoredMessageResultFailed = ReportChatSponsoredMessageResult; //@description The user must choose an option to report the message and repeat request with the chosen option @title Title for the option choice @options List of available options -reportChatSponsoredMessageResultOptionRequired title:string options:vector = ReportChatSponsoredMessageResult; +reportChatSponsoredMessageResultOptionRequired title:string options:vector = ReportChatSponsoredMessageResult; //@description Sponsored messages were hidden for the user in all chats reportChatSponsoredMessageResultAdsHidden = ReportChatSponsoredMessageResult; @@ -2265,6 +2315,9 @@ inlineKeyboardButtonTypeBuy = InlineKeyboardButtonType; //@description A button with a user reference to be handled in the same way as textEntityTypeMentionName entities @user_id User identifier inlineKeyboardButtonTypeUser user_id:int53 = InlineKeyboardButtonType; +//@description A button that copies specified text to clipboard @text The text to copy to clipboard +inlineKeyboardButtonTypeCopyText text:string = InlineKeyboardButtonType; + //@description Represents a single button in an inline keyboard @text Text of the button @type Type of the button inlineKeyboardButton text:string type:InlineKeyboardButtonType = InlineKeyboardButton; @@ -2283,7 +2336,7 @@ replyMarkupForceReply is_personal:Bool input_field_placeholder:string = ReplyMar //@description Contains a custom keyboard layout to quickly reply to bots //@rows A list of rows of bot keyboard buttons -//@is_persistent True, if the keyboard is supposed to always be shown when the ordinary keyboard is hidden +//@is_persistent True, if the keyboard is expected to always be shown when the ordinary keyboard is hidden //@resize_keyboard True, if the application needs to resize the keyboard vertically //@one_time True, if the application needs to hide the keyboard after use //@is_personal True, if the keyboard must automatically be shown to the current user. For outgoing messages, specify true to show the keyboard only for the mentioned users and for the target user of a reply @@ -3412,11 +3465,12 @@ messageSticker sticker:sticker is_premium:Bool = MessageContent; //@description A video message //@video The video description +//@alternative_videos Alternative qualities of the video //@caption Video caption //@show_caption_above_media True, if the caption must be shown above the video; otherwise, the caption must be shown below the video //@has_spoiler True, if the video preview must be covered by a spoiler animation //@is_secret True, if the video thumbnail must be blurred and the video must be shown only while tapped -messageVideo video:video caption:formattedText show_caption_above_media:Bool has_spoiler:Bool is_secret:Bool = MessageContent; +messageVideo video:video alternative_videos:vector caption:formattedText show_caption_above_media:Bool has_spoiler:Bool is_secret:Bool = MessageContent; //@description A video note message @video_note The video note description @is_viewed True, if at least one of the recipients has viewed the video note @is_secret True, if the video note thumbnail must be blurred and the video note must be shown only while tapped messageVideoNote video_note:videoNote is_viewed:Bool is_secret:Bool = MessageContent; @@ -3488,7 +3542,7 @@ messageInvoice product_info:productInfo currency:string total_amount:int53 start //@description A message with information about an ended call @is_video True, if the call was a video call @discard_reason Reason why the call was discarded @duration Call duration, in seconds messageCall is_video:Bool discard_reason:CallDiscardReason duration:int32 = MessageContent; -//@description A new video chat was scheduled @group_call_id Identifier of the video chat. The video chat can be received through the method getGroupCall @start_date Point in time (Unix timestamp) when the group call is supposed to be started by an administrator +//@description A new video chat was scheduled @group_call_id Identifier of the video chat. The video chat can be received through the method getGroupCall @start_date Point in time (Unix timestamp) when the group call is expected to be started by an administrator messageVideoChatScheduled group_call_id:int32 start_date:int32 = MessageContent; //@description A newly created video chat @group_call_id Identifier of the video chat. The video chat can be received through the method getGroupCall @@ -3677,7 +3731,7 @@ messageGiveawayWinners boosted_chat_id:int53 giveaway_message_id:int53 additiona //@sticker A sticker to be shown in the message; may be null if unknown messageGiftedStars gifter_user_id:int53 receiver_user_id:int53 currency:string amount:int53 cryptocurrency:string cryptocurrency_amount:int64 star_count:int53 transaction_id:string sticker:sticker = MessageContent; -//@description A Telegram Stars were received by the cuurent user from a giveaway +//@description A Telegram Stars were received by the current user from a giveaway //@star_count Number of Telegram Stars that were received //@transaction_id Identifier of the transaction for Telegram Stars credit //@boosted_chat_id Identifier of the supergroup or channel chat, which was automatically boosted by the winners of the giveaway @@ -3686,6 +3740,15 @@ messageGiftedStars gifter_user_id:int53 receiver_user_id:int53 currency:string a //@sticker A sticker to be shown in the message; may be null if unknown messageGiveawayPrizeStars star_count:int53 transaction_id:string boosted_chat_id:int53 giveaway_message_id:int53 is_unclaimed:Bool sticker:sticker = MessageContent; +//@description A gift was received or sent by the current user +//@gift The gift +//@text Message added to the gift +//@sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the gift +//@is_private True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone will be able to see them +//@is_saved True, if the gift is displayed on the user's profile page; only for the receiver of the gift +//@was_converted True, if the gift was converted to Telegram Stars; only for the receiver of the gift +messageGift gift:gift text:formattedText sell_star_count:int53 is_private:Bool is_saved:Bool was_converted:Bool = MessageContent; + //@description A contact has registered with Telegram messageContactRegistered = MessageContent; @@ -3800,7 +3863,7 @@ inputPaidMediaTypePhoto = InputPaidMediaType; //@description The media is a video //@duration Duration of the video, in seconds -//@supports_streaming True, if the video is supposed to be streamed +//@supports_streaming True, if the video is expected to be streamed inputPaidMediaTypeVideo duration:int32 supports_streaming:Bool = InputPaidMediaType; @@ -3847,7 +3910,7 @@ messageSendOptions disable_notification:Bool from_background:Bool protect_conten //@send_copy True, if content of the message needs to be copied without reference to the original sender. Always true if the message is forwarded to a secret chat or is local //@replace_caption True, if media caption of the message copy needs to be replaced. Ignored if send_copy is false //@new_caption New message caption; pass null to copy message without caption. Ignored if replace_caption is false -//@new_show_caption_above_media True, if new caption must be shown above the animation; otherwise, new caption must be shown below the animation; not supported in secret chats. Ignored if replace_caption is false +//@new_show_caption_above_media True, if new caption must be shown above the media; otherwise, new caption must be shown below the media; not supported in secret chats. Ignored if replace_caption is false messageCopyOptions send_copy:Bool replace_caption:Bool new_caption:formattedText new_show_caption_above_media:Bool = MessageCopyOptions; @@ -3892,7 +3955,7 @@ inputMessageDocument document:InputFile thumbnail:inputThumbnail disable_content //@star_count The number of Telegram Stars that must be paid to see the media; 1-getOption("paid_media_message_star_count_max") //@paid_media The content of the paid media //@caption Message caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters -//@show_caption_above_media True, if the caption must be shown above the video; otherwise, the caption must be shown below the video; not supported in secret chats +//@show_caption_above_media True, if the caption must be shown above the media; otherwise, the caption must be shown below the media; not supported in secret chats //@payload Bot-provided data for the paid media; bots only inputMessagePaidMedia star_count:int53 paid_media:vector caption:formattedText show_caption_above_media:Bool payload:string = InputMessageContent; @@ -3917,13 +3980,13 @@ inputMessagePhoto photo:InputFile thumbnail:inputThumbnail added_sticker_file_id inputMessageSticker sticker:InputFile thumbnail:inputThumbnail width:int32 height:int32 emoji:string = InputMessageContent; //@description A video message -//@video Video to be sent +//@video Video to be sent. The video is expected to be reencoded to MPEG4 format with H.264 codec by the sender //@thumbnail Video thumbnail; pass null to skip thumbnail uploading //@added_sticker_file_ids File identifiers of the stickers added to the video, if applicable //@duration Duration of the video, in seconds //@width Video width //@height Video height -//@supports_streaming True, if the video is supposed to be streamed +//@supports_streaming True, if the video is expected to be streamed //@caption Video caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters //@show_caption_above_media True, if the caption must be shown above the video; otherwise, the caption must be shown below the video; not supported in secret chats //@self_destruct_type Video self-destruct type; pass null if none; private chats only @@ -4354,7 +4417,7 @@ inputStoryAreas areas:vector = InputStoryAreas; //@is_animation True, if the video has no sound //@minithumbnail Video minithumbnail; may be null //@thumbnail Video thumbnail in JPEG or MPEG4 format; may be null -//@preload_prefix_size Size of file prefix, which is supposed to be preloaded, in bytes +//@preload_prefix_size Size of file prefix, which is expected to be preloaded, in bytes //@cover_frame_timestamp Timestamp of the frame used as video thumbnail //@video File containing the video storyVideo duration:double width:int32 height:int32 has_stickers:Bool is_animation:Bool minithumbnail:minithumbnail thumbnail:thumbnail preload_prefix_size:int32 cover_frame_timestamp:double video:file = StoryVideo; @@ -4365,7 +4428,7 @@ storyVideo duration:double width:int32 height:int32 has_stickers:Bool is_animati //@description A photo story @photo The photo storyContentPhoto photo:photo = StoryContent; -//@description A video story @video The video in MPEG4 format @alternative_video Alternative version of the video in MPEG4 format, encoded by x264 codec; may be null +//@description A video story @video The video in MPEG4 format @alternative_video Alternative version of the video in MPEG4 format, encoded with H.264 codec; may be null storyContentVideo video:storyVideo alternative_video:storyVideo = StoryContent; //@description A story content that is not supported in the current TDLib version @@ -4380,7 +4443,7 @@ storyContentUnsupported = StoryContent; inputStoryContentPhoto photo:InputFile added_sticker_file_ids:vector = InputStoryContent; //@description A video story -//@video Video to be sent. The video size must be 720x1280. The video must be streamable and stored in MPEG4 format, after encoding with x265 codec and key frames added each second +//@video Video to be sent. The video size must be 720x1280. The video must be streamable and stored in MPEG4 format, after encoding with H.265 codec and key frames added each second //@added_sticker_file_ids File identifiers of the stickers added to the video, if applicable //@duration Precise duration of the video, in seconds; 0-60 //@cover_frame_timestamp Timestamp of the frame, which will be used as video thumbnail @@ -4780,7 +4843,7 @@ groupCallRecentSpeaker participant_id:MessageSender is_speaking:Bool = GroupCall //@description Describes a group call //@id Group call identifier //@title Group call title -//@scheduled_start_date Point in time (Unix timestamp) when the group call is supposed to be started by an administrator; 0 if it is already active or was ended +//@scheduled_start_date Point in time (Unix timestamp) when the group call is expected to be started by an administrator; 0 if it is already active or was ended //@enabled_start_notification True, if the group call is scheduled and the current user will receive a notification when the group call starts //@is_active True, if the call is active //@is_rtmp_stream True, if the chat is an RTMP stream instead of an ordinary video chat @@ -6137,6 +6200,9 @@ pushMessageContentPremiumGiftCode month_count:int32 = PushMessageContent; //@is_pinned True, if the message is a pinned message with the specified content pushMessageContentGiveaway winner_count:int32 prize:GiveawayPrize is_pinned:Bool = PushMessageContent; +//@description A message with a gift @star_count Number of Telegram Stars that sender paid for the gift +pushMessageContentGift star_count:int53 = PushMessageContent; + //@description A screenshot of a message in the chat has been taken pushMessageContentScreenshotTaken = PushMessageContent; @@ -6567,6 +6633,33 @@ reportReasonPersonalDetails = ReportReason; reportReasonCustom = ReportReason; +//@class ReportChatResult @description Describes result of chat report + +//@description The chat was reported successfully +reportChatResultOk = ReportChatResult; + +//@description The user must choose an option to report the chat and repeat request with the chosen option @title Title for the option choice @options List of available options +reportChatResultOptionRequired title:string options:vector = ReportChatResult; + +//@description The user must add additional text details to the report @option_id Option identifier for the next reportChat request @is_optional True, if the user can skip text adding +reportChatResultTextRequired option_id:bytes is_optional:Bool = ReportChatResult; + +//@description The user must choose messages to report and repeat the reportChat request with the chosen messages +reportChatResultMessagesRequired = ReportChatResult; + + +//@class ReportStoryResult @description Describes result of story report + +//@description The story was reported successfully +reportStoryResultOk = ReportStoryResult; + +//@description The user must choose an option to report the story and repeat request with the chosen option @title Title for the option choice @options List of available options +reportStoryResultOptionRequired title:string options:vector = ReportStoryResult; + +//@description The user must add additional text details to the report @option_id Option identifier for the next reportStory request @is_optional True, if the user can skip text adding +reportStoryResultTextRequired option_id:bytes is_optional:Bool = ReportStoryResult; + + //@class TargetChat @description Describes the target chat to be opened //@description The currently opened chat needs to be kept @@ -6606,7 +6699,7 @@ internalLinkTypeAuthenticationCode code:string = InternalLinkType; //@background_name Name of the background internalLinkTypeBackground background_name:string = InternalLinkType; -//@description The link is a link to a Telegram bot, which is supposed to be added to a channel chat as an administrator. Call searchPublicChat with the given bot username and check that the user is a bot, +//@description The link is a link to a Telegram bot, which is expected to be added to a channel chat as an administrator. Call searchPublicChat with the given bot username and check that the user is a bot, //-ask the current user to select a channel chat to add the bot to as an administrator. Then, call getChatMember to receive the current bot rights in the chat and if the bot already is an administrator, //-check that the current user can edit its administrator rights and combine received rights with the requested administrator rights. Then, show confirmation box to the user, and call setChatMemberStatus with the chosen chat and confirmed rights //@bot_username Username of the bot @@ -6620,7 +6713,7 @@ internalLinkTypeBotAddToChannel bot_username:string administrator_rights:chatAdm //@autostart True, if sendBotStartMessage must be called automatically without showing the START button internalLinkTypeBotStart bot_username:string start_parameter:string autostart:Bool = InternalLinkType; -//@description The link is a link to a Telegram bot, which is supposed to be added to a group chat. Call searchPublicChat with the given bot username, check that the user is a bot and can be added to groups, +//@description The link is a link to a Telegram bot, which is expected to be added to a group chat. Call searchPublicChat with the given bot username, check that the user is a bot and can be added to groups, //-ask the current user to select a basic group or a supergroup chat to add the bot to, taking into account that bots can be added to a public supergroup only by administrators of the supergroup. //-If administrator rights are provided by the link, call getChatMember to receive the current bot rights in the chat and if the bot already is an administrator, //-check that the current user can edit its administrator rights, combine received rights with the requested administrator rights, show confirmation box to the user, @@ -6996,9 +7089,9 @@ networkStatistics since_date:int32 entries:vector = Netw autoDownloadSettings is_auto_download_enabled:Bool max_photo_file_size:int32 max_video_file_size:int53 max_other_file_size:int53 video_upload_bitrate:int32 preload_large_videos:Bool preload_next_audio:Bool preload_stories:Bool use_less_data_for_calls:Bool = AutoDownloadSettings; //@description Contains auto-download settings presets for the current user -//@low Preset with lowest settings; supposed to be used by default when roaming -//@medium Preset with medium settings; supposed to be used by default when using mobile data -//@high Preset with highest settings; supposed to be used by default when connected on Wi-Fi +//@low Preset with lowest settings; expected to be used by default when roaming +//@medium Preset with medium settings; expected to be used by default when using mobile data +//@high Preset with highest settings; expected to be used by default when connected on Wi-Fi autoDownloadSettingsPresets low:autoDownloadSettings medium:autoDownloadSettings high:autoDownloadSettings = AutoDownloadSettingsPresets; @@ -7047,7 +7140,7 @@ connectionStateConnectingToProxy = ConnectionState; //@description Establishing a connection to the Telegram servers connectionStateConnecting = ConnectionState; -//@description Downloading data supposed to be received while the application was offline +//@description Downloading data expected to be received while the application was offline connectionStateUpdating = ConnectionState; //@description There is a working connection to the Telegram servers @@ -7508,7 +7601,7 @@ updateMessageUnreadReactions chat_id:int53 message_id:int53 unread_reactions:vec //@fact_check The new fact-check updateMessageFactCheck chat_id:int53 message_id:int53 fact_check:factCheck = Update; -//@description A message with a live location was viewed. When the update is received, the application is supposed to update the live location +//@description A message with a live location was viewed. When the update is received, the application is expected to update the live location //@chat_id Identifier of the chat with the live location message //@message_id Identifier of the message with live location updateMessageLiveLocationViewed chat_id:int53 message_id:int53 = Update; @@ -7740,11 +7833,13 @@ updateServiceNotification type:string content:MessageContent = Update; //@description Information about a file was updated @file New data about the file updateFile file:file = Update; -//@description The file generation process needs to be started by the application +//@description The file generation process needs to be started by the application. Use setFileGenerationProgress and finishFileGeneration to generate the file //@generation_id Unique identifier for the generation process -//@original_path The path to a file from which a new file is generated; may be empty -//@destination_path The path to a file that must be created and where the new file is generated -//@conversion String specifying the conversion applied to the original file. If conversion is "#url#" than original_path contains an HTTP/HTTPS URL of a file, which must be downloaded by the application +//@original_path The original path specified by the application in inputFileGenerated +//@destination_path The path to a file that must be created and where the new file must be generated by the application. +//-If the application has no access to the path, it can use writeGeneratedFilePart to generate the file +//@conversion If the conversion is "#url#" than original_path contains an HTTP/HTTPS URL of a file that must be downloaded by the application. +//-Otherwise, this is the conversion specified by the application in inputFileGenerated updateFileGenerationStart generation_id:int64 original_path:string destination_path:string conversion:string = Update; //@description File generation is no longer needed @generation_id Unique identifier for the generation process @@ -8342,20 +8437,25 @@ getSecretChat secret_chat_id:int32 = SecretChat; //@description Returns information about a chat by its identifier; this is an offline request if the current user is not a bot @chat_id Chat identifier getChat chat_id:int53 = Chat; -//@description Returns information about a message @chat_id Identifier of the chat the message belongs to @message_id Identifier of the message to get +//@description Returns information about a message. Returns a 404 error if the message doesn't exist +//@chat_id Identifier of the chat the message belongs to +//@message_id Identifier of the message to get getMessage chat_id:int53 message_id:int53 = Message; -//@description Returns information about a message, if it is available without sending network request. This is an offline request @chat_id Identifier of the chat the message belongs to @message_id Identifier of the message to get +//@description Returns information about a message, if it is available without sending network request. Returns a 404 error if message isn't available locally. This is an offline request +//@chat_id Identifier of the chat the message belongs to +//@message_id Identifier of the message to get getMessageLocally chat_id:int53 message_id:int53 = Message; //@description Returns information about a non-bundled message that is replied by a given message. Also, returns the pinned message, the game message, the invoice message, //-the message with a previously set same background, the giveaway message, and the topic creation message for messages of the types -//-messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground, messageGiveawayCompleted and topic messages without non-bundled replied message respectively +//-messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground, messageGiveawayCompleted and topic messages without non-bundled replied message respectively. +//-Returns a 404 error if the message doesn't exist //@chat_id Identifier of the chat the message belongs to //@message_id Identifier of the reply message getRepliedMessage chat_id:int53 message_id:int53 = Message; -//@description Returns information about a newest pinned message in the chat @chat_id Identifier of the chat the message belongs to +//@description Returns information about a newest pinned message in the chat. Returns a 404 error if the message doesn't exist @chat_id Identifier of the chat the message belongs to getChatPinnedMessage chat_id:int53 = Message; //@description Returns information about a message with the callback button that originated a callback query; for bots only @chat_id Identifier of the chat the message belongs to @message_id Message identifier @callback_query_id Identifier of the callback query @@ -8415,9 +8515,7 @@ searchChats query:string limit:int32 = Chats; //@description Searches for the specified query in the title and username of already known chats via request to the server. Returns chats in the order seen in the main chat list @query Query to search for @limit The maximum number of chats to be returned searchChatsOnServer query:string limit:int32 = Chats; -//@description Returns a list of users and location-based supergroups nearby. The list of users nearby will be updated for 60 seconds after the request by the updates updateUsersNearby. -//-The request must be sent again every 25 seconds with adjusted location to not miss new chats -//@location Current user location +//@description Returns a list of users and location-based supergroups nearby. The method was disabled and returns an empty list of chats now @location Current user location searchChatsNearby location:location = ChatsNearby; //@description Returns a list of channel chats recommended to the current user @@ -8650,7 +8748,9 @@ deleteAllCallMessages revoke:Bool = Ok; //@description Returns information about the recent locations of chat members that were sent to the chat. Returns up to 1 location message per user @chat_id Chat identifier @limit The maximum number of messages to be returned searchChatRecentLocationMessages chat_id:int53 limit:int32 = Messages; -//@description Returns the last message sent in a chat no later than the specified date @chat_id Chat identifier @date Point in time (Unix timestamp) relative to which to search for messages +//@description Returns the last message sent in a chat no later than the specified date. Returns a 404 error if such message doesn't exist +//@chat_id Chat identifier +//@date Point in time (Unix timestamp) relative to which to search for messages getChatMessageByDate chat_id:int53 date:int32 = Message; //@description Returns sparse positions of messages of the specified type in the chat to be used for shared media scroll implementation. Returns the results in reverse chronological order (i.e., in order of decreasing message_id). @@ -8690,10 +8790,12 @@ getChatScheduledMessages chat_id:int53 = Messages; //@description Returns sponsored messages to be shown in a chat; for channel chats only @chat_id Identifier of the chat getChatSponsoredMessages chat_id:int53 = SponsoredMessages; -//@description Informs TDLib that the user opened the sponsored chat via the button, the name, the photo, or a mention in the sponsored message +//@description Informs TDLib that the user opened the sponsored chat via the button, the name, the chat photo, a mention in the sponsored message text, or the media in the sponsored message //@chat_id Chat identifier of the sponsored message //@message_id Identifier of the sponsored message -clickChatSponsoredMessage chat_id:int53 message_id:int53 = Ok; +//@is_media_click Pass true if the media was clicked in the sponsored message +//@from_fullscreen Pass true if the user expanded the video from the sponsored message fullscreen before the click +clickChatSponsoredMessage chat_id:int53 message_id:int53 is_media_click:Bool from_fullscreen:Bool = Ok; //@description Reports a sponsored message to Telegram moderators //@chat_id Chat identifier of the sponsored message @@ -8880,7 +8982,7 @@ editMessageMedia chat_id:int53 message_id:int53 reply_markup:ReplyMarkup input_m //@message_id Identifier of the message. Use messageProperties.can_be_edited to check whether the message can be edited //@reply_markup The new message reply markup; pass null if none; for bots only //@caption New message content caption; 0-getOption("message_caption_length_max") characters; pass null to remove caption -//@show_caption_above_media Pass true to show the caption above the media; otherwise, the caption will be shown below the media. Can be true only for animation, photo, and video messages +//@show_caption_above_media Pass true to show the caption above the media; otherwise, the caption will be shown below the media. May be true only for animation, photo, and video messages editMessageCaption chat_id:int53 message_id:int53 reply_markup:ReplyMarkup caption:formattedText show_caption_above_media:Bool = Message; //@description Edits the message reply markup; for bots only. Returns the edited message after the edit is completed on the server side @@ -8915,7 +9017,7 @@ editInlineMessageMedia inline_message_id:string reply_markup:ReplyMarkup input_m //@inline_message_id Inline message identifier //@reply_markup The new message reply markup; pass null if none //@caption New message content caption; pass null to remove caption; 0-getOption("message_caption_length_max") characters -//@show_caption_above_media Pass true to show the caption above the media; otherwise, the caption will be shown below the media. Can be true only for animation, photo, and video messages +//@show_caption_above_media Pass true to show the caption above the media; otherwise, the caption will be shown below the media. May be true only for animation, photo, and video messages editInlineMessageCaption inline_message_id:string reply_markup:ReplyMarkup caption:formattedText show_caption_above_media:Bool = Ok; //@description Edits the reply markup of an inline message sent via a bot; for bots only @@ -8992,7 +9094,7 @@ editBusinessMessageMedia business_connection_id:string chat_id:int53 message_id: //@message_id Identifier of the message //@reply_markup The new message reply markup; pass null if none //@caption New message content caption; pass null to remove caption; 0-getOption("message_caption_length_max") characters -//@show_caption_above_media Pass true to show the caption above the media; otherwise, the caption will be shown below the media. Can be true only for animation, photo, and video messages +//@show_caption_above_media Pass true to show the caption above the media; otherwise, the caption will be shown below the media. May be true only for animation, photo, and video messages editBusinessMessageCaption business_connection_id:string chat_id:int53 message_id:int53 reply_markup:ReplyMarkup caption:formattedText show_caption_above_media:Bool = BusinessMessage; //@description Edits the reply markup of a message sent on behalf of a business account; for bots only @@ -9251,7 +9353,7 @@ getFileMimeType file_name:string = Text; //@description Returns the extension of a file, guessed by its MIME type. Returns an empty string on failure. Can be called synchronously @mime_type The MIME type of the file getFileExtension mime_type:string = Text; -//@description Removes potentially dangerous characters from the name of a file. The encoding of the file name is supposed to be UTF-8. Returns an empty string on failure. Can be called synchronously @file_name File name or path to the file +//@description Removes potentially dangerous characters from the name of a file. Returns an empty string on failure. Can be called synchronously @file_name File name or path to the file cleanFileName file_name:string = Text; //@description Returns a string stored in the local database from the specified localization target and language pack by its key. Returns a 404 error if the string is not found. Can be called synchronously @@ -10010,9 +10112,9 @@ getChatStoryInteractions story_sender_chat_id:int53 story_id:int32 reaction_type //@description Reports a story to the Telegram moderators //@story_sender_chat_id The identifier of the sender of the story to report //@story_id The identifier of the story to report -//@reason The reason for reporting the story -//@text Additional report details; 0-1024 characters -reportStory story_sender_chat_id:int53 story_id:int32 reason:ReportReason text:string = Ok; +//@option_id Option identifier chosen by the user; leave empty for the initial request +//@text Additional report details; 0-1024 characters; leave empty for the initial request +reportStory story_sender_chat_id:int53 story_id:int32 option_id:bytes text:string = ReportStoryResult; //@description Activates stealth mode for stories, which hides all views of stories from the current user in the last "story_stealth_mode_past_period" seconds //-and for the next "story_stealth_mode_future_period" seconds; for Telegram Premium users only @@ -10113,7 +10215,7 @@ getFileDownloadedPrefixSize file_id:int32 offset:int53 = FileDownloadedPrefixSiz //@description Stops the downloading of a file. If a file has already been downloaded, does nothing @file_id Identifier of a file to stop downloading @only_if_pending Pass true to stop downloading only if it hasn't been started, i.e. request hasn't been sent to server cancelDownloadFile file_id:int32 only_if_pending:Bool = Ok; -//@description Returns suggested name for saving a file in a given directory @file_id Identifier of the file @directory Directory in which the file is supposed to be saved +//@description Returns suggested name for saving a file in a given directory @file_id Identifier of the file @directory Directory in which the file is expected to be saved getSuggestedFileName file_id:int32 directory:string = Text; //@description Preliminary uploads a file to the cloud before sending it in a message, which can be useful for uploading of being recorded voice and video notes. @@ -10124,7 +10226,7 @@ getSuggestedFileName file_id:int32 directory:string = Text; //@priority Priority of the upload (1-32). The higher the priority, the earlier the file will be uploaded. If the priorities of two files are equal, then the first one for which preliminaryUploadFile was called will be uploaded first preliminaryUploadFile file:InputFile file_type:FileType priority:int32 = File; -//@description Stops the preliminary uploading of a file. Supported only for files uploaded by using preliminaryUploadFile. For other files the behavior is undefined @file_id Identifier of the file to stop uploading +//@description Stops the preliminary uploading of a file. Supported only for files uploaded by using preliminaryUploadFile @file_id Identifier of the file to stop uploading cancelPreliminaryUploadFile file_id:int32 = Ok; //@description Writes a part of a generated file. This method is intended to be used only if the application has no direct access to TDLib's file system, because it is usually slower than a direct write to the destination file @@ -10346,7 +10448,7 @@ setVideoChatDefaultParticipant chat_id:int53 default_participant_id:MessageSende //@description Creates a video chat (a group call bound to a chat). Available only for basic groups, supergroups and channels; requires can_manage_video_chats administrator right //@chat_id Identifier of a chat in which the video chat will be created //@title Group call title; if empty, chat title will be used -//@start_date Point in time (Unix timestamp) when the group call is supposed to be started by an administrator; 0 to start the video chat immediately. The date must be at least 10 seconds and at most 8 days in the future +//@start_date Point in time (Unix timestamp) when the group call is expected to be started by an administrator; 0 to start the video chat immediately. The date must be at least 10 seconds and at most 8 days in the future //@is_rtmp_stream Pass true to create an RTMP stream instead of an ordinary video chat; requires owner privileges createVideoChat chat_id:int53 title:string start_date:int32 is_rtmp_stream:Bool = GroupCallId; @@ -11078,7 +11180,7 @@ toggleSupergroupIsBroadcastGroup supergroup_id:int53 = Ok; //@description Reports messages in a supergroup as spam; requires administrator rights in the supergroup //@supergroup_id Supergroup identifier -//@message_ids Identifiers of messages to report. Use messageProperties.can_be_reported to check whether the message can be reported +//@message_ids Identifiers of messages to report. Use messageProperties.can_report_supergroup_spam to check whether the message can be reported reportSupergroupSpam supergroup_id:int53 message_ids:vector = Ok; //@description Reports a false deletion of a message by aggressive anti-spam checks; requires administrator rights in the supergroup. Can be called only for messages from chatEventMessageDeleted with can_report_anti_spam_false_positive == true @@ -11145,10 +11247,38 @@ deleteSavedOrderInfo = Ok; deleteSavedCredentials = Ok; +//@description Returns gifts that can be sent to other users +getAvailableGifts = Gifts; + +//@description Send a gift to another user +//@gift_id Identifier of the gift to send +//@user_id Identifier of the user that will receive the gift +//@text Text to show along with the gift; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed +//@is_private Pass true to show the current user as sender and gift text only to the gift receiver; otherwise, everyone will be able to see them +sendGift gift_id:int64 user_id:int53 text:formattedText is_private:Bool = Ok; + +//@description Sells a gift received by the current user for Telegram Stars +//@sender_user_id Identifier of the user that sent the gift +//@message_id Identifier of the message with the gift in the chat with the user +sellGift sender_user_id:int53 message_id:int53 = Ok; + +//@description Toggles whether a gift is shown on the current user's profile page +//@sender_user_id Identifier of the user that sent the gift +//@message_id Identifier of the message with the gift in the chat with the user +//@is_saved Pass true to display the gift on the user's profile page; pass false to remove it from the profile page +toggleGiftIsSaved sender_user_id:int53 message_id:int53 is_saved:Bool = Ok; + +//@description Returns gifts saved to profile by the given user +//@user_id Identifier of the user +//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results +//@limit The maximum number of gifts to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned objects is chosen by TDLib and can be smaller than the specified limit +getUserGifts user_id:int53 offset:string limit:int32 = UserGifts; + + //@description Creates a link for the given invoice; for bots only @invoice Information about the invoice of the type inputMessageInvoice createInvoiceLink invoice:InputMessageContent = HttpUrl; -//@description Refunds a previously done payment in Telegram Stars +//@description Refunds a previously done payment in Telegram Stars; for bots only //@user_id Identifier of the user that did the payment //@telegram_payment_charge_id Telegram payment identifier refundStarPayment user_id:int53 telegram_payment_charge_id:string = Ok; @@ -11294,10 +11424,10 @@ removeChatActionBar chat_id:int53 = Ok; //@description Reports a chat to the Telegram moderators. A chat can be reported only from the chat action bar, or if chat.can_be_reported //@chat_id Chat identifier -//@message_ids Identifiers of reported messages; may be empty to report the whole chat. Use messageProperties.can_be_reported to check whether the message can be reported -//@reason The reason for reporting the chat -//@text Additional report details; 0-1024 characters -reportChat chat_id:int53 message_ids:vector reason:ReportReason text:string = Ok; +//@option_id Option identifier chosen by the user; leave empty for the initial request +//@message_ids Identifiers of reported messages. Use messageProperties.can_report_chat to check whether the message can be reported +//@text Additional report details if asked by the server; 0-1024 characters; leave empty for the initial request +reportChat chat_id:int53 option_id:bytes message_ids:vector text:string = ReportChatResult; //@description Reports a chat photo to the Telegram moderators. A chat photo can be reported only if chat.can_be_reported //@chat_id Chat identifier @@ -11578,6 +11708,9 @@ getPremiumFeatures source:PremiumSource = PremiumFeatures; //@description Returns examples of premium stickers for demonstration purposes getPremiumStickerExamples = Stickers; +//@description Returns the sticker to be used as representation of the Telegram Premium subscription @month_count Number of months the Telegram Premium subscription will be active +getPremiumInfoSticker month_count:int32 = Sticker; + //@description Informs TDLib that the user viewed detailed information about a Premium feature on the Premium features screen @feature The viewed premium feature viewPremiumFeature feature:PremiumFeature = Ok; From 4330cb2fa104fef541892e63b70d48fd58e1f653 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Fri, 1 Nov 2024 06:19:36 +0800 Subject: [PATCH 27/54] Update to TDLib 1.8.39 --- client/function.go | 90 +++-------- client/type.go | 344 +++++++++++++++++++----------------------- client/unmarshaler.go | 106 ++++++------- data/td_api.tl | 202 +++++++++++++------------ 4 files changed, 325 insertions(+), 417 deletions(-) diff --git a/client/function.go b/client/function.go index ca360f0..087d17c 100755 --- a/client/function.go +++ b/client/function.go @@ -1828,32 +1828,6 @@ func (client *Client) SearchChatsOnServer(req *SearchChatsOnServerRequest) (*Cha return UnmarshalChats(result.Data) } -type SearchChatsNearbyRequest struct { - // Current user location - Location *Location `json:"location"` -} - -// Returns a list of users and location-based supergroups nearby. The method was disabled and returns an empty list of chats now -func (client *Client) SearchChatsNearby(req *SearchChatsNearbyRequest) (*ChatsNearby, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "searchChatsNearby", - }, - Data: map[string]interface{}{ - "location": req.Location, - }, - }) - if err != nil { - return nil, err - } - - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } - - return UnmarshalChatsNearby(result.Data) -} - // Returns a list of channel chats recommended to the current user func (client *Client) GetRecommendedChats() (*Chats, error) { result, err := client.Send(Request{ @@ -2939,6 +2913,8 @@ func (client *Client) SearchPublicMessagesByTag(req *SearchPublicMessagesByTagRe } type SearchPublicStoriesByTagRequest struct { + // Identifier of the chat that posted the stories to search for; pass 0 to search stories in all chats + StorySenderChatId int64 `json:"story_sender_chat_id"` // Hashtag or cashtag to search for Tag string `json:"tag"` // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results @@ -2954,6 +2930,7 @@ func (client *Client) SearchPublicStoriesByTag(req *SearchPublicStoriesByTagRequ Type: "searchPublicStoriesByTag", }, Data: map[string]interface{}{ + "story_sender_chat_id": req.StorySenderChatId, "tag": req.Tag, "offset": req.Offset, "limit": req.Limit, @@ -3379,7 +3356,7 @@ type GetChatSponsoredMessagesRequest struct { ChatId int64 `json:"chat_id"` } -// Returns sponsored messages to be shown in a chat; for channel chats only +// Returns sponsored messages to be shown in a chat; for channel chats and chats with bots only func (client *Client) GetChatSponsoredMessages(req *GetChatSponsoredMessagesRequest) (*SponsoredMessages, error) { result, err := client.Send(Request{ meta: meta{ @@ -3982,7 +3959,7 @@ type ForwardMessagesRequest struct { MessageIds []int64 `json:"message_ids"` // Options to be used to send the messages; pass null to use default options Options *MessageSendOptions `json:"options"` - // Pass true to copy content of the messages without reference to the original sender. Always true if the messages are forwarded to a secret chat or are local + // Pass true to copy content of the messages without reference to the original sender. Always true if the messages are forwarded to a secret chat or are local. Use messageProperties.can_be_saved and messageProperties.can_be_copied_to_secret_chat to check whether the message is suitable SendCopy bool `json:"send_copy"` // Pass true to remove media captions of message copies. Ignored if send_copy is false RemoveCaption bool `json:"remove_caption"` @@ -4321,7 +4298,7 @@ func (client *Client) EditMessageLiveLocation(req *EditMessageLiveLocationReques type EditMessageMediaRequest struct { // The chat the message belongs to ChatId int64 `json:"chat_id"` - // Identifier of the message. Use messageProperties.can_be_edited to check whether the message can be edited + // Identifier of the message. Use messageProperties.can_edit_media to check whether the message can be edited MessageId int64 `json:"message_id"` // The new message reply markup; pass null if none; for bots only ReplyMarkup ReplyMarkup `json:"reply_markup"` @@ -4329,7 +4306,7 @@ type EditMessageMediaRequest struct { InputMessageContent InputMessageContent `json:"input_message_content"` } -// Edits the content of a message with an animation, an audio, a document, a photo or a video, including message caption. If only the caption needs to be edited, use editMessageCaption instead. The media can't be edited if the message was set to self-destruct or to a self-destructing media. The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa. Returns the edited message after the edit is completed on the server side +// Edits the media content of a message, including message caption. If only the caption needs to be edited, use editMessageCaption instead. The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa. Returns the edited message after the edit is completed on the server side func (client *Client) EditMessageMedia(req *EditMessageMediaRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -4505,7 +4482,7 @@ type EditInlineMessageMediaRequest struct { InputMessageContent InputMessageContent `json:"input_message_content"` } -// Edits the content of a message with an animation, an audio, a document, a photo or a video in an inline message sent via a bot; for bots only +// Edits the media content of a message with a text, an animation, an audio, a document, a photo or a video in an inline message sent via a bot; for bots only func (client *Client) EditInlineMessageMedia(req *EditInlineMessageMediaRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -4597,7 +4574,7 @@ type EditMessageSchedulingStateRequest struct { ChatId int64 `json:"chat_id"` // Identifier of the message. Use messageProperties.can_edit_scheduling_state to check whether the message is suitable MessageId int64 `json:"message_id"` - // The new message scheduling state; pass null to send the message immediately + // The new message scheduling state; pass null to send the message immediately. Must be null for messages in the state messageSchedulingStateSendWhenVideoProcessed SchedulingState MessageSchedulingState `json:"scheduling_state"` } @@ -4845,7 +4822,7 @@ type EditBusinessMessageMediaRequest struct { InputMessageContent InputMessageContent `json:"input_message_content"` } -// Edits the content of a message with an animation, an audio, a document, a photo or a video in a message sent on behalf of a business account; for bots only +// Edits the media content of a message with a text, an animation, an audio, a document, a photo or a video in a message sent on behalf of a business account; for bots only func (client *Client) EditBusinessMessageMedia(req *EditBusinessMessageMediaRequest) (*BusinessMessage, error) { result, err := client.Send(Request{ meta: meta{ @@ -5342,7 +5319,7 @@ type EditQuickReplyMessageRequest struct { InputMessageContent InputMessageContent `json:"input_message_content"` } -// Asynchronously edits the text, media or caption of a quick reply message. Use quickReplyMessage.can_be_edited to check whether a message can be edited. Text message can be edited only to a text message. The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa +// Asynchronously edits the text, media or caption of a quick reply message. Use quickReplyMessage.can_be_edited to check whether a message can be edited. Media message can be edited only to a media message. The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa func (client *Client) EditQuickReplyMessage(req *EditQuickReplyMessageRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -6035,7 +6012,7 @@ type SetMessageReactionsRequest struct { ChatId int64 `json:"chat_id"` // Identifier of the message MessageId int64 `json:"message_id"` - // Types of the reaction to set + // Types of the reaction to set; pass an empty list to remove the reactions ReactionTypes []ReactionType `json:"reaction_types"` // Pass true if the reactions are added with a big animation IsBig bool `json:"is_big"` @@ -14932,6 +14909,8 @@ func (client *Client) GetStickerSetName(req *GetStickerSetNameRequest) (*Text, e type SearchStickerSetRequest struct { // Name of the sticker set Name string `json:"name"` + // Pass true to ignore local cache of sticker sets and always send a network request + IgnoreCache bool `json:"ignore_cache"` } // Searches for a sticker set by its name @@ -14942,6 +14921,7 @@ func (client *Client) SearchStickerSet(req *SearchStickerSetRequest) (*StickerSe }, Data: map[string]interface{}{ "name": req.Name, + "ignore_cache": req.IgnoreCache, }, }) if err != nil { @@ -16059,32 +16039,6 @@ func (client *Client) SetEmojiStatus(req *SetEmojiStatusRequest) (*Ok, error) { return UnmarshalOk(result.Data) } -type SetLocationRequest struct { - // The new location of the user - Location *Location `json:"location"` -} - -// Changes the location of the current user. Needs to be called if getOption("is_location_visible") is true and location changes for more than 1 kilometer. Must not be called if the user has a business location -func (client *Client) SetLocation(req *SetLocationRequest) (*Ok, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "setLocation", - }, - Data: map[string]interface{}{ - "location": req.Location, - }, - }) - if err != nil { - return nil, err - } - - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } - - return UnmarshalOk(result.Data) -} - type ToggleHasSponsoredMessagesEnabledRequest struct { // Pass true to enable sponsored messages for the current user; false to disable them HasSponsoredMessagesEnabled bool `json:"has_sponsored_messages_enabled"` @@ -18513,7 +18467,7 @@ type SendGiftRequest struct { IsPrivate bool `json:"is_private"` } -// Send a gift to another user +// Sends a gift to another user. May return an error with a message "STARGIFT_USAGE_LIMITED" if the gift was sold out func (client *Client) SendGift(req *SendGiftRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -19773,7 +19727,7 @@ type GetChatRevenueStatisticsRequest struct { IsDark bool `json:"is_dark"` } -// Returns detailed revenue statistics about a chat. Currently, this method can be used only for channels if supergroupFullInfo.can_get_revenue_statistics == true +// Returns detailed revenue statistics about a chat. Currently, this method can be used only for channels if supergroupFullInfo.can_get_revenue_statistics == true or bots if userFullInfo.bot_info.can_get_revenue_statistics == true func (client *Client) GetChatRevenueStatistics(req *GetChatRevenueStatisticsRequest) (*ChatRevenueStatistics, error) { result, err := client.Send(Request{ meta: meta{ @@ -19802,7 +19756,7 @@ type GetChatRevenueWithdrawalUrlRequest struct { Password string `json:"password"` } -// Returns a URL for chat revenue withdrawal; requires owner privileges in the chat. Currently, this method can be used only for channels if supergroupFullInfo.can_get_revenue_statistics == true and getOption("can_withdraw_chat_revenue") +// Returns a URL for chat revenue withdrawal; requires owner privileges in the channel chat or the bot. Currently, this method can be used only if getOption("can_withdraw_chat_revenue") for channels with supergroupFullInfo.can_get_revenue_statistics == true or bots with userFullInfo.bot_info.can_get_revenue_statistics == true func (client *Client) GetChatRevenueWithdrawalUrl(req *GetChatRevenueWithdrawalUrlRequest) (*HttpUrl, error) { result, err := client.Send(Request{ meta: meta{ @@ -19833,7 +19787,7 @@ type GetChatRevenueTransactionsRequest struct { Limit int32 `json:"limit"` } -// Returns the list of revenue transactions for a chat. Currently, this method can be used only for channels if supergroupFullInfo.can_get_revenue_statistics == true +// Returns the list of revenue transactions for a chat. Currently, this method can be used only for channels if supergroupFullInfo.can_get_revenue_statistics == true or bots if userFullInfo.bot_info.can_get_revenue_statistics == true func (client *Client) GetChatRevenueTransactions(req *GetChatRevenueTransactionsRequest) (*ChatRevenueTransactions, error) { result, err := client.Send(Request{ meta: meta{ @@ -23331,6 +23285,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateMessageLiveLocationViewed: return UnmarshalUpdateMessageLiveLocationViewed(result.Data) + case TypeUpdateVideoPublished: + return UnmarshalUpdateVideoPublished(result.Data) + case TypeUpdateNewChat: return UnmarshalUpdateNewChat(result.Data) @@ -23619,9 +23576,6 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateTermsOfService: return UnmarshalUpdateTermsOfService(result.Data) - case TypeUpdateUsersNearby: - return UnmarshalUpdateUsersNearby(result.Data) - case TypeUpdateUnconfirmedSession: return UnmarshalUpdateUnconfirmedSession(result.Data) diff --git a/client/type.go b/client/type.go index 0305533..348df90 100755 --- a/client/type.go +++ b/client/type.go @@ -344,8 +344,6 @@ const ( ClassFailedToAddMember = "FailedToAddMember" ClassFailedToAddMembers = "FailedToAddMembers" ClassCreatedBasicGroupChat = "CreatedBasicGroupChat" - ClassChatNearby = "ChatNearby" - ClassChatsNearby = "ChatsNearby" ClassKeyboardButton = "KeyboardButton" ClassInlineKeyboardButton = "InlineKeyboardButton" ClassFoundWebApp = "FoundWebApp" @@ -741,6 +739,7 @@ const ( TypeStarTransactionPartnerGooglePlay = "starTransactionPartnerGooglePlay" TypeStarTransactionPartnerFragment = "starTransactionPartnerFragment" TypeStarTransactionPartnerTelegramAds = "starTransactionPartnerTelegramAds" + TypeStarTransactionPartnerTelegramApi = "starTransactionPartnerTelegramApi" TypeStarTransactionPartnerBot = "starTransactionPartnerBot" TypeStarTransactionPartnerBusiness = "starTransactionPartnerBusiness" TypeStarTransactionPartnerChat = "starTransactionPartnerChat" @@ -929,12 +928,9 @@ const ( TypeFailedToAddMember = "failedToAddMember" TypeFailedToAddMembers = "failedToAddMembers" TypeCreatedBasicGroupChat = "createdBasicGroupChat" - TypeChatNearby = "chatNearby" - TypeChatsNearby = "chatsNearby" TypePublicChatTypeHasUsername = "publicChatTypeHasUsername" TypePublicChatTypeIsLocationBased = "publicChatTypeIsLocationBased" TypeChatActionBarReportSpam = "chatActionBarReportSpam" - TypeChatActionBarReportUnrelatedLocation = "chatActionBarReportUnrelatedLocation" TypeChatActionBarInviteMembers = "chatActionBarInviteMembers" TypeChatActionBarReportAddBlock = "chatActionBarReportAddBlock" TypeChatActionBarAddContact = "chatActionBarAddContact" @@ -1287,6 +1283,7 @@ const ( TypeInputPaidMedia = "inputPaidMedia" TypeMessageSchedulingStateSendAtDate = "messageSchedulingStateSendAtDate" TypeMessageSchedulingStateSendWhenOnline = "messageSchedulingStateSendWhenOnline" + TypeMessageSchedulingStateSendWhenVideoProcessed = "messageSchedulingStateSendWhenVideoProcessed" TypeMessageSelfDestructTypeTimer = "messageSelfDestructTypeTimer" TypeMessageSelfDestructTypeImmediately = "messageSelfDestructTypeImmediately" TypeMessageSendOptions = "messageSendOptions" @@ -1663,7 +1660,6 @@ const ( TypeBusinessFeaturePromotionAnimation = "businessFeaturePromotionAnimation" TypePremiumState = "premiumState" TypeStorePaymentPurposePremiumSubscription = "storePaymentPurposePremiumSubscription" - TypeStorePaymentPurposeGiftedPremium = "storePaymentPurposeGiftedPremium" TypeStorePaymentPurposePremiumGiftCodes = "storePaymentPurposePremiumGiftCodes" TypeStorePaymentPurposePremiumGiveaway = "storePaymentPurposePremiumGiveaway" TypeStorePaymentPurposeStarGiveaway = "storePaymentPurposeStarGiveaway" @@ -2054,6 +2050,7 @@ const ( TypeUpdateMessageUnreadReactions = "updateMessageUnreadReactions" TypeUpdateMessageFactCheck = "updateMessageFactCheck" TypeUpdateMessageLiveLocationViewed = "updateMessageLiveLocationViewed" + TypeUpdateVideoPublished = "updateVideoPublished" TypeUpdateNewChat = "updateNewChat" TypeUpdateChatTitle = "updateChatTitle" TypeUpdateChatPhoto = "updateChatPhoto" @@ -2150,7 +2147,6 @@ const ( TypeUpdateLanguagePackStrings = "updateLanguagePackStrings" TypeUpdateConnectionState = "updateConnectionState" TypeUpdateTermsOfService = "updateTermsOfService" - TypeUpdateUsersNearby = "updateUsersNearby" TypeUpdateUnconfirmedSession = "updateUnconfirmedSession" TypeUpdateAttachmentMenuBots = "updateAttachmentMenuBots" TypeUpdateWebAppMessageSent = "updateWebAppMessageSent" @@ -7317,7 +7313,7 @@ type StarSubscriptions struct { meta // The amount of owned Telegram Stars StarCount int64 `json:"star_count"` - // List of subbscriptions for Telegram Stars + // List of subscriptions for Telegram Stars Subscriptions []*StarSubscription `json:"subscriptions"` // The number of Telegram Stars required to buy to extend subscriptions expiring soon RequiredStarCount int64 `json:"required_star_count"` @@ -7464,6 +7460,8 @@ type PremiumGiftCodePaymentOption struct { Currency string `json:"currency"` // The amount to pay, in the smallest units of the currency Amount int64 `json:"amount"` + // The discount associated with this option, as a percentage + DiscountPercentage int32 `json:"discount_percentage"` // Number of users which will be able to activate the gift codes WinnerCount int32 `json:"winner_count"` // Number of months the Telegram Premium subscription will be active @@ -7472,6 +7470,8 @@ type PremiumGiftCodePaymentOption struct { StoreProductId string `json:"store_product_id"` // Number of times the store product must be paid StoreProductQuantity int32 `json:"store_product_quantity"` + // A sticker to be shown along with the gift code; may be null if unknown + Sticker *Sticker `json:"sticker"` } func (entity *PremiumGiftCodePaymentOption) MarshalJSON() ([]byte, error) { @@ -7729,10 +7729,14 @@ type Gift struct { StarCount int64 `json:"star_count"` // Number of Telegram Stars that can be claimed by the receiver instead of the gift by default. If the gift was paid with just bought Telegram Stars, then full value can be claimed DefaultSellStarCount int64 `json:"default_sell_star_count"` - // Number of remaining times the gift can be purchased by all users; 0 if not limited + // Number of remaining times the gift can be purchased by all users; 0 if not limited or the gift was sold out RemainingCount int32 `json:"remaining_count"` // Number of total times the gift can be purchased by all users; 0 if not limited TotalCount int32 `json:"total_count"` + // Point in time (Unix timestamp) when the gift was send for the first time; for sold out gifts only + FirstSendDate int32 `json:"first_send_date"` + // Point in time (Unix timestamp) when the gift was send for the last time; for sold out gifts only + LastSendDate int32 `json:"last_send_date"` } func (entity *Gift) MarshalJSON() ([]byte, error) { @@ -7891,7 +7895,7 @@ func (*StarTransactionDirectionOutgoing) StarTransactionDirectionType() string { // Paid media were bought type BotTransactionPurposePaidMedia struct { meta - // The bought media if the trancastion wasn't refunded + // The bought media if the transaction wasn't refunded Media []PaidMedia `json:"media"` // Bot-provided payload; for bots only Payload string `json:"payload"` @@ -7970,7 +7974,7 @@ type ChatTransactionPurposePaidMedia struct { meta // Identifier of the corresponding message with paid media; can be 0 or an identifier of a deleted message MessageId int64 `json:"message_id"` - // The bought media if the trancastion wasn't refunded + // The bought media if the transaction wasn't refunded Media []PaidMedia `json:"media"` } @@ -8253,7 +8257,7 @@ func (*StarTransactionPartnerGooglePlay) StarTransactionPartnerType() string { // The transaction is a transaction with Fragment type StarTransactionPartnerFragment struct { meta - // State of the withdrawal; may be null for refunds from Fragment + // State of the withdrawal; may be null for refunds from Fragment or for Telegram Stars bought on Fragment WithdrawalState RevenueWithdrawalState `json:"withdrawal_state"` } @@ -8318,6 +8322,33 @@ func (*StarTransactionPartnerTelegramAds) StarTransactionPartnerType() string { return TypeStarTransactionPartnerTelegramAds } +// The transaction is a transaction with Telegram for API usage +type StarTransactionPartnerTelegramApi struct { + meta + // The number of billed requests + RequestCount int32 `json:"request_count"` +} + +func (entity *StarTransactionPartnerTelegramApi) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionPartnerTelegramApi + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionPartnerTelegramApi) GetClass() string { + return ClassStarTransactionPartner +} + +func (*StarTransactionPartnerTelegramApi) GetType() string { + return TypeStarTransactionPartnerTelegramApi +} + +func (*StarTransactionPartnerTelegramApi) StarTransactionPartnerType() string { + return TypeStarTransactionPartnerTelegramApi +} + // The transaction is a transaction with a bot type StarTransactionPartnerBot struct { meta @@ -8371,7 +8402,7 @@ type StarTransactionPartnerBusiness struct { meta // Identifier of the business account user UserId int64 `json:"user_id"` - // The bought media if the trancastion wasn't refunded + // The bought media if the transaction wasn't refunded Media []PaidMedia `json:"media"` } @@ -8462,7 +8493,7 @@ func (starTransactionPartnerChat *StarTransactionPartnerChat) UnmarshalJSON(data return nil } -// The transaction is a transcation with another user +// The transaction is a transaction with another user type StarTransactionPartnerUser struct { meta // Identifier of the user; 0 if the user was anonymous @@ -9235,6 +9266,8 @@ type BotInfo struct { DefaultGroupAdministratorRights *ChatAdministratorRights `json:"default_group_administrator_rights"` // Default administrator rights for adding the bot to channels; may be null DefaultChannelAdministratorRights *ChatAdministratorRights `json:"default_channel_administrator_rights"` + // True, if the bot's revenue statistics are available + CanGetRevenueStatistics bool `json:"can_get_revenue_statistics"` // True, if the bot has media previews HasMediaPreviews bool `json:"has_media_previews"` // The internal link, which can be used to edit bot commands; may be null @@ -9274,6 +9307,7 @@ func (botInfo *BotInfo) UnmarshalJSON(data []byte) error { PrivacyPolicyUrl string `json:"privacy_policy_url"` DefaultGroupAdministratorRights *ChatAdministratorRights `json:"default_group_administrator_rights"` DefaultChannelAdministratorRights *ChatAdministratorRights `json:"default_channel_administrator_rights"` + CanGetRevenueStatistics bool `json:"can_get_revenue_statistics"` HasMediaPreviews bool `json:"has_media_previews"` EditCommandsLink json.RawMessage `json:"edit_commands_link"` EditDescriptionLink json.RawMessage `json:"edit_description_link"` @@ -9295,6 +9329,7 @@ func (botInfo *BotInfo) UnmarshalJSON(data []byte) error { botInfo.PrivacyPolicyUrl = tmp.PrivacyPolicyUrl botInfo.DefaultGroupAdministratorRights = tmp.DefaultGroupAdministratorRights botInfo.DefaultChannelAdministratorRights = tmp.DefaultChannelAdministratorRights + botInfo.CanGetRevenueStatistics = tmp.CanGetRevenueStatistics botInfo.HasMediaPreviews = tmp.HasMediaPreviews fieldEditCommandsLink, _ := UnmarshalInternalLinkType(tmp.EditCommandsLink) @@ -9347,8 +9382,6 @@ type UserFullInfo struct { Birthdate *Birthdate `json:"birthdate"` // Identifier of the personal chat of the user; 0 if none PersonalChatId int64 `json:"personal_chat_id"` - // The list of available options for gifting Telegram Premium to the user - PremiumGiftOptions []*PremiumPaymentOption `json:"premium_gift_options"` // Number of gifts saved to profile by the user GiftCount int32 `json:"gift_count"` // Number of group chats where both the other user and the current user are a member; 0 for the current user @@ -9393,7 +9426,6 @@ func (userFullInfo *UserFullInfo) UnmarshalJSON(data []byte) error { Bio *FormattedText `json:"bio"` Birthdate *Birthdate `json:"birthdate"` PersonalChatId int64 `json:"personal_chat_id"` - PremiumGiftOptions []*PremiumPaymentOption `json:"premium_gift_options"` GiftCount int32 `json:"gift_count"` GroupInCommonCount int32 `json:"group_in_common_count"` BusinessInfo *BusinessInfo `json:"business_info"` @@ -9420,7 +9452,6 @@ func (userFullInfo *UserFullInfo) UnmarshalJSON(data []byte) error { userFullInfo.Bio = tmp.Bio userFullInfo.Birthdate = tmp.Birthdate userFullInfo.PersonalChatId = tmp.PersonalChatId - userFullInfo.PremiumGiftOptions = tmp.PremiumGiftOptions userFullInfo.GiftCount = tmp.GiftCount userFullInfo.GroupInCommonCount = tmp.GroupInCommonCount userFullInfo.BusinessInfo = tmp.BusinessInfo @@ -10735,7 +10766,7 @@ type Supergroup struct { Date int32 `json:"date"` // Status of the current user in the supergroup or channel; custom title will always be empty Status ChatMemberStatus `json:"status"` - // Number of members in the supergroup or channel; 0 if unknown. Currently, it is guaranteed to be known only if the supergroup or channel was received through getChatSimilarChats, getChatsToSendStories, getCreatedPublicChats, getGroupsInCommon, getInactiveSupergroupChats, getRecommendedChats, getSuitableDiscussionChats, getUserPrivacySettingRules, getVideoChatAvailableParticipants, searchChatsNearby, searchPublicChats, or in chatFolderInviteLinkInfo.missing_chat_ids, or in userFullInfo.personal_chat_id, or for chats with messages or stories from publicForwards and foundStories + // Number of members in the supergroup or channel; 0 if unknown. Currently, it is guaranteed to be known only if the supergroup or channel was received through getChatSimilarChats, getChatsToSendStories, getCreatedPublicChats, getGroupsInCommon, getInactiveSupergroupChats, getRecommendedChats, getSuitableDiscussionChats, getUserPrivacySettingRules, getVideoChatAvailableParticipants, searchPublicChats, or in chatFolderInviteLinkInfo.missing_chat_ids, or in userFullInfo.personal_chat_id, or for chats with messages or stories from publicForwards and foundStories MemberCount int32 `json:"member_count"` // Approximate boost level for the chat BoostLevel int32 `json:"boost_level"` @@ -12492,9 +12523,9 @@ type Message struct { IsTopicMessage bool `json:"is_topic_message"` // True, if the message contains an unread mention for the current user ContainsUnreadMention bool `json:"contains_unread_mention"` - // Point in time (Unix timestamp) when the message was sent + // Point in time (Unix timestamp) when the message was sent; 0 for scheduled messages Date int32 `json:"date"` - // Point in time (Unix timestamp) when the message was last edited + // Point in time (Unix timestamp) when the message was last edited; 0 for scheduled messages EditDate int32 `json:"edit_date"` // Information about the initial message sender; may be null if none or unknown ForwardInfo *MessageForwardInfo `json:"forward_info"` @@ -14979,56 +15010,6 @@ func (*CreatedBasicGroupChat) GetType() string { return TypeCreatedBasicGroupChat } -// Describes a chat located nearby -type ChatNearby struct { - meta - // Chat identifier - ChatId int64 `json:"chat_id"` - // Distance to the chat location, in meters - Distance int32 `json:"distance"` -} - -func (entity *ChatNearby) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatNearby - - return json.Marshal((*stub)(entity)) -} - -func (*ChatNearby) GetClass() string { - return ClassChatNearby -} - -func (*ChatNearby) GetType() string { - return TypeChatNearby -} - -// Represents a list of chats located nearby -type ChatsNearby struct { - meta - // List of users nearby - UsersNearby []*ChatNearby `json:"users_nearby"` - // List of location-based supergroups nearby - SupergroupsNearby []*ChatNearby `json:"supergroups_nearby"` -} - -func (entity *ChatsNearby) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatsNearby - - return json.Marshal((*stub)(entity)) -} - -func (*ChatsNearby) GetClass() string { - return ClassChatsNearby -} - -func (*ChatsNearby) GetType() string { - return TypeChatsNearby -} - // The chat is public, because it has an active username type PublicChatTypeHasUsername struct{ meta @@ -15079,7 +15060,7 @@ func (*PublicChatTypeIsLocationBased) PublicChatTypeType() string { return TypePublicChatTypeIsLocationBased } -// The chat can be reported as spam using the method reportChat with the reason reportReasonSpam. If the chat is a private chat with a user with an emoji status, then a notice about emoji status usage must be shown +// The chat can be reported as spam using the method reportChat with an empty option_id and message_ids. If the chat is a private chat with a user with an emoji status, then a notice about emoji status usage must be shown type ChatActionBarReportSpam struct { meta // If true, the chat was automatically archived and can be moved back to the main chat list using addChatToList simultaneously with setting chat notification settings to default using setChatNotificationSettings @@ -15106,31 +15087,6 @@ func (*ChatActionBarReportSpam) ChatActionBarType() string { return TypeChatActionBarReportSpam } -// The chat is a location-based supergroup, which can be reported as having unrelated location using the method reportChat with the reason reportReasonUnrelatedLocation -type ChatActionBarReportUnrelatedLocation struct{ - meta -} - -func (entity *ChatActionBarReportUnrelatedLocation) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatActionBarReportUnrelatedLocation - - return json.Marshal((*stub)(entity)) -} - -func (*ChatActionBarReportUnrelatedLocation) GetClass() string { - return ClassChatActionBar -} - -func (*ChatActionBarReportUnrelatedLocation) GetType() string { - return TypeChatActionBarReportUnrelatedLocation -} - -func (*ChatActionBarReportUnrelatedLocation) ChatActionBarType() string { - return TypeChatActionBarReportUnrelatedLocation -} - // The chat is a recently created group chat to which new members can be invited type ChatActionBarInviteMembers struct{ meta @@ -15161,8 +15117,6 @@ type ChatActionBarReportAddBlock struct { meta // If true, the chat was automatically archived and can be moved back to the main chat list using addChatToList simultaneously with setting chat notification settings to default using setChatNotificationSettings CanUnarchive bool `json:"can_unarchive"` - // If non-negative, the current user was found by the other user through searchChatsNearby and this is the distance between the users - Distance int32 `json:"distance"` } func (entity *ChatActionBarReportAddBlock) MarshalJSON() ([]byte, error) { @@ -19711,7 +19665,7 @@ type LinkPreviewTypeTheme struct { meta // The list of files with theme description Documents []*Document `json:"documents"` - // Settings for the cloud theme + // Settings for the cloud theme; may be null if unknown Settings *ThemeSettings `json:"settings"` } @@ -19902,7 +19856,7 @@ func (*LinkPreviewTypeVoiceNote) LinkPreviewTypeType() string { // The link is a link to a Web App type LinkPreviewTypeWebApp struct { meta - // Web App photo + // Web App photo; may be null if none Photo *Photo `json:"photo"` } @@ -20299,35 +20253,35 @@ func (*LocationAddress) GetType() string { // Contains parameters of the application theme type ThemeParameters struct { meta - // A color of the background in the RGB24 format + // A color of the background in the RGB format BackgroundColor int32 `json:"background_color"` - // A secondary color for the background in the RGB24 format + // A secondary color for the background in the RGB format SecondaryBackgroundColor int32 `json:"secondary_background_color"` - // A color of the header background in the RGB24 format + // A color of the header background in the RGB format HeaderBackgroundColor int32 `json:"header_background_color"` - // A color of the bottom bar background in the RGB24 format + // A color of the bottom bar background in the RGB format BottomBarBackgroundColor int32 `json:"bottom_bar_background_color"` - // A color of the section background in the RGB24 format + // A color of the section background in the RGB format SectionBackgroundColor int32 `json:"section_background_color"` - // A color of the section separator in the RGB24 format + // A color of the section separator in the RGB format SectionSeparatorColor int32 `json:"section_separator_color"` - // A color of text in the RGB24 format + // A color of text in the RGB format TextColor int32 `json:"text_color"` - // An accent color of the text in the RGB24 format + // An accent color of the text in the RGB format AccentTextColor int32 `json:"accent_text_color"` - // A color of text on the section headers in the RGB24 format + // A color of text on the section headers in the RGB format SectionHeaderTextColor int32 `json:"section_header_text_color"` - // A color of the subtitle text in the RGB24 format + // A color of the subtitle text in the RGB format SubtitleTextColor int32 `json:"subtitle_text_color"` - // A color of the text for destructive actions in the RGB24 format + // A color of the text for destructive actions in the RGB format DestructiveTextColor int32 `json:"destructive_text_color"` - // A color of hints in the RGB24 format + // A color of hints in the RGB format HintColor int32 `json:"hint_color"` - // A color of links in the RGB24 format + // A color of links in the RGB format LinkColor int32 `json:"link_color"` - // A color of the buttons in the RGB24 format + // A color of the buttons in the RGB format ButtonColor int32 `json:"button_color"` - // A color of text on the buttons in the RGB24 format + // A color of text on the buttons in the RGB format ButtonTextColor int32 `json:"button_text_color"` } @@ -21050,7 +21004,7 @@ type InputInvoiceMessage struct { meta // Chat identifier of the message ChatId int64 `json:"chat_id"` - // Message identifier + // Message identifier. Use messageProperties.can_be_paid to check whether the message can be used in the method MessageId int64 `json:"message_id"` } @@ -25201,6 +25155,8 @@ type MessageGiftedPremium struct { GifterUserId int64 `json:"gifter_user_id"` // The identifier of a user that received Telegram Premium; 0 if the gift is incoming ReceiverUserId int64 `json:"receiver_user_id"` + // Message added to the gifted Telegram Premium by the sender + Text *FormattedText `json:"text"` // Currency for the paid amount Currency string `json:"currency"` // The paid amount, in the smallest units of the currency @@ -25240,6 +25196,8 @@ type MessagePremiumGiftCode struct { meta // Identifier of a chat or a user that created the gift code; may be null if unknown CreatorId MessageSender `json:"creator_id"` + // Message added to the gift + Text *FormattedText `json:"text"` // True, if the gift code was created for a giveaway IsFromGiveaway bool `json:"is_from_giveaway"` // True, if the winner for the corresponding Telegram Premium subscription wasn't chosen @@ -25283,6 +25241,7 @@ func (*MessagePremiumGiftCode) MessageContentType() string { func (messagePremiumGiftCode *MessagePremiumGiftCode) UnmarshalJSON(data []byte) error { var tmp struct { CreatorId json.RawMessage `json:"creator_id"` + Text *FormattedText `json:"text"` IsFromGiveaway bool `json:"is_from_giveaway"` IsUnclaimed bool `json:"is_unclaimed"` Currency string `json:"currency"` @@ -25299,6 +25258,7 @@ func (messagePremiumGiftCode *MessagePremiumGiftCode) UnmarshalJSON(data []byte) return err } + messagePremiumGiftCode.Text = tmp.Text messagePremiumGiftCode.IsFromGiveaway = tmp.IsFromGiveaway messagePremiumGiftCode.IsUnclaimed = tmp.IsUnclaimed messagePremiumGiftCode.Currency = tmp.Currency @@ -25990,7 +25950,7 @@ func (*TextEntityTypeMention) TextEntityTypeType() string { return TypeTextEntityTypeMention } -// A hashtag text, beginning with "#" +// A hashtag text, beginning with "#" and optionally containing a chat username at the end type TextEntityTypeHashtag struct{ meta } @@ -26015,7 +25975,7 @@ func (*TextEntityTypeHashtag) TextEntityTypeType() string { return TypeTextEntityTypeHashtag } -// A cashtag text, beginning with "$" and consisting of capital English letters (e.g., "$USD") +// A cashtag text, beginning with "$", consisting of capital English letters (e.g., "$USD"), and optionally containing a chat username at the end type TextEntityTypeCashtag struct{ meta } @@ -26741,6 +26701,33 @@ func (*MessageSchedulingStateSendWhenOnline) MessageSchedulingStateType() string return TypeMessageSchedulingStateSendWhenOnline } +// The message will be sent when the video in the message is converted and optimized; can be used only by the server +type MessageSchedulingStateSendWhenVideoProcessed struct { + meta + // Approximate point in time (Unix timestamp) when the message is expected to be sent + SendDate int32 `json:"send_date"` +} + +func (entity *MessageSchedulingStateSendWhenVideoProcessed) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSchedulingStateSendWhenVideoProcessed + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSchedulingStateSendWhenVideoProcessed) GetClass() string { + return ClassMessageSchedulingState +} + +func (*MessageSchedulingStateSendWhenVideoProcessed) GetType() string { + return TypeMessageSchedulingStateSendWhenVideoProcessed +} + +func (*MessageSchedulingStateSendWhenVideoProcessed) MessageSchedulingStateType() string { + return TypeMessageSchedulingStateSendWhenVideoProcessed +} + // The message will be self-destructed in the specified time after its content was opened type MessageSelfDestructTypeTimer struct { meta @@ -26802,6 +26789,8 @@ type MessageSendOptions struct { FromBackground bool `json:"from_background"` // Pass true if the content of the message must be protected from forwarding and saving; for bots only ProtectContent bool `json:"protect_content"` + // Pass true to allow the message to ignore regular broadcast limits for a small fee; for bots only + AllowPaidBroadcast bool `json:"allow_paid_broadcast"` // Pass true if the user explicitly chosen a sticker or a custom emoji from an installed sticker set; applicable only to sendMessage and sendMessageAlbum UpdateOrderOfInstalledStickerSets bool `json:"update_order_of_installed_sticker_sets"` // Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, live location messages and self-destructing messages can't be scheduled @@ -26835,6 +26824,7 @@ func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { DisableNotification bool `json:"disable_notification"` FromBackground bool `json:"from_background"` ProtectContent bool `json:"protect_content"` + AllowPaidBroadcast bool `json:"allow_paid_broadcast"` UpdateOrderOfInstalledStickerSets bool `json:"update_order_of_installed_sticker_sets"` SchedulingState json.RawMessage `json:"scheduling_state"` EffectId JsonInt64 `json:"effect_id"` @@ -26850,6 +26840,7 @@ func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { messageSendOptions.DisableNotification = tmp.DisableNotification messageSendOptions.FromBackground = tmp.FromBackground messageSendOptions.ProtectContent = tmp.ProtectContent + messageSendOptions.AllowPaidBroadcast = tmp.AllowPaidBroadcast messageSendOptions.UpdateOrderOfInstalledStickerSets = tmp.UpdateOrderOfInstalledStickerSets messageSendOptions.EffectId = tmp.EffectId messageSendOptions.SendingId = tmp.SendingId @@ -26864,7 +26855,7 @@ func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { // Options to be used when a message content is copied without reference to the original sender. Service messages, messages with messageInvoice, messagePaidMedia, messageGiveaway, or messageGiveawayWinners content can't be copied type MessageCopyOptions struct { meta - // True, if content of the message needs to be copied without reference to the original sender. Always true if the message is forwarded to a secret chat or is local + // True, if content of the message needs to be copied without reference to the original sender. Always true if the message is forwarded to a secret chat or is local. Use messageProperties.can_be_saved and messageProperties.can_be_copied_to_secret_chat to check whether the message is suitable SendCopy bool `json:"send_copy"` // True, if media caption of the message copy needs to be replaced. Ignored if send_copy is false ReplaceCaption bool `json:"replace_caption"` @@ -27379,7 +27370,7 @@ func (inputMessageVideo *InputMessageVideo) UnmarshalJSON(data []byte) error { // A video note message type InputMessageVideoNote struct { meta - // Video note to be sent + // Video note to be sent. The video is expected to be encoded to MPEG4 format with H.264 codec and have no data outside of the visible circle VideoNote InputFile `json:"video_note"` // Video thumbnail; may be null if empty; pass null to skip thumbnail uploading Thumbnail *InputThumbnail `json:"thumbnail"` @@ -27835,7 +27826,7 @@ type MessageProperties struct { CanBeDeletedOnlyForSelf bool `json:"can_be_deleted_only_for_self"` // True, if the message can be deleted for all users using the method deleteMessages with revoke == true CanBeDeletedForAllUsers bool `json:"can_be_deleted_for_all_users"` - // True, if the message can be edited using the methods editMessageText, editMessageMedia, editMessageCaption, or editMessageReplyMarkup. For live location and poll messages this fields shows whether editMessageLiveLocation or stopPoll can be used with this message + // True, if the message can be edited using the methods editMessageText, editMessageCaption, or editMessageReplyMarkup. For live location and poll messages this fields shows whether editMessageLiveLocation or stopPoll can be used with this message CanBeEdited bool `json:"can_be_edited"` // True, if the message can be forwarded using inputMessageForwarded or forwardMessages CanBeForwarded bool `json:"can_be_forwarded"` @@ -27851,6 +27842,8 @@ type MessageProperties struct { CanBeSaved bool `json:"can_be_saved"` // True, if the message can be shared in a story using inputStoryAreaTypeMessage CanBeSharedInStory bool `json:"can_be_shared_in_story"` + // True, if the message can be edited using the method editMessageMedia + CanEditMedia bool `json:"can_edit_media"` // True, if scheduling state of the message can be edited CanEditSchedulingState bool `json:"can_edit_scheduling_state"` // True, if code for message embedding can be received using getMessageEmbeddingCode @@ -33544,9 +33537,9 @@ func (*BusinessConnection) GetType() string { // Describes a color to highlight a bot added to attachment menu type AttachmentMenuBotColor struct { meta - // Color in the RGB24 format for light themes + // Color in the RGB format for light themes LightColor int32 `json:"light_color"` - // Color in the RGB24 format for dark themes + // Color in the RGB format for dark themes DarkColor int32 `json:"dark_color"` } @@ -39389,37 +39382,6 @@ func (*StorePaymentPurposePremiumSubscription) StorePaymentPurposeType() string return TypeStorePaymentPurposePremiumSubscription } -// The user gifting Telegram Premium to another user -type StorePaymentPurposeGiftedPremium struct { - meta - // Identifier of the user to which Telegram Premium is gifted - UserId int64 `json:"user_id"` - // ISO 4217 currency code of the payment currency - Currency string `json:"currency"` - // Paid amount, in the smallest units of the currency - Amount int64 `json:"amount"` -} - -func (entity *StorePaymentPurposeGiftedPremium) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StorePaymentPurposeGiftedPremium - - return json.Marshal((*stub)(entity)) -} - -func (*StorePaymentPurposeGiftedPremium) GetClass() string { - return ClassStorePaymentPurpose -} - -func (*StorePaymentPurposeGiftedPremium) GetType() string { - return TypeStorePaymentPurposeGiftedPremium -} - -func (*StorePaymentPurposeGiftedPremium) StorePaymentPurposeType() string { - return TypeStorePaymentPurposeGiftedPremium -} - // The user creating Telegram Premium gift codes for other users type StorePaymentPurposePremiumGiftCodes struct { meta @@ -39431,6 +39393,8 @@ type StorePaymentPurposePremiumGiftCodes struct { Amount int64 `json:"amount"` // Identifiers of the users which can activate the gift codes UserIds []int64 `json:"user_ids"` + // Text to show along with the gift codes; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed + Text *FormattedText `json:"text"` } func (entity *StorePaymentPurposePremiumGiftCodes) MarshalJSON() ([]byte, error) { @@ -39596,6 +39560,8 @@ type TelegramPaymentPurposePremiumGiftCodes struct { UserIds []int64 `json:"user_ids"` // Number of months the Telegram Premium subscription will be active for the users MonthCount int32 `json:"month_count"` + // Text to show along with the gift codes; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed + Text *FormattedText `json:"text"` } func (entity *TelegramPaymentPurposePremiumGiftCodes) MarshalJSON() ([]byte, error) { @@ -40143,7 +40109,7 @@ func (*PushReceiverId) GetType() string { // Describes a solid fill of a background type BackgroundFillSolid struct { meta - // A color of the background in the RGB24 format + // A color of the background in the RGB format Color int32 `json:"color"` } @@ -40170,9 +40136,9 @@ func (*BackgroundFillSolid) BackgroundFillType() string { // Describes a gradient fill of a background type BackgroundFillGradient struct { meta - // A top color of the background in the RGB24 format + // A top color of the background in the RGB format TopColor int32 `json:"top_color"` - // A bottom color of the background in the RGB24 format + // A bottom color of the background in the RGB format BottomColor int32 `json:"bottom_color"` // Clockwise rotation angle of the gradient, in degrees; 0-359. Must always be divisible by 45 RotationAngle int32 `json:"rotation_angle"` @@ -40201,7 +40167,7 @@ func (*BackgroundFillGradient) BackgroundFillType() string { // Describes a freeform gradient fill of a background type BackgroundFillFreeformGradient struct { meta - // A list of 3 or 4 colors of the freeform gradient in the RGB24 format + // A list of 3 or 4 colors of the freeform gradient in the RGB format Colors []int32 `json:"colors"` } @@ -45783,7 +45749,7 @@ func (*InternalLinkTypePremiumFeatures) InternalLinkTypeType() string { return TypeInternalLinkTypePremiumFeatures } -// The link is a link to the screen for gifting Telegram Premium subscriptions to friends via inputInvoiceTelegram payments or in-store purchases +// The link is a link to the screen for gifting Telegram Premium subscriptions to friends via inputInvoiceTelegram with telegramPaymentPurposePremiumGiftCodes payments or in-store purchases type InternalLinkTypePremiumGift struct { meta // Referrer specified in the link @@ -50477,7 +50443,7 @@ func (*UpdateMessageSendAcknowledged) UpdateType() string { // A message has been successfully sent type UpdateMessageSendSucceeded struct { meta - // The sent message. Usually only the message identifier, date, and content are changed, but almost all other fields can also change + // The sent message. Almost any field of the new message can be different from the corresponding field of the original message. For example, the field scheduling_state may change, making the message scheduled, or non-scheduled Message *Message `json:"message"` // The previous temporary message identifier OldMessageId int64 `json:"old_message_id"` @@ -50857,6 +50823,35 @@ func (*UpdateMessageLiveLocationViewed) UpdateType() string { return TypeUpdateMessageLiveLocationViewed } +// An automatically scheduled message with video has been successfully sent after conversion +type UpdateVideoPublished struct { + meta + // Identifier of the chat with the message + ChatId int64 `json:"chat_id"` + // Identifier of the sent message + MessageId int64 `json:"message_id"` +} + +func (entity *UpdateVideoPublished) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateVideoPublished + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateVideoPublished) GetClass() string { + return ClassUpdate +} + +func (*UpdateVideoPublished) GetType() string { + return TypeUpdateVideoPublished +} + +func (*UpdateVideoPublished) UpdateType() string { + return TypeUpdateVideoPublished +} + // A new chat has been loaded/created. This update is guaranteed to come before the chat identifier is returned to the application. The chat field changes will be reported through separate updates type UpdateNewChat struct { meta @@ -54060,33 +54055,6 @@ func (*UpdateTermsOfService) UpdateType() string { return TypeUpdateTermsOfService } -// The list of users nearby has changed. The update is guaranteed to be sent only 60 seconds after a successful searchChatsNearby request -type UpdateUsersNearby struct { - meta - // The new list of users nearby - UsersNearby []*ChatNearby `json:"users_nearby"` -} - -func (entity *UpdateUsersNearby) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub UpdateUsersNearby - - return json.Marshal((*stub)(entity)) -} - -func (*UpdateUsersNearby) GetClass() string { - return ClassUpdate -} - -func (*UpdateUsersNearby) GetType() string { - return TypeUpdateUsersNearby -} - -func (*UpdateUsersNearby) UpdateType() string { - return TypeUpdateUsersNearby -} - // The first unconfirmed session has changed type UpdateUnconfirmedSession struct { meta diff --git a/client/unmarshaler.go b/client/unmarshaler.go index b779a08..7d468fc 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -828,6 +828,9 @@ func UnmarshalStarTransactionPartner(data json.RawMessage) (StarTransactionPartn case TypeStarTransactionPartnerTelegramAds: return UnmarshalStarTransactionPartnerTelegramAds(data) + case TypeStarTransactionPartnerTelegramApi: + return UnmarshalStarTransactionPartnerTelegramApi(data) + case TypeStarTransactionPartnerBot: return UnmarshalStarTransactionPartnerBot(data) @@ -1853,9 +1856,6 @@ func UnmarshalChatActionBar(data json.RawMessage) (ChatActionBar, error) { case TypeChatActionBarReportSpam: return UnmarshalChatActionBarReportSpam(data) - case TypeChatActionBarReportUnrelatedLocation: - return UnmarshalChatActionBarReportUnrelatedLocation(data) - case TypeChatActionBarInviteMembers: return UnmarshalChatActionBarInviteMembers(data) @@ -3491,6 +3491,9 @@ func UnmarshalMessageSchedulingState(data json.RawMessage) (MessageSchedulingSta case TypeMessageSchedulingStateSendWhenOnline: return UnmarshalMessageSchedulingStateSendWhenOnline(data) + case TypeMessageSchedulingStateSendWhenVideoProcessed: + return UnmarshalMessageSchedulingStateSendWhenVideoProcessed(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -5441,9 +5444,6 @@ func UnmarshalStorePaymentPurpose(data json.RawMessage) (StorePaymentPurpose, er case TypeStorePaymentPurposePremiumSubscription: return UnmarshalStorePaymentPurposePremiumSubscription(data) - case TypeStorePaymentPurposeGiftedPremium: - return UnmarshalStorePaymentPurposeGiftedPremium(data) - case TypeStorePaymentPurposePremiumGiftCodes: return UnmarshalStorePaymentPurposePremiumGiftCodes(data) @@ -7713,6 +7713,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateMessageLiveLocationViewed: return UnmarshalUpdateMessageLiveLocationViewed(data) + case TypeUpdateVideoPublished: + return UnmarshalUpdateVideoPublished(data) + case TypeUpdateNewChat: return UnmarshalUpdateNewChat(data) @@ -8001,9 +8004,6 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateTermsOfService: return UnmarshalUpdateTermsOfService(data) - case TypeUpdateUsersNearby: - return UnmarshalUpdateUsersNearby(data) - case TypeUpdateUnconfirmedSession: return UnmarshalUpdateUnconfirmedSession(data) @@ -9532,6 +9532,14 @@ func UnmarshalStarTransactionPartnerTelegramAds(data json.RawMessage) (*StarTran return &resp, err } +func UnmarshalStarTransactionPartnerTelegramApi(data json.RawMessage) (*StarTransactionPartnerTelegramApi, error) { + var resp StarTransactionPartnerTelegramApi + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarTransactionPartnerBot(data json.RawMessage) (*StarTransactionPartnerBot, error) { var resp StarTransactionPartnerBot @@ -11036,22 +11044,6 @@ func UnmarshalCreatedBasicGroupChat(data json.RawMessage) (*CreatedBasicGroupCha return &resp, err } -func UnmarshalChatNearby(data json.RawMessage) (*ChatNearby, error) { - var resp ChatNearby - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalChatsNearby(data json.RawMessage) (*ChatsNearby, error) { - var resp ChatsNearby - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - func UnmarshalPublicChatTypeHasUsername(data json.RawMessage) (*PublicChatTypeHasUsername, error) { var resp PublicChatTypeHasUsername @@ -11076,14 +11068,6 @@ func UnmarshalChatActionBarReportSpam(data json.RawMessage) (*ChatActionBarRepor return &resp, err } -func UnmarshalChatActionBarReportUnrelatedLocation(data json.RawMessage) (*ChatActionBarReportUnrelatedLocation, error) { - var resp ChatActionBarReportUnrelatedLocation - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - func UnmarshalChatActionBarInviteMembers(data json.RawMessage) (*ChatActionBarInviteMembers, error) { var resp ChatActionBarInviteMembers @@ -13900,6 +13884,14 @@ func UnmarshalMessageSchedulingStateSendWhenOnline(data json.RawMessage) (*Messa return &resp, err } +func UnmarshalMessageSchedulingStateSendWhenVideoProcessed(data json.RawMessage) (*MessageSchedulingStateSendWhenVideoProcessed, error) { + var resp MessageSchedulingStateSendWhenVideoProcessed + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageSelfDestructTypeTimer(data json.RawMessage) (*MessageSelfDestructTypeTimer, error) { var resp MessageSelfDestructTypeTimer @@ -16908,14 +16900,6 @@ func UnmarshalStorePaymentPurposePremiumSubscription(data json.RawMessage) (*Sto return &resp, err } -func UnmarshalStorePaymentPurposeGiftedPremium(data json.RawMessage) (*StorePaymentPurposeGiftedPremium, error) { - var resp StorePaymentPurposeGiftedPremium - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - func UnmarshalStorePaymentPurposePremiumGiftCodes(data json.RawMessage) (*StorePaymentPurposePremiumGiftCodes, error) { var resp StorePaymentPurposePremiumGiftCodes @@ -20036,6 +20020,14 @@ func UnmarshalUpdateMessageLiveLocationViewed(data json.RawMessage) (*UpdateMess return &resp, err } +func UnmarshalUpdateVideoPublished(data json.RawMessage) (*UpdateVideoPublished, error) { + var resp UpdateVideoPublished + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateNewChat(data json.RawMessage) (*UpdateNewChat, error) { var resp UpdateNewChat @@ -20804,14 +20796,6 @@ func UnmarshalUpdateTermsOfService(data json.RawMessage) (*UpdateTermsOfService, return &resp, err } -func UnmarshalUpdateUsersNearby(data json.RawMessage) (*UpdateUsersNearby, error) { - var resp UpdateUsersNearby - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - func UnmarshalUpdateUnconfirmedSession(data json.RawMessage) (*UpdateUnconfirmedSession, error) { var resp UpdateUnconfirmedSession @@ -21760,6 +21744,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarTransactionPartnerTelegramAds: return UnmarshalStarTransactionPartnerTelegramAds(data) + case TypeStarTransactionPartnerTelegramApi: + return UnmarshalStarTransactionPartnerTelegramApi(data) + case TypeStarTransactionPartnerBot: return UnmarshalStarTransactionPartnerBot(data) @@ -22324,12 +22311,6 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeCreatedBasicGroupChat: return UnmarshalCreatedBasicGroupChat(data) - case TypeChatNearby: - return UnmarshalChatNearby(data) - - case TypeChatsNearby: - return UnmarshalChatsNearby(data) - case TypePublicChatTypeHasUsername: return UnmarshalPublicChatTypeHasUsername(data) @@ -22339,9 +22320,6 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatActionBarReportSpam: return UnmarshalChatActionBarReportSpam(data) - case TypeChatActionBarReportUnrelatedLocation: - return UnmarshalChatActionBarReportUnrelatedLocation(data) - case TypeChatActionBarInviteMembers: return UnmarshalChatActionBarInviteMembers(data) @@ -23398,6 +23376,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageSchedulingStateSendWhenOnline: return UnmarshalMessageSchedulingStateSendWhenOnline(data) + case TypeMessageSchedulingStateSendWhenVideoProcessed: + return UnmarshalMessageSchedulingStateSendWhenVideoProcessed(data) + case TypeMessageSelfDestructTypeTimer: return UnmarshalMessageSelfDestructTypeTimer(data) @@ -24526,9 +24507,6 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStorePaymentPurposePremiumSubscription: return UnmarshalStorePaymentPurposePremiumSubscription(data) - case TypeStorePaymentPurposeGiftedPremium: - return UnmarshalStorePaymentPurposeGiftedPremium(data) - case TypeStorePaymentPurposePremiumGiftCodes: return UnmarshalStorePaymentPurposePremiumGiftCodes(data) @@ -25699,6 +25677,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateMessageLiveLocationViewed: return UnmarshalUpdateMessageLiveLocationViewed(data) + case TypeUpdateVideoPublished: + return UnmarshalUpdateVideoPublished(data) + case TypeUpdateNewChat: return UnmarshalUpdateNewChat(data) @@ -25987,9 +25968,6 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateTermsOfService: return UnmarshalUpdateTermsOfService(data) - case TypeUpdateUsersNearby: - return UnmarshalUpdateUsersNearby(data) - case TypeUpdateUnconfirmedSession: return UnmarshalUpdateUnconfirmedSession(data) diff --git a/data/td_api.tl b/data/td_api.tl index 8101cdc..c7dd285 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -829,7 +829,7 @@ starSubscription id:string chat_id:int53 expiration_date:int32 can_reuse:Bool is //@description Represents a list of Telegram Star subscriptions //@star_count The amount of owned Telegram Stars -//@subscriptions List of subbscriptions for Telegram Stars +//@subscriptions List of subscriptions for Telegram Stars //@required_star_count The number of Telegram Stars required to buy to extend subscriptions expiring soon //@next_offset The offset for the next request. If empty, then there are no more results starSubscriptions star_count:int53 subscriptions:vector required_star_count:int53 next_offset:string = StarSubscriptions; @@ -861,11 +861,13 @@ premiumStatePaymentOption payment_option:premiumPaymentOption is_current:Bool is //@description Describes an option for creating Telegram Premium gift codes or Telegram Premium giveaway. Use telegramPaymentPurposePremiumGiftCodes or telegramPaymentPurposePremiumGiveaway for out-of-store payments //@currency ISO 4217 currency code for Telegram Premium gift code payment //@amount The amount to pay, in the smallest units of the currency +//@discount_percentage The discount associated with this option, as a percentage //@winner_count Number of users which will be able to activate the gift codes //@month_count Number of months the Telegram Premium subscription will be active //@store_product_id Identifier of the store product associated with the option; may be empty if none //@store_product_quantity Number of times the store product must be paid -premiumGiftCodePaymentOption currency:string amount:int53 winner_count:int32 month_count:int32 store_product_id:string store_product_quantity:int32 = PremiumGiftCodePaymentOption; +//@sticker A sticker to be shown along with the gift code; may be null if unknown +premiumGiftCodePaymentOption currency:string amount:int53 discount_percentage:int32 winner_count:int32 month_count:int32 store_product_id:string store_product_quantity:int32 sticker:sticker = PremiumGiftCodePaymentOption; //@description Contains a list of options for creating Telegram Premium gift codes or Telegram Premium giveaway @options The list of options premiumGiftCodePaymentOptions options:vector = PremiumGiftCodePaymentOptions; @@ -916,9 +918,11 @@ starGiveawayPaymentOptions options:vector = StarGivea //@sticker The sticker representing the gift //@star_count Number of Telegram Stars that must be paid for the gift //@default_sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the gift by default. If the gift was paid with just bought Telegram Stars, then full value can be claimed -//@remaining_count Number of remaining times the gift can be purchased by all users; 0 if not limited +//@remaining_count Number of remaining times the gift can be purchased by all users; 0 if not limited or the gift was sold out //@total_count Number of total times the gift can be purchased by all users; 0 if not limited -gift id:int64 sticker:sticker star_count:int53 default_sell_star_count:int53 remaining_count:int32 total_count:int32 = Gift; +//@first_send_date Point in time (Unix timestamp) when the gift was send for the first time; for sold out gifts only +//@last_send_date Point in time (Unix timestamp) when the gift was send for the last time; for sold out gifts only +gift id:int64 sticker:sticker star_count:int53 default_sell_star_count:int53 remaining_count:int32 total_count:int32 first_send_date:int32 last_send_date:int32 = Gift; //@description Contains a list of gifts that can be sent to another user @gifts The list of gifts gifts gifts:vector = Gifts; @@ -952,7 +956,7 @@ starTransactionDirectionOutgoing = StarTransactionDirection; //@class BotTransactionPurpose @description Describes purpose of a transaction with a bot -//@description Paid media were bought @media The bought media if the trancastion wasn't refunded @payload Bot-provided payload; for bots only +//@description Paid media were bought @media The bought media if the transaction wasn't refunded @payload Bot-provided payload; for bots only botTransactionPurposePaidMedia media:vector payload:string = BotTransactionPurpose; //@description User bought a product from the bot @@ -965,7 +969,7 @@ botTransactionPurposeInvoicePayment product_info:productInfo invoice_payload:byt //@description Paid media were bought //@message_id Identifier of the corresponding message with paid media; can be 0 or an identifier of a deleted message -//@media The bought media if the trancastion wasn't refunded +//@media The bought media if the transaction wasn't refunded chatTransactionPurposePaidMedia message_id:int53 media:vector = ChatTransactionPurpose; //@description User joined the channel and subscribed to regular payments in Telegram Stars @@ -1003,22 +1007,25 @@ starTransactionPartnerAppStore = StarTransactionPartner; //@description The transaction is a transaction with Google Play starTransactionPartnerGooglePlay = StarTransactionPartner; -//@description The transaction is a transaction with Fragment @withdrawal_state State of the withdrawal; may be null for refunds from Fragment +//@description The transaction is a transaction with Fragment @withdrawal_state State of the withdrawal; may be null for refunds from Fragment or for Telegram Stars bought on Fragment starTransactionPartnerFragment withdrawal_state:RevenueWithdrawalState = StarTransactionPartner; //@description The transaction is a transaction with Telegram Ad platform starTransactionPartnerTelegramAds = StarTransactionPartner; +//@description The transaction is a transaction with Telegram for API usage @request_count The number of billed requests +starTransactionPartnerTelegramApi request_count:int32 = StarTransactionPartner; + //@description The transaction is a transaction with a bot @user_id Identifier of the bot @purpose Purpose of the transaction starTransactionPartnerBot user_id:int53 purpose:BotTransactionPurpose = StarTransactionPartner; -//@description The transaction is a transaction with a business account @user_id Identifier of the business account user @media The bought media if the trancastion wasn't refunded +//@description The transaction is a transaction with a business account @user_id Identifier of the business account user @media The bought media if the transaction wasn't refunded starTransactionPartnerBusiness user_id:int53 media:vector = StarTransactionPartner; //@description The transaction is a transaction with a supergroup or a channel chat @chat_id Identifier of the chat @purpose Purpose of the transaction starTransactionPartnerChat chat_id:int53 purpose:ChatTransactionPurpose = StarTransactionPartner; -//@description The transaction is a transcation with another user @user_id Identifier of the user; 0 if the user was anonymous @purpose Purpose of the transaction +//@description The transaction is a transaction with another user @user_id Identifier of the user; 0 if the user was anonymous @purpose Purpose of the transaction starTransactionPartnerUser user_id:int53 purpose:UserTransactionPurpose = StarTransactionPartner; //@description The transaction is a transaction with unknown partner @@ -1169,12 +1176,13 @@ user id:int53 access_hash:int64 first_name:string last_name:string usernames:use //@privacy_policy_url The HTTP link to the privacy policy of the bot. If empty, then /privacy command must be used if supported by the bot. If the command isn't supported, then https://telegram.org/privacy-tpa must be opened //@default_group_administrator_rights Default administrator rights for adding the bot to basic group and supergroup chats; may be null //@default_channel_administrator_rights Default administrator rights for adding the bot to channels; may be null +//@can_get_revenue_statistics True, if the bot's revenue statistics are available //@has_media_previews True, if the bot has media previews //@edit_commands_link The internal link, which can be used to edit bot commands; may be null //@edit_description_link The internal link, which can be used to edit bot description; may be null //@edit_description_media_link The internal link, which can be used to edit the photo or animation shown in the chat with the bot if the chat is empty; may be null //@edit_settings_link The internal link, which can be used to edit bot settings; may be null -botInfo short_description:string description:string photo:photo animation:animation menu_button:botMenuButton commands:vector privacy_policy_url:string default_group_administrator_rights:chatAdministratorRights default_channel_administrator_rights:chatAdministratorRights has_media_previews:Bool edit_commands_link:InternalLinkType edit_description_link:InternalLinkType edit_description_media_link:InternalLinkType edit_settings_link:InternalLinkType = BotInfo; +botInfo short_description:string description:string photo:photo animation:animation menu_button:botMenuButton commands:vector privacy_policy_url:string default_group_administrator_rights:chatAdministratorRights default_channel_administrator_rights:chatAdministratorRights can_get_revenue_statistics:Bool has_media_previews:Bool edit_commands_link:InternalLinkType edit_description_link:InternalLinkType edit_description_media_link:InternalLinkType edit_settings_link:InternalLinkType = BotInfo; //@description Contains full information about a user //@personal_photo User profile photo set by the current user for the contact; may be null. If null and user.profile_photo is null, then the photo is empty; otherwise, it is unknown. @@ -1196,12 +1204,11 @@ botInfo short_description:string description:string photo:photo animation:animat //@bio A short user bio; may be null for bots //@birthdate Birthdate of the user; may be null if unknown //@personal_chat_id Identifier of the personal chat of the user; 0 if none -//@premium_gift_options The list of available options for gifting Telegram Premium to the user //@gift_count Number of gifts saved to profile by the user //@group_in_common_count Number of group chats where both the other user and the current user are a member; 0 for the current user //@business_info Information about business settings for Telegram Business accounts; may be null if none //@bot_info For bots, information about the bot; may be null if the user isn't a bot -userFullInfo personal_photo:chatPhoto photo:chatPhoto public_photo:chatPhoto block_list:BlockList can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool has_private_forwards:Bool has_restricted_voice_and_video_note_messages:Bool has_posted_to_profile_stories:Bool has_sponsored_messages_enabled:Bool need_phone_number_privacy_exception:Bool set_chat_background:Bool bio:formattedText birthdate:birthdate personal_chat_id:int53 premium_gift_options:vector gift_count:int32 group_in_common_count:int32 business_info:businessInfo bot_info:botInfo = UserFullInfo; +userFullInfo personal_photo:chatPhoto photo:chatPhoto public_photo:chatPhoto block_list:BlockList can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool has_private_forwards:Bool has_restricted_voice_and_video_note_messages:Bool has_posted_to_profile_stories:Bool has_sponsored_messages_enabled:Bool need_phone_number_privacy_exception:Bool set_chat_background:Bool bio:formattedText birthdate:birthdate personal_chat_id:int53 gift_count:int32 group_in_common_count:int32 business_info:businessInfo bot_info:botInfo = UserFullInfo; //@description Represents a list of users @total_count Approximate total number of users found @user_ids A list of user identifiers users total_count:int32 user_ids:vector = Users; @@ -1430,7 +1437,7 @@ basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int53 memb //@status Status of the current user in the supergroup or channel; custom title will always be empty //@member_count Number of members in the supergroup or channel; 0 if unknown. Currently, it is guaranteed to be known only if the supergroup or channel was received through //-getChatSimilarChats, getChatsToSendStories, getCreatedPublicChats, getGroupsInCommon, getInactiveSupergroupChats, getRecommendedChats, getSuitableDiscussionChats, -//-getUserPrivacySettingRules, getVideoChatAvailableParticipants, searchChatsNearby, searchPublicChats, or in chatFolderInviteLinkInfo.missing_chat_ids, or in userFullInfo.personal_chat_id, +//-getUserPrivacySettingRules, getVideoChatAvailableParticipants, searchPublicChats, or in chatFolderInviteLinkInfo.missing_chat_ids, or in userFullInfo.personal_chat_id, //-or for chats with messages or stories from publicForwards and foundStories //@boost_level Approximate boost level for the chat //@has_linked_chat True, if the channel has a discussion group, or the supergroup is the designated discussion group for a channel @@ -1760,8 +1767,8 @@ factCheck text:formattedText country_code:string = FactCheck; //@is_channel_post True, if the message is a channel post. All messages to channels are channel posts, all other messages are not channel posts //@is_topic_message True, if the message is a forum topic message //@contains_unread_mention True, if the message contains an unread mention for the current user -//@date Point in time (Unix timestamp) when the message was sent -//@edit_date Point in time (Unix timestamp) when the message was last edited +//@date Point in time (Unix timestamp) when the message was sent; 0 for scheduled messages +//@edit_date Point in time (Unix timestamp) when the message was last edited; 0 for scheduled messages //@forward_info Information about the initial message sender; may be null if none or unknown //@import_info Information about the initial message for messages created with importMessages; may be null if the message isn't imported //@interaction_info Information about interactions with the message; may be null if none @@ -2189,13 +2196,6 @@ failedToAddMembers failed_to_add_members:vector = FailedToAdd createdBasicGroupChat chat_id:int53 failed_to_add_members:failedToAddMembers = CreatedBasicGroupChat; -//@description Describes a chat located nearby @chat_id Chat identifier @distance Distance to the chat location, in meters -chatNearby chat_id:int53 distance:int32 = ChatNearby; - -//@description Represents a list of chats located nearby @users_nearby List of users nearby @supergroups_nearby List of location-based supergroups nearby -chatsNearby users_nearby:vector supergroups_nearby:vector = ChatsNearby; - - //@class PublicChatType @description Describes type of public chat //@description The chat is public, because it has an active username @@ -2207,21 +2207,17 @@ publicChatTypeIsLocationBased = PublicChatType; //@class ChatActionBar @description Describes actions which must be possible to do through a chat action bar -//@description The chat can be reported as spam using the method reportChat with the reason reportReasonSpam. If the chat is a private chat with a user with an emoji status, then a notice about emoji status usage must be shown +//@description The chat can be reported as spam using the method reportChat with an empty option_id and message_ids. If the chat is a private chat with a user with an emoji status, then a notice about emoji status usage must be shown //@can_unarchive If true, the chat was automatically archived and can be moved back to the main chat list using addChatToList simultaneously with setting chat notification settings to default using setChatNotificationSettings chatActionBarReportSpam can_unarchive:Bool = ChatActionBar; -//@description The chat is a location-based supergroup, which can be reported as having unrelated location using the method reportChat with the reason reportReasonUnrelatedLocation -chatActionBarReportUnrelatedLocation = ChatActionBar; - //@description The chat is a recently created group chat to which new members can be invited chatActionBarInviteMembers = ChatActionBar; //@description The chat is a private or secret chat, which can be reported using the method reportChat, or the other user can be blocked using the method setMessageSenderBlockList, //-or the other user can be added to the contact list using the method addContact. If the chat is a private chat with a user with an emoji status, then a notice about emoji status usage must be shown //@can_unarchive If true, the chat was automatically archived and can be moved back to the main chat list using addChatToList simultaneously with setting chat notification settings to default using setChatNotificationSettings -//@distance If non-negative, the current user was found by the other user through searchChatsNearby and this is the distance between the users -chatActionBarReportAddBlock can_unarchive:Bool distance:int32 = ChatActionBar; +chatActionBarReportAddBlock can_unarchive:Bool = ChatActionBar; //@description The chat is a private or secret chat and the other user can be added to the contact list using the method addContact chatActionBarAddContact = ChatActionBar; @@ -2844,7 +2840,7 @@ linkPreviewTypeStory story_sender_chat_id:int53 story_id:int32 = LinkPreviewType //@description The link is a link to boost a supergroup chat @photo Photo of the chat; may be null linkPreviewTypeSupergroupBoost photo:chatPhoto = LinkPreviewType; -//@description The link is a link to a cloud theme. TDLib has no theme support yet @documents The list of files with theme description @settings Settings for the cloud theme +//@description The link is a link to a cloud theme. TDLib has no theme support yet @documents The list of files with theme description @settings Settings for the cloud theme; may be null if unknown linkPreviewTypeTheme documents:vector settings:themeSettings = LinkPreviewType; //@description The link preview type is unsupported yet @@ -2867,7 +2863,7 @@ linkPreviewTypeVideoNote video_note:videoNote = LinkPreviewType; //@description The link is a link to a voice note message @voice_note The voice note linkPreviewTypeVoiceNote voice_note:voiceNote = LinkPreviewType; -//@description The link is a link to a Web App @photo Web App photo +//@description The link is a link to a Web App @photo Web App photo; may be null if none linkPreviewTypeWebApp photo:photo = LinkPreviewType; @@ -2951,21 +2947,21 @@ locationAddress country_code:string state:string city:string street:string = Loc //@description Contains parameters of the application theme -//@background_color A color of the background in the RGB24 format -//@secondary_background_color A secondary color for the background in the RGB24 format -//@header_background_color A color of the header background in the RGB24 format -//@bottom_bar_background_color A color of the bottom bar background in the RGB24 format -//@section_background_color A color of the section background in the RGB24 format -//@section_separator_color A color of the section separator in the RGB24 format -//@text_color A color of text in the RGB24 format -//@accent_text_color An accent color of the text in the RGB24 format -//@section_header_text_color A color of text on the section headers in the RGB24 format -//@subtitle_text_color A color of the subtitle text in the RGB24 format -//@destructive_text_color A color of the text for destructive actions in the RGB24 format -//@hint_color A color of hints in the RGB24 format -//@link_color A color of links in the RGB24 format -//@button_color A color of the buttons in the RGB24 format -//@button_text_color A color of text on the buttons in the RGB24 format +//@background_color A color of the background in the RGB format +//@secondary_background_color A secondary color for the background in the RGB format +//@header_background_color A color of the header background in the RGB format +//@bottom_bar_background_color A color of the bottom bar background in the RGB format +//@section_background_color A color of the section background in the RGB format +//@section_separator_color A color of the section separator in the RGB format +//@text_color A color of text in the RGB format +//@accent_text_color An accent color of the text in the RGB format +//@section_header_text_color A color of text on the section headers in the RGB format +//@subtitle_text_color A color of the subtitle text in the RGB format +//@destructive_text_color A color of the text for destructive actions in the RGB format +//@hint_color A color of hints in the RGB format +//@link_color A color of links in the RGB format +//@button_color A color of the buttons in the RGB format +//@button_text_color A color of text on the buttons in the RGB format themeParameters background_color:int32 secondary_background_color:int32 header_background_color:int32 bottom_bar_background_color:int32 section_background_color:int32 section_separator_color:int32 text_color:int32 accent_text_color:int32 section_header_text_color:int32 subtitle_text_color:int32 destructive_text_color:int32 hint_color:int32 link_color:int32 button_color:int32 button_text_color:int32 = ThemeParameters; @@ -3101,7 +3097,7 @@ paymentReceipt product_info:productInfo date:int32 seller_bot_user_id:int53 type //@description An invoice from a message of the type messageInvoice or paid media purchase from messagePaidMedia //@chat_id Chat identifier of the message -//@message_id Message identifier +//@message_id Message identifier. Use messageProperties.can_be_paid to check whether the message can be used in the method inputInvoiceMessage chat_id:int53 message_id:int53 = InputInvoice; //@description An invoice from a link of the type internalLinkTypeInvoice @name Name of the invoice @@ -3666,16 +3662,18 @@ messagePaymentRefunded owner_id:MessageSender currency:string total_amount:int53 //@description Telegram Premium was gifted to a user //@gifter_user_id The identifier of a user that gifted Telegram Premium; 0 if the gift was anonymous or is outgoing //@receiver_user_id The identifier of a user that received Telegram Premium; 0 if the gift is incoming +//@text Message added to the gifted Telegram Premium by the sender //@currency Currency for the paid amount //@amount The paid amount, in the smallest units of the currency //@cryptocurrency Cryptocurrency used to pay for the gift; may be empty if none //@cryptocurrency_amount The paid amount, in the smallest units of the cryptocurrency; 0 if none //@month_count Number of months the Telegram Premium subscription will be active //@sticker A sticker to be shown in the message; may be null if unknown -messageGiftedPremium gifter_user_id:int53 receiver_user_id:int53 currency:string amount:int53 cryptocurrency:string cryptocurrency_amount:int64 month_count:int32 sticker:sticker = MessageContent; +messageGiftedPremium gifter_user_id:int53 receiver_user_id:int53 text:formattedText currency:string amount:int53 cryptocurrency:string cryptocurrency_amount:int64 month_count:int32 sticker:sticker = MessageContent; //@description A Telegram Premium gift code was created for the user //@creator_id Identifier of a chat or a user that created the gift code; may be null if unknown +//@text Message added to the gift //@is_from_giveaway True, if the gift code was created for a giveaway //@is_unclaimed True, if the winner for the corresponding Telegram Premium subscription wasn't chosen //@currency Currency for the paid amount; empty if unknown @@ -3685,7 +3683,7 @@ messageGiftedPremium gifter_user_id:int53 receiver_user_id:int53 currency:string //@month_count Number of months the Telegram Premium subscription will be active after code activation //@sticker A sticker to be shown in the message; may be null if unknown //@code The gift code -messagePremiumGiftCode creator_id:MessageSender is_from_giveaway:Bool is_unclaimed:Bool currency:string amount:int53 cryptocurrency:string cryptocurrency_amount:int64 month_count:int32 sticker:sticker code:string = MessageContent; +messagePremiumGiftCode creator_id:MessageSender text:formattedText is_from_giveaway:Bool is_unclaimed:Bool currency:string amount:int53 cryptocurrency:string cryptocurrency_amount:int64 month_count:int32 sticker:sticker code:string = MessageContent; //@description A giveaway was created for the chat. Use telegramPaymentPurposePremiumGiveaway, storePaymentPurposePremiumGiveaway, telegramPaymentPurposeStarGiveaway, or storePaymentPurposeStarGiveaway to create a giveaway //@star_count Number of Telegram Stars that will be shared by winners of the giveaway; 0 for Telegram Premium giveaways @@ -3785,10 +3783,10 @@ messageUnsupported = MessageContent; //@description A mention of a user, a supergroup, or a channel by their username textEntityTypeMention = TextEntityType; -//@description A hashtag text, beginning with "#" +//@description A hashtag text, beginning with "#" and optionally containing a chat username at the end textEntityTypeHashtag = TextEntityType; -//@description A cashtag text, beginning with "$" and consisting of capital English letters (e.g., "$USD") +//@description A cashtag text, beginning with "$", consisting of capital English letters (e.g., "$USD"), and optionally containing a chat username at the end textEntityTypeCashtag = TextEntityType; //@description A bot command, beginning with "/" @@ -3885,6 +3883,10 @@ messageSchedulingStateSendAtDate send_date:int32 = MessageSchedulingState; //@description The message will be sent when the other user is online. Applicable to private chats only and when the exact online status of the other user is known messageSchedulingStateSendWhenOnline = MessageSchedulingState; +//@description The message will be sent when the video in the message is converted and optimized; can be used only by the server +//@send_date Approximate point in time (Unix timestamp) when the message is expected to be sent +messageSchedulingStateSendWhenVideoProcessed send_date:int32 = MessageSchedulingState; + //@class MessageSelfDestructType @description Describes when a message will be self-destructed @@ -3899,15 +3901,17 @@ messageSelfDestructTypeImmediately = MessageSelfDestructType; //@disable_notification Pass true to disable notification for the message //@from_background Pass true if the message is sent from the background //@protect_content Pass true if the content of the message must be protected from forwarding and saving; for bots only +//@allow_paid_broadcast Pass true to allow the message to ignore regular broadcast limits for a small fee; for bots only //@update_order_of_installed_sticker_sets Pass true if the user explicitly chosen a sticker or a custom emoji from an installed sticker set; applicable only to sendMessage and sendMessageAlbum //@scheduling_state Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, live location messages and self-destructing messages can't be scheduled //@effect_id Identifier of the effect to apply to the message; pass 0 if none; applicable only to sendMessage and sendMessageAlbum in private chats //@sending_id Non-persistent identifier, which will be returned back in messageSendingStatePending object and can be used to match sent messages and corresponding updateNewMessage updates //@only_preview Pass true to get a fake message instead of actually sending them -messageSendOptions disable_notification:Bool from_background:Bool protect_content:Bool update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState effect_id:int64 sending_id:int32 only_preview:Bool = MessageSendOptions; +messageSendOptions disable_notification:Bool from_background:Bool protect_content:Bool allow_paid_broadcast:Bool update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState effect_id:int64 sending_id:int32 only_preview:Bool = MessageSendOptions; //@description Options to be used when a message content is copied without reference to the original sender. Service messages, messages with messageInvoice, messagePaidMedia, messageGiveaway, or messageGiveawayWinners content can't be copied -//@send_copy True, if content of the message needs to be copied without reference to the original sender. Always true if the message is forwarded to a secret chat or is local +//@send_copy True, if content of the message needs to be copied without reference to the original sender. Always true if the message is forwarded to a secret chat or is local. +//-Use messageProperties.can_be_saved and messageProperties.can_be_copied_to_secret_chat to check whether the message is suitable //@replace_caption True, if media caption of the message copy needs to be replaced. Ignored if send_copy is false //@new_caption New message caption; pass null to copy message without caption. Ignored if replace_caption is false //@new_show_caption_above_media True, if new caption must be shown above the media; otherwise, new caption must be shown below the media; not supported in secret chats. Ignored if replace_caption is false @@ -3994,7 +3998,7 @@ inputMessageSticker sticker:InputFile thumbnail:inputThumbnail width:int32 heigh inputMessageVideo video:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector duration:int32 width:int32 height:int32 supports_streaming:Bool caption:formattedText show_caption_above_media:Bool self_destruct_type:MessageSelfDestructType has_spoiler:Bool = InputMessageContent; //@description A video note message -//@video_note Video note to be sent +//@video_note Video note to be sent. The video is expected to be encoded to MPEG4 format with H.264 codec and have no data outside of the visible circle //@thumbnail Video thumbnail; may be null if empty; pass null to skip thumbnail uploading //@duration Duration of the video, in seconds; 0-60 //@length Video width and height; must be positive and not greater than 640 @@ -4071,7 +4075,7 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool cop //@can_be_copied_to_secret_chat True, if content of the message can be copied to a secret chat using inputMessageForwarded or forwardMessages with copy options //@can_be_deleted_only_for_self True, if the message can be deleted only for the current user while other users will continue to see it using the method deleteMessages with revoke == false //@can_be_deleted_for_all_users True, if the message can be deleted for all users using the method deleteMessages with revoke == true -//@can_be_edited True, if the message can be edited using the methods editMessageText, editMessageMedia, editMessageCaption, or editMessageReplyMarkup. +//@can_be_edited True, if the message can be edited using the methods editMessageText, editMessageCaption, or editMessageReplyMarkup. //-For live location and poll messages this fields shows whether editMessageLiveLocation or stopPoll can be used with this message //@can_be_forwarded True, if the message can be forwarded using inputMessageForwarded or forwardMessages //@can_be_paid True, if the message can be paid using inputInvoiceMessage @@ -4080,6 +4084,7 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool cop //@can_be_replied_in_another_chat True, if the message can be replied in another chat or forum topic using inputMessageReplyToExternalMessage //@can_be_saved True, if content of the message can be saved locally or copied using inputMessageForwarded or forwardMessages with copy options //@can_be_shared_in_story True, if the message can be shared in a story using inputStoryAreaTypeMessage +//@can_edit_media True, if the message can be edited using the method editMessageMedia //@can_edit_scheduling_state True, if scheduling state of the message can be edited //@can_get_embedding_code True, if code for message embedding can be received using getMessageEmbeddingCode //@can_get_link True, if a link can be generated for the message using getMessageLink @@ -4094,7 +4099,7 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool cop //@can_report_supergroup_spam True, if the message can be reported using reportSupergroupSpam //@can_set_fact_check True, if fact check for the message can be changed through setMessageFactCheck //@need_show_statistics True, if message statistics must be available from context menu of the message -messageProperties can_be_copied_to_secret_chat:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_paid:Bool can_be_pinned:Bool can_be_replied:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_shared_in_story:Bool can_edit_scheduling_state:Bool can_get_embedding_code:Bool can_get_link:Bool can_get_media_timestamp_links:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_statistics:Bool can_get_viewers:Bool can_recognize_speech:Bool can_report_chat:Bool can_report_reactions:Bool can_report_supergroup_spam:Bool can_set_fact_check:Bool need_show_statistics:Bool = MessageProperties; +messageProperties can_be_copied_to_secret_chat:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_paid:Bool can_be_pinned:Bool can_be_replied:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_shared_in_story:Bool can_edit_media:Bool can_edit_scheduling_state:Bool can_get_embedding_code:Bool can_get_link:Bool can_get_media_timestamp_links:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_statistics:Bool can_get_viewers:Bool can_recognize_speech:Bool can_report_chat:Bool can_report_reactions:Bool can_report_supergroup_spam:Bool can_set_fact_check:Bool need_show_statistics:Bool = MessageProperties; //@class SearchMessagesFilter @description Represents a filter for message search results @@ -5045,7 +5050,7 @@ speechRecognitionResultError error:error = SpeechRecognitionResult; businessConnection id:string user_id:int53 user_chat_id:int53 date:int32 can_reply:Bool is_enabled:Bool = BusinessConnection; -//@description Describes a color to highlight a bot added to attachment menu @light_color Color in the RGB24 format for light themes @dark_color Color in the RGB24 format for dark themes +//@description Describes a color to highlight a bot added to attachment menu @light_color Color in the RGB format for light themes @dark_color Color in the RGB format for dark themes attachmentMenuBotColor light_color:int32 dark_color:int32 = AttachmentMenuBotColor; //@description Represents a bot, which can be added to attachment or side menu @@ -5848,18 +5853,13 @@ premiumState state:formattedText payment_options:vector = StorePaymentPurpose; +//@text Text to show along with the gift codes; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed +storePaymentPurposePremiumGiftCodes boosted_chat_id:int53 currency:string amount:int53 user_ids:vector text:formattedText = StorePaymentPurpose; //@description The user creating a Telegram Premium giveaway //@parameters Giveaway parameters @@ -5897,7 +5897,8 @@ storePaymentPurposeGiftedStars user_id:int53 currency:string amount:int53 star_c //@amount Paid amount, in the smallest units of the currency //@user_ids Identifiers of the users which can activate the gift codes //@month_count Number of months the Telegram Premium subscription will be active for the users -telegramPaymentPurposePremiumGiftCodes boosted_chat_id:int53 currency:string amount:int53 user_ids:vector month_count:int32 = TelegramPaymentPurpose; +//@text Text to show along with the gift codes; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed +telegramPaymentPurposePremiumGiftCodes boosted_chat_id:int53 currency:string amount:int53 user_ids:vector month_count:int32 text:formattedText = TelegramPaymentPurpose; //@description The user creating a Telegram Premium giveaway //@parameters Giveaway parameters @@ -5980,16 +5981,16 @@ pushReceiverId id:int64 = PushReceiverId; //@class BackgroundFill @description Describes a fill of a background -//@description Describes a solid fill of a background @color A color of the background in the RGB24 format +//@description Describes a solid fill of a background @color A color of the background in the RGB format backgroundFillSolid color:int32 = BackgroundFill; //@description Describes a gradient fill of a background -//@top_color A top color of the background in the RGB24 format -//@bottom_color A bottom color of the background in the RGB24 format +//@top_color A top color of the background in the RGB format +//@bottom_color A bottom color of the background in the RGB format //@rotation_angle Clockwise rotation angle of the gradient, in degrees; 0-359. Must always be divisible by 45 backgroundFillGradient top_color:int32 bottom_color:int32 rotation_angle:int32 = BackgroundFill; -//@description Describes a freeform gradient fill of a background @colors A list of 3 or 4 colors of the freeform gradient in the RGB24 format +//@description Describes a freeform gradient fill of a background @colors A list of 3 or 4 colors of the freeform gradient in the RGB format backgroundFillFreeformGradient colors:vector = BackgroundFill; @@ -6824,7 +6825,8 @@ internalLinkTypePhoneNumberConfirmation hash:string phone_number:string = Intern //@referrer Referrer specified in the link internalLinkTypePremiumFeatures referrer:string = InternalLinkType; -//@description The link is a link to the screen for gifting Telegram Premium subscriptions to friends via inputInvoiceTelegram payments or in-store purchases @referrer Referrer specified in the link +//@description The link is a link to the screen for gifting Telegram Premium subscriptions to friends via inputInvoiceTelegram with telegramPaymentPurposePremiumGiftCodes payments or in-store purchases +//@referrer Referrer specified in the link internalLinkTypePremiumGift referrer:string = InternalLinkType; //@description The link is a link with a Telegram Premium gift code. Call checkPremiumGiftCode with the given code to process the link. @@ -7557,7 +7559,10 @@ updateNewMessage message:message = Update; //@message_id A temporary message identifier updateMessageSendAcknowledged chat_id:int53 message_id:int53 = Update; -//@description A message has been successfully sent @message The sent message. Usually only the message identifier, date, and content are changed, but almost all other fields can also change @old_message_id The previous temporary message identifier +//@description A message has been successfully sent +//@message The sent message. Almost any field of the new message can be different from the corresponding field of the original message. +//-For example, the field scheduling_state may change, making the message scheduled, or non-scheduled +//@old_message_id The previous temporary message identifier updateMessageSendSucceeded message:message old_message_id:int53 = Update; //@description A message failed to send. Be aware that some messages being sent can be irrecoverably deleted, in which case updateDeleteMessages will be received instead of this update @@ -7606,6 +7611,11 @@ updateMessageFactCheck chat_id:int53 message_id:int53 fact_check:factCheck = Upd //@message_id Identifier of the message with live location updateMessageLiveLocationViewed chat_id:int53 message_id:int53 = Update; +//@description An automatically scheduled message with video has been successfully sent after conversion +//@chat_id Identifier of the chat with the message +//@message_id Identifier of the sent message +updateVideoPublished chat_id:int53 message_id:int53 = Update; + //@description A new chat has been loaded/created. This update is guaranteed to come before the chat identifier is returned to the application. The chat field changes will be reported through separate updates @chat The chat updateNewChat chat:chat = Update; @@ -7981,9 +7991,6 @@ updateConnectionState state:ConnectionState = Update; //@description New terms of service must be accepted by the user. If the terms of service are declined, then the deleteAccount method must be called with the reason "Decline ToS update" @terms_of_service_id Identifier of the terms of service @terms_of_service The new terms of service updateTermsOfService terms_of_service_id:string terms_of_service:termsOfService = Update; -//@description The list of users nearby has changed. The update is guaranteed to be sent only 60 seconds after a successful searchChatsNearby request @users_nearby The new list of users nearby -updateUsersNearby users_nearby:vector = Update; - //@description The first unconfirmed session has changed @session The unconfirmed session; may be null if none updateUnconfirmedSession session:unconfirmedSession = Update; @@ -8515,9 +8522,6 @@ searchChats query:string limit:int32 = Chats; //@description Searches for the specified query in the title and username of already known chats via request to the server. Returns chats in the order seen in the main chat list @query Query to search for @limit The maximum number of chats to be returned searchChatsOnServer query:string limit:int32 = Chats; -//@description Returns a list of users and location-based supergroups nearby. The method was disabled and returns an empty list of chats now @location Current user location -searchChatsNearby location:location = ChatsNearby; - //@description Returns a list of channel chats recommended to the current user getRecommendedChats = Chats; @@ -8715,10 +8719,11 @@ searchOutgoingDocumentMessages query:string limit:int32 = FoundMessages; searchPublicMessagesByTag tag:string offset:string limit:int32 = FoundMessages; //@description Searches for public stories containing the given hashtag or cashtag. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit +//@story_sender_chat_id Identifier of the chat that posted the stories to search for; pass 0 to search stories in all chats //@tag Hashtag or cashtag to search for //@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results //@limit The maximum number of stories to be returned; up to 100. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit -searchPublicStoriesByTag tag:string offset:string limit:int32 = FoundStories; +searchPublicStoriesByTag story_sender_chat_id:int53 tag:string offset:string limit:int32 = FoundStories; //@description Searches for public stories by the given address location. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit //@address Address of the location @@ -8787,7 +8792,7 @@ getChatMessagePosition chat_id:int53 message_id:int53 filter:SearchMessagesFilte //@description Returns all scheduled messages in a chat. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id) @chat_id Chat identifier getChatScheduledMessages chat_id:int53 = Messages; -//@description Returns sponsored messages to be shown in a chat; for channel chats only @chat_id Identifier of the chat +//@description Returns sponsored messages to be shown in a chat; for channel chats and chats with bots only @chat_id Identifier of the chat getChatSponsoredMessages chat_id:int53 = SponsoredMessages; //@description Informs TDLib that the user opened the sponsored chat via the button, the name, the chat photo, a mention in the sponsored message text, or the media in the sponsored message @@ -8904,7 +8909,8 @@ sendInlineQueryResultMessage chat_id:int53 message_thread_id:int53 reply_to:Inpu //@from_chat_id Identifier of the chat from which to forward messages //@message_ids Identifiers of the messages to forward. Message identifiers must be in a strictly increasing order. At most 100 messages can be forwarded simultaneously. A message can be forwarded only if messageProperties.can_be_forwarded //@options Options to be used to send the messages; pass null to use default options -//@send_copy Pass true to copy content of the messages without reference to the original sender. Always true if the messages are forwarded to a secret chat or are local +//@send_copy Pass true to copy content of the messages without reference to the original sender. Always true if the messages are forwarded to a secret chat or are local. +//-Use messageProperties.can_be_saved and messageProperties.can_be_copied_to_secret_chat to check whether the message is suitable //@remove_caption Pass true to remove media captions of message copies. Ignored if send_copy is false forwardMessages chat_id:int53 message_thread_id:int53 from_chat_id:int53 message_ids:vector options:messageSendOptions send_copy:Bool remove_caption:Bool = Messages; @@ -8968,11 +8974,10 @@ editMessageText chat_id:int53 message_id:int53 reply_markup:ReplyMarkup input_me //@proximity_alert_radius The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled editMessageLiveLocation chat_id:int53 message_id:int53 reply_markup:ReplyMarkup location:location live_period:int32 heading:int32 proximity_alert_radius:int32 = Message; -//@description Edits the content of a message with an animation, an audio, a document, a photo or a video, including message caption. If only the caption needs to be edited, use editMessageCaption instead. -//-The media can't be edited if the message was set to self-destruct or to a self-destructing media. The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa. -//-Returns the edited message after the edit is completed on the server side +//@description Edits the media content of a message, including message caption. If only the caption needs to be edited, use editMessageCaption instead. +//-The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa. Returns the edited message after the edit is completed on the server side //@chat_id The chat the message belongs to -//@message_id Identifier of the message. Use messageProperties.can_be_edited to check whether the message can be edited +//@message_id Identifier of the message. Use messageProperties.can_edit_media to check whether the message can be edited //@reply_markup The new message reply markup; pass null if none; for bots only //@input_message_content New content of the message. Must be one of the following types: inputMessageAnimation, inputMessageAudio, inputMessageDocument, inputMessagePhoto or inputMessageVideo editMessageMedia chat_id:int53 message_id:int53 reply_markup:ReplyMarkup input_message_content:InputMessageContent = Message; @@ -9007,7 +9012,7 @@ editInlineMessageText inline_message_id:string reply_markup:ReplyMarkup input_me //@proximity_alert_radius The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled editInlineMessageLiveLocation inline_message_id:string reply_markup:ReplyMarkup location:location live_period:int32 heading:int32 proximity_alert_radius:int32 = Ok; -//@description Edits the content of a message with an animation, an audio, a document, a photo or a video in an inline message sent via a bot; for bots only +//@description Edits the media content of a message with a text, an animation, an audio, a document, a photo or a video in an inline message sent via a bot; for bots only //@inline_message_id Inline message identifier //@reply_markup The new message reply markup; pass null if none; for bots only //@input_message_content New content of the message. Must be one of the following types: inputMessageAnimation, inputMessageAudio, inputMessageDocument, inputMessagePhoto or inputMessageVideo @@ -9028,9 +9033,10 @@ editInlineMessageReplyMarkup inline_message_id:string reply_markup:ReplyMarkup = //@description Edits the time when a scheduled message will be sent. Scheduling state of all messages in the same album or forwarded together with the message will be also changed //@chat_id The chat the message belongs to //@message_id Identifier of the message. Use messageProperties.can_edit_scheduling_state to check whether the message is suitable -//@scheduling_state The new message scheduling state; pass null to send the message immediately +//@scheduling_state The new message scheduling state; pass null to send the message immediately. Must be null for messages in the state messageSchedulingStateSendWhenVideoProcessed editMessageSchedulingState chat_id:int53 message_id:int53 scheduling_state:MessageSchedulingState = Ok; + //@description Changes the fact-check of a message. Can be only used if messageProperties.can_set_fact_check == true //@chat_id The channel chat the message belongs to //@message_id Identifier of the message @@ -9080,7 +9086,7 @@ editBusinessMessageText business_connection_id:string chat_id:int53 message_id:i //@proximity_alert_radius The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled editBusinessMessageLiveLocation business_connection_id:string chat_id:int53 message_id:int53 reply_markup:ReplyMarkup location:location live_period:int32 heading:int32 proximity_alert_radius:int32 = BusinessMessage; -//@description Edits the content of a message with an animation, an audio, a document, a photo or a video in a message sent on behalf of a business account; for bots only +//@description Edits the media content of a message with a text, an animation, an audio, a document, a photo or a video in a message sent on behalf of a business account; for bots only //@business_connection_id Unique identifier of business connection on behalf of which the message was sent //@chat_id The chat the message belongs to //@message_id Identifier of the message @@ -9173,7 +9179,7 @@ addQuickReplyShortcutMessageAlbum shortcut_name:string reply_to_message_id:int53 readdQuickReplyShortcutMessages shortcut_name:string message_ids:vector = QuickReplyMessages; //@description Asynchronously edits the text, media or caption of a quick reply message. Use quickReplyMessage.can_be_edited to check whether a message can be edited. -//-Text message can be edited only to a text message. The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa +//-Media message can be edited only to a media message. The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa //@shortcut_id Unique identifier of the quick reply shortcut with the message //@message_id Identifier of the message //@input_message_content New content of the message. Must be one of the following types: inputMessageText, inputMessageAnimation, inputMessageAudio, inputMessageDocument, inputMessagePhoto or inputMessageVideo @@ -9296,7 +9302,7 @@ togglePaidMessageReactionIsAnonymous chat_id:int53 message_id:int53 is_anonymous //@description Sets reactions on a message; for bots only //@chat_id Identifier of the chat to which the message belongs //@message_id Identifier of the message -//@reaction_types Types of the reaction to set +//@reaction_types Types of the reaction to set; pass an empty list to remove the reactions //@is_big Pass true if the reactions are added with a big animation setMessageReactions chat_id:int53 message_id:int53 reaction_types:vector is_big:Bool = Ok; @@ -10701,8 +10707,8 @@ getStickerSet set_id:int64 = StickerSet; //@description Returns name of a sticker set by its identifier @set_id Identifier of the sticker set getStickerSetName set_id:int64 = Text; -//@description Searches for a sticker set by its name @name Name of the sticker set -searchStickerSet name:string = StickerSet; +//@description Searches for a sticker set by its name @name Name of the sticker set @ignore_cache Pass true to ignore local cache of sticker sets and always send a network request +searchStickerSet name:string ignore_cache:Bool = StickerSet; //@description Searches for installed sticker sets by looking for specified query in their title and name @sticker_type Type of the sticker sets to search for @query Query to search for @limit The maximum number of sticker sets to return searchInstalledStickerSets sticker_type:StickerType query:string limit:int32 = StickerSets; @@ -10861,9 +10867,6 @@ setPersonalChat chat_id:int53 = Ok; //@description Changes the emoji status of the current user; for Telegram Premium users only @emoji_status New emoji status; pass null to switch to the default badge setEmojiStatus emoji_status:emojiStatus = Ok; -//@description Changes the location of the current user. Needs to be called if getOption("is_location_visible") is true and location changes for more than 1 kilometer. Must not be called if the user has a business location @location The new location of the user -setLocation location:location = Ok; - //@description Toggles whether the current user has sponsored messages enabled. The setting has no effect for users without Telegram Premium for which sponsored messages are always enabled //@has_sponsored_messages_enabled Pass true to enable sponsored messages for the current user; false to disable them toggleHasSponsoredMessagesEnabled has_sponsored_messages_enabled:Bool = Ok; @@ -11250,7 +11253,7 @@ deleteSavedCredentials = Ok; //@description Returns gifts that can be sent to other users getAvailableGifts = Gifts; -//@description Send a gift to another user +//@description Sends a gift to another user. May return an error with a message "STARGIFT_USAGE_LIMITED" if the gift was sold out //@gift_id Identifier of the gift to send //@user_id Identifier of the user that will receive the gift //@text Text to show along with the gift; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed @@ -11443,15 +11446,20 @@ reportChatPhoto chat_id:int53 file_id:int32 reason:ReportReason text:string = Ok reportMessageReactions chat_id:int53 message_id:int53 sender_id:MessageSender = Ok; -//@description Returns detailed revenue statistics about a chat. Currently, this method can be used only for channels if supergroupFullInfo.can_get_revenue_statistics == true @chat_id Chat identifier @is_dark Pass true if a dark theme is used by the application +//@description Returns detailed revenue statistics about a chat. Currently, this method can be used only +//-for channels if supergroupFullInfo.can_get_revenue_statistics == true or bots if userFullInfo.bot_info.can_get_revenue_statistics == true +//@chat_id Chat identifier +//@is_dark Pass true if a dark theme is used by the application getChatRevenueStatistics chat_id:int53 is_dark:Bool = ChatRevenueStatistics; -//@description Returns a URL for chat revenue withdrawal; requires owner privileges in the chat. Currently, this method can be used only for channels if supergroupFullInfo.can_get_revenue_statistics == true and getOption("can_withdraw_chat_revenue") +//@description Returns a URL for chat revenue withdrawal; requires owner privileges in the channel chat or the bot. Currently, this method can be used only +//-if getOption("can_withdraw_chat_revenue") for channels with supergroupFullInfo.can_get_revenue_statistics == true or bots with userFullInfo.bot_info.can_get_revenue_statistics == true //@chat_id Chat identifier //@password The 2-step verification password of the current user getChatRevenueWithdrawalUrl chat_id:int53 password:string = HttpUrl; -//@description Returns the list of revenue transactions for a chat. Currently, this method can be used only for channels if supergroupFullInfo.can_get_revenue_statistics == true +//@description Returns the list of revenue transactions for a chat. Currently, this method can be used only +//-for channels if supergroupFullInfo.can_get_revenue_statistics == true or bots if userFullInfo.bot_info.can_get_revenue_statistics == true //@chat_id Chat identifier //@offset Number of transactions to skip //@limit The maximum number of transactions to be returned; up to 200 From 098715f4f0183925d083742ed32d3c15470b197c Mon Sep 17 00:00:00 2001 From: c0re100 Date: Sun, 17 Nov 2024 21:57:42 +0800 Subject: [PATCH 28/54] Update to TDLib 1.8.40 --- client/function.go | 286 ++++++++++-- client/type.go | 979 +++++++++++++++++++++++++++++++++--------- client/unmarshaler.go | 413 ++++++++++++++---- data/td_api.tl | 287 +++++++++---- 4 files changed, 1572 insertions(+), 393 deletions(-) diff --git a/client/function.go b/client/function.go index 087d17c..5159be1 100755 --- a/client/function.go +++ b/client/function.go @@ -7045,6 +7045,67 @@ func (client *Client) AnswerInlineQuery(req *AnswerInlineQueryRequest) (*Ok, err return UnmarshalOk(result.Data) } +type SavePreparedInlineMessageRequest struct { + // Identifier of the user + UserId int64 `json:"user_id"` + // The description of the message + Result InputInlineQueryResult `json:"result"` + // Types of the chats to which the message can be sent + ChatTypes *TargetChatTypes `json:"chat_types"` +} + +// Saves an inline message to be sent by the given user; for bots only +func (client *Client) SavePreparedInlineMessage(req *SavePreparedInlineMessageRequest) (*PreparedInlineMessageId, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "savePreparedInlineMessage", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "result": req.Result, + "chat_types": req.ChatTypes, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPreparedInlineMessageId(result.Data) +} + +type GetPreparedInlineMessageRequest struct { + // Identifier of the bot that created the message + BotUserId int64 `json:"bot_user_id"` + // Identifier of the prepared message + PreparedMessageId string `json:"prepared_message_id"` +} + +// Saves an inline message to be sent by the given user; for bots only +func (client *Client) GetPreparedInlineMessage(req *GetPreparedInlineMessageRequest) (*PreparedInlineMessage, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getPreparedInlineMessage", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "prepared_message_id": req.PreparedMessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPreparedInlineMessage(result.Data) +} + type GetGrossingWebAppBotsRequest struct { // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results Offset string `json:"offset"` @@ -7103,6 +7164,32 @@ func (client *Client) SearchWebApp(req *SearchWebAppRequest) (*FoundWebApp, erro return UnmarshalFoundWebApp(result.Data) } +type GetWebAppPlaceholderRequest struct { + // Identifier of the target bot + BotUserId int64 `json:"bot_user_id"` +} + +// Returns a default placeholder for Web Apps of a bot; this is an offline request. Returns a 404 error if the placeholder isn't known +func (client *Client) GetWebAppPlaceholder(req *GetWebAppPlaceholderRequest) (*Outline, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getWebAppPlaceholder", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOutline(result.Data) +} + type GetWebAppLinkUrlRequest struct { // Identifier of the chat in which the link was clicked; pass 0 if none ChatId int64 `json:"chat_id"` @@ -7112,12 +7199,10 @@ type GetWebAppLinkUrlRequest struct { WebAppShortName string `json:"web_app_short_name"` // Start parameter from internalLinkTypeWebApp StartParameter string `json:"start_parameter"` - // Preferred Web App theme; pass null to use the default theme - Theme *ThemeParameters `json:"theme"` - // Short name of the current application; 0-64 English letters, digits, and underscores - ApplicationName string `json:"application_name"` // Pass true if the current user allowed the bot to send them messages AllowWriteAccess bool `json:"allow_write_access"` + // Parameters to use to open the Web App + Parameters *WebAppOpenParameters `json:"parameters"` } // Returns an HTTPS URL of a Web App to open after a link of the type internalLinkTypeWebApp is clicked @@ -7131,9 +7216,8 @@ func (client *Client) GetWebAppLinkUrl(req *GetWebAppLinkUrlRequest) (*HttpUrl, "bot_user_id": req.BotUserId, "web_app_short_name": req.WebAppShortName, "start_parameter": req.StartParameter, - "theme": req.Theme, - "application_name": req.ApplicationName, "allow_write_access": req.AllowWriteAccess, + "parameters": req.Parameters, }, }) if err != nil { @@ -7154,10 +7238,8 @@ type GetMainWebAppRequest struct { BotUserId int64 `json:"bot_user_id"` // Start parameter from internalLinkTypeMainWebApp StartParameter string `json:"start_parameter"` - // Preferred Web App theme; pass null to use the default theme - Theme *ThemeParameters `json:"theme"` - // Short name of the current application; 0-64 English letters, digits, and underscores - ApplicationName string `json:"application_name"` + // Parameters to use to open the Web App + Parameters *WebAppOpenParameters `json:"parameters"` } // Returns information needed to open the main Web App of a bot @@ -7170,8 +7252,7 @@ func (client *Client) GetMainWebApp(req *GetMainWebAppRequest) (*MainWebApp, err "chat_id": req.ChatId, "bot_user_id": req.BotUserId, "start_parameter": req.StartParameter, - "theme": req.Theme, - "application_name": req.ApplicationName, + "parameters": req.Parameters, }, }) if err != nil { @@ -7190,10 +7271,8 @@ type GetWebAppUrlRequest struct { BotUserId int64 `json:"bot_user_id"` // The URL from a keyboardButtonTypeWebApp button, inlineQueryResultsButtonTypeWebApp button, or an empty string when the bot is opened from the side menu Url string `json:"url"` - // Preferred Web App theme; pass null to use the default theme - Theme *ThemeParameters `json:"theme"` - // Short name of the current application; 0-64 English letters, digits, and underscores - ApplicationName string `json:"application_name"` + // Parameters to use to open the Web App + Parameters *WebAppOpenParameters `json:"parameters"` } // Returns an HTTPS URL of a Web App to open from the side menu, a keyboardButtonTypeWebApp button, or an inlineQueryResultsButtonTypeWebApp button @@ -7205,8 +7284,7 @@ func (client *Client) GetWebAppUrl(req *GetWebAppUrlRequest) (*HttpUrl, error) { Data: map[string]interface{}{ "bot_user_id": req.BotUserId, "url": req.Url, - "theme": req.Theme, - "application_name": req.ApplicationName, + "parameters": req.Parameters, }, }) if err != nil { @@ -7259,14 +7337,12 @@ type OpenWebAppRequest struct { BotUserId int64 `json:"bot_user_id"` // The URL from an inlineKeyboardButtonTypeWebApp button, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an empty string otherwise Url string `json:"url"` - // Preferred Web App theme; pass null to use the default theme - Theme *ThemeParameters `json:"theme"` - // Short name of the current application; 0-64 English letters, digits, and underscores - ApplicationName string `json:"application_name"` // If not 0, the message thread identifier in which the message will be sent MessageThreadId int64 `json:"message_thread_id"` // Information about the message or story to be replied in the message sent by the Web App; pass null if none ReplyTo InputMessageReplyTo `json:"reply_to"` + // Parameters to use to open the Web App + Parameters *WebAppOpenParameters `json:"parameters"` } // Informs TDLib that a Web App is being opened from the attachment menu, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an inlineKeyboardButtonTypeWebApp button. For each bot, a confirmation alert about data sent to the bot must be shown once @@ -7279,10 +7355,9 @@ func (client *Client) OpenWebApp(req *OpenWebAppRequest) (*WebAppInfo, error) { "chat_id": req.ChatId, "bot_user_id": req.BotUserId, "url": req.Url, - "theme": req.Theme, - "application_name": req.ApplicationName, "message_thread_id": req.MessageThreadId, "reply_to": req.ReplyTo, + "parameters": req.Parameters, }, }) if err != nil { @@ -7351,6 +7426,38 @@ func (client *Client) AnswerWebAppQuery(req *AnswerWebAppQueryRequest) (*SentWeb return UnmarshalSentWebAppMessage(result.Data) } +type CheckWebAppFileDownloadRequest struct { + // Identifier of the bot, providing the Web App + BotUserId int64 `json:"bot_user_id"` + // Name of the file + FileName string `json:"file_name"` + // URL of the file + Url string `json:"url"` +} + +// Checks whether a file can be downloaded and saved locally by Web App request +func (client *Client) CheckWebAppFileDownload(req *CheckWebAppFileDownloadRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "checkWebAppFileDownload", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "file_name": req.FileName, + "url": req.Url, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type GetCallbackQueryAnswerRequest struct { // Identifier of the chat with the message ChatId int64 `json:"chat_id"` @@ -13319,7 +13426,7 @@ type GetVideoChatRtmpUrlRequest struct { ChatId int64 `json:"chat_id"` } -// Returns RTMP URL for streaming to the chat; requires owner privileges +// Returns RTMP URL for streaming to the chat; requires can_manage_video_chats administrator right func (client *Client) GetVideoChatRtmpUrl(req *GetVideoChatRtmpUrlRequest) (*RtmpUrl, error) { result, err := client.Send(Request{ meta: meta{ @@ -14504,6 +14611,64 @@ func (client *Client) SuggestUserProfilePhoto(req *SuggestUserProfilePhotoReques return UnmarshalOk(result.Data) } +type ToggleBotCanManageEmojiStatusRequest struct { + // User identifier of the bot + BotUserId int64 `json:"bot_user_id"` + // Pass true if the bot is allowed to change emoji status of the user; pass false otherwise + CanManageEmojiStatus bool `json:"can_manage_emoji_status"` +} + +// Toggles whether the bot can manage emoji status of the current user +func (client *Client) ToggleBotCanManageEmojiStatus(req *ToggleBotCanManageEmojiStatusRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleBotCanManageEmojiStatus", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "can_manage_emoji_status": req.CanManageEmojiStatus, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetUserEmojiStatusRequest struct { + // Identifier of the user + UserId int64 `json:"user_id"` + // New emoji status; pass null to switch to the default badge + EmojiStatus *EmojiStatus `json:"emoji_status"` +} + +// Changes the emoji status of a user; for bots only +func (client *Client) SetUserEmojiStatus(req *SetUserEmojiStatusRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setUserEmojiStatus", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "emoji_status": req.EmojiStatus, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type SearchUserByPhoneNumberRequest struct { // Phone number to search for PhoneNumber string `json:"phone_number"` @@ -14591,6 +14756,38 @@ func (client *Client) GetUserProfilePhotos(req *GetUserProfilePhotosRequest) (*C return UnmarshalChatPhotos(result.Data) } +type GetStickerOutlineRequest struct { + // File identifier of the sticker + StickerFileId int32 `json:"sticker_file_id"` + // Pass true to get the outline scaled for animated emoji + ForAnimatedEmoji bool `json:"for_animated_emoji"` + // Pass true to get the outline scaled for clicked animated emoji message + ForClickedAnimatedEmojiMessage bool `json:"for_clicked_animated_emoji_message"` +} + +// Returns outline of a sticker; this is an offline request. Returns a 404 error if the outline isn't known +func (client *Client) GetStickerOutline(req *GetStickerOutlineRequest) (*Outline, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getStickerOutline", + }, + Data: map[string]interface{}{ + "sticker_file_id": req.StickerFileId, + "for_animated_emoji": req.ForAnimatedEmoji, + "for_clicked_animated_emoji_message": req.ForClickedAnimatedEmojiMessage, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOutline(result.Data) +} + type GetStickersRequest struct { // Type of the stickers to return StickerType StickerType `json:"sticker_type"` @@ -18585,6 +18782,8 @@ func (client *Client) GetUserGifts(req *GetUserGiftsRequest) (*UserGifts, error) } type CreateInvoiceLinkRequest struct { + // Unique identifier of business connection on behalf of which to send the request + BusinessConnectionId string `json:"business_connection_id"` // Information about the invoice of the type inputMessageInvoice Invoice InputMessageContent `json:"invoice"` } @@ -18596,6 +18795,7 @@ func (client *Client) CreateInvoiceLink(req *CreateInvoiceLinkRequest) (*HttpUrl Type: "createInvoiceLink", }, Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, "invoice": req.Invoice, }, }) @@ -21950,7 +22150,7 @@ type EditStarSubscriptionRequest struct { IsCanceled bool `json:"is_canceled"` } -// Cancels or reenables Telegram Star subscription to a channel +// Cancels or re-enables Telegram Star subscription func (client *Client) EditStarSubscription(req *EditStarSubscriptionRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -21972,12 +22172,44 @@ func (client *Client) EditStarSubscription(req *EditStarSubscriptionRequest) (*O return UnmarshalOk(result.Data) } +type EditUserStarSubscriptionRequest struct { + // User identifier + UserId int64 `json:"user_id"` + // Telegram payment identifier of the subscription + TelegramPaymentChargeId string `json:"telegram_payment_charge_id"` + // Pass true to cancel the subscription; pass false to allow the user to enable it + IsCanceled bool `json:"is_canceled"` +} + +// Cancels or re-enables Telegram Star subscription for a user; for bots only +func (client *Client) EditUserStarSubscription(req *EditUserStarSubscriptionRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editUserStarSubscription", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "telegram_payment_charge_id": req.TelegramPaymentChargeId, + "is_canceled": req.IsCanceled, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type ReuseStarSubscriptionRequest struct { // Identifier of the subscription SubscriptionId string `json:"subscription_id"` } -// Reuses an active subscription and joins the subscribed chat again +// Reuses an active Telegram Star subscription to a channel chat and joins the chat again func (client *Client) ReuseStarSubscription(req *ReuseStarSubscriptionRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ diff --git a/client/type.go b/client/type.go index 348df90..7f43b1a 100755 --- a/client/type.go +++ b/client/type.go @@ -23,6 +23,7 @@ const ( ClassBusinessAwayMessageSchedule = "BusinessAwayMessageSchedule" ClassChatPhotoStickerType = "ChatPhotoStickerType" ClassInputChatPhoto = "InputChatPhoto" + ClassStarSubscriptionType = "StarSubscriptionType" ClassStarTransactionDirection = "StarTransactionDirection" ClassBotTransactionPurpose = "BotTransactionPurpose" ClassChatTransactionPurpose = "ChatTransactionPurpose" @@ -58,6 +59,7 @@ const ( ClassInlineKeyboardButtonType = "InlineKeyboardButtonType" ClassReplyMarkup = "ReplyMarkup" ClassLoginUrlInfo = "LoginUrlInfo" + ClassWebAppOpenMode = "WebAppOpenMode" ClassSavedMessagesTopicType = "SavedMessagesTopicType" ClassRichText = "RichText" ClassPageBlockHorizontalAlignment = "PageBlockHorizontalAlignment" @@ -108,6 +110,7 @@ const ( ClassDiceStickers = "DiceStickers" ClassSpeechRecognitionResult = "SpeechRecognitionResult" ClassBotWriteAccessAllowReason = "BotWriteAccessAllowReason" + ClassTargetChat = "TargetChat" ClassInputInlineQueryResult = "InputInlineQueryResult" ClassInlineQueryResult = "InlineQueryResult" ClassInlineQueryResultsButtonType = "InlineQueryResultsButtonType" @@ -144,7 +147,6 @@ const ( ClassReportReason = "ReportReason" ClassReportChatResult = "ReportChatResult" ClassReportStoryResult = "ReportStoryResult" - ClassTargetChat = "TargetChat" ClassInternalLinkType = "InternalLinkType" ClassBlockList = "BlockList" ClassFileType = "FileType" @@ -186,6 +188,7 @@ const ( ClassThumbnail = "Thumbnail" ClassMaskPosition = "MaskPosition" ClassClosedVectorPath = "ClosedVectorPath" + ClassOutline = "Outline" ClassPollOption = "PollOption" ClassAnimation = "Animation" ClassAudio = "Audio" @@ -346,9 +349,11 @@ const ( ClassCreatedBasicGroupChat = "CreatedBasicGroupChat" ClassKeyboardButton = "KeyboardButton" ClassInlineKeyboardButton = "InlineKeyboardButton" + ClassThemeParameters = "ThemeParameters" ClassFoundWebApp = "FoundWebApp" ClassWebAppInfo = "WebAppInfo" ClassMainWebApp = "MainWebApp" + ClassWebAppOpenParameters = "WebAppOpenParameters" ClassMessageThreadInfo = "MessageThreadInfo" ClassSavedMessagesTopic = "SavedMessagesTopic" ClassForumTopicIcon = "ForumTopicIcon" @@ -373,7 +378,6 @@ const ( ClassBankCardInfo = "BankCardInfo" ClassAddress = "Address" ClassLocationAddress = "LocationAddress" - ClassThemeParameters = "ThemeParameters" ClassLabeledPricePart = "LabeledPricePart" ClassInvoice = "Invoice" ClassOrderInfo = "OrderInfo" @@ -474,8 +478,11 @@ const ( ClassSentWebAppMessage = "SentWebAppMessage" ClassHttpUrl = "HttpUrl" ClassUserLink = "UserLink" + ClassTargetChatTypes = "TargetChatTypes" ClassInlineQueryResultsButton = "InlineQueryResultsButton" ClassInlineQueryResults = "InlineQueryResults" + ClassPreparedInlineMessageId = "PreparedInlineMessageId" + ClassPreparedInlineMessage = "PreparedInlineMessage" ClassCallbackQueryAnswer = "CallbackQueryAnswer" ClassCustomRequestResult = "CustomRequestResult" ClassGameHighScore = "GameHighScore" @@ -642,6 +649,7 @@ const ( TypeStickerFullTypeMask = "stickerFullTypeMask" TypeStickerFullTypeCustomEmoji = "stickerFullTypeCustomEmoji" TypeClosedVectorPath = "closedVectorPath" + TypeOutline = "outline" TypePollOption = "pollOption" TypePollTypeRegular = "pollTypeRegular" TypePollTypeQuiz = "pollTypeQuiz" @@ -705,6 +713,8 @@ const ( TypeInputChatPhotoSticker = "inputChatPhotoSticker" TypeChatPermissions = "chatPermissions" TypeChatAdministratorRights = "chatAdministratorRights" + TypeStarSubscriptionTypeChannel = "starSubscriptionTypeChannel" + TypeStarSubscriptionTypeBot = "starSubscriptionTypeBot" TypeStarSubscriptionPricing = "starSubscriptionPricing" TypeStarSubscription = "starSubscription" TypeStarSubscriptions = "starSubscriptions" @@ -727,6 +737,7 @@ const ( TypeStarTransactionDirectionOutgoing = "starTransactionDirectionOutgoing" TypeBotTransactionPurposePaidMedia = "botTransactionPurposePaidMedia" TypeBotTransactionPurposeInvoicePayment = "botTransactionPurposeInvoicePayment" + TypeBotTransactionPurposeSubscription = "botTransactionPurposeSubscription" TypeChatTransactionPurposePaidMedia = "chatTransactionPurposePaidMedia" TypeChatTransactionPurposeJoin = "chatTransactionPurposeJoin" TypeChatTransactionPurposeReaction = "chatTransactionPurposeReaction" @@ -961,9 +972,14 @@ const ( TypeReplyMarkupInlineKeyboard = "replyMarkupInlineKeyboard" TypeLoginUrlInfoOpen = "loginUrlInfoOpen" TypeLoginUrlInfoRequestConfirmation = "loginUrlInfoRequestConfirmation" + TypeThemeParameters = "themeParameters" + TypeWebAppOpenModeCompact = "webAppOpenModeCompact" + TypeWebAppOpenModeFullSize = "webAppOpenModeFullSize" + TypeWebAppOpenModeFullScreen = "webAppOpenModeFullScreen" TypeFoundWebApp = "foundWebApp" TypeWebAppInfo = "webAppInfo" TypeMainWebApp = "mainWebApp" + TypeWebAppOpenParameters = "webAppOpenParameters" TypeMessageThreadInfo = "messageThreadInfo" TypeSavedMessagesTopicTypeMyNotes = "savedMessagesTopicTypeMyNotes" TypeSavedMessagesTopicTypeAuthorHidden = "savedMessagesTopicTypeAuthorHidden" @@ -1078,7 +1094,6 @@ const ( TypeBankCardInfo = "bankCardInfo" TypeAddress = "address" TypeLocationAddress = "locationAddress" - TypeThemeParameters = "themeParameters" TypeLabeledPricePart = "labeledPricePart" TypeInvoice = "invoice" TypeOrderInfo = "orderInfo" @@ -1094,6 +1109,7 @@ const ( TypePaymentOption = "paymentOption" TypePaymentFormTypeRegular = "paymentFormTypeRegular" TypePaymentFormTypeStars = "paymentFormTypeStars" + TypePaymentFormTypeStarSubscription = "paymentFormTypeStarSubscription" TypePaymentForm = "paymentForm" TypeValidatedOrderInfo = "validatedOrderInfo" TypePaymentResult = "paymentResult" @@ -1490,6 +1506,10 @@ const ( TypeBotWriteAccessAllowReasonAcceptedRequest = "botWriteAccessAllowReasonAcceptedRequest" TypeHttpUrl = "httpUrl" TypeUserLink = "userLink" + TypeTargetChatTypes = "targetChatTypes" + TypeTargetChatCurrent = "targetChatCurrent" + TypeTargetChatChosen = "targetChatChosen" + TypeTargetChatInternalLink = "targetChatInternalLink" TypeInputInlineQueryResultAnimation = "inputInlineQueryResultAnimation" TypeInputInlineQueryResultArticle = "inputInlineQueryResultArticle" TypeInputInlineQueryResultAudio = "inputInlineQueryResultAudio" @@ -1518,6 +1538,8 @@ const ( TypeInlineQueryResultsButtonTypeWebApp = "inlineQueryResultsButtonTypeWebApp" TypeInlineQueryResultsButton = "inlineQueryResultsButton" TypeInlineQueryResults = "inlineQueryResults" + TypePreparedInlineMessageId = "preparedInlineMessageId" + TypePreparedInlineMessage = "preparedInlineMessage" TypeCallbackQueryPayloadData = "callbackQueryPayloadData" TypeCallbackQueryPayloadDataWithPassword = "callbackQueryPayloadDataWithPassword" TypeCallbackQueryPayloadGame = "callbackQueryPayloadGame" @@ -1788,11 +1810,13 @@ const ( TypeStoryPrivacySettingsSelectedUsers = "storyPrivacySettingsSelectedUsers" TypeUserPrivacySettingRuleAllowAll = "userPrivacySettingRuleAllowAll" TypeUserPrivacySettingRuleAllowContacts = "userPrivacySettingRuleAllowContacts" + TypeUserPrivacySettingRuleAllowBots = "userPrivacySettingRuleAllowBots" TypeUserPrivacySettingRuleAllowPremiumUsers = "userPrivacySettingRuleAllowPremiumUsers" TypeUserPrivacySettingRuleAllowUsers = "userPrivacySettingRuleAllowUsers" TypeUserPrivacySettingRuleAllowChatMembers = "userPrivacySettingRuleAllowChatMembers" TypeUserPrivacySettingRuleRestrictAll = "userPrivacySettingRuleRestrictAll" TypeUserPrivacySettingRuleRestrictContacts = "userPrivacySettingRuleRestrictContacts" + TypeUserPrivacySettingRuleRestrictBots = "userPrivacySettingRuleRestrictBots" TypeUserPrivacySettingRuleRestrictUsers = "userPrivacySettingRuleRestrictUsers" TypeUserPrivacySettingRuleRestrictChatMembers = "userPrivacySettingRuleRestrictChatMembers" TypeUserPrivacySettingRules = "userPrivacySettingRules" @@ -1807,6 +1831,7 @@ const ( TypeUserPrivacySettingAllowPeerToPeerCalls = "userPrivacySettingAllowPeerToPeerCalls" TypeUserPrivacySettingAllowFindingByPhoneNumber = "userPrivacySettingAllowFindingByPhoneNumber" TypeUserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages = "userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages" + TypeUserPrivacySettingAutosaveGifts = "userPrivacySettingAutosaveGifts" TypeReadDatePrivacySettings = "readDatePrivacySettings" TypeNewChatPrivacySettings = "newChatPrivacySettings" TypeCanSendMessageToUserResultOk = "canSendMessageToUserResultOk" @@ -1853,9 +1878,6 @@ const ( TypeReportStoryResultOk = "reportStoryResultOk" TypeReportStoryResultOptionRequired = "reportStoryResultOptionRequired" TypeReportStoryResultTextRequired = "reportStoryResultTextRequired" - TypeTargetChatCurrent = "targetChatCurrent" - TypeTargetChatChosen = "targetChatChosen" - TypeTargetChatInternalLink = "targetChatInternalLink" TypeInternalLinkTypeActiveSessions = "internalLinkTypeActiveSessions" TypeInternalLinkTypeAttachmentMenuBot = "internalLinkTypeAttachmentMenuBot" TypeInternalLinkTypeAuthenticationCode = "internalLinkTypeAuthenticationCode" @@ -2283,6 +2305,11 @@ type InputChatPhoto interface { InputChatPhotoType() string } +// Describes type of subscription paid in Telegram Stars +type StarSubscriptionType interface { + StarSubscriptionTypeType() string +} + // Describes direction of a transaction with Telegram Stars type StarTransactionDirection interface { StarTransactionDirectionType() string @@ -2458,6 +2485,11 @@ type LoginUrlInfo interface { LoginUrlInfoType() string } +// Describes mode in which a Web App is opened +type WebAppOpenMode interface { + WebAppOpenModeType() string +} + // Describes type of Saved Messages topic type SavedMessagesTopicType interface { SavedMessagesTopicTypeType() string @@ -2708,6 +2740,11 @@ type BotWriteAccessAllowReason interface { BotWriteAccessAllowReasonType() string } +// Describes the target chat to be opened +type TargetChat interface { + TargetChatType() string +} + // Represents a single result of an inline query; for bots only type InputInlineQueryResult interface { InputInlineQueryResultType() string @@ -2888,11 +2925,6 @@ type ReportStoryResult interface { ReportStoryResultType() string } -// Describes the target chat to be opened -type TargetChat interface { - TargetChatType() string -} - // Describes an internal https://t.me or tg: link, which must be processed by the application in a special way type InternalLinkType interface { InternalLinkTypeType() string @@ -5056,7 +5088,7 @@ func (*StickerFullTypeCustomEmoji) StickerFullTypeType() string { return TypeStickerFullTypeCustomEmoji } -// Represents a closed vector path. The path begins at the end point of the last command +// Represents a closed vector path. The path begins at the end point of the last command. The coordinate system origin is in the upper-left corner type ClosedVectorPath struct { meta // List of vector path commands @@ -5095,6 +5127,29 @@ func (closedVectorPath *ClosedVectorPath) UnmarshalJSON(data []byte) error { return nil } +// Represents outline of an image +type Outline struct { + meta + // The list of closed vector paths + Paths []*ClosedVectorPath `json:"paths"` +} + +func (entity *Outline) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Outline + + return json.Marshal((*stub)(entity)) +} + +func (*Outline) GetClass() string { + return ClassOutline +} + +func (*Outline) GetType() string { + return TypeOutline +} + // Describes one answer option of a poll type PollOption struct { meta @@ -5335,8 +5390,6 @@ type Sticker struct { Format StickerFormat `json:"format"` // Sticker's full type FullType StickerFullType `json:"full_type"` - // Sticker's outline represented as a list of closed vector paths; may be empty. The coordinate system origin is in the upper-left corner - Outline []*ClosedVectorPath `json:"outline"` // Sticker thumbnail in WEBP or JPEG format; may be null Thumbnail *Thumbnail `json:"thumbnail"` // File containing the sticker @@ -5368,7 +5421,6 @@ func (sticker *Sticker) UnmarshalJSON(data []byte) error { Emoji string `json:"emoji"` Format json.RawMessage `json:"format"` FullType json.RawMessage `json:"full_type"` - Outline []*ClosedVectorPath `json:"outline"` Thumbnail *Thumbnail `json:"thumbnail"` Sticker *File `json:"sticker"` } @@ -5383,7 +5435,6 @@ func (sticker *Sticker) UnmarshalJSON(data []byte) error { sticker.Width = tmp.Width sticker.Height = tmp.Height sticker.Emoji = tmp.Emoji - sticker.Outline = tmp.Outline sticker.Thumbnail = tmp.Thumbnail sticker.Sticker = tmp.Sticker @@ -5823,7 +5874,7 @@ func (poll *Poll) UnmarshalJSON(data []byte) error { return nil } -// Describes an alternative reencoded quality of a video file +// Describes an alternative re-encoded quality of a video file type AlternativeVideo struct { meta // Video width @@ -7246,6 +7297,68 @@ func (*ChatAdministratorRights) GetType() string { return TypeChatAdministratorRights } +// Describes a subscription to a channel chat +type StarSubscriptionTypeChannel struct { + meta + // True, if the subscription is active and the user can use the method reuseStarSubscription to join the subscribed chat again + CanReuse bool `json:"can_reuse"` + // The invite link that can be used to renew the subscription if it has been expired; may be empty, if the link isn't available anymore + InviteLink string `json:"invite_link"` +} + +func (entity *StarSubscriptionTypeChannel) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarSubscriptionTypeChannel + + return json.Marshal((*stub)(entity)) +} + +func (*StarSubscriptionTypeChannel) GetClass() string { + return ClassStarSubscriptionType +} + +func (*StarSubscriptionTypeChannel) GetType() string { + return TypeStarSubscriptionTypeChannel +} + +func (*StarSubscriptionTypeChannel) StarSubscriptionTypeType() string { + return TypeStarSubscriptionTypeChannel +} + +// Describes a subscription in a bot or a business account +type StarSubscriptionTypeBot struct { + meta + // True, if the subscription was canceled by the bot and can't be extended + IsCanceledByBot bool `json:"is_canceled_by_bot"` + // Subscription invoice title + Title string `json:"title"` + // Subscription invoice photo + Photo *Photo `json:"photo"` + // The link to the subscription invoice + InvoiceLink string `json:"invoice_link"` +} + +func (entity *StarSubscriptionTypeBot) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarSubscriptionTypeBot + + return json.Marshal((*stub)(entity)) +} + +func (*StarSubscriptionTypeBot) GetClass() string { + return ClassStarSubscriptionType +} + +func (*StarSubscriptionTypeBot) GetType() string { + return TypeStarSubscriptionTypeBot +} + +func (*StarSubscriptionTypeBot) StarSubscriptionTypeType() string { + return TypeStarSubscriptionTypeBot +} + // Describes subscription plan paid in Telegram Stars type StarSubscriptionPricing struct { meta @@ -7271,25 +7384,23 @@ func (*StarSubscriptionPricing) GetType() string { return TypeStarSubscriptionPricing } -// Contains information about subscription to a channel chat paid in Telegram Stars +// Contains information about subscription to a channel chat, a bot, or a business account that was paid in Telegram Stars type StarSubscription struct { meta // Unique identifier of the subscription Id string `json:"id"` - // Identifier of the channel chat that is subscribed + // Identifier of the chat that is subscribed ChatId int64 `json:"chat_id"` // Point in time (Unix timestamp) when the subscription will expire or expired ExpirationDate int32 `json:"expiration_date"` - // True, if the subscription is active and the user can use the method reuseStarSubscription to join the subscribed chat again - CanReuse bool `json:"can_reuse"` // True, if the subscription was canceled IsCanceled bool `json:"is_canceled"` // True, if the subscription expires soon and there are no enough Telegram Stars on the user's balance to extend it IsExpiring bool `json:"is_expiring"` - // The invite link that can be used to renew the subscription if it has been expired; may be empty, if the link isn't available anymore - InviteLink string `json:"invite_link"` // The subscription plan Pricing *StarSubscriptionPricing `json:"pricing"` + // Type of the subscription + Type StarSubscriptionType `json:"type"` } func (entity *StarSubscription) MarshalJSON() ([]byte, error) { @@ -7308,6 +7419,35 @@ func (*StarSubscription) GetType() string { return TypeStarSubscription } +func (starSubscription *StarSubscription) UnmarshalJSON(data []byte) error { + var tmp struct { + Id string `json:"id"` + ChatId int64 `json:"chat_id"` + ExpirationDate int32 `json:"expiration_date"` + IsCanceled bool `json:"is_canceled"` + IsExpiring bool `json:"is_expiring"` + Pricing *StarSubscriptionPricing `json:"pricing"` + Type json.RawMessage `json:"type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + starSubscription.Id = tmp.Id + starSubscription.ChatId = tmp.ChatId + starSubscription.ExpirationDate = tmp.ExpirationDate + starSubscription.IsCanceled = tmp.IsCanceled + starSubscription.IsExpiring = tmp.IsExpiring + starSubscription.Pricing = tmp.Pricing + + fieldType, _ := UnmarshalStarSubscriptionType(tmp.Type) + starSubscription.Type = fieldType + + return nil +} + // Represents a list of Telegram Star subscriptions type StarSubscriptions struct { meta @@ -7729,6 +7869,8 @@ type Gift struct { StarCount int64 `json:"star_count"` // Number of Telegram Stars that can be claimed by the receiver instead of the gift by default. If the gift was paid with just bought Telegram Stars, then full value can be claimed DefaultSellStarCount int64 `json:"default_sell_star_count"` + // True, if the gift is a birthday gift + IsForBirthday bool `json:"is_for_birthday"` // Number of remaining times the gift can be purchased by all users; 0 if not limited or the gift was sold out RemainingCount int32 `json:"remaining_count"` // Number of total times the gift can be purchased by all users; 0 if not limited @@ -7795,7 +7937,7 @@ type UserGift struct { Gift *Gift `json:"gift"` // Identifier of the message with the gift in the chat with the sender of the gift; can be 0 or an identifier of a deleted message; only for the gift receiver MessageId int64 `json:"message_id"` - // Number of Telegram Stars that can be claimed by the receiver instead of the gift; only for the gift receiver + // Number of Telegram Stars that can be claimed by the receiver instead of the gift; 0 if the gift can't be sold by the current user SellStarCount int64 `json:"sell_star_count"` } @@ -7969,6 +8111,37 @@ func (*BotTransactionPurposeInvoicePayment) BotTransactionPurposeType() string { return TypeBotTransactionPurposeInvoicePayment } +// User bought a subscription in a bot or a business account +type BotTransactionPurposeSubscription struct { + meta + // The number of seconds between consecutive Telegram Star debiting + Period int32 `json:"period"` + // Information about the bought subscription; may be null if not applicable + ProductInfo *ProductInfo `json:"product_info"` + // Invoice payload; for bots only + InvoicePayload []byte `json:"invoice_payload"` +} + +func (entity *BotTransactionPurposeSubscription) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BotTransactionPurposeSubscription + + return json.Marshal((*stub)(entity)) +} + +func (*BotTransactionPurposeSubscription) GetClass() string { + return ClassBotTransactionPurpose +} + +func (*BotTransactionPurposeSubscription) GetType() string { + return TypeBotTransactionPurposeSubscription +} + +func (*BotTransactionPurposeSubscription) BotTransactionPurposeType() string { + return TypeBotTransactionPurposeSubscription +} + // Paid media were bought type ChatTransactionPurposePaidMedia struct { meta @@ -8125,7 +8298,7 @@ func (*UserTransactionPurposeGiftedStars) UserTransactionPurposeType() string { return TypeUserTransactionPurposeGiftedStars } -// The current user sold a gift received from another user +// The user sold a gift received from another user or bot type UserTransactionPurposeGiftSell struct { meta // The gift @@ -8152,7 +8325,7 @@ func (*UserTransactionPurposeGiftSell) UserTransactionPurposeType() string { return TypeUserTransactionPurposeGiftSell } -// The current user sent a gift to another user +// The user or the bot sent a gift to a user type UserTransactionPurposeGiftSend struct { meta // The gift @@ -9266,8 +9439,18 @@ type BotInfo struct { DefaultGroupAdministratorRights *ChatAdministratorRights `json:"default_group_administrator_rights"` // Default administrator rights for adding the bot to channels; may be null DefaultChannelAdministratorRights *ChatAdministratorRights `json:"default_channel_administrator_rights"` - // True, if the bot's revenue statistics are available + // Default light background color for bot Web Apps; -1 if not specified + WebAppBackgroundLightColor int32 `json:"web_app_background_light_color"` + // Default dark background color for bot Web Apps; -1 if not specified + WebAppBackgroundDarkColor int32 `json:"web_app_background_dark_color"` + // Default light header color for bot Web Apps; -1 if not specified + WebAppHeaderLightColor int32 `json:"web_app_header_light_color"` + // Default dark header color for bot Web Apps; -1 if not specified + WebAppHeaderDarkColor int32 `json:"web_app_header_dark_color"` + // True, if the bot's revenue statistics are available to the current user CanGetRevenueStatistics bool `json:"can_get_revenue_statistics"` + // True, if the bot can manage emoji status of the current user + CanManageEmojiStatus bool `json:"can_manage_emoji_status"` // True, if the bot has media previews HasMediaPreviews bool `json:"has_media_previews"` // The internal link, which can be used to edit bot commands; may be null @@ -9307,7 +9490,12 @@ func (botInfo *BotInfo) UnmarshalJSON(data []byte) error { PrivacyPolicyUrl string `json:"privacy_policy_url"` DefaultGroupAdministratorRights *ChatAdministratorRights `json:"default_group_administrator_rights"` DefaultChannelAdministratorRights *ChatAdministratorRights `json:"default_channel_administrator_rights"` + WebAppBackgroundLightColor int32 `json:"web_app_background_light_color"` + WebAppBackgroundDarkColor int32 `json:"web_app_background_dark_color"` + WebAppHeaderLightColor int32 `json:"web_app_header_light_color"` + WebAppHeaderDarkColor int32 `json:"web_app_header_dark_color"` CanGetRevenueStatistics bool `json:"can_get_revenue_statistics"` + CanManageEmojiStatus bool `json:"can_manage_emoji_status"` HasMediaPreviews bool `json:"has_media_previews"` EditCommandsLink json.RawMessage `json:"edit_commands_link"` EditDescriptionLink json.RawMessage `json:"edit_description_link"` @@ -9329,7 +9517,12 @@ func (botInfo *BotInfo) UnmarshalJSON(data []byte) error { botInfo.PrivacyPolicyUrl = tmp.PrivacyPolicyUrl botInfo.DefaultGroupAdministratorRights = tmp.DefaultGroupAdministratorRights botInfo.DefaultChannelAdministratorRights = tmp.DefaultChannelAdministratorRights + botInfo.WebAppBackgroundLightColor = tmp.WebAppBackgroundLightColor + botInfo.WebAppBackgroundDarkColor = tmp.WebAppBackgroundDarkColor + botInfo.WebAppHeaderLightColor = tmp.WebAppHeaderLightColor + botInfo.WebAppHeaderDarkColor = tmp.WebAppHeaderDarkColor botInfo.CanGetRevenueStatistics = tmp.CanGetRevenueStatistics + botInfo.CanManageEmojiStatus = tmp.CanManageEmojiStatus botInfo.HasMediaPreviews = tmp.HasMediaPreviews fieldEditCommandsLink, _ := UnmarshalInternalLinkType(tmp.EditCommandsLink) @@ -16006,6 +16199,132 @@ func (*LoginUrlInfoRequestConfirmation) LoginUrlInfoType() string { return TypeLoginUrlInfoRequestConfirmation } +// Contains parameters of the application theme +type ThemeParameters struct { + meta + // A color of the background in the RGB format + BackgroundColor int32 `json:"background_color"` + // A secondary color for the background in the RGB format + SecondaryBackgroundColor int32 `json:"secondary_background_color"` + // A color of the header background in the RGB format + HeaderBackgroundColor int32 `json:"header_background_color"` + // A color of the bottom bar background in the RGB format + BottomBarBackgroundColor int32 `json:"bottom_bar_background_color"` + // A color of the section background in the RGB format + SectionBackgroundColor int32 `json:"section_background_color"` + // A color of the section separator in the RGB format + SectionSeparatorColor int32 `json:"section_separator_color"` + // A color of text in the RGB format + TextColor int32 `json:"text_color"` + // An accent color of the text in the RGB format + AccentTextColor int32 `json:"accent_text_color"` + // A color of text on the section headers in the RGB format + SectionHeaderTextColor int32 `json:"section_header_text_color"` + // A color of the subtitle text in the RGB format + SubtitleTextColor int32 `json:"subtitle_text_color"` + // A color of the text for destructive actions in the RGB format + DestructiveTextColor int32 `json:"destructive_text_color"` + // A color of hints in the RGB format + HintColor int32 `json:"hint_color"` + // A color of links in the RGB format + LinkColor int32 `json:"link_color"` + // A color of the buttons in the RGB format + ButtonColor int32 `json:"button_color"` + // A color of text on the buttons in the RGB format + ButtonTextColor int32 `json:"button_text_color"` +} + +func (entity *ThemeParameters) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ThemeParameters + + return json.Marshal((*stub)(entity)) +} + +func (*ThemeParameters) GetClass() string { + return ClassThemeParameters +} + +func (*ThemeParameters) GetType() string { + return TypeThemeParameters +} + +// The Web App is opened in the compact mode +type WebAppOpenModeCompact struct{ + meta +} + +func (entity *WebAppOpenModeCompact) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub WebAppOpenModeCompact + + return json.Marshal((*stub)(entity)) +} + +func (*WebAppOpenModeCompact) GetClass() string { + return ClassWebAppOpenMode +} + +func (*WebAppOpenModeCompact) GetType() string { + return TypeWebAppOpenModeCompact +} + +func (*WebAppOpenModeCompact) WebAppOpenModeType() string { + return TypeWebAppOpenModeCompact +} + +// The Web App is opened in the full-size mode +type WebAppOpenModeFullSize struct{ + meta +} + +func (entity *WebAppOpenModeFullSize) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub WebAppOpenModeFullSize + + return json.Marshal((*stub)(entity)) +} + +func (*WebAppOpenModeFullSize) GetClass() string { + return ClassWebAppOpenMode +} + +func (*WebAppOpenModeFullSize) GetType() string { + return TypeWebAppOpenModeFullSize +} + +func (*WebAppOpenModeFullSize) WebAppOpenModeType() string { + return TypeWebAppOpenModeFullSize +} + +// The Web App is opened in the full-screen mode +type WebAppOpenModeFullScreen struct{ + meta +} + +func (entity *WebAppOpenModeFullScreen) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub WebAppOpenModeFullScreen + + return json.Marshal((*stub)(entity)) +} + +func (*WebAppOpenModeFullScreen) GetClass() string { + return ClassWebAppOpenMode +} + +func (*WebAppOpenModeFullScreen) GetType() string { + return TypeWebAppOpenModeFullScreen +} + +func (*WebAppOpenModeFullScreen) WebAppOpenModeType() string { + return TypeWebAppOpenModeFullScreen +} + // Contains information about a Web App found by its short name type FoundWebApp struct { meta @@ -16063,8 +16382,8 @@ type MainWebApp struct { meta // URL of the Web App to open Url string `json:"url"` - // True, if the Web App must always be opened in the compact mode instead of the full-size mode - IsCompact bool `json:"is_compact"` + // The mode in which the Web App must be opened + Mode WebAppOpenMode `json:"mode"` } func (entity *MainWebApp) MarshalJSON() ([]byte, error) { @@ -16083,6 +16402,73 @@ func (*MainWebApp) GetType() string { return TypeMainWebApp } +func (mainWebApp *MainWebApp) UnmarshalJSON(data []byte) error { + var tmp struct { + Url string `json:"url"` + Mode json.RawMessage `json:"mode"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + mainWebApp.Url = tmp.Url + + fieldMode, _ := UnmarshalWebAppOpenMode(tmp.Mode) + mainWebApp.Mode = fieldMode + + return nil +} + +// Options to be used when a Web App is opened +type WebAppOpenParameters struct { + meta + // Preferred Web App theme; pass null to use the default theme + Theme *ThemeParameters `json:"theme"` + // Short name of the current application; 0-64 English letters, digits, and underscores + ApplicationName string `json:"application_name"` + // The mode in which the Web App is opened; pass null to open in webAppOpenModeFullSize + Mode WebAppOpenMode `json:"mode"` +} + +func (entity *WebAppOpenParameters) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub WebAppOpenParameters + + return json.Marshal((*stub)(entity)) +} + +func (*WebAppOpenParameters) GetClass() string { + return ClassWebAppOpenParameters +} + +func (*WebAppOpenParameters) GetType() string { + return TypeWebAppOpenParameters +} + +func (webAppOpenParameters *WebAppOpenParameters) UnmarshalJSON(data []byte) error { + var tmp struct { + Theme *ThemeParameters `json:"theme"` + ApplicationName string `json:"application_name"` + Mode json.RawMessage `json:"mode"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + webAppOpenParameters.Theme = tmp.Theme + webAppOpenParameters.ApplicationName = tmp.ApplicationName + + fieldMode, _ := UnmarshalWebAppOpenMode(tmp.Mode) + webAppOpenParameters.Mode = fieldMode + + return nil +} + // Contains information about a message thread type MessageThreadInfo struct { meta @@ -20250,57 +20636,6 @@ func (*LocationAddress) GetType() string { return TypeLocationAddress } -// Contains parameters of the application theme -type ThemeParameters struct { - meta - // A color of the background in the RGB format - BackgroundColor int32 `json:"background_color"` - // A secondary color for the background in the RGB format - SecondaryBackgroundColor int32 `json:"secondary_background_color"` - // A color of the header background in the RGB format - HeaderBackgroundColor int32 `json:"header_background_color"` - // A color of the bottom bar background in the RGB format - BottomBarBackgroundColor int32 `json:"bottom_bar_background_color"` - // A color of the section background in the RGB format - SectionBackgroundColor int32 `json:"section_background_color"` - // A color of the section separator in the RGB format - SectionSeparatorColor int32 `json:"section_separator_color"` - // A color of text in the RGB format - TextColor int32 `json:"text_color"` - // An accent color of the text in the RGB format - AccentTextColor int32 `json:"accent_text_color"` - // A color of text on the section headers in the RGB format - SectionHeaderTextColor int32 `json:"section_header_text_color"` - // A color of the subtitle text in the RGB format - SubtitleTextColor int32 `json:"subtitle_text_color"` - // A color of the text for destructive actions in the RGB format - DestructiveTextColor int32 `json:"destructive_text_color"` - // A color of hints in the RGB format - HintColor int32 `json:"hint_color"` - // A color of links in the RGB format - LinkColor int32 `json:"link_color"` - // A color of the buttons in the RGB format - ButtonColor int32 `json:"button_color"` - // A color of text on the buttons in the RGB format - ButtonTextColor int32 `json:"button_text_color"` -} - -func (entity *ThemeParameters) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ThemeParameters - - return json.Marshal((*stub)(entity)) -} - -func (*ThemeParameters) GetClass() string { - return ClassThemeParameters -} - -func (*ThemeParameters) GetType() string { - return TypeThemeParameters -} - // Portion of the price of a product (e.g., "delivery cost", "tax amount") type LabeledPricePart struct { meta @@ -20333,6 +20668,8 @@ type Invoice struct { Currency string `json:"currency"` // A list of objects used to calculate the total price of the product PriceParts []*LabeledPricePart `json:"price_parts"` + // The number of seconds between consecutive Telegram Star debiting for subscription invoices; 0 if the invoice doesn't create subscription + SubscriptionPeriod int32 `json:"subscription_period"` // The maximum allowed amount of tip in the smallest units of the currency MaxTipAmount int64 `json:"max_tip_amount"` // Suggested amounts of tip in the smallest units of the currency @@ -20779,6 +21116,33 @@ func (*PaymentFormTypeStars) PaymentFormTypeType() string { return TypePaymentFormTypeStars } +// The payment form is for a payment in Telegram Stars for subscription +type PaymentFormTypeStarSubscription struct { + meta + // Information about subscription plan + Pricing *StarSubscriptionPricing `json:"pricing"` +} + +func (entity *PaymentFormTypeStarSubscription) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PaymentFormTypeStarSubscription + + return json.Marshal((*stub)(entity)) +} + +func (*PaymentFormTypeStarSubscription) GetClass() string { + return ClassPaymentFormType +} + +func (*PaymentFormTypeStarSubscription) GetType() string { + return TypePaymentFormTypeStarSubscription +} + +func (*PaymentFormTypeStarSubscription) PaymentFormTypeType() string { + return TypePaymentFormTypeStarSubscription +} + // Contains information about an invoice payment form type PaymentForm struct { meta @@ -25002,7 +25366,7 @@ func (*MessageGameScore) MessageContentType() string { return TypeMessageGameScore } -// A payment has been completed +// A payment has been sent to a bot or a business account type MessagePaymentSuccessful struct { meta // Identifier of the chat, containing the corresponding invoice message @@ -25013,6 +25377,8 @@ type MessagePaymentSuccessful struct { Currency string `json:"currency"` // Total price for the product, in the smallest units of the currency TotalAmount int64 `json:"total_amount"` + // Point in time (Unix timestamp) when the subscription will expire; 0 if unknown or the payment isn't recurring + SubscriptionUntilDate int32 `json:"subscription_until_date"` // True, if this is a recurring payment IsRecurring bool `json:"is_recurring"` // True, if this is the first recurring payment @@ -25041,22 +25407,24 @@ func (*MessagePaymentSuccessful) MessageContentType() string { return TypeMessagePaymentSuccessful } -// A payment has been completed; for bots only +// A payment has been received by the bot or the business account type MessagePaymentSuccessfulBot struct { meta // Currency for price of the product Currency string `json:"currency"` // Total price for the product, in the smallest units of the currency TotalAmount int64 `json:"total_amount"` + // Point in time (Unix timestamp) when the subscription will expire; 0 if unknown or the payment isn't recurring + SubscriptionUntilDate int32 `json:"subscription_until_date"` // True, if this is a recurring payment IsRecurring bool `json:"is_recurring"` // True, if this is the first recurring payment IsFirstRecurring bool `json:"is_first_recurring"` // Invoice payload InvoicePayload []byte `json:"invoice_payload"` - // Identifier of the shipping option chosen by the user; may be empty if not applicable + // Identifier of the shipping option chosen by the user; may be empty if not applicable; for bots only ShippingOptionId string `json:"shipping_option_id"` - // Information about the order; may be null + // Information about the order; may be null; for bots only OrderInfo *OrderInfo `json:"order_info"` // Telegram payment identifier TelegramPaymentChargeId string `json:"telegram_payment_charge_id"` @@ -25562,7 +25930,7 @@ type MessageGift struct { Gift *Gift `json:"gift"` // Message added to the gift Text *FormattedText `json:"text"` - // Number of Telegram Stars that can be claimed by the receiver instead of the gift + // Number of Telegram Stars that can be claimed by the receiver instead of the gift; 0 if the gift can't be sold by the receiver SellStarCount int64 `json:"sell_star_count"` // True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone will be able to see them IsPrivate bool `json:"is_private"` @@ -27284,7 +27652,7 @@ func (inputMessageSticker *InputMessageSticker) UnmarshalJSON(data []byte) error // A video message type InputMessageVideo struct { meta - // Video to be sent. The video is expected to be reencoded to MPEG4 format with H.264 codec by the sender + // Video to be sent. The video is expected to be re-encoded to MPEG4 format with H.264 codec by the sender Video InputFile `json:"video"` // Video thumbnail; pass null to skip thumbnail uploading Thumbnail *InputThumbnail `json:"thumbnail"` @@ -28967,8 +29335,8 @@ type StickerSet struct { Name string `json:"name"` // Sticker set thumbnail in WEBP, TGS, or WEBM format with width and height 100; may be null. The file can be downloaded only before the thumbnail is changed Thumbnail *Thumbnail `json:"thumbnail"` - // Sticker set thumbnail's outline represented as a list of closed vector paths; may be empty. The coordinate system origin is in the upper-left corner - ThumbnailOutline []*ClosedVectorPath `json:"thumbnail_outline"` + // Sticker set thumbnail's outline; may be null if unknown + ThumbnailOutline *Outline `json:"thumbnail_outline"` // True, if the sticker set is owned by the current user IsOwned bool `json:"is_owned"` // True, if the sticker set has been installed by the current user @@ -29013,7 +29381,7 @@ func (stickerSet *StickerSet) UnmarshalJSON(data []byte) error { Title string `json:"title"` Name string `json:"name"` Thumbnail *Thumbnail `json:"thumbnail"` - ThumbnailOutline []*ClosedVectorPath `json:"thumbnail_outline"` + ThumbnailOutline *Outline `json:"thumbnail_outline"` IsOwned bool `json:"is_owned"` IsInstalled bool `json:"is_installed"` IsArchived bool `json:"is_archived"` @@ -29063,8 +29431,8 @@ type StickerSetInfo struct { Name string `json:"name"` // Sticker set thumbnail in WEBP, TGS, or WEBM format with width and height 100; may be null. The file can be downloaded only before the thumbnail is changed Thumbnail *Thumbnail `json:"thumbnail"` - // Sticker set thumbnail's outline represented as a list of closed vector paths; may be empty. The coordinate system origin is in the upper-left corner - ThumbnailOutline []*ClosedVectorPath `json:"thumbnail_outline"` + // Sticker set thumbnail's outline; may be null if unknown + ThumbnailOutline *Outline `json:"thumbnail_outline"` // True, if the sticker set is owned by the current user IsOwned bool `json:"is_owned"` // True, if the sticker set has been installed by the current user @@ -29109,7 +29477,7 @@ func (stickerSetInfo *StickerSetInfo) UnmarshalJSON(data []byte) error { Title string `json:"title"` Name string `json:"name"` Thumbnail *Thumbnail `json:"thumbnail"` - ThumbnailOutline []*ClosedVectorPath `json:"thumbnail_outline"` + ThumbnailOutline *Outline `json:"thumbnail_outline"` IsOwned bool `json:"is_owned"` IsInstalled bool `json:"is_installed"` IsArchived bool `json:"is_archived"` @@ -33801,6 +34169,130 @@ func (*UserLink) GetType() string { return TypeUserLink } +// Describes allowed types for the target chat +type TargetChatTypes struct { + meta + // True, if private chats with ordinary users are allowed + AllowUserChats bool `json:"allow_user_chats"` + // True, if private chats with other bots are allowed + AllowBotChats bool `json:"allow_bot_chats"` + // True, if basic group and supergroup chats are allowed + AllowGroupChats bool `json:"allow_group_chats"` + // True, if channel chats are allowed + AllowChannelChats bool `json:"allow_channel_chats"` +} + +func (entity *TargetChatTypes) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TargetChatTypes + + return json.Marshal((*stub)(entity)) +} + +func (*TargetChatTypes) GetClass() string { + return ClassTargetChatTypes +} + +func (*TargetChatTypes) GetType() string { + return TypeTargetChatTypes +} + +// The currently opened chat needs to be kept +type TargetChatCurrent struct{ + meta +} + +func (entity *TargetChatCurrent) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TargetChatCurrent + + return json.Marshal((*stub)(entity)) +} + +func (*TargetChatCurrent) GetClass() string { + return ClassTargetChat +} + +func (*TargetChatCurrent) GetType() string { + return TypeTargetChatCurrent +} + +func (*TargetChatCurrent) TargetChatType() string { + return TypeTargetChatCurrent +} + +// The chat needs to be chosen by the user among chats of the specified types +type TargetChatChosen struct { + meta + // Allowed types for the chat + Types *TargetChatTypes `json:"types"` +} + +func (entity *TargetChatChosen) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TargetChatChosen + + return json.Marshal((*stub)(entity)) +} + +func (*TargetChatChosen) GetClass() string { + return ClassTargetChat +} + +func (*TargetChatChosen) GetType() string { + return TypeTargetChatChosen +} + +func (*TargetChatChosen) TargetChatType() string { + return TypeTargetChatChosen +} + +// The chat needs to be open with the provided internal link +type TargetChatInternalLink struct { + meta + // An internal link pointing to the chat + Link InternalLinkType `json:"link"` +} + +func (entity *TargetChatInternalLink) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TargetChatInternalLink + + return json.Marshal((*stub)(entity)) +} + +func (*TargetChatInternalLink) GetClass() string { + return ClassTargetChat +} + +func (*TargetChatInternalLink) GetType() string { + return TypeTargetChatInternalLink +} + +func (*TargetChatInternalLink) TargetChatType() string { + return TypeTargetChatInternalLink +} + +func (targetChatInternalLink *TargetChatInternalLink) UnmarshalJSON(data []byte) error { + var tmp struct { + Link json.RawMessage `json:"link"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldLink, _ := UnmarshalInternalLinkType(tmp.Link) + targetChatInternalLink.Link = fieldLink + + return nil +} + // Represents a link to an animated GIF or an animated (i.e., without sound) H.264/MPEG-4 AVC video type InputInlineQueryResultAnimation struct { meta @@ -35221,6 +35713,79 @@ func (inlineQueryResults *InlineQueryResults) UnmarshalJSON(data []byte) error { return nil } +// Represents an inline message that can be sent via the bot +type PreparedInlineMessageId struct { + meta + // Unique identifier for the message + Id string `json:"id"` + // Point in time (Unix timestamp) when the message can't be used anymore + ExpirationDate int32 `json:"expiration_date"` +} + +func (entity *PreparedInlineMessageId) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PreparedInlineMessageId + + return json.Marshal((*stub)(entity)) +} + +func (*PreparedInlineMessageId) GetClass() string { + return ClassPreparedInlineMessageId +} + +func (*PreparedInlineMessageId) GetType() string { + return TypePreparedInlineMessageId +} + +// Represents a ready to send inline message. Use sendInlineQueryResultMessage to send the message +type PreparedInlineMessage struct { + meta + // Unique identifier of the inline query to pass to sendInlineQueryResultMessage + InlineQueryId JsonInt64 `json:"inline_query_id"` + // Resulted inline message of the query + Result InlineQueryResult `json:"result"` + // Types of the chats to which the message can be sent + ChatTypes *TargetChatTypes `json:"chat_types"` +} + +func (entity *PreparedInlineMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PreparedInlineMessage + + return json.Marshal((*stub)(entity)) +} + +func (*PreparedInlineMessage) GetClass() string { + return ClassPreparedInlineMessage +} + +func (*PreparedInlineMessage) GetType() string { + return TypePreparedInlineMessage +} + +func (preparedInlineMessage *PreparedInlineMessage) UnmarshalJSON(data []byte) error { + var tmp struct { + InlineQueryId JsonInt64 `json:"inline_query_id"` + Result json.RawMessage `json:"result"` + ChatTypes *TargetChatTypes `json:"chat_types"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + preparedInlineMessage.InlineQueryId = tmp.InlineQueryId + preparedInlineMessage.ChatTypes = tmp.ChatTypes + + fieldResult, _ := UnmarshalInlineQueryResult(tmp.Result) + preparedInlineMessage.Result = fieldResult + + return nil +} + // The payload for a general callback button type CallbackQueryPayloadData struct { meta @@ -43120,6 +43685,31 @@ func (*UserPrivacySettingRuleAllowContacts) UserPrivacySettingRuleType() string return TypeUserPrivacySettingRuleAllowContacts } +// A rule to allow all bots to do something +type UserPrivacySettingRuleAllowBots struct{ + meta +} + +func (entity *UserPrivacySettingRuleAllowBots) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserPrivacySettingRuleAllowBots + + return json.Marshal((*stub)(entity)) +} + +func (*UserPrivacySettingRuleAllowBots) GetClass() string { + return ClassUserPrivacySettingRule +} + +func (*UserPrivacySettingRuleAllowBots) GetType() string { + return TypeUserPrivacySettingRuleAllowBots +} + +func (*UserPrivacySettingRuleAllowBots) UserPrivacySettingRuleType() string { + return TypeUserPrivacySettingRuleAllowBots +} + // A rule to allow all Premium Users to do something; currently, allowed only for userPrivacySettingAllowChatInvites type UserPrivacySettingRuleAllowPremiumUsers struct{ meta @@ -43249,6 +43839,31 @@ func (*UserPrivacySettingRuleRestrictContacts) UserPrivacySettingRuleType() stri return TypeUserPrivacySettingRuleRestrictContacts } +// A rule to restrict all bots from doing something +type UserPrivacySettingRuleRestrictBots struct{ + meta +} + +func (entity *UserPrivacySettingRuleRestrictBots) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserPrivacySettingRuleRestrictBots + + return json.Marshal((*stub)(entity)) +} + +func (*UserPrivacySettingRuleRestrictBots) GetClass() string { + return ClassUserPrivacySettingRule +} + +func (*UserPrivacySettingRuleRestrictBots) GetType() string { + return TypeUserPrivacySettingRuleRestrictBots +} + +func (*UserPrivacySettingRuleRestrictBots) UserPrivacySettingRuleType() string { + return TypeUserPrivacySettingRuleRestrictBots +} + // A rule to restrict all specified users from doing something type UserPrivacySettingRuleRestrictUsers struct { meta @@ -43617,6 +44232,31 @@ func (*UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages) UserPrivacySetti return TypeUserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages } +// A privacy setting for managing whether received gifts are automatically shown on the user's profile page +type UserPrivacySettingAutosaveGifts struct{ + meta +} + +func (entity *UserPrivacySettingAutosaveGifts) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserPrivacySettingAutosaveGifts + + return json.Marshal((*stub)(entity)) +} + +func (*UserPrivacySettingAutosaveGifts) GetClass() string { + return ClassUserPrivacySetting +} + +func (*UserPrivacySettingAutosaveGifts) GetType() string { + return TypeUserPrivacySettingAutosaveGifts +} + +func (*UserPrivacySettingAutosaveGifts) UserPrivacySettingType() string { + return TypeUserPrivacySettingAutosaveGifts +} + // Contains privacy settings for message read date in private chats. Read dates are always shown to the users that can see online status of the current user regardless of this setting type ReadDatePrivacySettings struct { meta @@ -44874,107 +45514,6 @@ func (*ReportStoryResultTextRequired) ReportStoryResultType() string { return TypeReportStoryResultTextRequired } -// The currently opened chat needs to be kept -type TargetChatCurrent struct{ - meta -} - -func (entity *TargetChatCurrent) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub TargetChatCurrent - - return json.Marshal((*stub)(entity)) -} - -func (*TargetChatCurrent) GetClass() string { - return ClassTargetChat -} - -func (*TargetChatCurrent) GetType() string { - return TypeTargetChatCurrent -} - -func (*TargetChatCurrent) TargetChatType() string { - return TypeTargetChatCurrent -} - -// The chat needs to be chosen by the user among chats of the specified types -type TargetChatChosen struct { - meta - // True, if private chats with ordinary users are allowed - AllowUserChats bool `json:"allow_user_chats"` - // True, if private chats with other bots are allowed - AllowBotChats bool `json:"allow_bot_chats"` - // True, if basic group and supergroup chats are allowed - AllowGroupChats bool `json:"allow_group_chats"` - // True, if channel chats are allowed - AllowChannelChats bool `json:"allow_channel_chats"` -} - -func (entity *TargetChatChosen) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub TargetChatChosen - - return json.Marshal((*stub)(entity)) -} - -func (*TargetChatChosen) GetClass() string { - return ClassTargetChat -} - -func (*TargetChatChosen) GetType() string { - return TypeTargetChatChosen -} - -func (*TargetChatChosen) TargetChatType() string { - return TypeTargetChatChosen -} - -// The chat needs to be open with the provided internal link -type TargetChatInternalLink struct { - meta - // An internal link pointing to the chat - Link InternalLinkType `json:"link"` -} - -func (entity *TargetChatInternalLink) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub TargetChatInternalLink - - return json.Marshal((*stub)(entity)) -} - -func (*TargetChatInternalLink) GetClass() string { - return ClassTargetChat -} - -func (*TargetChatInternalLink) GetType() string { - return TypeTargetChatInternalLink -} - -func (*TargetChatInternalLink) TargetChatType() string { - return TypeTargetChatInternalLink -} - -func (targetChatInternalLink *TargetChatInternalLink) UnmarshalJSON(data []byte) error { - var tmp struct { - Link json.RawMessage `json:"link"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - fieldLink, _ := UnmarshalInternalLinkType(tmp.Link) - targetChatInternalLink.Link = fieldLink - - return nil -} - // The link is a link to the Devices section of the application. Use getActiveSessions to get the list of active sessions and show them to the user type InternalLinkTypeActiveSessions struct{ meta @@ -45571,15 +46110,15 @@ func (*InternalLinkTypeLanguageSettings) InternalLinkTypeType() string { return TypeInternalLinkTypeLanguageSettings } -// The link is a link to the main Web App of a bot. Call searchPublicChat with the given bot username, check that the user is a bot and has the main Web App. If the bot can be added to attachment menu, then use getAttachmentMenuBot to receive information about the bot, then if the bot isn't added to side menu, show a disclaimer about Mini Apps being third-party applications, ask the user to accept their Terms of service and confirm adding the bot to side and attachment menu, then if the user accepts the terms and confirms adding, use toggleBotIsAddedToAttachmentMenu to add the bot. Then, use getMainWebApp with the given start parameter and open the returned URL as a Web App +// The link is a link to the main Web App of a bot. Call searchPublicChat with the given bot username, check that the user is a bot and has the main Web App. If the bot can be added to attachment menu, then use getAttachmentMenuBot to receive information about the bot, then if the bot isn't added to side menu, show a disclaimer about Mini Apps being third-party applications, ask the user to accept their Terms of service and confirm adding the bot to side and attachment menu, then if the user accepts the terms and confirms adding, use toggleBotIsAddedToAttachmentMenu to add the bot. Then, use getMainWebApp with the given start parameter and mode and open the returned URL as a Web App type InternalLinkTypeMainWebApp struct { meta // Username of the bot BotUsername string `json:"bot_username"` // Start parameter to be passed to getMainWebApp StartParameter string `json:"start_parameter"` - // True, if the Web App must be opened in the compact mode instead of the full-size mode - IsCompact bool `json:"is_compact"` + // The mode to be passed to getMainWebApp + Mode WebAppOpenMode `json:"mode"` } func (entity *InternalLinkTypeMainWebApp) MarshalJSON() ([]byte, error) { @@ -45602,6 +46141,27 @@ func (*InternalLinkTypeMainWebApp) InternalLinkTypeType() string { return TypeInternalLinkTypeMainWebApp } +func (internalLinkTypeMainWebApp *InternalLinkTypeMainWebApp) UnmarshalJSON(data []byte) error { + var tmp struct { + BotUsername string `json:"bot_username"` + StartParameter string `json:"start_parameter"` + Mode json.RawMessage `json:"mode"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + internalLinkTypeMainWebApp.BotUsername = tmp.BotUsername + internalLinkTypeMainWebApp.StartParameter = tmp.StartParameter + + fieldMode, _ := UnmarshalWebAppOpenMode(tmp.Mode) + internalLinkTypeMainWebApp.Mode = fieldMode + + return nil +} + // The link is a link to a Telegram message or a forum topic. Call getMessageLinkInfo with the given URL to process the link, and then open received forum topic or chat and show the message there type InternalLinkTypeMessage struct { meta @@ -46246,8 +46806,8 @@ type InternalLinkTypeWebApp struct { WebAppShortName string `json:"web_app_short_name"` // Start parameter to be passed to getWebAppLinkUrl StartParameter string `json:"start_parameter"` - // True, if the Web App must be opened in the compact mode instead of the full-size mode - IsCompact bool `json:"is_compact"` + // The mode in which the Web App must be opened + Mode WebAppOpenMode `json:"mode"` } func (entity *InternalLinkTypeWebApp) MarshalJSON() ([]byte, error) { @@ -46270,6 +46830,29 @@ func (*InternalLinkTypeWebApp) InternalLinkTypeType() string { return TypeInternalLinkTypeWebApp } +func (internalLinkTypeWebApp *InternalLinkTypeWebApp) UnmarshalJSON(data []byte) error { + var tmp struct { + BotUsername string `json:"bot_username"` + WebAppShortName string `json:"web_app_short_name"` + StartParameter string `json:"start_parameter"` + Mode json.RawMessage `json:"mode"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + internalLinkTypeWebApp.BotUsername = tmp.BotUsername + internalLinkTypeWebApp.WebAppShortName = tmp.WebAppShortName + internalLinkTypeWebApp.StartParameter = tmp.StartParameter + + fieldMode, _ := UnmarshalWebAppOpenMode(tmp.Mode) + internalLinkTypeWebApp.Mode = fieldMode + + return nil +} + // Contains an HTTPS link to a message in a supergroup or channel, or a forum topic type MessageLink struct { meta diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 7d468fc..c30f7ad 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -659,6 +659,40 @@ func UnmarshalListOfInputChatPhoto(dataList []json.RawMessage) ([]InputChatPhoto return list, nil } +func UnmarshalStarSubscriptionType(data json.RawMessage) (StarSubscriptionType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeStarSubscriptionTypeChannel: + return UnmarshalStarSubscriptionTypeChannel(data) + + case TypeStarSubscriptionTypeBot: + return UnmarshalStarSubscriptionTypeBot(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfStarSubscriptionType(dataList []json.RawMessage) ([]StarSubscriptionType, error) { + list := []StarSubscriptionType{} + + for _, data := range dataList { + entity, err := UnmarshalStarSubscriptionType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalStarTransactionDirection(data json.RawMessage) (StarTransactionDirection, error) { var meta meta @@ -708,6 +742,9 @@ func UnmarshalBotTransactionPurpose(data json.RawMessage) (BotTransactionPurpose case TypeBotTransactionPurposeInvoicePayment: return UnmarshalBotTransactionPurposeInvoicePayment(data) + case TypeBotTransactionPurposeSubscription: + return UnmarshalBotTransactionPurposeSubscription(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -2071,6 +2108,43 @@ func UnmarshalListOfLoginUrlInfo(dataList []json.RawMessage) ([]LoginUrlInfo, er return list, nil } +func UnmarshalWebAppOpenMode(data json.RawMessage) (WebAppOpenMode, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeWebAppOpenModeCompact: + return UnmarshalWebAppOpenModeCompact(data) + + case TypeWebAppOpenModeFullSize: + return UnmarshalWebAppOpenModeFullSize(data) + + case TypeWebAppOpenModeFullScreen: + return UnmarshalWebAppOpenModeFullScreen(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfWebAppOpenMode(dataList []json.RawMessage) ([]WebAppOpenMode, error) { + list := []WebAppOpenMode{} + + for _, data := range dataList { + entity, err := UnmarshalWebAppOpenMode(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalSavedMessagesTopicType(data json.RawMessage) (SavedMessagesTopicType, error) { var meta meta @@ -2657,6 +2731,9 @@ func UnmarshalPaymentFormType(data json.RawMessage) (PaymentFormType, error) { case TypePaymentFormTypeStars: return UnmarshalPaymentFormTypeStars(data) + case TypePaymentFormTypeStarSubscription: + return UnmarshalPaymentFormTypeStarSubscription(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -4674,6 +4751,43 @@ func UnmarshalListOfBotWriteAccessAllowReason(dataList []json.RawMessage) ([]Bot return list, nil } +func UnmarshalTargetChat(data json.RawMessage) (TargetChat, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeTargetChatCurrent: + return UnmarshalTargetChatCurrent(data) + + case TypeTargetChatChosen: + return UnmarshalTargetChatChosen(data) + + case TypeTargetChatInternalLink: + return UnmarshalTargetChatInternalLink(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfTargetChat(dataList []json.RawMessage) ([]TargetChat, error) { + list := []TargetChat{} + + for _, data := range dataList { + entity, err := UnmarshalTargetChat(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalInputInlineQueryResult(data json.RawMessage) (InputInlineQueryResult, error) { var meta meta @@ -6302,6 +6416,9 @@ func UnmarshalUserPrivacySettingRule(data json.RawMessage) (UserPrivacySettingRu case TypeUserPrivacySettingRuleAllowContacts: return UnmarshalUserPrivacySettingRuleAllowContacts(data) + case TypeUserPrivacySettingRuleAllowBots: + return UnmarshalUserPrivacySettingRuleAllowBots(data) + case TypeUserPrivacySettingRuleAllowPremiumUsers: return UnmarshalUserPrivacySettingRuleAllowPremiumUsers(data) @@ -6317,6 +6434,9 @@ func UnmarshalUserPrivacySettingRule(data json.RawMessage) (UserPrivacySettingRu case TypeUserPrivacySettingRuleRestrictContacts: return UnmarshalUserPrivacySettingRuleRestrictContacts(data) + case TypeUserPrivacySettingRuleRestrictBots: + return UnmarshalUserPrivacySettingRuleRestrictBots(data) + case TypeUserPrivacySettingRuleRestrictUsers: return UnmarshalUserPrivacySettingRuleRestrictUsers(data) @@ -6384,6 +6504,9 @@ func UnmarshalUserPrivacySetting(data json.RawMessage) (UserPrivacySetting, erro case TypeUserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages: return UnmarshalUserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages(data) + case TypeUserPrivacySettingAutosaveGifts: + return UnmarshalUserPrivacySettingAutosaveGifts(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -6654,43 +6777,6 @@ func UnmarshalListOfReportStoryResult(dataList []json.RawMessage) ([]ReportStory return list, nil } -func UnmarshalTargetChat(data json.RawMessage) (TargetChat, error) { - var meta meta - - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } - - switch meta.Type { - case TypeTargetChatCurrent: - return UnmarshalTargetChatCurrent(data) - - case TypeTargetChatChosen: - return UnmarshalTargetChatChosen(data) - - case TypeTargetChatInternalLink: - return UnmarshalTargetChatInternalLink(data) - - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } -} - -func UnmarshalListOfTargetChat(dataList []json.RawMessage) ([]TargetChat, error) { - list := []TargetChat{} - - for _, data := range dataList { - entity, err := UnmarshalTargetChat(data) - if err != nil { - return nil, err - } - list = append(list, entity) - } - - return list, nil -} - func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { var meta meta @@ -8756,6 +8842,14 @@ func UnmarshalClosedVectorPath(data json.RawMessage) (*ClosedVectorPath, error) return &resp, err } +func UnmarshalOutline(data json.RawMessage) (*Outline, error) { + var resp Outline + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPollOption(data json.RawMessage) (*PollOption, error) { var resp PollOption @@ -9260,6 +9354,22 @@ func UnmarshalChatAdministratorRights(data json.RawMessage) (*ChatAdministratorR return &resp, err } +func UnmarshalStarSubscriptionTypeChannel(data json.RawMessage) (*StarSubscriptionTypeChannel, error) { + var resp StarSubscriptionTypeChannel + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarSubscriptionTypeBot(data json.RawMessage) (*StarSubscriptionTypeBot, error) { + var resp StarSubscriptionTypeBot + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarSubscriptionPricing(data json.RawMessage) (*StarSubscriptionPricing, error) { var resp StarSubscriptionPricing @@ -9436,6 +9546,14 @@ func UnmarshalBotTransactionPurposeInvoicePayment(data json.RawMessage) (*BotTra return &resp, err } +func UnmarshalBotTransactionPurposeSubscription(data json.RawMessage) (*BotTransactionPurposeSubscription, error) { + var resp BotTransactionPurposeSubscription + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatTransactionPurposePaidMedia(data json.RawMessage) (*ChatTransactionPurposePaidMedia, error) { var resp ChatTransactionPurposePaidMedia @@ -11308,6 +11426,38 @@ func UnmarshalLoginUrlInfoRequestConfirmation(data json.RawMessage) (*LoginUrlIn return &resp, err } +func UnmarshalThemeParameters(data json.RawMessage) (*ThemeParameters, error) { + var resp ThemeParameters + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalWebAppOpenModeCompact(data json.RawMessage) (*WebAppOpenModeCompact, error) { + var resp WebAppOpenModeCompact + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalWebAppOpenModeFullSize(data json.RawMessage) (*WebAppOpenModeFullSize, error) { + var resp WebAppOpenModeFullSize + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalWebAppOpenModeFullScreen(data json.RawMessage) (*WebAppOpenModeFullScreen, error) { + var resp WebAppOpenModeFullScreen + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalFoundWebApp(data json.RawMessage) (*FoundWebApp, error) { var resp FoundWebApp @@ -11332,6 +11482,14 @@ func UnmarshalMainWebApp(data json.RawMessage) (*MainWebApp, error) { return &resp, err } +func UnmarshalWebAppOpenParameters(data json.RawMessage) (*WebAppOpenParameters, error) { + var resp WebAppOpenParameters + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageThreadInfo(data json.RawMessage) (*MessageThreadInfo, error) { var resp MessageThreadInfo @@ -12244,14 +12402,6 @@ func UnmarshalLocationAddress(data json.RawMessage) (*LocationAddress, error) { return &resp, err } -func UnmarshalThemeParameters(data json.RawMessage) (*ThemeParameters, error) { - var resp ThemeParameters - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - func UnmarshalLabeledPricePart(data json.RawMessage) (*LabeledPricePart, error) { var resp LabeledPricePart @@ -12372,6 +12522,14 @@ func UnmarshalPaymentFormTypeStars(data json.RawMessage) (*PaymentFormTypeStars, return &resp, err } +func UnmarshalPaymentFormTypeStarSubscription(data json.RawMessage) (*PaymentFormTypeStarSubscription, error) { + var resp PaymentFormTypeStarSubscription + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPaymentForm(data json.RawMessage) (*PaymentForm, error) { var resp PaymentForm @@ -15540,6 +15698,38 @@ func UnmarshalUserLink(data json.RawMessage) (*UserLink, error) { return &resp, err } +func UnmarshalTargetChatTypes(data json.RawMessage) (*TargetChatTypes, error) { + var resp TargetChatTypes + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTargetChatCurrent(data json.RawMessage) (*TargetChatCurrent, error) { + var resp TargetChatCurrent + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTargetChatChosen(data json.RawMessage) (*TargetChatChosen, error) { + var resp TargetChatChosen + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTargetChatInternalLink(data json.RawMessage) (*TargetChatInternalLink, error) { + var resp TargetChatInternalLink + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInputInlineQueryResultAnimation(data json.RawMessage) (*InputInlineQueryResultAnimation, error) { var resp InputInlineQueryResultAnimation @@ -15764,6 +15954,22 @@ func UnmarshalInlineQueryResults(data json.RawMessage) (*InlineQueryResults, err return &resp, err } +func UnmarshalPreparedInlineMessageId(data json.RawMessage) (*PreparedInlineMessageId, error) { + var resp PreparedInlineMessageId + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPreparedInlineMessage(data json.RawMessage) (*PreparedInlineMessage, error) { + var resp PreparedInlineMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalCallbackQueryPayloadData(data json.RawMessage) (*CallbackQueryPayloadData, error) { var resp CallbackQueryPayloadData @@ -17924,6 +18130,14 @@ func UnmarshalUserPrivacySettingRuleAllowContacts(data json.RawMessage) (*UserPr return &resp, err } +func UnmarshalUserPrivacySettingRuleAllowBots(data json.RawMessage) (*UserPrivacySettingRuleAllowBots, error) { + var resp UserPrivacySettingRuleAllowBots + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUserPrivacySettingRuleAllowPremiumUsers(data json.RawMessage) (*UserPrivacySettingRuleAllowPremiumUsers, error) { var resp UserPrivacySettingRuleAllowPremiumUsers @@ -17964,6 +18178,14 @@ func UnmarshalUserPrivacySettingRuleRestrictContacts(data json.RawMessage) (*Use return &resp, err } +func UnmarshalUserPrivacySettingRuleRestrictBots(data json.RawMessage) (*UserPrivacySettingRuleRestrictBots, error) { + var resp UserPrivacySettingRuleRestrictBots + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUserPrivacySettingRuleRestrictUsers(data json.RawMessage) (*UserPrivacySettingRuleRestrictUsers, error) { var resp UserPrivacySettingRuleRestrictUsers @@ -18076,6 +18298,14 @@ func UnmarshalUserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages(data json. return &resp, err } +func UnmarshalUserPrivacySettingAutosaveGifts(data json.RawMessage) (*UserPrivacySettingAutosaveGifts, error) { + var resp UserPrivacySettingAutosaveGifts + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalReadDatePrivacySettings(data json.RawMessage) (*ReadDatePrivacySettings, error) { var resp ReadDatePrivacySettings @@ -18444,30 +18674,6 @@ func UnmarshalReportStoryResultTextRequired(data json.RawMessage) (*ReportStoryR return &resp, err } -func UnmarshalTargetChatCurrent(data json.RawMessage) (*TargetChatCurrent, error) { - var resp TargetChatCurrent - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalTargetChatChosen(data json.RawMessage) (*TargetChatChosen, error) { - var resp TargetChatChosen - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalTargetChatInternalLink(data json.RawMessage) (*TargetChatInternalLink, error) { - var resp TargetChatInternalLink - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - func UnmarshalInternalLinkTypeActiveSessions(data json.RawMessage) (*InternalLinkTypeActiveSessions, error) { var resp InternalLinkTypeActiveSessions @@ -21453,6 +21659,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeClosedVectorPath: return UnmarshalClosedVectorPath(data) + case TypeOutline: + return UnmarshalOutline(data) + case TypePollOption: return UnmarshalPollOption(data) @@ -21642,6 +21851,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatAdministratorRights: return UnmarshalChatAdministratorRights(data) + case TypeStarSubscriptionTypeChannel: + return UnmarshalStarSubscriptionTypeChannel(data) + + case TypeStarSubscriptionTypeBot: + return UnmarshalStarSubscriptionTypeBot(data) + case TypeStarSubscriptionPricing: return UnmarshalStarSubscriptionPricing(data) @@ -21708,6 +21923,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeBotTransactionPurposeInvoicePayment: return UnmarshalBotTransactionPurposeInvoicePayment(data) + case TypeBotTransactionPurposeSubscription: + return UnmarshalBotTransactionPurposeSubscription(data) + case TypeChatTransactionPurposePaidMedia: return UnmarshalChatTransactionPurposePaidMedia(data) @@ -22410,6 +22628,18 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeLoginUrlInfoRequestConfirmation: return UnmarshalLoginUrlInfoRequestConfirmation(data) + case TypeThemeParameters: + return UnmarshalThemeParameters(data) + + case TypeWebAppOpenModeCompact: + return UnmarshalWebAppOpenModeCompact(data) + + case TypeWebAppOpenModeFullSize: + return UnmarshalWebAppOpenModeFullSize(data) + + case TypeWebAppOpenModeFullScreen: + return UnmarshalWebAppOpenModeFullScreen(data) + case TypeFoundWebApp: return UnmarshalFoundWebApp(data) @@ -22419,6 +22649,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMainWebApp: return UnmarshalMainWebApp(data) + case TypeWebAppOpenParameters: + return UnmarshalWebAppOpenParameters(data) + case TypeMessageThreadInfo: return UnmarshalMessageThreadInfo(data) @@ -22761,9 +22994,6 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeLocationAddress: return UnmarshalLocationAddress(data) - case TypeThemeParameters: - return UnmarshalThemeParameters(data) - case TypeLabeledPricePart: return UnmarshalLabeledPricePart(data) @@ -22809,6 +23039,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePaymentFormTypeStars: return UnmarshalPaymentFormTypeStars(data) + case TypePaymentFormTypeStarSubscription: + return UnmarshalPaymentFormTypeStarSubscription(data) + case TypePaymentForm: return UnmarshalPaymentForm(data) @@ -23997,6 +24230,18 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUserLink: return UnmarshalUserLink(data) + case TypeTargetChatTypes: + return UnmarshalTargetChatTypes(data) + + case TypeTargetChatCurrent: + return UnmarshalTargetChatCurrent(data) + + case TypeTargetChatChosen: + return UnmarshalTargetChatChosen(data) + + case TypeTargetChatInternalLink: + return UnmarshalTargetChatInternalLink(data) + case TypeInputInlineQueryResultAnimation: return UnmarshalInputInlineQueryResultAnimation(data) @@ -24081,6 +24326,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInlineQueryResults: return UnmarshalInlineQueryResults(data) + case TypePreparedInlineMessageId: + return UnmarshalPreparedInlineMessageId(data) + + case TypePreparedInlineMessage: + return UnmarshalPreparedInlineMessage(data) + case TypeCallbackQueryPayloadData: return UnmarshalCallbackQueryPayloadData(data) @@ -24891,6 +25142,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUserPrivacySettingRuleAllowContacts: return UnmarshalUserPrivacySettingRuleAllowContacts(data) + case TypeUserPrivacySettingRuleAllowBots: + return UnmarshalUserPrivacySettingRuleAllowBots(data) + case TypeUserPrivacySettingRuleAllowPremiumUsers: return UnmarshalUserPrivacySettingRuleAllowPremiumUsers(data) @@ -24906,6 +25160,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUserPrivacySettingRuleRestrictContacts: return UnmarshalUserPrivacySettingRuleRestrictContacts(data) + case TypeUserPrivacySettingRuleRestrictBots: + return UnmarshalUserPrivacySettingRuleRestrictBots(data) + case TypeUserPrivacySettingRuleRestrictUsers: return UnmarshalUserPrivacySettingRuleRestrictUsers(data) @@ -24948,6 +25205,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages: return UnmarshalUserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages(data) + case TypeUserPrivacySettingAutosaveGifts: + return UnmarshalUserPrivacySettingAutosaveGifts(data) + case TypeReadDatePrivacySettings: return UnmarshalReadDatePrivacySettings(data) @@ -25086,15 +25346,6 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeReportStoryResultTextRequired: return UnmarshalReportStoryResultTextRequired(data) - case TypeTargetChatCurrent: - return UnmarshalTargetChatCurrent(data) - - case TypeTargetChatChosen: - return UnmarshalTargetChatChosen(data) - - case TypeTargetChatInternalLink: - return UnmarshalTargetChatInternalLink(data) - case TypeInternalLinkTypeActiveSessions: return UnmarshalInternalLinkTypeActiveSessions(data) diff --git a/data/td_api.tl b/data/td_api.tl index c7dd285..ee20b8d 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -357,9 +357,12 @@ stickerFullTypeMask mask_position:maskPosition = StickerFullType; stickerFullTypeCustomEmoji custom_emoji_id:int64 needs_repainting:Bool = StickerFullType; -//@description Represents a closed vector path. The path begins at the end point of the last command @commands List of vector path commands +//@description Represents a closed vector path. The path begins at the end point of the last command. The coordinate system origin is in the upper-left corner @commands List of vector path commands closedVectorPath commands:vector = ClosedVectorPath; +//@description Represents outline of an image @paths The list of closed vector paths +outline paths:vector = Outline; + //@description Describes one answer option of a poll //@text Option text; 1-100 characters. Only custom emoji entities are allowed @@ -427,10 +430,9 @@ photo has_stickers:Bool minithumbnail:minithumbnail sizes:vector = Ph //@emoji Emoji corresponding to the sticker //@format Sticker format //@full_type Sticker's full type -//@outline Sticker's outline represented as a list of closed vector paths; may be empty. The coordinate system origin is in the upper-left corner //@thumbnail Sticker thumbnail in WEBP or JPEG format; may be null //@sticker File containing the sticker -sticker id:int64 set_id:int64 width:int32 height:int32 emoji:string format:StickerFormat full_type:StickerFullType outline:vector thumbnail:thumbnail sticker:file = Sticker; +sticker id:int64 set_id:int64 width:int32 height:int32 emoji:string format:StickerFormat full_type:StickerFullType thumbnail:thumbnail sticker:file = Sticker; //@description Describes a video file //@duration Duration of the video, in seconds; as defined by the sender @@ -526,7 +528,7 @@ webApp short_name:string title:string description:string photo:photo animation:a poll id:int64 question:formattedText options:vector total_voter_count:int32 recent_voter_ids:vector is_anonymous:Bool type:PollType open_period:int32 close_date:int32 is_closed:Bool = Poll; -//@description Describes an alternative reencoded quality of a video file +//@description Describes an alternative re-encoded quality of a video file //@width Video width //@height Video height //@codec Codec used for video file encoding, for example, "h264", "h265", or "av1" @@ -811,21 +813,35 @@ chatPermissions can_send_basic_messages:Bool can_send_audios:Bool can_send_docum chatAdministratorRights can_manage_chat:Bool can_change_info:Bool can_post_messages:Bool can_edit_messages:Bool can_delete_messages:Bool can_invite_users:Bool can_restrict_members:Bool can_pin_messages:Bool can_manage_topics:Bool can_promote_members:Bool can_manage_video_chats:Bool can_post_stories:Bool can_edit_stories:Bool can_delete_stories:Bool is_anonymous:Bool = ChatAdministratorRights; +//@class StarSubscriptionType @description Describes type of subscription paid in Telegram Stars + +//@description Describes a subscription to a channel chat +//@can_reuse True, if the subscription is active and the user can use the method reuseStarSubscription to join the subscribed chat again +//@invite_link The invite link that can be used to renew the subscription if it has been expired; may be empty, if the link isn't available anymore +starSubscriptionTypeChannel can_reuse:Bool invite_link:string = StarSubscriptionType; + +//@description Describes a subscription in a bot or a business account +//@is_canceled_by_bot True, if the subscription was canceled by the bot and can't be extended +//@title Subscription invoice title +//@photo Subscription invoice photo +//@invoice_link The link to the subscription invoice +starSubscriptionTypeBot is_canceled_by_bot:Bool title:string photo:photo invoice_link:string = StarSubscriptionType; + + //@description Describes subscription plan paid in Telegram Stars //@period The number of seconds between consecutive Telegram Star debiting //@star_count The amount of Telegram Stars that must be paid for each period starSubscriptionPricing period:int32 star_count:int53 = StarSubscriptionPricing; -//@description Contains information about subscription to a channel chat paid in Telegram Stars +//@description Contains information about subscription to a channel chat, a bot, or a business account that was paid in Telegram Stars //@id Unique identifier of the subscription -//@chat_id Identifier of the channel chat that is subscribed +//@chat_id Identifier of the chat that is subscribed //@expiration_date Point in time (Unix timestamp) when the subscription will expire or expired -//@can_reuse True, if the subscription is active and the user can use the method reuseStarSubscription to join the subscribed chat again //@is_canceled True, if the subscription was canceled //@is_expiring True, if the subscription expires soon and there are no enough Telegram Stars on the user's balance to extend it -//@invite_link The invite link that can be used to renew the subscription if it has been expired; may be empty, if the link isn't available anymore //@pricing The subscription plan -starSubscription id:string chat_id:int53 expiration_date:int32 can_reuse:Bool is_canceled:Bool is_expiring:Bool invite_link:string pricing:starSubscriptionPricing = StarSubscription; +//@type Type of the subscription +starSubscription id:string chat_id:int53 expiration_date:int32 is_canceled:Bool is_expiring:Bool pricing:starSubscriptionPricing type:StarSubscriptionType = StarSubscription; //@description Represents a list of Telegram Star subscriptions //@star_count The amount of owned Telegram Stars @@ -918,11 +934,12 @@ starGiveawayPaymentOptions options:vector = StarGivea //@sticker The sticker representing the gift //@star_count Number of Telegram Stars that must be paid for the gift //@default_sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the gift by default. If the gift was paid with just bought Telegram Stars, then full value can be claimed +//@is_for_birthday True, if the gift is a birthday gift //@remaining_count Number of remaining times the gift can be purchased by all users; 0 if not limited or the gift was sold out //@total_count Number of total times the gift can be purchased by all users; 0 if not limited //@first_send_date Point in time (Unix timestamp) when the gift was send for the first time; for sold out gifts only //@last_send_date Point in time (Unix timestamp) when the gift was send for the last time; for sold out gifts only -gift id:int64 sticker:sticker star_count:int53 default_sell_star_count:int53 remaining_count:int32 total_count:int32 first_send_date:int32 last_send_date:int32 = Gift; +gift id:int64 sticker:sticker star_count:int53 default_sell_star_count:int53 is_for_birthday:Bool remaining_count:int32 total_count:int32 first_send_date:int32 last_send_date:int32 = Gift; //@description Contains a list of gifts that can be sent to another user @gifts The list of gifts gifts gifts:vector = Gifts; @@ -935,7 +952,7 @@ gifts gifts:vector = Gifts; //@date Point in time (Unix timestamp) when the gift was sent //@gift The gift //@message_id Identifier of the message with the gift in the chat with the sender of the gift; can be 0 or an identifier of a deleted message; only for the gift receiver -//@sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the gift; only for the gift receiver +//@sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the gift; 0 if the gift can't be sold by the current user userGift sender_user_id:int53 text:formattedText is_private:Bool is_saved:Bool date:int32 gift:gift message_id:int53 sell_star_count:int53 = UserGift; //@description Represents a list of gifts received by a user @@ -964,6 +981,12 @@ botTransactionPurposePaidMedia media:vector payload:string = BotTrans //@invoice_payload Invoice payload; for bots only botTransactionPurposeInvoicePayment product_info:productInfo invoice_payload:bytes = BotTransactionPurpose; +//@description User bought a subscription in a bot or a business account +//@period The number of seconds between consecutive Telegram Star debiting +//@product_info Information about the bought subscription; may be null if not applicable +//@invoice_payload Invoice payload; for bots only +botTransactionPurposeSubscription period:int32 product_info:productInfo invoice_payload:bytes = BotTransactionPurpose; + //@class ChatTransactionPurpose @description Describes purpose of a transaction with a supergroup or a channel @@ -989,10 +1012,10 @@ chatTransactionPurposeGiveaway giveaway_message_id:int53 = ChatTransactionPurpos //@description A user gifted Telegram Stars @sticker A sticker to be shown in the transaction information; may be null if unknown userTransactionPurposeGiftedStars sticker:sticker = UserTransactionPurpose; -//@description The current user sold a gift received from another user @gift The gift +//@description The user sold a gift received from another user or bot @gift The gift userTransactionPurposeGiftSell gift:gift = UserTransactionPurpose; -//@description The current user sent a gift to another user @gift The gift +//@description The user or the bot sent a gift to a user @gift The gift userTransactionPurposeGiftSend gift:gift = UserTransactionPurpose; @@ -1176,13 +1199,18 @@ user id:int53 access_hash:int64 first_name:string last_name:string usernames:use //@privacy_policy_url The HTTP link to the privacy policy of the bot. If empty, then /privacy command must be used if supported by the bot. If the command isn't supported, then https://telegram.org/privacy-tpa must be opened //@default_group_administrator_rights Default administrator rights for adding the bot to basic group and supergroup chats; may be null //@default_channel_administrator_rights Default administrator rights for adding the bot to channels; may be null -//@can_get_revenue_statistics True, if the bot's revenue statistics are available +//@web_app_background_light_color Default light background color for bot Web Apps; -1 if not specified +//@web_app_background_dark_color Default dark background color for bot Web Apps; -1 if not specified +//@web_app_header_light_color Default light header color for bot Web Apps; -1 if not specified +//@web_app_header_dark_color Default dark header color for bot Web Apps; -1 if not specified +//@can_get_revenue_statistics True, if the bot's revenue statistics are available to the current user +//@can_manage_emoji_status True, if the bot can manage emoji status of the current user //@has_media_previews True, if the bot has media previews //@edit_commands_link The internal link, which can be used to edit bot commands; may be null //@edit_description_link The internal link, which can be used to edit bot description; may be null //@edit_description_media_link The internal link, which can be used to edit the photo or animation shown in the chat with the bot if the chat is empty; may be null //@edit_settings_link The internal link, which can be used to edit bot settings; may be null -botInfo short_description:string description:string photo:photo animation:animation menu_button:botMenuButton commands:vector privacy_policy_url:string default_group_administrator_rights:chatAdministratorRights default_channel_administrator_rights:chatAdministratorRights can_get_revenue_statistics:Bool has_media_previews:Bool edit_commands_link:InternalLinkType edit_description_link:InternalLinkType edit_description_media_link:InternalLinkType edit_settings_link:InternalLinkType = BotInfo; +botInfo short_description:string description:string photo:photo animation:animation menu_button:botMenuButton commands:vector privacy_policy_url:string default_group_administrator_rights:chatAdministratorRights default_channel_administrator_rights:chatAdministratorRights web_app_background_light_color:int32 web_app_background_dark_color:int32 web_app_header_light_color:int32 web_app_header_dark_color:int32 can_get_revenue_statistics:Bool can_manage_emoji_status:Bool has_media_previews:Bool edit_commands_link:InternalLinkType edit_description_link:InternalLinkType edit_description_media_link:InternalLinkType edit_settings_link:InternalLinkType = BotInfo; //@description Contains full information about a user //@personal_photo User profile photo set by the current user for the contact; may be null. If null and user.profile_photo is null, then the photo is empty; otherwise, it is unknown. @@ -2357,6 +2385,37 @@ loginUrlInfoOpen url:string skip_confirmation:Bool = LoginUrlInfo; loginUrlInfoRequestConfirmation url:string domain:string bot_user_id:int53 request_write_access:Bool = LoginUrlInfo; +//@description Contains parameters of the application theme +//@background_color A color of the background in the RGB format +//@secondary_background_color A secondary color for the background in the RGB format +//@header_background_color A color of the header background in the RGB format +//@bottom_bar_background_color A color of the bottom bar background in the RGB format +//@section_background_color A color of the section background in the RGB format +//@section_separator_color A color of the section separator in the RGB format +//@text_color A color of text in the RGB format +//@accent_text_color An accent color of the text in the RGB format +//@section_header_text_color A color of text on the section headers in the RGB format +//@subtitle_text_color A color of the subtitle text in the RGB format +//@destructive_text_color A color of the text for destructive actions in the RGB format +//@hint_color A color of hints in the RGB format +//@link_color A color of links in the RGB format +//@button_color A color of the buttons in the RGB format +//@button_text_color A color of text on the buttons in the RGB format +themeParameters background_color:int32 secondary_background_color:int32 header_background_color:int32 bottom_bar_background_color:int32 section_background_color:int32 section_separator_color:int32 text_color:int32 accent_text_color:int32 section_header_text_color:int32 subtitle_text_color:int32 destructive_text_color:int32 hint_color:int32 link_color:int32 button_color:int32 button_text_color:int32 = ThemeParameters; + + +//@class WebAppOpenMode @description Describes mode in which a Web App is opened + +//@description The Web App is opened in the compact mode +webAppOpenModeCompact = WebAppOpenMode; + +//@description The Web App is opened in the full-size mode +webAppOpenModeFullSize = WebAppOpenMode; + +//@description The Web App is opened in the full-screen mode +webAppOpenModeFullScreen = WebAppOpenMode; + + //@description Contains information about a Web App found by its short name //@web_app The Web App //@request_write_access True, if the user must be asked for the permission to the bot to send them messages @@ -2366,8 +2425,14 @@ foundWebApp web_app:webApp request_write_access:Bool skip_confirmation:Bool = Fo //@description Contains information about a Web App @launch_id Unique identifier for the Web App launch @url A Web App URL to open in a web view webAppInfo launch_id:int64 url:string = WebAppInfo; -//@description Contains information about the main Web App of a bot @url URL of the Web App to open @is_compact True, if the Web App must always be opened in the compact mode instead of the full-size mode -mainWebApp url:string is_compact:Bool = MainWebApp; +//@description Contains information about the main Web App of a bot @url URL of the Web App to open @mode The mode in which the Web App must be opened +mainWebApp url:string mode:WebAppOpenMode = MainWebApp; + +//@description Options to be used when a Web App is opened +//@theme Preferred Web App theme; pass null to use the default theme +//@application_name Short name of the current application; 0-64 English letters, digits, and underscores +//@mode The mode in which the Web App is opened; pass null to open in webAppOpenModeFullSize +webAppOpenParameters theme:themeParameters application_name:string mode:WebAppOpenMode = WebAppOpenParameters; //@description Contains information about a message thread @@ -2946,31 +3011,13 @@ address country_code:string state:string city:string street_line1:string street_ locationAddress country_code:string state:string city:string street:string = LocationAddress; -//@description Contains parameters of the application theme -//@background_color A color of the background in the RGB format -//@secondary_background_color A secondary color for the background in the RGB format -//@header_background_color A color of the header background in the RGB format -//@bottom_bar_background_color A color of the bottom bar background in the RGB format -//@section_background_color A color of the section background in the RGB format -//@section_separator_color A color of the section separator in the RGB format -//@text_color A color of text in the RGB format -//@accent_text_color An accent color of the text in the RGB format -//@section_header_text_color A color of text on the section headers in the RGB format -//@subtitle_text_color A color of the subtitle text in the RGB format -//@destructive_text_color A color of the text for destructive actions in the RGB format -//@hint_color A color of hints in the RGB format -//@link_color A color of links in the RGB format -//@button_color A color of the buttons in the RGB format -//@button_text_color A color of text on the buttons in the RGB format -themeParameters background_color:int32 secondary_background_color:int32 header_background_color:int32 bottom_bar_background_color:int32 section_background_color:int32 section_separator_color:int32 text_color:int32 accent_text_color:int32 section_header_text_color:int32 subtitle_text_color:int32 destructive_text_color:int32 hint_color:int32 link_color:int32 button_color:int32 button_text_color:int32 = ThemeParameters; - - //@description Portion of the price of a product (e.g., "delivery cost", "tax amount") @label Label for this portion of the product price @amount Currency amount in the smallest units of the currency labeledPricePart label:string amount:int53 = LabeledPricePart; //@description Product invoice //@currency ISO 4217 currency code //@price_parts A list of objects used to calculate the total price of the product +//@subscription_period The number of seconds between consecutive Telegram Star debiting for subscription invoices; 0 if the invoice doesn't create subscription //@max_tip_amount The maximum allowed amount of tip in the smallest units of the currency //@suggested_tip_amounts Suggested amounts of tip in the smallest units of the currency //@recurring_payment_terms_of_service_url An HTTP URL with terms of service for recurring payments. If non-empty, the invoice payment will result in recurring payments and the user must accept the terms of service before allowed to pay @@ -2983,7 +3030,7 @@ labeledPricePart label:string amount:int53 = LabeledPricePart; //@send_phone_number_to_provider True, if the user's phone number will be sent to the provider //@send_email_address_to_provider True, if the user's email address will be sent to the provider //@is_flexible True, if the total price depends on the shipping method -invoice currency:string price_parts:vector max_tip_amount:int53 suggested_tip_amounts:vector recurring_payment_terms_of_service_url:string terms_of_service_url:string is_test:Bool need_name:Bool need_phone_number:Bool need_email_address:Bool need_shipping_address:Bool send_phone_number_to_provider:Bool send_email_address_to_provider:Bool is_flexible:Bool = Invoice; +invoice currency:string price_parts:vector subscription_period:int32 max_tip_amount:int53 suggested_tip_amounts:vector recurring_payment_terms_of_service_url:string terms_of_service_url:string is_test:Bool need_name:Bool need_phone_number:Bool need_email_address:Bool need_shipping_address:Bool send_phone_number_to_provider:Bool send_email_address_to_provider:Bool is_flexible:Bool = Invoice; //@description Order information //@name Name of the user @@ -3053,6 +3100,9 @@ paymentFormTypeRegular invoice:invoice payment_provider_user_id:int53 payment_pr //@description The payment form is for a payment in Telegram Stars @star_count Number of Telegram Stars that will be paid paymentFormTypeStars star_count:int53 = PaymentFormType; +//@description The payment form is for a payment in Telegram Stars for subscription @pricing Information about subscription plan +paymentFormTypeStarSubscription pricing:starSubscriptionPricing = PaymentFormType; + //@description Contains information about an invoice payment form //@id The payment form identifier @@ -3628,27 +3678,29 @@ messageCustomServiceAction text:string = MessageContent; //@description A new high score was achieved in a game @game_message_id Identifier of the message with the game, can be an identifier of a deleted message @game_id Identifier of the game; may be different from the games presented in the message with the game @score New score messageGameScore game_message_id:int53 game_id:int64 score:int32 = MessageContent; -//@description A payment has been completed +//@description A payment has been sent to a bot or a business account //@invoice_chat_id Identifier of the chat, containing the corresponding invoice message //@invoice_message_id Identifier of the message with the corresponding invoice; can be 0 or an identifier of a deleted message //@currency Currency for the price of the product //@total_amount Total price for the product, in the smallest units of the currency +//@subscription_until_date Point in time (Unix timestamp) when the subscription will expire; 0 if unknown or the payment isn't recurring //@is_recurring True, if this is a recurring payment //@is_first_recurring True, if this is the first recurring payment //@invoice_name Name of the invoice; may be empty if unknown -messagePaymentSuccessful invoice_chat_id:int53 invoice_message_id:int53 currency:string total_amount:int53 is_recurring:Bool is_first_recurring:Bool invoice_name:string = MessageContent; +messagePaymentSuccessful invoice_chat_id:int53 invoice_message_id:int53 currency:string total_amount:int53 subscription_until_date:int32 is_recurring:Bool is_first_recurring:Bool invoice_name:string = MessageContent; -//@description A payment has been completed; for bots only +//@description A payment has been received by the bot or the business account //@currency Currency for price of the product //@total_amount Total price for the product, in the smallest units of the currency +//@subscription_until_date Point in time (Unix timestamp) when the subscription will expire; 0 if unknown or the payment isn't recurring //@is_recurring True, if this is a recurring payment //@is_first_recurring True, if this is the first recurring payment //@invoice_payload Invoice payload -//@shipping_option_id Identifier of the shipping option chosen by the user; may be empty if not applicable -//@order_info Information about the order; may be null +//@shipping_option_id Identifier of the shipping option chosen by the user; may be empty if not applicable; for bots only +//@order_info Information about the order; may be null; for bots only //@telegram_payment_charge_id Telegram payment identifier //@provider_payment_charge_id Provider payment identifier -messagePaymentSuccessfulBot currency:string total_amount:int53 is_recurring:Bool is_first_recurring:Bool invoice_payload:bytes shipping_option_id:string order_info:orderInfo telegram_payment_charge_id:string provider_payment_charge_id:string = MessageContent; +messagePaymentSuccessfulBot currency:string total_amount:int53 subscription_until_date:int32 is_recurring:Bool is_first_recurring:Bool invoice_payload:bytes shipping_option_id:string order_info:orderInfo telegram_payment_charge_id:string provider_payment_charge_id:string = MessageContent; //@description A payment has been refunded //@owner_id Identifier of the previous owner of the Telegram Stars that refunds them @@ -3741,7 +3793,7 @@ messageGiveawayPrizeStars star_count:int53 transaction_id:string boosted_chat_id //@description A gift was received or sent by the current user //@gift The gift //@text Message added to the gift -//@sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the gift +//@sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the gift; 0 if the gift can't be sold by the receiver //@is_private True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone will be able to see them //@is_saved True, if the gift is displayed on the user's profile page; only for the receiver of the gift //@was_converted True, if the gift was converted to Telegram Stars; only for the receiver of the gift @@ -3984,7 +4036,7 @@ inputMessagePhoto photo:InputFile thumbnail:inputThumbnail added_sticker_file_id inputMessageSticker sticker:InputFile thumbnail:inputThumbnail width:int32 height:int32 emoji:string = InputMessageContent; //@description A video message -//@video Video to be sent. The video is expected to be reencoded to MPEG4 format with H.264 codec by the sender +//@video Video to be sent. The video is expected to be re-encoded to MPEG4 format with H.264 codec by the sender //@thumbnail Video thumbnail; pass null to skip thumbnail uploading //@added_sticker_file_ids File identifiers of the stickers added to the video, if applicable //@duration Duration of the video, in seconds @@ -4242,7 +4294,7 @@ emojis emojis:vector = Emojis; //@title Title of the sticker set //@name Name of the sticker set //@thumbnail Sticker set thumbnail in WEBP, TGS, or WEBM format with width and height 100; may be null. The file can be downloaded only before the thumbnail is changed -//@thumbnail_outline Sticker set thumbnail's outline represented as a list of closed vector paths; may be empty. The coordinate system origin is in the upper-left corner +//@thumbnail_outline Sticker set thumbnail's outline; may be null if unknown //@is_owned True, if the sticker set is owned by the current user //@is_installed True, if the sticker set has been installed by the current user //@is_archived True, if the sticker set has been archived. A sticker set can't be installed and archived simultaneously @@ -4253,14 +4305,14 @@ emojis emojis:vector = Emojis; //@is_viewed True for already viewed trending sticker sets //@stickers List of stickers in this set //@emojis A list of emojis corresponding to the stickers in the same order. The list is only for informational purposes, because a sticker is always sent with a fixed emoji from the corresponding Sticker object -stickerSet id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:vector is_owned:Bool is_installed:Bool is_archived:Bool is_official:Bool sticker_type:StickerType needs_repainting:Bool is_allowed_as_chat_emoji_status:Bool is_viewed:Bool stickers:vector emojis:vector = StickerSet; +stickerSet id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:outline is_owned:Bool is_installed:Bool is_archived:Bool is_official:Bool sticker_type:StickerType needs_repainting:Bool is_allowed_as_chat_emoji_status:Bool is_viewed:Bool stickers:vector emojis:vector = StickerSet; //@description Represents short information about a sticker set //@id Identifier of the sticker set //@title Title of the sticker set //@name Name of the sticker set //@thumbnail Sticker set thumbnail in WEBP, TGS, or WEBM format with width and height 100; may be null. The file can be downloaded only before the thumbnail is changed -//@thumbnail_outline Sticker set thumbnail's outline represented as a list of closed vector paths; may be empty. The coordinate system origin is in the upper-left corner +//@thumbnail_outline Sticker set thumbnail's outline; may be null if unknown //@is_owned True, if the sticker set is owned by the current user //@is_installed True, if the sticker set has been installed by the current user //@is_archived True, if the sticker set has been archived. A sticker set can't be installed and archived simultaneously @@ -4271,7 +4323,7 @@ stickerSet id:int64 title:string name:string thumbnail:thumbnail thumbnail_outli //@is_viewed True for already viewed trending sticker sets //@size Total number of stickers in the set //@covers Up to the first 5 stickers from the set, depending on the context. If the application needs more stickers the full sticker set needs to be requested -stickerSetInfo id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:vector is_owned:Bool is_installed:Bool is_archived:Bool is_official:Bool sticker_type:StickerType needs_repainting:Bool is_allowed_as_chat_emoji_status:Bool is_viewed:Bool size:int32 covers:vector = StickerSetInfo; +stickerSetInfo id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:outline is_owned:Bool is_installed:Bool is_archived:Bool is_official:Bool sticker_type:StickerType needs_repainting:Bool is_allowed_as_chat_emoji_status:Bool is_viewed:Bool size:int32 covers:vector = StickerSetInfo; //@description Represents a list of sticker sets @total_count Approximate total number of sticker sets found @sets List of sticker sets stickerSets total_count:int32 sets:vector = StickerSets; @@ -5106,6 +5158,26 @@ httpUrl url:string = HttpUrl; userLink url:string expires_in:int32 = UserLink; +//@description Describes allowed types for the target chat +//@allow_user_chats True, if private chats with ordinary users are allowed +//@allow_bot_chats True, if private chats with other bots are allowed +//@allow_group_chats True, if basic group and supergroup chats are allowed +//@allow_channel_chats True, if channel chats are allowed +targetChatTypes allow_user_chats:Bool allow_bot_chats:Bool allow_group_chats:Bool allow_channel_chats:Bool = TargetChatTypes; + + +//@class TargetChat @description Describes the target chat to be opened + +//@description The currently opened chat needs to be kept +targetChatCurrent = TargetChat; + +//@description The chat needs to be chosen by the user among chats of the specified types @types Allowed types for the chat +targetChatChosen types:targetChatTypes = TargetChat; + +//@description The chat needs to be open with the provided internal link @link An internal link pointing to the chat +targetChatInternalLink link:InternalLinkType = TargetChat; + + //@class InputInlineQueryResult @description Represents a single result of an inline query; for bots only //@description Represents a link to an animated GIF or an animated (i.e., without sound) H.264/MPEG-4 AVC video @@ -5342,6 +5414,18 @@ inlineQueryResultsButton text:string type:InlineQueryResultsButtonType = InlineQ inlineQueryResults inline_query_id:int64 button:inlineQueryResultsButton results:vector next_offset:string = InlineQueryResults; +//@description Represents an inline message that can be sent via the bot +//@id Unique identifier for the message +//@expiration_date Point in time (Unix timestamp) when the message can't be used anymore +preparedInlineMessageId id:string expiration_date:int32 = PreparedInlineMessageId; + +//@description Represents a ready to send inline message. Use sendInlineQueryResultMessage to send the message +//@inline_query_id Unique identifier of the inline query to pass to sendInlineQueryResultMessage +//@result Resulted inline message of the query +//@chat_types Types of the chats to which the message can be sent +preparedInlineMessage inline_query_id:int64 result:InlineQueryResult chat_types:targetChatTypes = PreparedInlineMessage; + + //@class CallbackQueryPayload @description Represents a payload of a callback query //@description The payload for a general callback button @data Data that was attached to the callback button @@ -6409,6 +6493,9 @@ userPrivacySettingRuleAllowAll = UserPrivacySettingRule; //@description A rule to allow all contacts of the user to do something userPrivacySettingRuleAllowContacts = UserPrivacySettingRule; +//@description A rule to allow all bots to do something +userPrivacySettingRuleAllowBots = UserPrivacySettingRule; + //@description A rule to allow all Premium Users to do something; currently, allowed only for userPrivacySettingAllowChatInvites userPrivacySettingRuleAllowPremiumUsers = UserPrivacySettingRule; @@ -6424,6 +6511,9 @@ userPrivacySettingRuleRestrictAll = UserPrivacySettingRule; //@description A rule to restrict all contacts of the user from doing something userPrivacySettingRuleRestrictContacts = UserPrivacySettingRule; +//@description A rule to restrict all bots from doing something +userPrivacySettingRuleRestrictBots = UserPrivacySettingRule; + //@description A rule to restrict all specified users from doing something @user_ids The user identifiers, total number of users in all rules must not exceed 1000 userPrivacySettingRuleRestrictUsers user_ids:vector = UserPrivacySettingRule; @@ -6469,6 +6559,9 @@ userPrivacySettingAllowFindingByPhoneNumber = UserPrivacySetting; //@description A privacy setting for managing whether the user can receive voice and video messages in private chats; for Telegram Premium users only userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages = UserPrivacySetting; +//@description A privacy setting for managing whether received gifts are automatically shown on the user's profile page +userPrivacySettingAutosaveGifts = UserPrivacySetting; + //@description Contains privacy settings for message read date in private chats. Read dates are always shown to the users that can see online status of the current user regardless of this setting //@show_read_date True, if message read date is shown to other users in private chats. If false and the current user isn't a Telegram Premium user, then they will not be able to see other's message read date @@ -6661,22 +6754,6 @@ reportStoryResultOptionRequired title:string options:vector = Repo reportStoryResultTextRequired option_id:bytes is_optional:Bool = ReportStoryResult; -//@class TargetChat @description Describes the target chat to be opened - -//@description The currently opened chat needs to be kept -targetChatCurrent = TargetChat; - -//@description The chat needs to be chosen by the user among chats of the specified types -//@allow_user_chats True, if private chats with ordinary users are allowed -//@allow_bot_chats True, if private chats with other bots are allowed -//@allow_group_chats True, if basic group and supergroup chats are allowed -//@allow_channel_chats True, if channel chats are allowed -targetChatChosen allow_user_chats:Bool allow_bot_chats:Bool allow_group_chats:Bool allow_channel_chats:Bool = TargetChat; - -//@description The chat needs to be open with the provided internal link @link An internal link pointing to the chat -targetChatInternalLink link:InternalLinkType = TargetChat; - - //@class InternalLinkType @description Describes an internal https://t.me or tg: link, which must be processed by the application in a special way //@description The link is a link to the Devices section of the application. Use getActiveSessions to get the list of active sessions and show them to the user @@ -6790,11 +6867,11 @@ internalLinkTypeLanguageSettings = InternalLinkType; //-If the bot can be added to attachment menu, then use getAttachmentMenuBot to receive information about the bot, then if the bot isn't added to side menu, //-show a disclaimer about Mini Apps being third-party applications, ask the user to accept their Terms of service and confirm adding the bot to side and attachment menu, //-then if the user accepts the terms and confirms adding, use toggleBotIsAddedToAttachmentMenu to add the bot. -//-Then, use getMainWebApp with the given start parameter and open the returned URL as a Web App +//-Then, use getMainWebApp with the given start parameter and mode and open the returned URL as a Web App //@bot_username Username of the bot //@start_parameter Start parameter to be passed to getMainWebApp -//@is_compact True, if the Web App must be opened in the compact mode instead of the full-size mode -internalLinkTypeMainWebApp bot_username:string start_parameter:string is_compact:Bool = InternalLinkType; +//@mode The mode to be passed to getMainWebApp +internalLinkTypeMainWebApp bot_username:string start_parameter:string mode:WebAppOpenMode = InternalLinkType; //@description The link is a link to a Telegram message or a forum topic. Call getMessageLinkInfo with the given URL to process the link, //-and then open received forum topic or chat and show the message there @@ -6909,8 +6986,8 @@ internalLinkTypeVideoChat chat_username:string invite_hash:string is_live_stream //@bot_username Username of the bot that owns the Web App //@web_app_short_name Short name of the Web App //@start_parameter Start parameter to be passed to getWebAppLinkUrl -//@is_compact True, if the Web App must be opened in the compact mode instead of the full-size mode -internalLinkTypeWebApp bot_username:string web_app_short_name:string start_parameter:string is_compact:Bool = InternalLinkType; +//@mode The mode in which the Web App must be opened +internalLinkTypeWebApp bot_username:string web_app_short_name:string start_parameter:string mode:WebAppOpenMode = InternalLinkType; //@description Contains an HTTPS link to a message in a supergroup or channel, or a forum topic @link The link @is_public True, if the link will work for non-members of the chat @@ -9462,6 +9539,17 @@ getInlineQueryResults bot_user_id:int53 chat_id:int53 user_location:location que //@next_offset Offset for the next inline query; pass an empty string if there are no more results answerInlineQuery inline_query_id:int64 is_personal:Bool button:inlineQueryResultsButton results:vector cache_time:int32 next_offset:string = Ok; +//@description Saves an inline message to be sent by the given user; for bots only +//@user_id Identifier of the user +//@result The description of the message +//@chat_types Types of the chats to which the message can be sent +savePreparedInlineMessage user_id:int53 result:InputInlineQueryResult chat_types:targetChatTypes = PreparedInlineMessageId; + +//@description Saves an inline message to be sent by the given user; for bots only +//@bot_user_id Identifier of the bot that created the message +//@prepared_message_id Identifier of the prepared message +getPreparedInlineMessage bot_user_id:int53 prepared_message_id:string = PreparedInlineMessage; + //@description Returns the most grossing Web App bots //@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results @@ -9473,30 +9561,30 @@ getGrossingWebAppBots offset:string limit:int32 = FoundUsers; //@web_app_short_name Short name of the Web App searchWebApp bot_user_id:int53 web_app_short_name:string = FoundWebApp; +//@description Returns a default placeholder for Web Apps of a bot; this is an offline request. Returns a 404 error if the placeholder isn't known @bot_user_id Identifier of the target bot +getWebAppPlaceholder bot_user_id:int53 = Outline; + //@description Returns an HTTPS URL of a Web App to open after a link of the type internalLinkTypeWebApp is clicked //@chat_id Identifier of the chat in which the link was clicked; pass 0 if none //@bot_user_id Identifier of the target bot //@web_app_short_name Short name of the Web App //@start_parameter Start parameter from internalLinkTypeWebApp -//@theme Preferred Web App theme; pass null to use the default theme -//@application_name Short name of the current application; 0-64 English letters, digits, and underscores //@allow_write_access Pass true if the current user allowed the bot to send them messages -getWebAppLinkUrl chat_id:int53 bot_user_id:int53 web_app_short_name:string start_parameter:string theme:themeParameters application_name:string allow_write_access:Bool = HttpUrl; +//@parameters Parameters to use to open the Web App +getWebAppLinkUrl chat_id:int53 bot_user_id:int53 web_app_short_name:string start_parameter:string allow_write_access:Bool parameters:webAppOpenParameters = HttpUrl; //@description Returns information needed to open the main Web App of a bot //@chat_id Identifier of the chat in which the Web App is opened; pass 0 if none //@bot_user_id Identifier of the target bot //@start_parameter Start parameter from internalLinkTypeMainWebApp -//@theme Preferred Web App theme; pass null to use the default theme -//@application_name Short name of the current application; 0-64 English letters, digits, and underscores -getMainWebApp chat_id:int53 bot_user_id:int53 start_parameter:string theme:themeParameters application_name:string = MainWebApp; +//@parameters Parameters to use to open the Web App +getMainWebApp chat_id:int53 bot_user_id:int53 start_parameter:string parameters:webAppOpenParameters = MainWebApp; //@description Returns an HTTPS URL of a Web App to open from the side menu, a keyboardButtonTypeWebApp button, or an inlineQueryResultsButtonTypeWebApp button //@bot_user_id Identifier of the target bot //@url The URL from a keyboardButtonTypeWebApp button, inlineQueryResultsButtonTypeWebApp button, or an empty string when the bot is opened from the side menu -//@theme Preferred Web App theme; pass null to use the default theme -//@application_name Short name of the current application; 0-64 English letters, digits, and underscores -getWebAppUrl bot_user_id:int53 url:string theme:themeParameters application_name:string = HttpUrl; +//@parameters Parameters to use to open the Web App +getWebAppUrl bot_user_id:int53 url:string parameters:webAppOpenParameters = HttpUrl; //@description Sends data received from a keyboardButtonTypeWebApp Web App to a bot //@bot_user_id Identifier of the target bot @@ -9509,11 +9597,10 @@ sendWebAppData bot_user_id:int53 button_text:string data:string = Ok; //@chat_id Identifier of the chat in which the Web App is opened. The Web App can't be opened in secret chats //@bot_user_id Identifier of the bot, providing the Web App //@url The URL from an inlineKeyboardButtonTypeWebApp button, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an empty string otherwise -//@theme Preferred Web App theme; pass null to use the default theme -//@application_name Short name of the current application; 0-64 English letters, digits, and underscores //@message_thread_id If not 0, the message thread identifier in which the message will be sent //@reply_to Information about the message or story to be replied in the message sent by the Web App; pass null if none -openWebApp chat_id:int53 bot_user_id:int53 url:string theme:themeParameters application_name:string message_thread_id:int53 reply_to:InputMessageReplyTo = WebAppInfo; +//@parameters Parameters to use to open the Web App +openWebApp chat_id:int53 bot_user_id:int53 url:string message_thread_id:int53 reply_to:InputMessageReplyTo parameters:webAppOpenParameters = WebAppInfo; //@description Informs TDLib that a previously opened Web App was closed @web_app_launch_id Identifier of Web App launch, received from openWebApp closeWebApp web_app_launch_id:int64 = Ok; @@ -9523,6 +9610,12 @@ closeWebApp web_app_launch_id:int64 = Ok; //@result The result of the query answerWebAppQuery web_app_query_id:string result:InputInlineQueryResult = SentWebAppMessage; +//@description Checks whether a file can be downloaded and saved locally by Web App request +//@bot_user_id Identifier of the bot, providing the Web App +//@file_name Name of the file +//@url URL of the file +checkWebAppFileDownload bot_user_id:int53 file_name:string url:string = Ok; + //@description Sends a callback query to a bot and returns an answer. Returns an error with code 502 if the bot fails to answer the query before the query timeout expires //@chat_id Identifier of the chat with the message @@ -10458,7 +10551,7 @@ setVideoChatDefaultParticipant chat_id:int53 default_participant_id:MessageSende //@is_rtmp_stream Pass true to create an RTMP stream instead of an ordinary video chat; requires owner privileges createVideoChat chat_id:int53 title:string start_date:int32 is_rtmp_stream:Bool = GroupCallId; -//@description Returns RTMP URL for streaming to the chat; requires owner privileges @chat_id Chat identifier +//@description Returns RTMP URL for streaming to the chat; requires can_manage_video_chats administrator right @chat_id Chat identifier getVideoChatRtmpUrl chat_id:int53 = RtmpUrl; //@description Replaces the current RTMP URL for streaming to the chat; requires owner privileges @chat_id Chat identifier @@ -10643,6 +10736,12 @@ setUserPersonalProfilePhoto user_id:int53 photo:InputChatPhoto = Ok; //@description Suggests a profile photo to another regular user with common messages @user_id User identifier @photo Profile photo to suggest; inputChatPhotoPrevious isn't supported in this function suggestUserProfilePhoto user_id:int53 photo:InputChatPhoto = Ok; +//@description Toggles whether the bot can manage emoji status of the current user @bot_user_id User identifier of the bot @can_manage_emoji_status Pass true if the bot is allowed to change emoji status of the user; pass false otherwise +toggleBotCanManageEmojiStatus bot_user_id:int53 can_manage_emoji_status:Bool = Ok; + +//@description Changes the emoji status of a user; for bots only @user_id Identifier of the user @emoji_status New emoji status; pass null to switch to the default badge +setUserEmojiStatus user_id:int53 emoji_status:emojiStatus = Ok; + //@description Searches a user by their phone number. Returns a 404 error if the user can't be found //@phone_number Phone number to search for @@ -10657,6 +10756,12 @@ sharePhoneNumber user_id:int53 = Ok; getUserProfilePhotos user_id:int53 offset:int32 limit:int32 = ChatPhotos; +//@description Returns outline of a sticker; this is an offline request. Returns a 404 error if the outline isn't known +//@sticker_file_id File identifier of the sticker +//@for_animated_emoji Pass true to get the outline scaled for animated emoji +//@for_clicked_animated_emoji_message Pass true to get the outline scaled for clicked animated emoji message +getStickerOutline sticker_file_id:int32 for_animated_emoji:Bool for_clicked_animated_emoji_message:Bool = Outline; + //@description Returns stickers from the installed sticker sets that correspond to any of the given emoji or can be found by sticker-specific keywords. If the query is non-empty, then favorite, recently used or trending stickers may also be returned //@sticker_type Type of the stickers to return //@query Search query; a space-separated list of emojis or a keyword prefix. If empty, returns all known installed stickers @@ -11278,8 +11383,10 @@ toggleGiftIsSaved sender_user_id:int53 message_id:int53 is_saved:Bool = Ok; getUserGifts user_id:int53 offset:string limit:int32 = UserGifts; -//@description Creates a link for the given invoice; for bots only @invoice Information about the invoice of the type inputMessageInvoice -createInvoiceLink invoice:InputMessageContent = HttpUrl; +//@description Creates a link for the given invoice; for bots only +//@business_connection_id Unique identifier of business connection on behalf of which to send the request +//@invoice Information about the invoice of the type inputMessageInvoice +createInvoiceLink business_connection_id:string invoice:InputMessageContent = HttpUrl; //@description Refunds a previously done payment in Telegram Stars; for bots only //@user_id Identifier of the user that did the payment @@ -11786,12 +11893,18 @@ assignAppStoreTransaction receipt:bytes purpose:StorePaymentPurpose = Ok; //@purpose Transaction purpose assignGooglePlayTransaction package_name:string store_product_id:string purchase_token:string purpose:StorePaymentPurpose = Ok; -//@description Cancels or reenables Telegram Star subscription to a channel +//@description Cancels or re-enables Telegram Star subscription //@subscription_id Identifier of the subscription to change //@is_canceled New value of is_canceled editStarSubscription subscription_id:string is_canceled:Bool = Ok; -//@description Reuses an active subscription and joins the subscribed chat again @subscription_id Identifier of the subscription +//@description Cancels or re-enables Telegram Star subscription for a user; for bots only +//@user_id User identifier +//@telegram_payment_charge_id Telegram payment identifier of the subscription +//@is_canceled Pass true to cancel the subscription; pass false to allow the user to enable it +editUserStarSubscription user_id:int53 telegram_payment_charge_id:string is_canceled:Bool = Ok; + +//@description Reuses an active Telegram Star subscription to a channel chat and joins the chat again @subscription_id Identifier of the subscription reuseStarSubscription subscription_id:string = Ok; From 4b010c3b4336bce177b208f9db3a3707a0457f23 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Mon, 18 Nov 2024 13:15:17 +0800 Subject: [PATCH 29/54] Support FreeBSD --- client/tdlib.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client/tdlib.go b/client/tdlib.go index adf0a0d..c9c07db 100644 --- a/client/tdlib.go +++ b/client/tdlib.go @@ -1,9 +1,11 @@ package client //#cgo linux CFLAGS: -I/usr/local/include +//#cgo freebsd CFLAGS: -I/usr/local/include //#cgo darwin CFLAGS: -I/usr/local/include //#cgo windows CFLAGS: -IE:/src/tdlib -IE:/src/tdlib/build //#cgo linux LDFLAGS: -L/usr/local/lib -ltdjson_static -ltdjson_private -ltdclient -ltdcore -ltdapi -ltdactor -ltddb -ltdsqlite -ltdmtproto -ltdnet -ltdutils -lstdc++ -lssl -lcrypto -ldl -lz -lm +//#cgo freebsd LDFLAGS: -L/usr/local/lib -ltdjson_static -ltdjson_private -ltdclient -ltdcore -ltdapi -ltdactor -ltddb -ltdsqlite -ltdmtproto -ltdnet -ltdutils -lstdc++ -lssl -lcrypto -ldl -lz -lm //#cgo darwin LDFLAGS: -L/usr/local/lib -L/usr/local/opt/openssl/lib -ltdjson_static -ltdjson_private -ltdclient -ltdcore -ltdapi -ltdactor -ltddb -ltdsqlite -ltdmtproto -ltdnet -ltdutils -lstdc++ -lssl -lcrypto -ldl -lz -lm //#cgo windows LDFLAGS: -LE:/src/tdlib/build/Release -ltdjson //#include From 930f3352f321da987d6655a376650ddc7be95166 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Thu, 12 Dec 2024 14:18:11 +0800 Subject: [PATCH 30/54] Update go mod --- go.mod | 4 ++-- go.sum | 36 +++++++++++++++++++++++++++++++----- 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index 204c57c..2b1a523 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,6 @@ module github.com/c0re100/gotdlib go 1.16 require ( - github.com/google/uuid v1.3.1 - golang.org/x/crypto v0.13.0 + github.com/google/uuid v1.6.0 + golang.org/x/crypto v0.31.0 ) diff --git a/go.sum b/go.sum index 26cc704..131bad5 100644 --- a/go.sum +++ b/go.sum @@ -1,20 +1,34 @@ -github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= -github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= +golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= +golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= +golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -22,22 +36,34 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= +golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= -golang.org/x/term v0.12.0 h1:/ZfYdc3zq+q02Rv9vGqTeSItdzZTSNDmfTi0mBAuidU= golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= +golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= +golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= +golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q= +golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= From 58adcc480457a7667690521f0768cc50a3bab8e9 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Sun, 15 Dec 2024 02:12:12 +0800 Subject: [PATCH 31/54] Update to TDLib 1.8.41 --- client/function.go | 251 ++++++- client/type.go | 1638 +++++++++++++++++++++++++++-------------- client/unmarshaler.go | 664 +++++++++++------ data/td_api.tl | 353 ++++++--- 4 files changed, 2033 insertions(+), 873 deletions(-) diff --git a/client/function.go b/client/function.go index 5159be1..5b97dd5 100755 --- a/client/function.go +++ b/client/function.go @@ -7084,7 +7084,7 @@ type GetPreparedInlineMessageRequest struct { PreparedMessageId string `json:"prepared_message_id"` } -// Saves an inline message to be sent by the given user; for bots only +// Saves an inline message to be sent by the given user func (client *Client) GetPreparedInlineMessage(req *GetPreparedInlineMessageRequest) (*PreparedInlineMessage, error) { result, err := client.Send(Request{ meta: meta{ @@ -8021,6 +8021,9 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeChangePhoneNumber: return UnmarshalInternalLinkTypeChangePhoneNumber(result.Data) + case TypeInternalLinkTypeChatAffiliateProgram: + return UnmarshalInternalLinkTypeChatAffiliateProgram(result.Data) + case TypeInternalLinkTypeChatBoost: return UnmarshalInternalLinkTypeChatBoost(result.Data) @@ -10897,7 +10900,7 @@ func (client *Client) EditStoryCover(req *EditStoryCoverRequest) (*Ok, error) { type SetStoryPrivacySettingsRequest struct { // Identifier of the story StoryId int32 `json:"story_id"` - // The new privacy settigs for the story + // The new privacy settings for the story PrivacySettings StoryPrivacySettings `json:"privacy_settings"` } @@ -13393,7 +13396,7 @@ type CreateVideoChatRequest struct { Title string `json:"title"` // Point in time (Unix timestamp) when the group call is expected to be started by an administrator; 0 to start the video chat immediately. The date must be at least 10 seconds and at most 8 days in the future StartDate int32 `json:"start_date"` - // Pass true to create an RTMP stream instead of an ordinary video chat; requires owner privileges + // Pass true to create an RTMP stream instead of an ordinary video chat IsRtmpStream bool `json:"is_rtmp_stream"` } @@ -14861,8 +14864,14 @@ func (client *Client) GetAllStickerEmojis(req *GetAllStickerEmojisRequest) (*Emo type SearchStickersRequest struct { // Type of the stickers to return StickerType StickerType `json:"sticker_type"` - // Space-separated list of emojis to search for; must be non-empty + // Space-separated list of emojis to search for Emojis string `json:"emojis"` + // Query to search for; may be empty to search for emoji only + Query string `json:"query"` + // List of possible IETF language tags of the user's input language; may be empty if unknown + InputLanguageCodes []string `json:"input_language_codes"` + // The offset from which to return the stickers; must be non-negative + Offset int32 `json:"offset"` // The maximum number of stickers to be returned; 0-100 Limit int32 `json:"limit"` } @@ -14876,6 +14885,9 @@ func (client *Client) SearchStickers(req *SearchStickersRequest) (*Stickers, err Data: map[string]interface{}{ "sticker_type": req.StickerType, "emojis": req.Emojis, + "query": req.Query, + "input_language_codes": req.InputLanguageCodes, + "offset": req.Offset, "limit": req.Limit, }, }) @@ -15796,6 +15808,25 @@ func (client *Client) GetRecentInlineBots() (*Users, error) { return UnmarshalUsers(result.Data) } +// Returns the list of bots owned by the current user +func (client *Client) GetOwnedBots() (*Users, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getOwnedBots", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalUsers(result.Data) +} + type SearchHashtagsRequest struct { // Hashtag prefix to search for Prefix string `json:"prefix"` @@ -22230,6 +22261,218 @@ func (client *Client) ReuseStarSubscription(req *ReuseStarSubscriptionRequest) ( return UnmarshalOk(result.Data) } +type SetChatAffiliateProgramRequest struct { + // Identifier of the chat with an owned bot for which affiliate program is changed + ChatId int64 `json:"chat_id"` + // Parameters of the affiliate program; pass null to close the currently active program. If there is an active program, then commission and program duration can only be increased. If the active program is scheduled to be closed, then it can't be changed anymore + Parameters *AffiliateProgramParameters `json:"parameters"` +} + +// Changes affiliate program for a bot +func (client *Client) SetChatAffiliateProgram(req *SetChatAffiliateProgramRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setChatAffiliateProgram", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "parameters": req.Parameters, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SearchChatAffiliateProgramRequest struct { + // Username of the chat + Username string `json:"username"` + // The referrer from an internalLinkTypeChatAffiliateProgram link + Referrer string `json:"referrer"` +} + +// Searches a chat with an affiliate program. Returns the chat if found and the program is active +func (client *Client) SearchChatAffiliateProgram(req *SearchChatAffiliateProgramRequest) (*Chat, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchChatAffiliateProgram", + }, + Data: map[string]interface{}{ + "username": req.Username, + "referrer": req.Referrer, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChat(result.Data) +} + +type SearchAffiliateProgramsRequest struct { + // Identifier of the chat for which affiliate programs are searched for. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right + ChatId int64 `json:"chat_id"` + // Sort order for the results + SortOrder AffiliateProgramSortOrder `json:"sort_order"` + // Offset of the first affiliate program to return as received from the previous request; use empty string to get the first chunk of results + Offset string `json:"offset"` + // The maximum number of affiliate programs to return + Limit int32 `json:"limit"` +} + +// Searches affiliate programs that can be applied to the given chat +func (client *Client) SearchAffiliatePrograms(req *SearchAffiliateProgramsRequest) (*FoundAffiliatePrograms, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchAffiliatePrograms", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "sort_order": req.SortOrder, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFoundAffiliatePrograms(result.Data) +} + +type ConnectChatAffiliateProgramRequest struct { + // Identifier of the chat to which the affiliate program will be connected. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right + ChatId int64 `json:"chat_id"` + // Identifier of the bot, which affiliate program is connected + BotUserId int64 `json:"bot_user_id"` +} + +// Connects an affiliate program to the given chat. Returns information about the connected affiliate program +func (client *Client) ConnectChatAffiliateProgram(req *ConnectChatAffiliateProgramRequest) (*ChatAffiliateProgram, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "connectChatAffiliateProgram", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "bot_user_id": req.BotUserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatAffiliateProgram(result.Data) +} + +type DisconnectChatAffiliateProgramRequest struct { + // Identifier of the chat for which the affiliate program is connected + ChatId int64 `json:"chat_id"` + // The referral link of the affiliate program + Url string `json:"url"` +} + +// Disconnects an affiliate program from the given chat and immediately deactivates its referral link. Returns updated information about the disconnected affiliate program +func (client *Client) DisconnectChatAffiliateProgram(req *DisconnectChatAffiliateProgramRequest) (*ChatAffiliateProgram, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "disconnectChatAffiliateProgram", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "url": req.Url, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatAffiliateProgram(result.Data) +} + +type GetChatAffiliateProgramRequest struct { + // Identifier of the chat for which the affiliate program was connected. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right + ChatId int64 `json:"chat_id"` + // Identifier of the bot that created the program + BotUserId int64 `json:"bot_user_id"` +} + +// Returns an affiliate program that were connected to the given chat by identifier of the bot that created the program +func (client *Client) GetChatAffiliateProgram(req *GetChatAffiliateProgramRequest) (*ChatAffiliateProgram, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatAffiliateProgram", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "bot_user_id": req.BotUserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatAffiliateProgram(result.Data) +} + +type GetChatAffiliateProgramsRequest struct { + // Identifier of the chat for which the affiliate programs were connected. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right + ChatId int64 `json:"chat_id"` + // Offset of the first affiliate program to return as received from the previous request; use empty string to get the first chunk of results + Offset string `json:"offset"` + // The maximum number of affiliate programs to return + Limit int32 `json:"limit"` +} + +// Returns affiliate programs that were connected to the given chat +func (client *Client) GetChatAffiliatePrograms(req *GetChatAffiliateProgramsRequest) (*ChatAffiliatePrograms, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatAffiliatePrograms", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatAffiliatePrograms(result.Data) +} + type GetBusinessFeaturesRequest struct { // Source of the request; pass null if the method is called from settings or some non-standard source Source BusinessFeature `json:"source"` diff --git a/client/type.go b/client/type.go index 7f43b1a..e2c1ee7 100755 --- a/client/type.go +++ b/client/type.go @@ -24,11 +24,9 @@ const ( ClassChatPhotoStickerType = "ChatPhotoStickerType" ClassInputChatPhoto = "InputChatPhoto" ClassStarSubscriptionType = "StarSubscriptionType" + ClassAffiliateProgramSortOrder = "AffiliateProgramSortOrder" ClassStarTransactionDirection = "StarTransactionDirection" - ClassBotTransactionPurpose = "BotTransactionPurpose" - ClassChatTransactionPurpose = "ChatTransactionPurpose" - ClassUserTransactionPurpose = "UserTransactionPurpose" - ClassStarTransactionPartner = "StarTransactionPartner" + ClassStarTransactionType = "StarTransactionType" ClassGiveawayParticipantStatus = "GiveawayParticipantStatus" ClassGiveawayInfo = "GiveawayInfo" ClassGiveawayPrize = "GiveawayPrize" @@ -237,9 +235,17 @@ const ( ClassChatPhotos = "ChatPhotos" ClassChatPermissions = "ChatPermissions" ClassChatAdministratorRights = "ChatAdministratorRights" + ClassStarAmount = "StarAmount" ClassStarSubscriptionPricing = "StarSubscriptionPricing" ClassStarSubscription = "StarSubscription" ClassStarSubscriptions = "StarSubscriptions" + ClassAffiliateProgramParameters = "AffiliateProgramParameters" + ClassAffiliateProgramInfo = "AffiliateProgramInfo" + ClassAffiliateInfo = "AffiliateInfo" + ClassFoundAffiliateProgram = "FoundAffiliateProgram" + ClassFoundAffiliatePrograms = "FoundAffiliatePrograms" + ClassChatAffiliateProgram = "ChatAffiliateProgram" + ClassChatAffiliatePrograms = "ChatAffiliatePrograms" ClassProductInfo = "ProductInfo" ClassPremiumPaymentOption = "PremiumPaymentOption" ClassPremiumStatePaymentOption = "PremiumStatePaymentOption" @@ -713,11 +719,22 @@ const ( TypeInputChatPhotoSticker = "inputChatPhotoSticker" TypeChatPermissions = "chatPermissions" TypeChatAdministratorRights = "chatAdministratorRights" + TypeStarAmount = "starAmount" TypeStarSubscriptionTypeChannel = "starSubscriptionTypeChannel" TypeStarSubscriptionTypeBot = "starSubscriptionTypeBot" TypeStarSubscriptionPricing = "starSubscriptionPricing" TypeStarSubscription = "starSubscription" TypeStarSubscriptions = "starSubscriptions" + TypeAffiliateProgramSortOrderProfitability = "affiliateProgramSortOrderProfitability" + TypeAffiliateProgramSortOrderCreationDate = "affiliateProgramSortOrderCreationDate" + TypeAffiliateProgramSortOrderRevenue = "affiliateProgramSortOrderRevenue" + TypeAffiliateProgramParameters = "affiliateProgramParameters" + TypeAffiliateProgramInfo = "affiliateProgramInfo" + TypeAffiliateInfo = "affiliateInfo" + TypeFoundAffiliateProgram = "foundAffiliateProgram" + TypeFoundAffiliatePrograms = "foundAffiliatePrograms" + TypeChatAffiliateProgram = "chatAffiliateProgram" + TypeChatAffiliatePrograms = "chatAffiliatePrograms" TypeProductInfo = "productInfo" TypePremiumPaymentOption = "premiumPaymentOption" TypePremiumStatePaymentOption = "premiumStatePaymentOption" @@ -735,27 +752,31 @@ const ( TypeUserGifts = "userGifts" TypeStarTransactionDirectionIncoming = "starTransactionDirectionIncoming" TypeStarTransactionDirectionOutgoing = "starTransactionDirectionOutgoing" - TypeBotTransactionPurposePaidMedia = "botTransactionPurposePaidMedia" - TypeBotTransactionPurposeInvoicePayment = "botTransactionPurposeInvoicePayment" - TypeBotTransactionPurposeSubscription = "botTransactionPurposeSubscription" - TypeChatTransactionPurposePaidMedia = "chatTransactionPurposePaidMedia" - TypeChatTransactionPurposeJoin = "chatTransactionPurposeJoin" - TypeChatTransactionPurposeReaction = "chatTransactionPurposeReaction" - TypeChatTransactionPurposeGiveaway = "chatTransactionPurposeGiveaway" - TypeUserTransactionPurposeGiftedStars = "userTransactionPurposeGiftedStars" - TypeUserTransactionPurposeGiftSell = "userTransactionPurposeGiftSell" - TypeUserTransactionPurposeGiftSend = "userTransactionPurposeGiftSend" - TypeStarTransactionPartnerTelegram = "starTransactionPartnerTelegram" - TypeStarTransactionPartnerAppStore = "starTransactionPartnerAppStore" - TypeStarTransactionPartnerGooglePlay = "starTransactionPartnerGooglePlay" - TypeStarTransactionPartnerFragment = "starTransactionPartnerFragment" - TypeStarTransactionPartnerTelegramAds = "starTransactionPartnerTelegramAds" - TypeStarTransactionPartnerTelegramApi = "starTransactionPartnerTelegramApi" - TypeStarTransactionPartnerBot = "starTransactionPartnerBot" - TypeStarTransactionPartnerBusiness = "starTransactionPartnerBusiness" - TypeStarTransactionPartnerChat = "starTransactionPartnerChat" - TypeStarTransactionPartnerUser = "starTransactionPartnerUser" - TypeStarTransactionPartnerUnsupported = "starTransactionPartnerUnsupported" + TypeStarTransactionTypePremiumBotDeposit = "starTransactionTypePremiumBotDeposit" + TypeStarTransactionTypeAppStoreDeposit = "starTransactionTypeAppStoreDeposit" + TypeStarTransactionTypeGooglePlayDeposit = "starTransactionTypeGooglePlayDeposit" + TypeStarTransactionTypeFragmentDeposit = "starTransactionTypeFragmentDeposit" + TypeStarTransactionTypeUserDeposit = "starTransactionTypeUserDeposit" + TypeStarTransactionTypeGiveawayDeposit = "starTransactionTypeGiveawayDeposit" + TypeStarTransactionTypeFragmentWithdrawal = "starTransactionTypeFragmentWithdrawal" + TypeStarTransactionTypeTelegramAdsWithdrawal = "starTransactionTypeTelegramAdsWithdrawal" + TypeStarTransactionTypeTelegramApiUsage = "starTransactionTypeTelegramApiUsage" + TypeStarTransactionTypeBotPaidMediaPurchase = "starTransactionTypeBotPaidMediaPurchase" + TypeStarTransactionTypeBotPaidMediaSale = "starTransactionTypeBotPaidMediaSale" + TypeStarTransactionTypeChannelPaidMediaPurchase = "starTransactionTypeChannelPaidMediaPurchase" + TypeStarTransactionTypeChannelPaidMediaSale = "starTransactionTypeChannelPaidMediaSale" + TypeStarTransactionTypeBotInvoicePurchase = "starTransactionTypeBotInvoicePurchase" + TypeStarTransactionTypeBotInvoiceSale = "starTransactionTypeBotInvoiceSale" + TypeStarTransactionTypeBotSubscriptionPurchase = "starTransactionTypeBotSubscriptionPurchase" + TypeStarTransactionTypeBotSubscriptionSale = "starTransactionTypeBotSubscriptionSale" + TypeStarTransactionTypeChannelSubscriptionPurchase = "starTransactionTypeChannelSubscriptionPurchase" + TypeStarTransactionTypeChannelSubscriptionSale = "starTransactionTypeChannelSubscriptionSale" + TypeStarTransactionTypeGiftPurchase = "starTransactionTypeGiftPurchase" + TypeStarTransactionTypeGiftSale = "starTransactionTypeGiftSale" + TypeStarTransactionTypeChannelPaidReactionSend = "starTransactionTypeChannelPaidReactionSend" + TypeStarTransactionTypeChannelPaidReactionReceive = "starTransactionTypeChannelPaidReactionReceive" + TypeStarTransactionTypeAffiliateProgramCommission = "starTransactionTypeAffiliateProgramCommission" + TypeStarTransactionTypeUnsupported = "starTransactionTypeUnsupported" TypeStarTransaction = "starTransaction" TypeStarTransactions = "starTransactions" TypeGiveawayParticipantStatusEligible = "giveawayParticipantStatusEligible" @@ -1888,6 +1909,7 @@ const ( TypeInternalLinkTypeBusinessChat = "internalLinkTypeBusinessChat" TypeInternalLinkTypeBuyStars = "internalLinkTypeBuyStars" TypeInternalLinkTypeChangePhoneNumber = "internalLinkTypeChangePhoneNumber" + TypeInternalLinkTypeChatAffiliateProgram = "internalLinkTypeChatAffiliateProgram" TypeInternalLinkTypeChatBoost = "internalLinkTypeChatBoost" TypeInternalLinkTypeChatFolderInvite = "internalLinkTypeChatFolderInvite" TypeInternalLinkTypeChatFolderSettings = "internalLinkTypeChatFolderSettings" @@ -1941,6 +1963,10 @@ const ( TypeFileTypeSecret = "fileTypeSecret" TypeFileTypeSecretThumbnail = "fileTypeSecretThumbnail" TypeFileTypeSecure = "fileTypeSecure" + TypeFileTypeSelfDestructingPhoto = "fileTypeSelfDestructingPhoto" + TypeFileTypeSelfDestructingVideo = "fileTypeSelfDestructingVideo" + TypeFileTypeSelfDestructingVideoNote = "fileTypeSelfDestructingVideoNote" + TypeFileTypeSelfDestructingVoiceNote = "fileTypeSelfDestructingVoiceNote" TypeFileTypeSticker = "fileTypeSticker" TypeFileTypeThumbnail = "fileTypeThumbnail" TypeFileTypeUnknown = "fileTypeUnknown" @@ -2310,29 +2336,19 @@ type StarSubscriptionType interface { StarSubscriptionTypeType() string } +// Describes the order of the found affiliate programs +type AffiliateProgramSortOrder interface { + AffiliateProgramSortOrderType() string +} + // Describes direction of a transaction with Telegram Stars type StarTransactionDirection interface { StarTransactionDirectionType() string } -// Describes purpose of a transaction with a bot -type BotTransactionPurpose interface { - BotTransactionPurposeType() string -} - -// Describes purpose of a transaction with a supergroup or a channel -type ChatTransactionPurpose interface { - ChatTransactionPurposeType() string -} - -// Describes purpose of a transaction with a user -type UserTransactionPurpose interface { - UserTransactionPurposeType() string -} - -// Describes source or recipient of a transaction with Telegram Stars -type StarTransactionPartner interface { - StarTransactionPartnerType() string +// Describes type of transaction with Telegram Stars +type StarTransactionType interface { + StarTransactionTypeType() string } // Contains information about status of a user in a giveaway @@ -7297,6 +7313,31 @@ func (*ChatAdministratorRights) GetType() string { return TypeChatAdministratorRights } +// Describes a possibly non-integer amount of Telegram Stars +type StarAmount struct { + meta + // The integer amount of Telegram Stars rounded to 0 + StarCount int64 `json:"star_count"` + // The number of 1/1000000000 shares of Telegram Stars; from -999999999 to 999999999 + NanostarCount int32 `json:"nanostar_count"` +} + +func (entity *StarAmount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarAmount + + return json.Marshal((*stub)(entity)) +} + +func (*StarAmount) GetClass() string { + return ClassStarAmount +} + +func (*StarAmount) GetType() string { + return TypeStarAmount +} + // Describes a subscription to a channel chat type StarSubscriptionTypeChannel struct { meta @@ -7452,7 +7493,7 @@ func (starSubscription *StarSubscription) UnmarshalJSON(data []byte) error { type StarSubscriptions struct { meta // The amount of owned Telegram Stars - StarCount int64 `json:"star_count"` + StarAmount *StarAmount `json:"star_amount"` // List of subscriptions for Telegram Stars Subscriptions []*StarSubscription `json:"subscriptions"` // The number of Telegram Stars required to buy to extend subscriptions expiring soon @@ -7477,6 +7518,274 @@ func (*StarSubscriptions) GetType() string { return TypeStarSubscriptions } +// The affiliate programs must be sorted by the profitability +type AffiliateProgramSortOrderProfitability struct{ + meta +} + +func (entity *AffiliateProgramSortOrderProfitability) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AffiliateProgramSortOrderProfitability + + return json.Marshal((*stub)(entity)) +} + +func (*AffiliateProgramSortOrderProfitability) GetClass() string { + return ClassAffiliateProgramSortOrder +} + +func (*AffiliateProgramSortOrderProfitability) GetType() string { + return TypeAffiliateProgramSortOrderProfitability +} + +func (*AffiliateProgramSortOrderProfitability) AffiliateProgramSortOrderType() string { + return TypeAffiliateProgramSortOrderProfitability +} + +// The affiliate programs must be sorted by creation date +type AffiliateProgramSortOrderCreationDate struct{ + meta +} + +func (entity *AffiliateProgramSortOrderCreationDate) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AffiliateProgramSortOrderCreationDate + + return json.Marshal((*stub)(entity)) +} + +func (*AffiliateProgramSortOrderCreationDate) GetClass() string { + return ClassAffiliateProgramSortOrder +} + +func (*AffiliateProgramSortOrderCreationDate) GetType() string { + return TypeAffiliateProgramSortOrderCreationDate +} + +func (*AffiliateProgramSortOrderCreationDate) AffiliateProgramSortOrderType() string { + return TypeAffiliateProgramSortOrderCreationDate +} + +// The affiliate programs must be sorted by the expected revenue +type AffiliateProgramSortOrderRevenue struct{ + meta +} + +func (entity *AffiliateProgramSortOrderRevenue) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AffiliateProgramSortOrderRevenue + + return json.Marshal((*stub)(entity)) +} + +func (*AffiliateProgramSortOrderRevenue) GetClass() string { + return ClassAffiliateProgramSortOrder +} + +func (*AffiliateProgramSortOrderRevenue) GetType() string { + return TypeAffiliateProgramSortOrderRevenue +} + +func (*AffiliateProgramSortOrderRevenue) AffiliateProgramSortOrderType() string { + return TypeAffiliateProgramSortOrderRevenue +} + +// Describes parameters of an affiliate program +type AffiliateProgramParameters struct { + meta + // The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the program owner; getOption("affiliate_program_commission_per_mille_min")-getOption("affiliate_program_commission_per_mille_max") + CommissionPerMille int32 `json:"commission_per_mille"` + // Number of months the program will be active; 0-36. If 0, then the program is eternal + MonthCount int32 `json:"month_count"` +} + +func (entity *AffiliateProgramParameters) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AffiliateProgramParameters + + return json.Marshal((*stub)(entity)) +} + +func (*AffiliateProgramParameters) GetClass() string { + return ClassAffiliateProgramParameters +} + +func (*AffiliateProgramParameters) GetType() string { + return TypeAffiliateProgramParameters +} + +// Contains information about an active affiliate program +type AffiliateProgramInfo struct { + meta + // Parameters of the affiliate program + Parameters *AffiliateProgramParameters `json:"parameters"` + // Point in time (Unix timestamp) when the affiliate program will be closed; 0 if the affiliate program isn't scheduled to be closed. If positive, then the program can't be connected using connectChatAffiliateProgram, but active connections will work until the date + EndDate int32 `json:"end_date"` + // The amount of daily revenue per user in Telegram Stars of the bot that created the affiliate program + DailyRevenuePerUserAmount *StarAmount `json:"daily_revenue_per_user_amount"` +} + +func (entity *AffiliateProgramInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AffiliateProgramInfo + + return json.Marshal((*stub)(entity)) +} + +func (*AffiliateProgramInfo) GetClass() string { + return ClassAffiliateProgramInfo +} + +func (*AffiliateProgramInfo) GetType() string { + return TypeAffiliateProgramInfo +} + +// Contains information about an affiliate that received commission from a Telegram Star transaction +type AffiliateInfo struct { + meta + // The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the program owner + CommissionPerMille int32 `json:"commission_per_mille"` + // Identifier of the chat which received the commission + AffiliateChatId int64 `json:"affiliate_chat_id"` + // The amount of Telegram Stars that were received by the affiliate; can be negative for refunds + StarAmount *StarAmount `json:"star_amount"` +} + +func (entity *AffiliateInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AffiliateInfo + + return json.Marshal((*stub)(entity)) +} + +func (*AffiliateInfo) GetClass() string { + return ClassAffiliateInfo +} + +func (*AffiliateInfo) GetType() string { + return TypeAffiliateInfo +} + +// Describes a found affiliate program +type FoundAffiliateProgram struct { + meta + // User identifier of the bot created the program + BotUserId int64 `json:"bot_user_id"` + // Information about the affiliate program + Parameters *AffiliateProgramInfo `json:"parameters"` +} + +func (entity *FoundAffiliateProgram) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FoundAffiliateProgram + + return json.Marshal((*stub)(entity)) +} + +func (*FoundAffiliateProgram) GetClass() string { + return ClassFoundAffiliateProgram +} + +func (*FoundAffiliateProgram) GetType() string { + return TypeFoundAffiliateProgram +} + +// Represents a list of found affiliate programs +type FoundAffiliatePrograms struct { + meta + // The total number of found affiliate programs + TotalCount int32 `json:"total_count"` + // The list of affiliate programs + Programs []*FoundAffiliateProgram `json:"programs"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` +} + +func (entity *FoundAffiliatePrograms) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FoundAffiliatePrograms + + return json.Marshal((*stub)(entity)) +} + +func (*FoundAffiliatePrograms) GetClass() string { + return ClassFoundAffiliatePrograms +} + +func (*FoundAffiliatePrograms) GetType() string { + return TypeFoundAffiliatePrograms +} + +// Describes an affiliate program that was connected to a chat +type ChatAffiliateProgram struct { + meta + // The link that can be used to refer users if the program is still active + Url string `json:"url"` + // User identifier of the bot created the program + BotUserId int64 `json:"bot_user_id"` + // The parameters of the affiliate program + Parameters *AffiliateProgramParameters `json:"parameters"` + // Point in time (Unix timestamp) when the affiliate program was connected + ConnectionDate int32 `json:"connection_date"` + // True, if the program was canceled by the bot, or disconnected by the chat owner and isn't available anymore + IsDisconnected bool `json:"is_disconnected"` + // The number of users that used the affiliate program + UserCount JsonInt64 `json:"user_count"` + // The number of Telegram Stars that were earned by the affiliate program + RevenueStarCount JsonInt64 `json:"revenue_star_count"` +} + +func (entity *ChatAffiliateProgram) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatAffiliateProgram + + return json.Marshal((*stub)(entity)) +} + +func (*ChatAffiliateProgram) GetClass() string { + return ClassChatAffiliateProgram +} + +func (*ChatAffiliateProgram) GetType() string { + return TypeChatAffiliateProgram +} + +// Represents a list of affiliate programs that were connected to a chat +type ChatAffiliatePrograms struct { + meta + // The total number of affiliate programs that were connected to the chat + TotalCount int32 `json:"total_count"` + // The list of connected affiliate programs + Programs []*ChatAffiliateProgram `json:"programs"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` +} + +func (entity *ChatAffiliatePrograms) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatAffiliatePrograms + + return json.Marshal((*stub)(entity)) +} + +func (*ChatAffiliatePrograms) GetClass() string { + return ClassChatAffiliatePrograms +} + +func (*ChatAffiliatePrograms) GetType() string { + return TypeChatAffiliatePrograms +} + // Contains information about a product that can be paid with invoice type ProductInfo struct { meta @@ -8034,427 +8343,192 @@ func (*StarTransactionDirectionOutgoing) StarTransactionDirectionType() string { return TypeStarTransactionDirectionOutgoing } -// Paid media were bought -type BotTransactionPurposePaidMedia struct { +// The transaction is a deposit of Telegram Stars from the Premium bot; for regular users only +type StarTransactionTypePremiumBotDeposit struct{ meta - // The bought media if the transaction wasn't refunded - Media []PaidMedia `json:"media"` - // Bot-provided payload; for bots only - Payload string `json:"payload"` } -func (entity *BotTransactionPurposePaidMedia) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionTypePremiumBotDeposit) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub BotTransactionPurposePaidMedia + type stub StarTransactionTypePremiumBotDeposit return json.Marshal((*stub)(entity)) } -func (*BotTransactionPurposePaidMedia) GetClass() string { - return ClassBotTransactionPurpose +func (*StarTransactionTypePremiumBotDeposit) GetClass() string { + return ClassStarTransactionType } -func (*BotTransactionPurposePaidMedia) GetType() string { - return TypeBotTransactionPurposePaidMedia +func (*StarTransactionTypePremiumBotDeposit) GetType() string { + return TypeStarTransactionTypePremiumBotDeposit } -func (*BotTransactionPurposePaidMedia) BotTransactionPurposeType() string { - return TypeBotTransactionPurposePaidMedia +func (*StarTransactionTypePremiumBotDeposit) StarTransactionTypeType() string { + return TypeStarTransactionTypePremiumBotDeposit } -func (botTransactionPurposePaidMedia *BotTransactionPurposePaidMedia) UnmarshalJSON(data []byte) error { - var tmp struct { - Media []json.RawMessage `json:"media"` - Payload string `json:"payload"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - botTransactionPurposePaidMedia.Payload = tmp.Payload - - fieldMedia, _ := UnmarshalListOfPaidMedia(tmp.Media) - botTransactionPurposePaidMedia.Media = fieldMedia - - return nil -} - -// User bought a product from the bot -type BotTransactionPurposeInvoicePayment struct { +// The transaction is a deposit of Telegram Stars from App Store; for regular users only +type StarTransactionTypeAppStoreDeposit struct{ meta - // Information about the bought product; may be null if not applicable - ProductInfo *ProductInfo `json:"product_info"` - // Invoice payload; for bots only - InvoicePayload []byte `json:"invoice_payload"` } -func (entity *BotTransactionPurposeInvoicePayment) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionTypeAppStoreDeposit) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub BotTransactionPurposeInvoicePayment + type stub StarTransactionTypeAppStoreDeposit return json.Marshal((*stub)(entity)) } -func (*BotTransactionPurposeInvoicePayment) GetClass() string { - return ClassBotTransactionPurpose +func (*StarTransactionTypeAppStoreDeposit) GetClass() string { + return ClassStarTransactionType } -func (*BotTransactionPurposeInvoicePayment) GetType() string { - return TypeBotTransactionPurposeInvoicePayment +func (*StarTransactionTypeAppStoreDeposit) GetType() string { + return TypeStarTransactionTypeAppStoreDeposit } -func (*BotTransactionPurposeInvoicePayment) BotTransactionPurposeType() string { - return TypeBotTransactionPurposeInvoicePayment +func (*StarTransactionTypeAppStoreDeposit) StarTransactionTypeType() string { + return TypeStarTransactionTypeAppStoreDeposit } -// User bought a subscription in a bot or a business account -type BotTransactionPurposeSubscription struct { +// The transaction is a deposit of Telegram Stars from Google Play; for regular users only +type StarTransactionTypeGooglePlayDeposit struct{ meta - // The number of seconds between consecutive Telegram Star debiting - Period int32 `json:"period"` - // Information about the bought subscription; may be null if not applicable - ProductInfo *ProductInfo `json:"product_info"` - // Invoice payload; for bots only - InvoicePayload []byte `json:"invoice_payload"` } -func (entity *BotTransactionPurposeSubscription) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionTypeGooglePlayDeposit) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub BotTransactionPurposeSubscription + type stub StarTransactionTypeGooglePlayDeposit return json.Marshal((*stub)(entity)) } -func (*BotTransactionPurposeSubscription) GetClass() string { - return ClassBotTransactionPurpose +func (*StarTransactionTypeGooglePlayDeposit) GetClass() string { + return ClassStarTransactionType } -func (*BotTransactionPurposeSubscription) GetType() string { - return TypeBotTransactionPurposeSubscription +func (*StarTransactionTypeGooglePlayDeposit) GetType() string { + return TypeStarTransactionTypeGooglePlayDeposit } -func (*BotTransactionPurposeSubscription) BotTransactionPurposeType() string { - return TypeBotTransactionPurposeSubscription +func (*StarTransactionTypeGooglePlayDeposit) StarTransactionTypeType() string { + return TypeStarTransactionTypeGooglePlayDeposit } -// Paid media were bought -type ChatTransactionPurposePaidMedia struct { +// The transaction is a deposit of Telegram Stars from Fragment; for regular users and bots only +type StarTransactionTypeFragmentDeposit struct{ meta - // Identifier of the corresponding message with paid media; can be 0 or an identifier of a deleted message - MessageId int64 `json:"message_id"` - // The bought media if the transaction wasn't refunded - Media []PaidMedia `json:"media"` } -func (entity *ChatTransactionPurposePaidMedia) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionTypeFragmentDeposit) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ChatTransactionPurposePaidMedia + type stub StarTransactionTypeFragmentDeposit return json.Marshal((*stub)(entity)) } -func (*ChatTransactionPurposePaidMedia) GetClass() string { - return ClassChatTransactionPurpose +func (*StarTransactionTypeFragmentDeposit) GetClass() string { + return ClassStarTransactionType } -func (*ChatTransactionPurposePaidMedia) GetType() string { - return TypeChatTransactionPurposePaidMedia +func (*StarTransactionTypeFragmentDeposit) GetType() string { + return TypeStarTransactionTypeFragmentDeposit } -func (*ChatTransactionPurposePaidMedia) ChatTransactionPurposeType() string { - return TypeChatTransactionPurposePaidMedia +func (*StarTransactionTypeFragmentDeposit) StarTransactionTypeType() string { + return TypeStarTransactionTypeFragmentDeposit } -func (chatTransactionPurposePaidMedia *ChatTransactionPurposePaidMedia) UnmarshalJSON(data []byte) error { - var tmp struct { - MessageId int64 `json:"message_id"` - Media []json.RawMessage `json:"media"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - chatTransactionPurposePaidMedia.MessageId = tmp.MessageId - - fieldMedia, _ := UnmarshalListOfPaidMedia(tmp.Media) - chatTransactionPurposePaidMedia.Media = fieldMedia - - return nil -} - -// User joined the channel and subscribed to regular payments in Telegram Stars -type ChatTransactionPurposeJoin struct { +// The transaction is a deposit of Telegram Stars by another user; for regular users only +type StarTransactionTypeUserDeposit struct { meta - // The number of seconds between consecutive Telegram Star debiting - Period int32 `json:"period"` -} - -func (entity *ChatTransactionPurposeJoin) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatTransactionPurposeJoin - - return json.Marshal((*stub)(entity)) -} - -func (*ChatTransactionPurposeJoin) GetClass() string { - return ClassChatTransactionPurpose -} - -func (*ChatTransactionPurposeJoin) GetType() string { - return TypeChatTransactionPurposeJoin -} - -func (*ChatTransactionPurposeJoin) ChatTransactionPurposeType() string { - return TypeChatTransactionPurposeJoin -} - -// User paid for a reaction -type ChatTransactionPurposeReaction struct { - meta - // Identifier of the reacted message; can be 0 or an identifier of a deleted message - MessageId int64 `json:"message_id"` -} - -func (entity *ChatTransactionPurposeReaction) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatTransactionPurposeReaction - - return json.Marshal((*stub)(entity)) -} - -func (*ChatTransactionPurposeReaction) GetClass() string { - return ClassChatTransactionPurpose -} - -func (*ChatTransactionPurposeReaction) GetType() string { - return TypeChatTransactionPurposeReaction -} - -func (*ChatTransactionPurposeReaction) ChatTransactionPurposeType() string { - return TypeChatTransactionPurposeReaction -} - -// User received Telegram Stars from a giveaway -type ChatTransactionPurposeGiveaway struct { - meta - // Identifier of the message with giveaway; can be 0 or an identifier of a deleted message - GiveawayMessageId int64 `json:"giveaway_message_id"` -} - -func (entity *ChatTransactionPurposeGiveaway) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatTransactionPurposeGiveaway - - return json.Marshal((*stub)(entity)) -} - -func (*ChatTransactionPurposeGiveaway) GetClass() string { - return ClassChatTransactionPurpose -} - -func (*ChatTransactionPurposeGiveaway) GetType() string { - return TypeChatTransactionPurposeGiveaway -} - -func (*ChatTransactionPurposeGiveaway) ChatTransactionPurposeType() string { - return TypeChatTransactionPurposeGiveaway -} - -// A user gifted Telegram Stars -type UserTransactionPurposeGiftedStars struct { - meta - // A sticker to be shown in the transaction information; may be null if unknown + // Identifier of the user that gifted Telegram Stars; 0 if the user was anonymous + UserId int64 `json:"user_id"` + // The sticker to be shown in the transaction information; may be null if unknown Sticker *Sticker `json:"sticker"` } -func (entity *UserTransactionPurposeGiftedStars) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionTypeUserDeposit) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub UserTransactionPurposeGiftedStars + type stub StarTransactionTypeUserDeposit return json.Marshal((*stub)(entity)) } -func (*UserTransactionPurposeGiftedStars) GetClass() string { - return ClassUserTransactionPurpose +func (*StarTransactionTypeUserDeposit) GetClass() string { + return ClassStarTransactionType } -func (*UserTransactionPurposeGiftedStars) GetType() string { - return TypeUserTransactionPurposeGiftedStars +func (*StarTransactionTypeUserDeposit) GetType() string { + return TypeStarTransactionTypeUserDeposit } -func (*UserTransactionPurposeGiftedStars) UserTransactionPurposeType() string { - return TypeUserTransactionPurposeGiftedStars +func (*StarTransactionTypeUserDeposit) StarTransactionTypeType() string { + return TypeStarTransactionTypeUserDeposit } -// The user sold a gift received from another user or bot -type UserTransactionPurposeGiftSell struct { +// The transaction is a deposit of Telegram Stars from a giveaway; for regular users only +type StarTransactionTypeGiveawayDeposit struct { meta - // The gift - Gift *Gift `json:"gift"` + // Identifier of a supergroup or a channel chat that created the giveaway + ChatId int64 `json:"chat_id"` + // Identifier of the message with the giveaway; can be 0 or an identifier of a deleted message + GiveawayMessageId int64 `json:"giveaway_message_id"` } -func (entity *UserTransactionPurposeGiftSell) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionTypeGiveawayDeposit) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub UserTransactionPurposeGiftSell + type stub StarTransactionTypeGiveawayDeposit return json.Marshal((*stub)(entity)) } -func (*UserTransactionPurposeGiftSell) GetClass() string { - return ClassUserTransactionPurpose +func (*StarTransactionTypeGiveawayDeposit) GetClass() string { + return ClassStarTransactionType } -func (*UserTransactionPurposeGiftSell) GetType() string { - return TypeUserTransactionPurposeGiftSell +func (*StarTransactionTypeGiveawayDeposit) GetType() string { + return TypeStarTransactionTypeGiveawayDeposit } -func (*UserTransactionPurposeGiftSell) UserTransactionPurposeType() string { - return TypeUserTransactionPurposeGiftSell +func (*StarTransactionTypeGiveawayDeposit) StarTransactionTypeType() string { + return TypeStarTransactionTypeGiveawayDeposit } -// The user or the bot sent a gift to a user -type UserTransactionPurposeGiftSend struct { +// The transaction is a withdrawal of earned Telegram Stars to Fragment; for bots and channel chats only +type StarTransactionTypeFragmentWithdrawal struct { meta - // The gift - Gift *Gift `json:"gift"` -} - -func (entity *UserTransactionPurposeGiftSend) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub UserTransactionPurposeGiftSend - - return json.Marshal((*stub)(entity)) -} - -func (*UserTransactionPurposeGiftSend) GetClass() string { - return ClassUserTransactionPurpose -} - -func (*UserTransactionPurposeGiftSend) GetType() string { - return TypeUserTransactionPurposeGiftSend -} - -func (*UserTransactionPurposeGiftSend) UserTransactionPurposeType() string { - return TypeUserTransactionPurposeGiftSend -} - -// The transaction is a transaction with Telegram through a bot -type StarTransactionPartnerTelegram struct{ - meta -} - -func (entity *StarTransactionPartnerTelegram) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StarTransactionPartnerTelegram - - return json.Marshal((*stub)(entity)) -} - -func (*StarTransactionPartnerTelegram) GetClass() string { - return ClassStarTransactionPartner -} - -func (*StarTransactionPartnerTelegram) GetType() string { - return TypeStarTransactionPartnerTelegram -} - -func (*StarTransactionPartnerTelegram) StarTransactionPartnerType() string { - return TypeStarTransactionPartnerTelegram -} - -// The transaction is a transaction with App Store -type StarTransactionPartnerAppStore struct{ - meta -} - -func (entity *StarTransactionPartnerAppStore) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StarTransactionPartnerAppStore - - return json.Marshal((*stub)(entity)) -} - -func (*StarTransactionPartnerAppStore) GetClass() string { - return ClassStarTransactionPartner -} - -func (*StarTransactionPartnerAppStore) GetType() string { - return TypeStarTransactionPartnerAppStore -} - -func (*StarTransactionPartnerAppStore) StarTransactionPartnerType() string { - return TypeStarTransactionPartnerAppStore -} - -// The transaction is a transaction with Google Play -type StarTransactionPartnerGooglePlay struct{ - meta -} - -func (entity *StarTransactionPartnerGooglePlay) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StarTransactionPartnerGooglePlay - - return json.Marshal((*stub)(entity)) -} - -func (*StarTransactionPartnerGooglePlay) GetClass() string { - return ClassStarTransactionPartner -} - -func (*StarTransactionPartnerGooglePlay) GetType() string { - return TypeStarTransactionPartnerGooglePlay -} - -func (*StarTransactionPartnerGooglePlay) StarTransactionPartnerType() string { - return TypeStarTransactionPartnerGooglePlay -} - -// The transaction is a transaction with Fragment -type StarTransactionPartnerFragment struct { - meta - // State of the withdrawal; may be null for refunds from Fragment or for Telegram Stars bought on Fragment + // State of the withdrawal; may be null for refunds from Fragment WithdrawalState RevenueWithdrawalState `json:"withdrawal_state"` } -func (entity *StarTransactionPartnerFragment) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionTypeFragmentWithdrawal) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub StarTransactionPartnerFragment + type stub StarTransactionTypeFragmentWithdrawal return json.Marshal((*stub)(entity)) } -func (*StarTransactionPartnerFragment) GetClass() string { - return ClassStarTransactionPartner +func (*StarTransactionTypeFragmentWithdrawal) GetClass() string { + return ClassStarTransactionType } -func (*StarTransactionPartnerFragment) GetType() string { - return TypeStarTransactionPartnerFragment +func (*StarTransactionTypeFragmentWithdrawal) GetType() string { + return TypeStarTransactionTypeFragmentWithdrawal } -func (*StarTransactionPartnerFragment) StarTransactionPartnerType() string { - return TypeStarTransactionPartnerFragment +func (*StarTransactionTypeFragmentWithdrawal) StarTransactionTypeType() string { + return TypeStarTransactionTypeFragmentWithdrawal } -func (starTransactionPartnerFragment *StarTransactionPartnerFragment) UnmarshalJSON(data []byte) error { +func (starTransactionTypeFragmentWithdrawal *StarTransactionTypeFragmentWithdrawal) UnmarshalJSON(data []byte) error { var tmp struct { WithdrawalState json.RawMessage `json:"withdrawal_state"` } @@ -8465,141 +8539,93 @@ func (starTransactionPartnerFragment *StarTransactionPartnerFragment) UnmarshalJ } fieldWithdrawalState, _ := UnmarshalRevenueWithdrawalState(tmp.WithdrawalState) - starTransactionPartnerFragment.WithdrawalState = fieldWithdrawalState + starTransactionTypeFragmentWithdrawal.WithdrawalState = fieldWithdrawalState return nil } -// The transaction is a transaction with Telegram Ad platform -type StarTransactionPartnerTelegramAds struct{ +// The transaction is a withdrawal of earned Telegram Stars to Telegram Ad platform; for bots and channel chats only +type StarTransactionTypeTelegramAdsWithdrawal struct{ meta } -func (entity *StarTransactionPartnerTelegramAds) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionTypeTelegramAdsWithdrawal) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub StarTransactionPartnerTelegramAds + type stub StarTransactionTypeTelegramAdsWithdrawal return json.Marshal((*stub)(entity)) } -func (*StarTransactionPartnerTelegramAds) GetClass() string { - return ClassStarTransactionPartner +func (*StarTransactionTypeTelegramAdsWithdrawal) GetClass() string { + return ClassStarTransactionType } -func (*StarTransactionPartnerTelegramAds) GetType() string { - return TypeStarTransactionPartnerTelegramAds +func (*StarTransactionTypeTelegramAdsWithdrawal) GetType() string { + return TypeStarTransactionTypeTelegramAdsWithdrawal } -func (*StarTransactionPartnerTelegramAds) StarTransactionPartnerType() string { - return TypeStarTransactionPartnerTelegramAds +func (*StarTransactionTypeTelegramAdsWithdrawal) StarTransactionTypeType() string { + return TypeStarTransactionTypeTelegramAdsWithdrawal } -// The transaction is a transaction with Telegram for API usage -type StarTransactionPartnerTelegramApi struct { +// The transaction is a payment for Telegram API usage; for bots only +type StarTransactionTypeTelegramApiUsage struct { meta // The number of billed requests RequestCount int32 `json:"request_count"` } -func (entity *StarTransactionPartnerTelegramApi) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionTypeTelegramApiUsage) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub StarTransactionPartnerTelegramApi + type stub StarTransactionTypeTelegramApiUsage return json.Marshal((*stub)(entity)) } -func (*StarTransactionPartnerTelegramApi) GetClass() string { - return ClassStarTransactionPartner +func (*StarTransactionTypeTelegramApiUsage) GetClass() string { + return ClassStarTransactionType } -func (*StarTransactionPartnerTelegramApi) GetType() string { - return TypeStarTransactionPartnerTelegramApi +func (*StarTransactionTypeTelegramApiUsage) GetType() string { + return TypeStarTransactionTypeTelegramApiUsage } -func (*StarTransactionPartnerTelegramApi) StarTransactionPartnerType() string { - return TypeStarTransactionPartnerTelegramApi +func (*StarTransactionTypeTelegramApiUsage) StarTransactionTypeType() string { + return TypeStarTransactionTypeTelegramApiUsage } -// The transaction is a transaction with a bot -type StarTransactionPartnerBot struct { +// The transaction is a purchase of paid media from a bot or a business account by the current user; for regular users only +type StarTransactionTypeBotPaidMediaPurchase struct { meta - // Identifier of the bot - UserId int64 `json:"user_id"` - // Purpose of the transaction - Purpose BotTransactionPurpose `json:"purpose"` -} - -func (entity *StarTransactionPartnerBot) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StarTransactionPartnerBot - - return json.Marshal((*stub)(entity)) -} - -func (*StarTransactionPartnerBot) GetClass() string { - return ClassStarTransactionPartner -} - -func (*StarTransactionPartnerBot) GetType() string { - return TypeStarTransactionPartnerBot -} - -func (*StarTransactionPartnerBot) StarTransactionPartnerType() string { - return TypeStarTransactionPartnerBot -} - -func (starTransactionPartnerBot *StarTransactionPartnerBot) UnmarshalJSON(data []byte) error { - var tmp struct { - UserId int64 `json:"user_id"` - Purpose json.RawMessage `json:"purpose"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - starTransactionPartnerBot.UserId = tmp.UserId - - fieldPurpose, _ := UnmarshalBotTransactionPurpose(tmp.Purpose) - starTransactionPartnerBot.Purpose = fieldPurpose - - return nil -} - -// The transaction is a transaction with a business account -type StarTransactionPartnerBusiness struct { - meta - // Identifier of the business account user + // Identifier of the bot or the business account user that sent the paid media UserId int64 `json:"user_id"` // The bought media if the transaction wasn't refunded Media []PaidMedia `json:"media"` } -func (entity *StarTransactionPartnerBusiness) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionTypeBotPaidMediaPurchase) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub StarTransactionPartnerBusiness + type stub StarTransactionTypeBotPaidMediaPurchase return json.Marshal((*stub)(entity)) } -func (*StarTransactionPartnerBusiness) GetClass() string { - return ClassStarTransactionPartner +func (*StarTransactionTypeBotPaidMediaPurchase) GetClass() string { + return ClassStarTransactionType } -func (*StarTransactionPartnerBusiness) GetType() string { - return TypeStarTransactionPartnerBusiness +func (*StarTransactionTypeBotPaidMediaPurchase) GetType() string { + return TypeStarTransactionTypeBotPaidMediaPurchase } -func (*StarTransactionPartnerBusiness) StarTransactionPartnerType() string { - return TypeStarTransactionPartnerBusiness +func (*StarTransactionTypeBotPaidMediaPurchase) StarTransactionTypeType() string { + return TypeStarTransactionTypeBotPaidMediaPurchase } -func (starTransactionPartnerBusiness *StarTransactionPartnerBusiness) UnmarshalJSON(data []byte) error { +func (starTransactionTypeBotPaidMediaPurchase *StarTransactionTypeBotPaidMediaPurchase) UnmarshalJSON(data []byte) error { var tmp struct { UserId int64 `json:"user_id"` Media []json.RawMessage `json:"media"` @@ -8610,95 +8636,53 @@ func (starTransactionPartnerBusiness *StarTransactionPartnerBusiness) UnmarshalJ return err } - starTransactionPartnerBusiness.UserId = tmp.UserId + starTransactionTypeBotPaidMediaPurchase.UserId = tmp.UserId fieldMedia, _ := UnmarshalListOfPaidMedia(tmp.Media) - starTransactionPartnerBusiness.Media = fieldMedia + starTransactionTypeBotPaidMediaPurchase.Media = fieldMedia return nil } -// The transaction is a transaction with a supergroup or a channel chat -type StarTransactionPartnerChat struct { +// The transaction is a sale of paid media by the bot or a business account managed by the bot; for bots only +type StarTransactionTypeBotPaidMediaSale struct { meta - // Identifier of the chat - ChatId int64 `json:"chat_id"` - // Purpose of the transaction - Purpose ChatTransactionPurpose `json:"purpose"` -} - -func (entity *StarTransactionPartnerChat) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StarTransactionPartnerChat - - return json.Marshal((*stub)(entity)) -} - -func (*StarTransactionPartnerChat) GetClass() string { - return ClassStarTransactionPartner -} - -func (*StarTransactionPartnerChat) GetType() string { - return TypeStarTransactionPartnerChat -} - -func (*StarTransactionPartnerChat) StarTransactionPartnerType() string { - return TypeStarTransactionPartnerChat -} - -func (starTransactionPartnerChat *StarTransactionPartnerChat) UnmarshalJSON(data []byte) error { - var tmp struct { - ChatId int64 `json:"chat_id"` - Purpose json.RawMessage `json:"purpose"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - starTransactionPartnerChat.ChatId = tmp.ChatId - - fieldPurpose, _ := UnmarshalChatTransactionPurpose(tmp.Purpose) - starTransactionPartnerChat.Purpose = fieldPurpose - - return nil -} - -// The transaction is a transaction with another user -type StarTransactionPartnerUser struct { - meta - // Identifier of the user; 0 if the user was anonymous + // Identifier of the user that bought the media UserId int64 `json:"user_id"` - // Purpose of the transaction - Purpose UserTransactionPurpose `json:"purpose"` + // The bought media + Media []PaidMedia `json:"media"` + // Bot-provided payload + Payload string `json:"payload"` + // Information about the affiliate which received commission from the transaction; may be null if none + Affiliate *AffiliateInfo `json:"affiliate"` } -func (entity *StarTransactionPartnerUser) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionTypeBotPaidMediaSale) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub StarTransactionPartnerUser + type stub StarTransactionTypeBotPaidMediaSale return json.Marshal((*stub)(entity)) } -func (*StarTransactionPartnerUser) GetClass() string { - return ClassStarTransactionPartner +func (*StarTransactionTypeBotPaidMediaSale) GetClass() string { + return ClassStarTransactionType } -func (*StarTransactionPartnerUser) GetType() string { - return TypeStarTransactionPartnerUser +func (*StarTransactionTypeBotPaidMediaSale) GetType() string { + return TypeStarTransactionTypeBotPaidMediaSale } -func (*StarTransactionPartnerUser) StarTransactionPartnerType() string { - return TypeStarTransactionPartnerUser +func (*StarTransactionTypeBotPaidMediaSale) StarTransactionTypeType() string { + return TypeStarTransactionTypeBotPaidMediaSale } -func (starTransactionPartnerUser *StarTransactionPartnerUser) UnmarshalJSON(data []byte) error { +func (starTransactionTypeBotPaidMediaSale *StarTransactionTypeBotPaidMediaSale) UnmarshalJSON(data []byte) error { var tmp struct { UserId int64 `json:"user_id"` - Purpose json.RawMessage `json:"purpose"` + Media []json.RawMessage `json:"media"` + Payload string `json:"payload"` + Affiliate *AffiliateInfo `json:"affiliate"` } err := json.Unmarshal(data, &tmp) @@ -8706,37 +8690,474 @@ func (starTransactionPartnerUser *StarTransactionPartnerUser) UnmarshalJSON(data return err } - starTransactionPartnerUser.UserId = tmp.UserId + starTransactionTypeBotPaidMediaSale.UserId = tmp.UserId + starTransactionTypeBotPaidMediaSale.Payload = tmp.Payload + starTransactionTypeBotPaidMediaSale.Affiliate = tmp.Affiliate - fieldPurpose, _ := UnmarshalUserTransactionPurpose(tmp.Purpose) - starTransactionPartnerUser.Purpose = fieldPurpose + fieldMedia, _ := UnmarshalListOfPaidMedia(tmp.Media) + starTransactionTypeBotPaidMediaSale.Media = fieldMedia return nil } -// The transaction is a transaction with unknown partner -type StarTransactionPartnerUnsupported struct{ +// The transaction is a purchase of paid media from a channel by the current user; for regular users only +type StarTransactionTypeChannelPaidMediaPurchase struct { meta + // Identifier of the channel chat that sent the paid media + ChatId int64 `json:"chat_id"` + // Identifier of the corresponding message with paid media; can be 0 or an identifier of a deleted message + MessageId int64 `json:"message_id"` + // The bought media if the transaction wasn't refunded + Media []PaidMedia `json:"media"` } -func (entity *StarTransactionPartnerUnsupported) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionTypeChannelPaidMediaPurchase) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub StarTransactionPartnerUnsupported + type stub StarTransactionTypeChannelPaidMediaPurchase return json.Marshal((*stub)(entity)) } -func (*StarTransactionPartnerUnsupported) GetClass() string { - return ClassStarTransactionPartner +func (*StarTransactionTypeChannelPaidMediaPurchase) GetClass() string { + return ClassStarTransactionType } -func (*StarTransactionPartnerUnsupported) GetType() string { - return TypeStarTransactionPartnerUnsupported +func (*StarTransactionTypeChannelPaidMediaPurchase) GetType() string { + return TypeStarTransactionTypeChannelPaidMediaPurchase } -func (*StarTransactionPartnerUnsupported) StarTransactionPartnerType() string { - return TypeStarTransactionPartnerUnsupported +func (*StarTransactionTypeChannelPaidMediaPurchase) StarTransactionTypeType() string { + return TypeStarTransactionTypeChannelPaidMediaPurchase +} + +func (starTransactionTypeChannelPaidMediaPurchase *StarTransactionTypeChannelPaidMediaPurchase) UnmarshalJSON(data []byte) error { + var tmp struct { + ChatId int64 `json:"chat_id"` + MessageId int64 `json:"message_id"` + Media []json.RawMessage `json:"media"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + starTransactionTypeChannelPaidMediaPurchase.ChatId = tmp.ChatId + starTransactionTypeChannelPaidMediaPurchase.MessageId = tmp.MessageId + + fieldMedia, _ := UnmarshalListOfPaidMedia(tmp.Media) + starTransactionTypeChannelPaidMediaPurchase.Media = fieldMedia + + return nil +} + +// The transaction is a sale of paid media by the channel chat; for channel chats only +type StarTransactionTypeChannelPaidMediaSale struct { + meta + // Identifier of the user that bought the media + UserId int64 `json:"user_id"` + // Identifier of the corresponding message with paid media; can be 0 or an identifier of a deleted message + MessageId int64 `json:"message_id"` + // The bought media + Media []PaidMedia `json:"media"` +} + +func (entity *StarTransactionTypeChannelPaidMediaSale) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeChannelPaidMediaSale + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeChannelPaidMediaSale) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeChannelPaidMediaSale) GetType() string { + return TypeStarTransactionTypeChannelPaidMediaSale +} + +func (*StarTransactionTypeChannelPaidMediaSale) StarTransactionTypeType() string { + return TypeStarTransactionTypeChannelPaidMediaSale +} + +func (starTransactionTypeChannelPaidMediaSale *StarTransactionTypeChannelPaidMediaSale) UnmarshalJSON(data []byte) error { + var tmp struct { + UserId int64 `json:"user_id"` + MessageId int64 `json:"message_id"` + Media []json.RawMessage `json:"media"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + starTransactionTypeChannelPaidMediaSale.UserId = tmp.UserId + starTransactionTypeChannelPaidMediaSale.MessageId = tmp.MessageId + + fieldMedia, _ := UnmarshalListOfPaidMedia(tmp.Media) + starTransactionTypeChannelPaidMediaSale.Media = fieldMedia + + return nil +} + +// The transaction is a purchase of a product from a bot or a business account by the current user; for regular users only +type StarTransactionTypeBotInvoicePurchase struct { + meta + // Identifier of the bot or the business account user that created the invoice + UserId int64 `json:"user_id"` + // Information about the bought product + ProductInfo *ProductInfo `json:"product_info"` +} + +func (entity *StarTransactionTypeBotInvoicePurchase) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeBotInvoicePurchase + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeBotInvoicePurchase) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeBotInvoicePurchase) GetType() string { + return TypeStarTransactionTypeBotInvoicePurchase +} + +func (*StarTransactionTypeBotInvoicePurchase) StarTransactionTypeType() string { + return TypeStarTransactionTypeBotInvoicePurchase +} + +// The transaction is a sale of a product by the bot; for bots only +type StarTransactionTypeBotInvoiceSale struct { + meta + // Identifier of the user that bought the product + UserId int64 `json:"user_id"` + // Information about the bought product + ProductInfo *ProductInfo `json:"product_info"` + // Invoice payload + InvoicePayload []byte `json:"invoice_payload"` + // Information about the affiliate which received commission from the transaction; may be null if none + Affiliate *AffiliateInfo `json:"affiliate"` +} + +func (entity *StarTransactionTypeBotInvoiceSale) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeBotInvoiceSale + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeBotInvoiceSale) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeBotInvoiceSale) GetType() string { + return TypeStarTransactionTypeBotInvoiceSale +} + +func (*StarTransactionTypeBotInvoiceSale) StarTransactionTypeType() string { + return TypeStarTransactionTypeBotInvoiceSale +} + +// The transaction is a purchase of a subscription from a bot or a business account by the current user; for regular users only +type StarTransactionTypeBotSubscriptionPurchase struct { + meta + // Identifier of the bot or the business account user that created the subscription link + UserId int64 `json:"user_id"` + // The number of seconds between consecutive Telegram Star debitings + SubscriptionPeriod int32 `json:"subscription_period"` + // Information about the bought subscription + ProductInfo *ProductInfo `json:"product_info"` +} + +func (entity *StarTransactionTypeBotSubscriptionPurchase) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeBotSubscriptionPurchase + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeBotSubscriptionPurchase) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeBotSubscriptionPurchase) GetType() string { + return TypeStarTransactionTypeBotSubscriptionPurchase +} + +func (*StarTransactionTypeBotSubscriptionPurchase) StarTransactionTypeType() string { + return TypeStarTransactionTypeBotSubscriptionPurchase +} + +// The transaction is a sale of a subscription by the bot; for bots only +type StarTransactionTypeBotSubscriptionSale struct { + meta + // Identifier of the user that bought the subscription + UserId int64 `json:"user_id"` + // The number of seconds between consecutive Telegram Star debitings + SubscriptionPeriod int32 `json:"subscription_period"` + // Information about the bought subscription + ProductInfo *ProductInfo `json:"product_info"` + // Invoice payload + InvoicePayload []byte `json:"invoice_payload"` + // Information about the affiliate which received commission from the transaction; may be null if none + Affiliate *AffiliateInfo `json:"affiliate"` +} + +func (entity *StarTransactionTypeBotSubscriptionSale) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeBotSubscriptionSale + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeBotSubscriptionSale) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeBotSubscriptionSale) GetType() string { + return TypeStarTransactionTypeBotSubscriptionSale +} + +func (*StarTransactionTypeBotSubscriptionSale) StarTransactionTypeType() string { + return TypeStarTransactionTypeBotSubscriptionSale +} + +// The transaction is a purchase of a subscription to a channel chat by the current user; for regular users only +type StarTransactionTypeChannelSubscriptionPurchase struct { + meta + // Identifier of the channel chat that created the subscription + ChatId int64 `json:"chat_id"` + // The number of seconds between consecutive Telegram Star debitings + SubscriptionPeriod int32 `json:"subscription_period"` +} + +func (entity *StarTransactionTypeChannelSubscriptionPurchase) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeChannelSubscriptionPurchase + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeChannelSubscriptionPurchase) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeChannelSubscriptionPurchase) GetType() string { + return TypeStarTransactionTypeChannelSubscriptionPurchase +} + +func (*StarTransactionTypeChannelSubscriptionPurchase) StarTransactionTypeType() string { + return TypeStarTransactionTypeChannelSubscriptionPurchase +} + +// The transaction is a sale of a subscription by the channel chat; for channel chats only +type StarTransactionTypeChannelSubscriptionSale struct { + meta + // Identifier of the user that bought the subscription + UserId int64 `json:"user_id"` + // The number of seconds between consecutive Telegram Star debitings + SubscriptionPeriod int32 `json:"subscription_period"` +} + +func (entity *StarTransactionTypeChannelSubscriptionSale) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeChannelSubscriptionSale + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeChannelSubscriptionSale) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeChannelSubscriptionSale) GetType() string { + return TypeStarTransactionTypeChannelSubscriptionSale +} + +func (*StarTransactionTypeChannelSubscriptionSale) StarTransactionTypeType() string { + return TypeStarTransactionTypeChannelSubscriptionSale +} + +// The transaction is a purchase of a gift to another user; for regular users and bots only +type StarTransactionTypeGiftPurchase struct { + meta + // Identifier of the user that received the gift + UserId int64 `json:"user_id"` + // The gift + Gift *Gift `json:"gift"` +} + +func (entity *StarTransactionTypeGiftPurchase) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeGiftPurchase + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeGiftPurchase) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeGiftPurchase) GetType() string { + return TypeStarTransactionTypeGiftPurchase +} + +func (*StarTransactionTypeGiftPurchase) StarTransactionTypeType() string { + return TypeStarTransactionTypeGiftPurchase +} + +// The transaction is a sale of a gift received from another user or bot; for regular users only +type StarTransactionTypeGiftSale struct { + meta + // Identifier of the user that sent the gift + UserId int64 `json:"user_id"` + // The gift + Gift *Gift `json:"gift"` +} + +func (entity *StarTransactionTypeGiftSale) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeGiftSale + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeGiftSale) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeGiftSale) GetType() string { + return TypeStarTransactionTypeGiftSale +} + +func (*StarTransactionTypeGiftSale) StarTransactionTypeType() string { + return TypeStarTransactionTypeGiftSale +} + +// The transaction is a sending of a paid reaction to a message in a channel chat by the current user; for regular users only +type StarTransactionTypeChannelPaidReactionSend struct { + meta + // Identifier of the channel chat + ChatId int64 `json:"chat_id"` + // Identifier of the reacted message; can be 0 or an identifier of a deleted message + MessageId int64 `json:"message_id"` +} + +func (entity *StarTransactionTypeChannelPaidReactionSend) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeChannelPaidReactionSend + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeChannelPaidReactionSend) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeChannelPaidReactionSend) GetType() string { + return TypeStarTransactionTypeChannelPaidReactionSend +} + +func (*StarTransactionTypeChannelPaidReactionSend) StarTransactionTypeType() string { + return TypeStarTransactionTypeChannelPaidReactionSend +} + +// The transaction is a receiving of a paid reaction to a message by the channel chat; for channel chats only +type StarTransactionTypeChannelPaidReactionReceive struct { + meta + // Identifier of the user that added the paid reaction + UserId int64 `json:"user_id"` + // Identifier of the reacted message; can be 0 or an identifier of a deleted message + MessageId int64 `json:"message_id"` +} + +func (entity *StarTransactionTypeChannelPaidReactionReceive) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeChannelPaidReactionReceive + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeChannelPaidReactionReceive) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeChannelPaidReactionReceive) GetType() string { + return TypeStarTransactionTypeChannelPaidReactionReceive +} + +func (*StarTransactionTypeChannelPaidReactionReceive) StarTransactionTypeType() string { + return TypeStarTransactionTypeChannelPaidReactionReceive +} + +// The transaction is a receiving of a commission from an affiliate program; for regular users, bots and channel chats only +type StarTransactionTypeAffiliateProgramCommission struct { + meta + // Identifier of the chat that created the affiliate program + ChatId int64 `json:"chat_id"` + // The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the program owner + CommissionPerMille int32 `json:"commission_per_mille"` +} + +func (entity *StarTransactionTypeAffiliateProgramCommission) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeAffiliateProgramCommission + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeAffiliateProgramCommission) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeAffiliateProgramCommission) GetType() string { + return TypeStarTransactionTypeAffiliateProgramCommission +} + +func (*StarTransactionTypeAffiliateProgramCommission) StarTransactionTypeType() string { + return TypeStarTransactionTypeAffiliateProgramCommission +} + +// The transaction is a transaction of an unsupported type +type StarTransactionTypeUnsupported struct{ + meta +} + +func (entity *StarTransactionTypeUnsupported) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeUnsupported + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeUnsupported) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeUnsupported) GetType() string { + return TypeStarTransactionTypeUnsupported +} + +func (*StarTransactionTypeUnsupported) StarTransactionTypeType() string { + return TypeStarTransactionTypeUnsupported } // Represents a transaction changing the amount of owned Telegram Stars @@ -8745,13 +9166,13 @@ type StarTransaction struct { // Unique identifier of the transaction Id string `json:"id"` // The amount of added owned Telegram Stars; negative for outgoing transactions - StarCount int64 `json:"star_count"` + StarAmount *StarAmount `json:"star_amount"` // True, if the transaction is a refund of a previous transaction IsRefund bool `json:"is_refund"` // Point in time (Unix timestamp) when the transaction was completed Date int32 `json:"date"` - // Source of the incoming transaction, or its recipient for outgoing transactions - Partner StarTransactionPartner `json:"partner"` + // Type of the transaction + Type StarTransactionType `json:"type"` } func (entity *StarTransaction) MarshalJSON() ([]byte, error) { @@ -8773,10 +9194,10 @@ func (*StarTransaction) GetType() string { func (starTransaction *StarTransaction) UnmarshalJSON(data []byte) error { var tmp struct { Id string `json:"id"` - StarCount int64 `json:"star_count"` + StarAmount *StarAmount `json:"star_amount"` IsRefund bool `json:"is_refund"` Date int32 `json:"date"` - Partner json.RawMessage `json:"partner"` + Type json.RawMessage `json:"type"` } err := json.Unmarshal(data, &tmp) @@ -8785,12 +9206,12 @@ func (starTransaction *StarTransaction) UnmarshalJSON(data []byte) error { } starTransaction.Id = tmp.Id - starTransaction.StarCount = tmp.StarCount + starTransaction.StarAmount = tmp.StarAmount starTransaction.IsRefund = tmp.IsRefund starTransaction.Date = tmp.Date - fieldPartner, _ := UnmarshalStarTransactionPartner(tmp.Partner) - starTransaction.Partner = fieldPartner + fieldType, _ := UnmarshalStarTransactionType(tmp.Type) + starTransaction.Type = fieldType return nil } @@ -8799,7 +9220,7 @@ func (starTransaction *StarTransaction) UnmarshalJSON(data []byte) error { type StarTransactions struct { meta // The amount of owned Telegram Stars - StarCount int64 `json:"star_count"` + StarAmount *StarAmount `json:"star_amount"` // List of transactions with Telegram Stars Transactions []*StarTransaction `json:"transactions"` // The offset for the next request. If empty, then there are no more results @@ -9283,15 +9704,15 @@ type User struct { Status UserStatus `json:"status"` // Profile photo of the user; may be null ProfilePhoto *ProfilePhoto `json:"profile_photo"` - // Identifier of the accent color for name, and backgrounds of profile photo, reply header, and link preview. For Telegram Premium users only + // Identifier of the accent color for name, and backgrounds of profile photo, reply header, and link preview AccentColorId int32 `json:"accent_color_id"` - // Identifier of a custom emoji to be shown on the reply header and link preview background; 0 if none. For Telegram Premium users only + // Identifier of a custom emoji to be shown on the reply header and link preview background; 0 if none BackgroundCustomEmojiId JsonInt64 `json:"background_custom_emoji_id"` - // Identifier of the accent color for the user's profile; -1 if none. For Telegram Premium users only + // Identifier of the accent color for the user's profile; -1 if none ProfileAccentColorId int32 `json:"profile_accent_color_id"` - // Identifier of a custom emoji to be shown on the background of the user's profile; 0 if none. For Telegram Premium users only + // Identifier of a custom emoji to be shown on the background of the user's profile; 0 if none ProfileBackgroundCustomEmojiId JsonInt64 `json:"profile_background_custom_emoji_id"` - // Emoji status to be shown instead of the default Telegram Premium badge; may be null. For Telegram Premium users only + // Emoji status to be shown instead of the default Telegram Premium badge; may be null EmojiStatus *EmojiStatus `json:"emoji_status"` // The user is a contact of the current user IsContact bool `json:"is_contact"` @@ -9439,6 +9860,8 @@ type BotInfo struct { DefaultGroupAdministratorRights *ChatAdministratorRights `json:"default_group_administrator_rights"` // Default administrator rights for adding the bot to channels; may be null DefaultChannelAdministratorRights *ChatAdministratorRights `json:"default_channel_administrator_rights"` + // Information about the affiliate program of the bot; may be null if none + AffiliateProgram *AffiliateProgramInfo `json:"affiliate_program"` // Default light background color for bot Web Apps; -1 if not specified WebAppBackgroundLightColor int32 `json:"web_app_background_light_color"` // Default dark background color for bot Web Apps; -1 if not specified @@ -9490,6 +9913,7 @@ func (botInfo *BotInfo) UnmarshalJSON(data []byte) error { PrivacyPolicyUrl string `json:"privacy_policy_url"` DefaultGroupAdministratorRights *ChatAdministratorRights `json:"default_group_administrator_rights"` DefaultChannelAdministratorRights *ChatAdministratorRights `json:"default_channel_administrator_rights"` + AffiliateProgram *AffiliateProgramInfo `json:"affiliate_program"` WebAppBackgroundLightColor int32 `json:"web_app_background_light_color"` WebAppBackgroundDarkColor int32 `json:"web_app_background_dark_color"` WebAppHeaderLightColor int32 `json:"web_app_header_light_color"` @@ -9517,6 +9941,7 @@ func (botInfo *BotInfo) UnmarshalJSON(data []byte) error { botInfo.PrivacyPolicyUrl = tmp.PrivacyPolicyUrl botInfo.DefaultGroupAdministratorRights = tmp.DefaultGroupAdministratorRights botInfo.DefaultChannelAdministratorRights = tmp.DefaultChannelAdministratorRights + botInfo.AffiliateProgram = tmp.AffiliateProgram botInfo.WebAppBackgroundLightColor = tmp.WebAppBackgroundLightColor botInfo.WebAppBackgroundDarkColor = tmp.WebAppBackgroundDarkColor botInfo.WebAppHeaderLightColor = tmp.WebAppHeaderLightColor @@ -34198,7 +34623,7 @@ func (*TargetChatTypes) GetType() string { return TypeTargetChatTypes } -// The currently opened chat needs to be kept +// The currently opened chat and forum topic must be kept type TargetChatCurrent struct{ meta } @@ -45817,6 +46242,35 @@ func (*InternalLinkTypeChangePhoneNumber) InternalLinkTypeType() string { return TypeInternalLinkTypeChangePhoneNumber } +// The link is an affiliate program link. Call searchChatAffiliateProgram with the given username and referrer to process the link +type InternalLinkTypeChatAffiliateProgram struct { + meta + // Username to be passed to searchChatAffiliateProgram + Username string `json:"username"` + // Referrer to be passed to searchChatAffiliateProgram + Referrer string `json:"referrer"` +} + +func (entity *InternalLinkTypeChatAffiliateProgram) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeChatAffiliateProgram + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeChatAffiliateProgram) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeChatAffiliateProgram) GetType() string { + return TypeInternalLinkTypeChatAffiliateProgram +} + +func (*InternalLinkTypeChatAffiliateProgram) InternalLinkTypeType() string { + return TypeInternalLinkTypeChatAffiliateProgram +} + // The link is a link to boost a Telegram chat. Call getChatBoostLinkInfo with the given URL to process the link. If the chat is found, then call getChatBoostStatus and getAvailableChatBoostSlots to get the current boost status and check whether the chat can be boosted. If the user wants to boost the chat and the chat can be boosted, then call boostChat type InternalLinkTypeChatBoost struct { meta @@ -47309,6 +47763,106 @@ func (*FileTypeSecure) FileTypeType() string { return TypeFileTypeSecure } +// The file is a self-destructing photo in a private chat +type FileTypeSelfDestructingPhoto struct{ + meta +} + +func (entity *FileTypeSelfDestructingPhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FileTypeSelfDestructingPhoto + + return json.Marshal((*stub)(entity)) +} + +func (*FileTypeSelfDestructingPhoto) GetClass() string { + return ClassFileType +} + +func (*FileTypeSelfDestructingPhoto) GetType() string { + return TypeFileTypeSelfDestructingPhoto +} + +func (*FileTypeSelfDestructingPhoto) FileTypeType() string { + return TypeFileTypeSelfDestructingPhoto +} + +// The file is a self-destructing video in a private chat +type FileTypeSelfDestructingVideo struct{ + meta +} + +func (entity *FileTypeSelfDestructingVideo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FileTypeSelfDestructingVideo + + return json.Marshal((*stub)(entity)) +} + +func (*FileTypeSelfDestructingVideo) GetClass() string { + return ClassFileType +} + +func (*FileTypeSelfDestructingVideo) GetType() string { + return TypeFileTypeSelfDestructingVideo +} + +func (*FileTypeSelfDestructingVideo) FileTypeType() string { + return TypeFileTypeSelfDestructingVideo +} + +// The file is a self-destructing video note in a private chat +type FileTypeSelfDestructingVideoNote struct{ + meta +} + +func (entity *FileTypeSelfDestructingVideoNote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FileTypeSelfDestructingVideoNote + + return json.Marshal((*stub)(entity)) +} + +func (*FileTypeSelfDestructingVideoNote) GetClass() string { + return ClassFileType +} + +func (*FileTypeSelfDestructingVideoNote) GetType() string { + return TypeFileTypeSelfDestructingVideoNote +} + +func (*FileTypeSelfDestructingVideoNote) FileTypeType() string { + return TypeFileTypeSelfDestructingVideoNote +} + +// The file is a self-destructing voice note in a private chat +type FileTypeSelfDestructingVoiceNote struct{ + meta +} + +func (entity *FileTypeSelfDestructingVoiceNote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FileTypeSelfDestructingVoiceNote + + return json.Marshal((*stub)(entity)) +} + +func (*FileTypeSelfDestructingVoiceNote) GetClass() string { + return ClassFileType +} + +func (*FileTypeSelfDestructingVoiceNote) GetType() string { + return TypeFileTypeSelfDestructingVoiceNote +} + +func (*FileTypeSelfDestructingVoiceNote) FileTypeType() string { + return TypeFileTypeSelfDestructingVoiceNote +} + // The file is a sticker type FileTypeSticker struct{ meta @@ -50505,12 +51059,12 @@ func (*ChatRevenueTransactions) GetType() string { // Contains information about Telegram Stars earned by a bot or a chat type StarRevenueStatus struct { meta - // Total number of Telegram Stars earned - TotalCount int64 `json:"total_count"` - // The number of Telegram Stars that aren't withdrawn yet - CurrentCount int64 `json:"current_count"` - // The number of Telegram Stars that are available for withdrawal - AvailableCount int64 `json:"available_count"` + // Total amount of Telegram Stars earned + TotalAmount *StarAmount `json:"total_amount"` + // The amount of Telegram Stars that aren't withdrawn yet + CurrentAmount *StarAmount `json:"current_amount"` + // The amount of Telegram Stars that are available for withdrawal + AvailableAmount *StarAmount `json:"available_amount"` // True, if Telegram Stars can be withdrawn now or later WithdrawalEnabled bool `json:"withdrawal_enabled"` // Time left before the next withdrawal can be started, in seconds; 0 if withdrawal can be started now @@ -54482,7 +55036,7 @@ type UpdateAccentColors struct { meta // Information about supported colors; colors with identifiers 0 (red), 1 (orange), 2 (purple/violet), 3 (green), 4 (cyan), 5 (blue), 6 (pink) must always be supported and aren't included in the list. The exact colors for the accent colors with identifiers 0-6 must be taken from the app theme Colors []*AccentColor `json:"colors"` - // The list of accent color identifiers, which can be set through setAccentColor and setChatAccentColor. The colors must be shown in the specififed order + // The list of accent color identifiers, which can be set through setAccentColor and setChatAccentColor. The colors must be shown in the specified order AvailableAccentColorIds []int32 `json:"available_accent_color_ids"` } @@ -54511,7 +55065,7 @@ type UpdateProfileAccentColors struct { meta // Information about supported colors Colors []*ProfileAccentColor `json:"colors"` - // The list of accent color identifiers, which can be set through setProfileAccentColor and setChatProfileAccentColor. The colors must be shown in the specififed order + // The list of accent color identifiers, which can be set through setProfileAccentColor and setChatProfileAccentColor. The colors must be shown in the specified order AvailableAccentColorIds []int32 `json:"available_accent_color_ids"` } @@ -54877,8 +55431,8 @@ func (*UpdateActiveLiveLocationMessages) UpdateType() string { // The number of Telegram Stars owned by the current user has changed type UpdateOwnedStarCount struct { meta - // The new number of Telegram Stars owned - StarCount int64 `json:"star_count"` + // The new amount of owned Telegram Stars + StarAmount *StarAmount `json:"star_amount"` } func (entity *UpdateOwnedStarCount) MarshalJSON() ([]byte, error) { diff --git a/client/unmarshaler.go b/client/unmarshaler.go index c30f7ad..ec11136 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -693,6 +693,43 @@ func UnmarshalListOfStarSubscriptionType(dataList []json.RawMessage) ([]StarSubs return list, nil } +func UnmarshalAffiliateProgramSortOrder(data json.RawMessage) (AffiliateProgramSortOrder, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeAffiliateProgramSortOrderProfitability: + return UnmarshalAffiliateProgramSortOrderProfitability(data) + + case TypeAffiliateProgramSortOrderCreationDate: + return UnmarshalAffiliateProgramSortOrderCreationDate(data) + + case TypeAffiliateProgramSortOrderRevenue: + return UnmarshalAffiliateProgramSortOrderRevenue(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfAffiliateProgramSortOrder(dataList []json.RawMessage) ([]AffiliateProgramSortOrder, error) { + list := []AffiliateProgramSortOrder{} + + for _, data := range dataList { + entity, err := UnmarshalAffiliateProgramSortOrder(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalStarTransactionDirection(data json.RawMessage) (StarTransactionDirection, error) { var meta meta @@ -727,7 +764,7 @@ func UnmarshalListOfStarTransactionDirection(dataList []json.RawMessage) ([]Star return list, nil } -func UnmarshalBotTransactionPurpose(data json.RawMessage) (BotTransactionPurpose, error) { +func UnmarshalStarTransactionType(data json.RawMessage) (StarTransactionType, error) { var meta meta err := json.Unmarshal(data, &meta) @@ -736,163 +773,91 @@ func UnmarshalBotTransactionPurpose(data json.RawMessage) (BotTransactionPurpose } switch meta.Type { - case TypeBotTransactionPurposePaidMedia: - return UnmarshalBotTransactionPurposePaidMedia(data) + case TypeStarTransactionTypePremiumBotDeposit: + return UnmarshalStarTransactionTypePremiumBotDeposit(data) - case TypeBotTransactionPurposeInvoicePayment: - return UnmarshalBotTransactionPurposeInvoicePayment(data) + case TypeStarTransactionTypeAppStoreDeposit: + return UnmarshalStarTransactionTypeAppStoreDeposit(data) - case TypeBotTransactionPurposeSubscription: - return UnmarshalBotTransactionPurposeSubscription(data) + case TypeStarTransactionTypeGooglePlayDeposit: + return UnmarshalStarTransactionTypeGooglePlayDeposit(data) + + case TypeStarTransactionTypeFragmentDeposit: + return UnmarshalStarTransactionTypeFragmentDeposit(data) + + case TypeStarTransactionTypeUserDeposit: + return UnmarshalStarTransactionTypeUserDeposit(data) + + case TypeStarTransactionTypeGiveawayDeposit: + return UnmarshalStarTransactionTypeGiveawayDeposit(data) + + case TypeStarTransactionTypeFragmentWithdrawal: + return UnmarshalStarTransactionTypeFragmentWithdrawal(data) + + case TypeStarTransactionTypeTelegramAdsWithdrawal: + return UnmarshalStarTransactionTypeTelegramAdsWithdrawal(data) + + case TypeStarTransactionTypeTelegramApiUsage: + return UnmarshalStarTransactionTypeTelegramApiUsage(data) + + case TypeStarTransactionTypeBotPaidMediaPurchase: + return UnmarshalStarTransactionTypeBotPaidMediaPurchase(data) + + case TypeStarTransactionTypeBotPaidMediaSale: + return UnmarshalStarTransactionTypeBotPaidMediaSale(data) + + case TypeStarTransactionTypeChannelPaidMediaPurchase: + return UnmarshalStarTransactionTypeChannelPaidMediaPurchase(data) + + case TypeStarTransactionTypeChannelPaidMediaSale: + return UnmarshalStarTransactionTypeChannelPaidMediaSale(data) + + case TypeStarTransactionTypeBotInvoicePurchase: + return UnmarshalStarTransactionTypeBotInvoicePurchase(data) + + case TypeStarTransactionTypeBotInvoiceSale: + return UnmarshalStarTransactionTypeBotInvoiceSale(data) + + case TypeStarTransactionTypeBotSubscriptionPurchase: + return UnmarshalStarTransactionTypeBotSubscriptionPurchase(data) + + case TypeStarTransactionTypeBotSubscriptionSale: + return UnmarshalStarTransactionTypeBotSubscriptionSale(data) + + case TypeStarTransactionTypeChannelSubscriptionPurchase: + return UnmarshalStarTransactionTypeChannelSubscriptionPurchase(data) + + case TypeStarTransactionTypeChannelSubscriptionSale: + return UnmarshalStarTransactionTypeChannelSubscriptionSale(data) + + case TypeStarTransactionTypeGiftPurchase: + return UnmarshalStarTransactionTypeGiftPurchase(data) + + case TypeStarTransactionTypeGiftSale: + return UnmarshalStarTransactionTypeGiftSale(data) + + case TypeStarTransactionTypeChannelPaidReactionSend: + return UnmarshalStarTransactionTypeChannelPaidReactionSend(data) + + case TypeStarTransactionTypeChannelPaidReactionReceive: + return UnmarshalStarTransactionTypeChannelPaidReactionReceive(data) + + case TypeStarTransactionTypeAffiliateProgramCommission: + return UnmarshalStarTransactionTypeAffiliateProgramCommission(data) + + case TypeStarTransactionTypeUnsupported: + return UnmarshalStarTransactionTypeUnsupported(data) default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } } -func UnmarshalListOfBotTransactionPurpose(dataList []json.RawMessage) ([]BotTransactionPurpose, error) { - list := []BotTransactionPurpose{} +func UnmarshalListOfStarTransactionType(dataList []json.RawMessage) ([]StarTransactionType, error) { + list := []StarTransactionType{} for _, data := range dataList { - entity, err := UnmarshalBotTransactionPurpose(data) - if err != nil { - return nil, err - } - list = append(list, entity) - } - - return list, nil -} - -func UnmarshalChatTransactionPurpose(data json.RawMessage) (ChatTransactionPurpose, error) { - var meta meta - - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } - - switch meta.Type { - case TypeChatTransactionPurposePaidMedia: - return UnmarshalChatTransactionPurposePaidMedia(data) - - case TypeChatTransactionPurposeJoin: - return UnmarshalChatTransactionPurposeJoin(data) - - case TypeChatTransactionPurposeReaction: - return UnmarshalChatTransactionPurposeReaction(data) - - case TypeChatTransactionPurposeGiveaway: - return UnmarshalChatTransactionPurposeGiveaway(data) - - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } -} - -func UnmarshalListOfChatTransactionPurpose(dataList []json.RawMessage) ([]ChatTransactionPurpose, error) { - list := []ChatTransactionPurpose{} - - for _, data := range dataList { - entity, err := UnmarshalChatTransactionPurpose(data) - if err != nil { - return nil, err - } - list = append(list, entity) - } - - return list, nil -} - -func UnmarshalUserTransactionPurpose(data json.RawMessage) (UserTransactionPurpose, error) { - var meta meta - - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } - - switch meta.Type { - case TypeUserTransactionPurposeGiftedStars: - return UnmarshalUserTransactionPurposeGiftedStars(data) - - case TypeUserTransactionPurposeGiftSell: - return UnmarshalUserTransactionPurposeGiftSell(data) - - case TypeUserTransactionPurposeGiftSend: - return UnmarshalUserTransactionPurposeGiftSend(data) - - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } -} - -func UnmarshalListOfUserTransactionPurpose(dataList []json.RawMessage) ([]UserTransactionPurpose, error) { - list := []UserTransactionPurpose{} - - for _, data := range dataList { - entity, err := UnmarshalUserTransactionPurpose(data) - if err != nil { - return nil, err - } - list = append(list, entity) - } - - return list, nil -} - -func UnmarshalStarTransactionPartner(data json.RawMessage) (StarTransactionPartner, error) { - var meta meta - - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } - - switch meta.Type { - case TypeStarTransactionPartnerTelegram: - return UnmarshalStarTransactionPartnerTelegram(data) - - case TypeStarTransactionPartnerAppStore: - return UnmarshalStarTransactionPartnerAppStore(data) - - case TypeStarTransactionPartnerGooglePlay: - return UnmarshalStarTransactionPartnerGooglePlay(data) - - case TypeStarTransactionPartnerFragment: - return UnmarshalStarTransactionPartnerFragment(data) - - case TypeStarTransactionPartnerTelegramAds: - return UnmarshalStarTransactionPartnerTelegramAds(data) - - case TypeStarTransactionPartnerTelegramApi: - return UnmarshalStarTransactionPartnerTelegramApi(data) - - case TypeStarTransactionPartnerBot: - return UnmarshalStarTransactionPartnerBot(data) - - case TypeStarTransactionPartnerBusiness: - return UnmarshalStarTransactionPartnerBusiness(data) - - case TypeStarTransactionPartnerChat: - return UnmarshalStarTransactionPartnerChat(data) - - case TypeStarTransactionPartnerUser: - return UnmarshalStarTransactionPartnerUser(data) - - case TypeStarTransactionPartnerUnsupported: - return UnmarshalStarTransactionPartnerUnsupported(data) - - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } -} - -func UnmarshalListOfStarTransactionPartner(dataList []json.RawMessage) ([]StarTransactionPartner, error) { - list := []StarTransactionPartner{} - - for _, data := range dataList { - entity, err := UnmarshalStarTransactionPartner(data) + entity, err := UnmarshalStarTransactionType(data) if err != nil { return nil, err } @@ -6816,6 +6781,9 @@ func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { case TypeInternalLinkTypeChangePhoneNumber: return UnmarshalInternalLinkTypeChangePhoneNumber(data) + case TypeInternalLinkTypeChatAffiliateProgram: + return UnmarshalInternalLinkTypeChatAffiliateProgram(data) + case TypeInternalLinkTypeChatBoost: return UnmarshalInternalLinkTypeChatBoost(data) @@ -7016,6 +6984,18 @@ func UnmarshalFileType(data json.RawMessage) (FileType, error) { case TypeFileTypeSecure: return UnmarshalFileTypeSecure(data) + case TypeFileTypeSelfDestructingPhoto: + return UnmarshalFileTypeSelfDestructingPhoto(data) + + case TypeFileTypeSelfDestructingVideo: + return UnmarshalFileTypeSelfDestructingVideo(data) + + case TypeFileTypeSelfDestructingVideoNote: + return UnmarshalFileTypeSelfDestructingVideoNote(data) + + case TypeFileTypeSelfDestructingVoiceNote: + return UnmarshalFileTypeSelfDestructingVoiceNote(data) + case TypeFileTypeSticker: return UnmarshalFileTypeSticker(data) @@ -9354,6 +9334,14 @@ func UnmarshalChatAdministratorRights(data json.RawMessage) (*ChatAdministratorR return &resp, err } +func UnmarshalStarAmount(data json.RawMessage) (*StarAmount, error) { + var resp StarAmount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarSubscriptionTypeChannel(data json.RawMessage) (*StarSubscriptionTypeChannel, error) { var resp StarSubscriptionTypeChannel @@ -9394,6 +9382,86 @@ func UnmarshalStarSubscriptions(data json.RawMessage) (*StarSubscriptions, error return &resp, err } +func UnmarshalAffiliateProgramSortOrderProfitability(data json.RawMessage) (*AffiliateProgramSortOrderProfitability, error) { + var resp AffiliateProgramSortOrderProfitability + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAffiliateProgramSortOrderCreationDate(data json.RawMessage) (*AffiliateProgramSortOrderCreationDate, error) { + var resp AffiliateProgramSortOrderCreationDate + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAffiliateProgramSortOrderRevenue(data json.RawMessage) (*AffiliateProgramSortOrderRevenue, error) { + var resp AffiliateProgramSortOrderRevenue + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAffiliateProgramParameters(data json.RawMessage) (*AffiliateProgramParameters, error) { + var resp AffiliateProgramParameters + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAffiliateProgramInfo(data json.RawMessage) (*AffiliateProgramInfo, error) { + var resp AffiliateProgramInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAffiliateInfo(data json.RawMessage) (*AffiliateInfo, error) { + var resp AffiliateInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFoundAffiliateProgram(data json.RawMessage) (*FoundAffiliateProgram, error) { + var resp FoundAffiliateProgram + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFoundAffiliatePrograms(data json.RawMessage) (*FoundAffiliatePrograms, error) { + var resp FoundAffiliatePrograms + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatAffiliateProgram(data json.RawMessage) (*ChatAffiliateProgram, error) { + var resp ChatAffiliateProgram + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatAffiliatePrograms(data json.RawMessage) (*ChatAffiliatePrograms, error) { + var resp ChatAffiliatePrograms + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalProductInfo(data json.RawMessage) (*ProductInfo, error) { var resp ProductInfo @@ -9530,168 +9598,200 @@ func UnmarshalStarTransactionDirectionOutgoing(data json.RawMessage) (*StarTrans return &resp, err } -func UnmarshalBotTransactionPurposePaidMedia(data json.RawMessage) (*BotTransactionPurposePaidMedia, error) { - var resp BotTransactionPurposePaidMedia +func UnmarshalStarTransactionTypePremiumBotDeposit(data json.RawMessage) (*StarTransactionTypePremiumBotDeposit, error) { + var resp StarTransactionTypePremiumBotDeposit err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalBotTransactionPurposeInvoicePayment(data json.RawMessage) (*BotTransactionPurposeInvoicePayment, error) { - var resp BotTransactionPurposeInvoicePayment +func UnmarshalStarTransactionTypeAppStoreDeposit(data json.RawMessage) (*StarTransactionTypeAppStoreDeposit, error) { + var resp StarTransactionTypeAppStoreDeposit err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalBotTransactionPurposeSubscription(data json.RawMessage) (*BotTransactionPurposeSubscription, error) { - var resp BotTransactionPurposeSubscription +func UnmarshalStarTransactionTypeGooglePlayDeposit(data json.RawMessage) (*StarTransactionTypeGooglePlayDeposit, error) { + var resp StarTransactionTypeGooglePlayDeposit err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalChatTransactionPurposePaidMedia(data json.RawMessage) (*ChatTransactionPurposePaidMedia, error) { - var resp ChatTransactionPurposePaidMedia +func UnmarshalStarTransactionTypeFragmentDeposit(data json.RawMessage) (*StarTransactionTypeFragmentDeposit, error) { + var resp StarTransactionTypeFragmentDeposit err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalChatTransactionPurposeJoin(data json.RawMessage) (*ChatTransactionPurposeJoin, error) { - var resp ChatTransactionPurposeJoin +func UnmarshalStarTransactionTypeUserDeposit(data json.RawMessage) (*StarTransactionTypeUserDeposit, error) { + var resp StarTransactionTypeUserDeposit err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalChatTransactionPurposeReaction(data json.RawMessage) (*ChatTransactionPurposeReaction, error) { - var resp ChatTransactionPurposeReaction +func UnmarshalStarTransactionTypeGiveawayDeposit(data json.RawMessage) (*StarTransactionTypeGiveawayDeposit, error) { + var resp StarTransactionTypeGiveawayDeposit err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalChatTransactionPurposeGiveaway(data json.RawMessage) (*ChatTransactionPurposeGiveaway, error) { - var resp ChatTransactionPurposeGiveaway +func UnmarshalStarTransactionTypeFragmentWithdrawal(data json.RawMessage) (*StarTransactionTypeFragmentWithdrawal, error) { + var resp StarTransactionTypeFragmentWithdrawal err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalUserTransactionPurposeGiftedStars(data json.RawMessage) (*UserTransactionPurposeGiftedStars, error) { - var resp UserTransactionPurposeGiftedStars +func UnmarshalStarTransactionTypeTelegramAdsWithdrawal(data json.RawMessage) (*StarTransactionTypeTelegramAdsWithdrawal, error) { + var resp StarTransactionTypeTelegramAdsWithdrawal err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalUserTransactionPurposeGiftSell(data json.RawMessage) (*UserTransactionPurposeGiftSell, error) { - var resp UserTransactionPurposeGiftSell +func UnmarshalStarTransactionTypeTelegramApiUsage(data json.RawMessage) (*StarTransactionTypeTelegramApiUsage, error) { + var resp StarTransactionTypeTelegramApiUsage err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalUserTransactionPurposeGiftSend(data json.RawMessage) (*UserTransactionPurposeGiftSend, error) { - var resp UserTransactionPurposeGiftSend +func UnmarshalStarTransactionTypeBotPaidMediaPurchase(data json.RawMessage) (*StarTransactionTypeBotPaidMediaPurchase, error) { + var resp StarTransactionTypeBotPaidMediaPurchase err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionPartnerTelegram(data json.RawMessage) (*StarTransactionPartnerTelegram, error) { - var resp StarTransactionPartnerTelegram +func UnmarshalStarTransactionTypeBotPaidMediaSale(data json.RawMessage) (*StarTransactionTypeBotPaidMediaSale, error) { + var resp StarTransactionTypeBotPaidMediaSale err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionPartnerAppStore(data json.RawMessage) (*StarTransactionPartnerAppStore, error) { - var resp StarTransactionPartnerAppStore +func UnmarshalStarTransactionTypeChannelPaidMediaPurchase(data json.RawMessage) (*StarTransactionTypeChannelPaidMediaPurchase, error) { + var resp StarTransactionTypeChannelPaidMediaPurchase err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionPartnerGooglePlay(data json.RawMessage) (*StarTransactionPartnerGooglePlay, error) { - var resp StarTransactionPartnerGooglePlay +func UnmarshalStarTransactionTypeChannelPaidMediaSale(data json.RawMessage) (*StarTransactionTypeChannelPaidMediaSale, error) { + var resp StarTransactionTypeChannelPaidMediaSale err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionPartnerFragment(data json.RawMessage) (*StarTransactionPartnerFragment, error) { - var resp StarTransactionPartnerFragment +func UnmarshalStarTransactionTypeBotInvoicePurchase(data json.RawMessage) (*StarTransactionTypeBotInvoicePurchase, error) { + var resp StarTransactionTypeBotInvoicePurchase err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionPartnerTelegramAds(data json.RawMessage) (*StarTransactionPartnerTelegramAds, error) { - var resp StarTransactionPartnerTelegramAds +func UnmarshalStarTransactionTypeBotInvoiceSale(data json.RawMessage) (*StarTransactionTypeBotInvoiceSale, error) { + var resp StarTransactionTypeBotInvoiceSale err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionPartnerTelegramApi(data json.RawMessage) (*StarTransactionPartnerTelegramApi, error) { - var resp StarTransactionPartnerTelegramApi +func UnmarshalStarTransactionTypeBotSubscriptionPurchase(data json.RawMessage) (*StarTransactionTypeBotSubscriptionPurchase, error) { + var resp StarTransactionTypeBotSubscriptionPurchase err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionPartnerBot(data json.RawMessage) (*StarTransactionPartnerBot, error) { - var resp StarTransactionPartnerBot +func UnmarshalStarTransactionTypeBotSubscriptionSale(data json.RawMessage) (*StarTransactionTypeBotSubscriptionSale, error) { + var resp StarTransactionTypeBotSubscriptionSale err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionPartnerBusiness(data json.RawMessage) (*StarTransactionPartnerBusiness, error) { - var resp StarTransactionPartnerBusiness +func UnmarshalStarTransactionTypeChannelSubscriptionPurchase(data json.RawMessage) (*StarTransactionTypeChannelSubscriptionPurchase, error) { + var resp StarTransactionTypeChannelSubscriptionPurchase err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionPartnerChat(data json.RawMessage) (*StarTransactionPartnerChat, error) { - var resp StarTransactionPartnerChat +func UnmarshalStarTransactionTypeChannelSubscriptionSale(data json.RawMessage) (*StarTransactionTypeChannelSubscriptionSale, error) { + var resp StarTransactionTypeChannelSubscriptionSale err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionPartnerUser(data json.RawMessage) (*StarTransactionPartnerUser, error) { - var resp StarTransactionPartnerUser +func UnmarshalStarTransactionTypeGiftPurchase(data json.RawMessage) (*StarTransactionTypeGiftPurchase, error) { + var resp StarTransactionTypeGiftPurchase err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionPartnerUnsupported(data json.RawMessage) (*StarTransactionPartnerUnsupported, error) { - var resp StarTransactionPartnerUnsupported +func UnmarshalStarTransactionTypeGiftSale(data json.RawMessage) (*StarTransactionTypeGiftSale, error) { + var resp StarTransactionTypeGiftSale + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeChannelPaidReactionSend(data json.RawMessage) (*StarTransactionTypeChannelPaidReactionSend, error) { + var resp StarTransactionTypeChannelPaidReactionSend + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeChannelPaidReactionReceive(data json.RawMessage) (*StarTransactionTypeChannelPaidReactionReceive, error) { + var resp StarTransactionTypeChannelPaidReactionReceive + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeAffiliateProgramCommission(data json.RawMessage) (*StarTransactionTypeAffiliateProgramCommission, error) { + var resp StarTransactionTypeAffiliateProgramCommission + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeUnsupported(data json.RawMessage) (*StarTransactionTypeUnsupported, error) { + var resp StarTransactionTypeUnsupported err := json.Unmarshal(data, &resp) @@ -18754,6 +18854,14 @@ func UnmarshalInternalLinkTypeChangePhoneNumber(data json.RawMessage) (*Internal return &resp, err } +func UnmarshalInternalLinkTypeChatAffiliateProgram(data json.RawMessage) (*InternalLinkTypeChatAffiliateProgram, error) { + var resp InternalLinkTypeChatAffiliateProgram + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInternalLinkTypeChatBoost(data json.RawMessage) (*InternalLinkTypeChatBoost, error) { var resp InternalLinkTypeChatBoost @@ -19178,6 +19286,38 @@ func UnmarshalFileTypeSecure(data json.RawMessage) (*FileTypeSecure, error) { return &resp, err } +func UnmarshalFileTypeSelfDestructingPhoto(data json.RawMessage) (*FileTypeSelfDestructingPhoto, error) { + var resp FileTypeSelfDestructingPhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFileTypeSelfDestructingVideo(data json.RawMessage) (*FileTypeSelfDestructingVideo, error) { + var resp FileTypeSelfDestructingVideo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFileTypeSelfDestructingVideoNote(data json.RawMessage) (*FileTypeSelfDestructingVideoNote, error) { + var resp FileTypeSelfDestructingVideoNote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFileTypeSelfDestructingVoiceNote(data json.RawMessage) (*FileTypeSelfDestructingVoiceNote, error) { + var resp FileTypeSelfDestructingVoiceNote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalFileTypeSticker(data json.RawMessage) (*FileTypeSticker, error) { var resp FileTypeSticker @@ -21851,6 +21991,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatAdministratorRights: return UnmarshalChatAdministratorRights(data) + case TypeStarAmount: + return UnmarshalStarAmount(data) + case TypeStarSubscriptionTypeChannel: return UnmarshalStarSubscriptionTypeChannel(data) @@ -21866,6 +22009,36 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarSubscriptions: return UnmarshalStarSubscriptions(data) + case TypeAffiliateProgramSortOrderProfitability: + return UnmarshalAffiliateProgramSortOrderProfitability(data) + + case TypeAffiliateProgramSortOrderCreationDate: + return UnmarshalAffiliateProgramSortOrderCreationDate(data) + + case TypeAffiliateProgramSortOrderRevenue: + return UnmarshalAffiliateProgramSortOrderRevenue(data) + + case TypeAffiliateProgramParameters: + return UnmarshalAffiliateProgramParameters(data) + + case TypeAffiliateProgramInfo: + return UnmarshalAffiliateProgramInfo(data) + + case TypeAffiliateInfo: + return UnmarshalAffiliateInfo(data) + + case TypeFoundAffiliateProgram: + return UnmarshalFoundAffiliateProgram(data) + + case TypeFoundAffiliatePrograms: + return UnmarshalFoundAffiliatePrograms(data) + + case TypeChatAffiliateProgram: + return UnmarshalChatAffiliateProgram(data) + + case TypeChatAffiliatePrograms: + return UnmarshalChatAffiliatePrograms(data) + case TypeProductInfo: return UnmarshalProductInfo(data) @@ -21917,68 +22090,80 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarTransactionDirectionOutgoing: return UnmarshalStarTransactionDirectionOutgoing(data) - case TypeBotTransactionPurposePaidMedia: - return UnmarshalBotTransactionPurposePaidMedia(data) + case TypeStarTransactionTypePremiumBotDeposit: + return UnmarshalStarTransactionTypePremiumBotDeposit(data) - case TypeBotTransactionPurposeInvoicePayment: - return UnmarshalBotTransactionPurposeInvoicePayment(data) + case TypeStarTransactionTypeAppStoreDeposit: + return UnmarshalStarTransactionTypeAppStoreDeposit(data) - case TypeBotTransactionPurposeSubscription: - return UnmarshalBotTransactionPurposeSubscription(data) + case TypeStarTransactionTypeGooglePlayDeposit: + return UnmarshalStarTransactionTypeGooglePlayDeposit(data) - case TypeChatTransactionPurposePaidMedia: - return UnmarshalChatTransactionPurposePaidMedia(data) + case TypeStarTransactionTypeFragmentDeposit: + return UnmarshalStarTransactionTypeFragmentDeposit(data) - case TypeChatTransactionPurposeJoin: - return UnmarshalChatTransactionPurposeJoin(data) + case TypeStarTransactionTypeUserDeposit: + return UnmarshalStarTransactionTypeUserDeposit(data) - case TypeChatTransactionPurposeReaction: - return UnmarshalChatTransactionPurposeReaction(data) + case TypeStarTransactionTypeGiveawayDeposit: + return UnmarshalStarTransactionTypeGiveawayDeposit(data) - case TypeChatTransactionPurposeGiveaway: - return UnmarshalChatTransactionPurposeGiveaway(data) + case TypeStarTransactionTypeFragmentWithdrawal: + return UnmarshalStarTransactionTypeFragmentWithdrawal(data) - case TypeUserTransactionPurposeGiftedStars: - return UnmarshalUserTransactionPurposeGiftedStars(data) + case TypeStarTransactionTypeTelegramAdsWithdrawal: + return UnmarshalStarTransactionTypeTelegramAdsWithdrawal(data) - case TypeUserTransactionPurposeGiftSell: - return UnmarshalUserTransactionPurposeGiftSell(data) + case TypeStarTransactionTypeTelegramApiUsage: + return UnmarshalStarTransactionTypeTelegramApiUsage(data) - case TypeUserTransactionPurposeGiftSend: - return UnmarshalUserTransactionPurposeGiftSend(data) + case TypeStarTransactionTypeBotPaidMediaPurchase: + return UnmarshalStarTransactionTypeBotPaidMediaPurchase(data) - case TypeStarTransactionPartnerTelegram: - return UnmarshalStarTransactionPartnerTelegram(data) + case TypeStarTransactionTypeBotPaidMediaSale: + return UnmarshalStarTransactionTypeBotPaidMediaSale(data) - case TypeStarTransactionPartnerAppStore: - return UnmarshalStarTransactionPartnerAppStore(data) + case TypeStarTransactionTypeChannelPaidMediaPurchase: + return UnmarshalStarTransactionTypeChannelPaidMediaPurchase(data) - case TypeStarTransactionPartnerGooglePlay: - return UnmarshalStarTransactionPartnerGooglePlay(data) + case TypeStarTransactionTypeChannelPaidMediaSale: + return UnmarshalStarTransactionTypeChannelPaidMediaSale(data) - case TypeStarTransactionPartnerFragment: - return UnmarshalStarTransactionPartnerFragment(data) + case TypeStarTransactionTypeBotInvoicePurchase: + return UnmarshalStarTransactionTypeBotInvoicePurchase(data) - case TypeStarTransactionPartnerTelegramAds: - return UnmarshalStarTransactionPartnerTelegramAds(data) + case TypeStarTransactionTypeBotInvoiceSale: + return UnmarshalStarTransactionTypeBotInvoiceSale(data) - case TypeStarTransactionPartnerTelegramApi: - return UnmarshalStarTransactionPartnerTelegramApi(data) + case TypeStarTransactionTypeBotSubscriptionPurchase: + return UnmarshalStarTransactionTypeBotSubscriptionPurchase(data) - case TypeStarTransactionPartnerBot: - return UnmarshalStarTransactionPartnerBot(data) + case TypeStarTransactionTypeBotSubscriptionSale: + return UnmarshalStarTransactionTypeBotSubscriptionSale(data) - case TypeStarTransactionPartnerBusiness: - return UnmarshalStarTransactionPartnerBusiness(data) + case TypeStarTransactionTypeChannelSubscriptionPurchase: + return UnmarshalStarTransactionTypeChannelSubscriptionPurchase(data) - case TypeStarTransactionPartnerChat: - return UnmarshalStarTransactionPartnerChat(data) + case TypeStarTransactionTypeChannelSubscriptionSale: + return UnmarshalStarTransactionTypeChannelSubscriptionSale(data) - case TypeStarTransactionPartnerUser: - return UnmarshalStarTransactionPartnerUser(data) + case TypeStarTransactionTypeGiftPurchase: + return UnmarshalStarTransactionTypeGiftPurchase(data) - case TypeStarTransactionPartnerUnsupported: - return UnmarshalStarTransactionPartnerUnsupported(data) + case TypeStarTransactionTypeGiftSale: + return UnmarshalStarTransactionTypeGiftSale(data) + + case TypeStarTransactionTypeChannelPaidReactionSend: + return UnmarshalStarTransactionTypeChannelPaidReactionSend(data) + + case TypeStarTransactionTypeChannelPaidReactionReceive: + return UnmarshalStarTransactionTypeChannelPaidReactionReceive(data) + + case TypeStarTransactionTypeAffiliateProgramCommission: + return UnmarshalStarTransactionTypeAffiliateProgramCommission(data) + + case TypeStarTransactionTypeUnsupported: + return UnmarshalStarTransactionTypeUnsupported(data) case TypeStarTransaction: return UnmarshalStarTransaction(data) @@ -25376,6 +25561,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInternalLinkTypeChangePhoneNumber: return UnmarshalInternalLinkTypeChangePhoneNumber(data) + case TypeInternalLinkTypeChatAffiliateProgram: + return UnmarshalInternalLinkTypeChatAffiliateProgram(data) + case TypeInternalLinkTypeChatBoost: return UnmarshalInternalLinkTypeChatBoost(data) @@ -25535,6 +25723,18 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeFileTypeSecure: return UnmarshalFileTypeSecure(data) + case TypeFileTypeSelfDestructingPhoto: + return UnmarshalFileTypeSelfDestructingPhoto(data) + + case TypeFileTypeSelfDestructingVideo: + return UnmarshalFileTypeSelfDestructingVideo(data) + + case TypeFileTypeSelfDestructingVideoNote: + return UnmarshalFileTypeSelfDestructingVideoNote(data) + + case TypeFileTypeSelfDestructingVoiceNote: + return UnmarshalFileTypeSelfDestructingVoiceNote(data) + case TypeFileTypeSticker: return UnmarshalFileTypeSticker(data) diff --git a/data/td_api.tl b/data/td_api.tl index ee20b8d..1512e66 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -813,6 +813,12 @@ chatPermissions can_send_basic_messages:Bool can_send_audios:Bool can_send_docum chatAdministratorRights can_manage_chat:Bool can_change_info:Bool can_post_messages:Bool can_edit_messages:Bool can_delete_messages:Bool can_invite_users:Bool can_restrict_members:Bool can_pin_messages:Bool can_manage_topics:Bool can_promote_members:Bool can_manage_video_chats:Bool can_post_stories:Bool can_edit_stories:Bool can_delete_stories:Bool is_anonymous:Bool = ChatAdministratorRights; +//@description Describes a possibly non-integer amount of Telegram Stars +//@star_count The integer amount of Telegram Stars rounded to 0 +//@nanostar_count The number of 1/1000000000 shares of Telegram Stars; from -999999999 to 999999999 +starAmount star_count:int53 nanostar_count:int32 = StarAmount; + + //@class StarSubscriptionType @description Describes type of subscription paid in Telegram Stars //@description Describes a subscription to a channel chat @@ -844,11 +850,70 @@ starSubscriptionPricing period:int32 star_count:int53 = StarSubscriptionPricing; starSubscription id:string chat_id:int53 expiration_date:int32 is_canceled:Bool is_expiring:Bool pricing:starSubscriptionPricing type:StarSubscriptionType = StarSubscription; //@description Represents a list of Telegram Star subscriptions -//@star_count The amount of owned Telegram Stars +//@star_amount The amount of owned Telegram Stars //@subscriptions List of subscriptions for Telegram Stars //@required_star_count The number of Telegram Stars required to buy to extend subscriptions expiring soon //@next_offset The offset for the next request. If empty, then there are no more results -starSubscriptions star_count:int53 subscriptions:vector required_star_count:int53 next_offset:string = StarSubscriptions; +starSubscriptions star_amount:starAmount subscriptions:vector required_star_count:int53 next_offset:string = StarSubscriptions; + + +//@class AffiliateProgramSortOrder @description Describes the order of the found affiliate programs + +//@description The affiliate programs must be sorted by the profitability +affiliateProgramSortOrderProfitability = AffiliateProgramSortOrder; + +//@description The affiliate programs must be sorted by creation date +affiliateProgramSortOrderCreationDate = AffiliateProgramSortOrder; + +//@description The affiliate programs must be sorted by the expected revenue +affiliateProgramSortOrderRevenue = AffiliateProgramSortOrder; + + +//@description Describes parameters of an affiliate program +//@commission_per_mille The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the program owner; +//-getOption("affiliate_program_commission_per_mille_min")-getOption("affiliate_program_commission_per_mille_max") +//@month_count Number of months the program will be active; 0-36. If 0, then the program is eternal +affiliateProgramParameters commission_per_mille:int32 month_count:int32 = AffiliateProgramParameters; + +//@description Contains information about an active affiliate program +//@parameters Parameters of the affiliate program +//@end_date Point in time (Unix timestamp) when the affiliate program will be closed; 0 if the affiliate program isn't scheduled to be closed. +//-If positive, then the program can't be connected using connectChatAffiliateProgram, but active connections will work until the date +//@daily_revenue_per_user_amount The amount of daily revenue per user in Telegram Stars of the bot that created the affiliate program +affiliateProgramInfo parameters:affiliateProgramParameters end_date:int32 daily_revenue_per_user_amount:starAmount = AffiliateProgramInfo; + +//@description Contains information about an affiliate that received commission from a Telegram Star transaction +//@commission_per_mille The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the program owner +//@affiliate_chat_id Identifier of the chat which received the commission +//@star_amount The amount of Telegram Stars that were received by the affiliate; can be negative for refunds +affiliateInfo commission_per_mille:int32 affiliate_chat_id:int53 star_amount:starAmount = AffiliateInfo; + +//@description Describes a found affiliate program +//@bot_user_id User identifier of the bot created the program +//@parameters Information about the affiliate program +foundAffiliateProgram bot_user_id:int53 parameters:affiliateProgramInfo = FoundAffiliateProgram; + +//@description Represents a list of found affiliate programs +//@total_count The total number of found affiliate programs +//@programs The list of affiliate programs +//@next_offset The offset for the next request. If empty, then there are no more results +foundAffiliatePrograms total_count:int32 programs:vector next_offset:string = FoundAffiliatePrograms; + +//@description Describes an affiliate program that was connected to a chat +//@url The link that can be used to refer users if the program is still active +//@bot_user_id User identifier of the bot created the program +//@parameters The parameters of the affiliate program +//@connection_date Point in time (Unix timestamp) when the affiliate program was connected +//@is_disconnected True, if the program was canceled by the bot, or disconnected by the chat owner and isn't available anymore +//@user_count The number of users that used the affiliate program +//@revenue_star_count The number of Telegram Stars that were earned by the affiliate program +chatAffiliateProgram url:string bot_user_id:int53 parameters:affiliateProgramParameters connection_date:int32 is_disconnected:Bool user_count:int64 revenue_star_count:int64 = ChatAffiliateProgram; + +//@description Represents a list of affiliate programs that were connected to a chat +//@total_count The total number of affiliate programs that were connected to the chat +//@programs The list of connected affiliate programs +//@next_offset The offset for the next request. If empty, then there are no more results +chatAffiliatePrograms total_count:int32 programs:vector next_offset:string = ChatAffiliatePrograms; //@description Contains information about a product that can be paid with invoice @@ -971,103 +1036,137 @@ starTransactionDirectionIncoming = StarTransactionDirection; starTransactionDirectionOutgoing = StarTransactionDirection; -//@class BotTransactionPurpose @description Describes purpose of a transaction with a bot +//@class StarTransactionType @description Describes type of transaction with Telegram Stars -//@description Paid media were bought @media The bought media if the transaction wasn't refunded @payload Bot-provided payload; for bots only -botTransactionPurposePaidMedia media:vector payload:string = BotTransactionPurpose; +//@description The transaction is a deposit of Telegram Stars from the Premium bot; for regular users only +starTransactionTypePremiumBotDeposit = StarTransactionType; -//@description User bought a product from the bot -//@product_info Information about the bought product; may be null if not applicable -//@invoice_payload Invoice payload; for bots only -botTransactionPurposeInvoicePayment product_info:productInfo invoice_payload:bytes = BotTransactionPurpose; +//@description The transaction is a deposit of Telegram Stars from App Store; for regular users only +starTransactionTypeAppStoreDeposit = StarTransactionType; -//@description User bought a subscription in a bot or a business account -//@period The number of seconds between consecutive Telegram Star debiting -//@product_info Information about the bought subscription; may be null if not applicable -//@invoice_payload Invoice payload; for bots only -botTransactionPurposeSubscription period:int32 product_info:productInfo invoice_payload:bytes = BotTransactionPurpose; +//@description The transaction is a deposit of Telegram Stars from Google Play; for regular users only +starTransactionTypeGooglePlayDeposit = StarTransactionType; +//@description The transaction is a deposit of Telegram Stars from Fragment; for regular users and bots only +starTransactionTypeFragmentDeposit = StarTransactionType; -//@class ChatTransactionPurpose @description Describes purpose of a transaction with a supergroup or a channel +//@description The transaction is a deposit of Telegram Stars by another user; for regular users only +//@user_id Identifier of the user that gifted Telegram Stars; 0 if the user was anonymous +//@sticker The sticker to be shown in the transaction information; may be null if unknown +starTransactionTypeUserDeposit user_id:int53 sticker:sticker = StarTransactionType; -//@description Paid media were bought +//@description The transaction is a deposit of Telegram Stars from a giveaway; for regular users only +//@chat_id Identifier of a supergroup or a channel chat that created the giveaway +//@giveaway_message_id Identifier of the message with the giveaway; can be 0 or an identifier of a deleted message +starTransactionTypeGiveawayDeposit chat_id:int53 giveaway_message_id:int53 = StarTransactionType; + +//@description The transaction is a withdrawal of earned Telegram Stars to Fragment; for bots and channel chats only @withdrawal_state State of the withdrawal; may be null for refunds from Fragment +starTransactionTypeFragmentWithdrawal withdrawal_state:RevenueWithdrawalState = StarTransactionType; + +//@description The transaction is a withdrawal of earned Telegram Stars to Telegram Ad platform; for bots and channel chats only +starTransactionTypeTelegramAdsWithdrawal = StarTransactionType; + +//@description The transaction is a payment for Telegram API usage; for bots only @request_count The number of billed requests +starTransactionTypeTelegramApiUsage request_count:int32 = StarTransactionType; + +//@description The transaction is a purchase of paid media from a bot or a business account by the current user; for regular users only +//@user_id Identifier of the bot or the business account user that sent the paid media +//@media The bought media if the transaction wasn't refunded +starTransactionTypeBotPaidMediaPurchase user_id:int53 media:vector = StarTransactionType; + +//@description The transaction is a sale of paid media by the bot or a business account managed by the bot; for bots only +//@user_id Identifier of the user that bought the media +//@media The bought media +//@payload Bot-provided payload +//@affiliate Information about the affiliate which received commission from the transaction; may be null if none +starTransactionTypeBotPaidMediaSale user_id:int53 media:vector payload:string affiliate:affiliateInfo = StarTransactionType; + +//@description The transaction is a purchase of paid media from a channel by the current user; for regular users only +//@chat_id Identifier of the channel chat that sent the paid media //@message_id Identifier of the corresponding message with paid media; can be 0 or an identifier of a deleted message //@media The bought media if the transaction wasn't refunded -chatTransactionPurposePaidMedia message_id:int53 media:vector = ChatTransactionPurpose; +starTransactionTypeChannelPaidMediaPurchase chat_id:int53 message_id:int53 media:vector = StarTransactionType; -//@description User joined the channel and subscribed to regular payments in Telegram Stars -//@period The number of seconds between consecutive Telegram Star debiting -chatTransactionPurposeJoin period:int32 = ChatTransactionPurpose; +//@description The transaction is a sale of paid media by the channel chat; for channel chats only +//@user_id Identifier of the user that bought the media +//@message_id Identifier of the corresponding message with paid media; can be 0 or an identifier of a deleted message +//@media The bought media +starTransactionTypeChannelPaidMediaSale user_id:int53 message_id:int53 media:vector = StarTransactionType; -//@description User paid for a reaction +//@description The transaction is a purchase of a product from a bot or a business account by the current user; for regular users only +//@user_id Identifier of the bot or the business account user that created the invoice +//@product_info Information about the bought product +starTransactionTypeBotInvoicePurchase user_id:int53 product_info:productInfo = StarTransactionType; + +//@description The transaction is a sale of a product by the bot; for bots only +//@user_id Identifier of the user that bought the product +//@product_info Information about the bought product +//@invoice_payload Invoice payload +//@affiliate Information about the affiliate which received commission from the transaction; may be null if none +starTransactionTypeBotInvoiceSale user_id:int53 product_info:productInfo invoice_payload:bytes affiliate:affiliateInfo = StarTransactionType; + +//@description The transaction is a purchase of a subscription from a bot or a business account by the current user; for regular users only +//@user_id Identifier of the bot or the business account user that created the subscription link +//@subscription_period The number of seconds between consecutive Telegram Star debitings +//@product_info Information about the bought subscription +starTransactionTypeBotSubscriptionPurchase user_id:int53 subscription_period:int32 product_info:productInfo = StarTransactionType; + +//@description The transaction is a sale of a subscription by the bot; for bots only +//@user_id Identifier of the user that bought the subscription +//@subscription_period The number of seconds between consecutive Telegram Star debitings +//@product_info Information about the bought subscription +//@invoice_payload Invoice payload +//@affiliate Information about the affiliate which received commission from the transaction; may be null if none +starTransactionTypeBotSubscriptionSale user_id:int53 subscription_period:int32 product_info:productInfo invoice_payload:bytes affiliate:affiliateInfo = StarTransactionType; + +//@description The transaction is a purchase of a subscription to a channel chat by the current user; for regular users only +//@chat_id Identifier of the channel chat that created the subscription +//@subscription_period The number of seconds between consecutive Telegram Star debitings +starTransactionTypeChannelSubscriptionPurchase chat_id:int53 subscription_period:int32 = StarTransactionType; + +//@description The transaction is a sale of a subscription by the channel chat; for channel chats only +//@user_id Identifier of the user that bought the subscription +//@subscription_period The number of seconds between consecutive Telegram Star debitings +starTransactionTypeChannelSubscriptionSale user_id:int53 subscription_period:int32 = StarTransactionType; + +//@description The transaction is a purchase of a gift to another user; for regular users and bots only @user_id Identifier of the user that received the gift @gift The gift +starTransactionTypeGiftPurchase user_id:int53 gift:gift = StarTransactionType; + +//@description The transaction is a sale of a gift received from another user or bot; for regular users only @user_id Identifier of the user that sent the gift @gift The gift +starTransactionTypeGiftSale user_id:int53 gift:gift = StarTransactionType; + +//@description The transaction is a sending of a paid reaction to a message in a channel chat by the current user; for regular users only +//@chat_id Identifier of the channel chat //@message_id Identifier of the reacted message; can be 0 or an identifier of a deleted message -chatTransactionPurposeReaction message_id:int53 = ChatTransactionPurpose; +starTransactionTypeChannelPaidReactionSend chat_id:int53 message_id:int53 = StarTransactionType; -//@description User received Telegram Stars from a giveaway @giveaway_message_id Identifier of the message with giveaway; can be 0 or an identifier of a deleted message -chatTransactionPurposeGiveaway giveaway_message_id:int53 = ChatTransactionPurpose; +//@description The transaction is a receiving of a paid reaction to a message by the channel chat; for channel chats only +//@user_id Identifier of the user that added the paid reaction +//@message_id Identifier of the reacted message; can be 0 or an identifier of a deleted message +starTransactionTypeChannelPaidReactionReceive user_id:int53 message_id:int53 = StarTransactionType; +//@description The transaction is a receiving of a commission from an affiliate program; for regular users, bots and channel chats only +//@chat_id Identifier of the chat that created the affiliate program +//@commission_per_mille The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the program owner +starTransactionTypeAffiliateProgramCommission chat_id:int53 commission_per_mille:int32 = StarTransactionType; -//@class UserTransactionPurpose @description Describes purpose of a transaction with a user - -//@description A user gifted Telegram Stars @sticker A sticker to be shown in the transaction information; may be null if unknown -userTransactionPurposeGiftedStars sticker:sticker = UserTransactionPurpose; - -//@description The user sold a gift received from another user or bot @gift The gift -userTransactionPurposeGiftSell gift:gift = UserTransactionPurpose; - -//@description The user or the bot sent a gift to a user @gift The gift -userTransactionPurposeGiftSend gift:gift = UserTransactionPurpose; - - -//@class StarTransactionPartner @description Describes source or recipient of a transaction with Telegram Stars - -//@description The transaction is a transaction with Telegram through a bot -starTransactionPartnerTelegram = StarTransactionPartner; - -//@description The transaction is a transaction with App Store -starTransactionPartnerAppStore = StarTransactionPartner; - -//@description The transaction is a transaction with Google Play -starTransactionPartnerGooglePlay = StarTransactionPartner; - -//@description The transaction is a transaction with Fragment @withdrawal_state State of the withdrawal; may be null for refunds from Fragment or for Telegram Stars bought on Fragment -starTransactionPartnerFragment withdrawal_state:RevenueWithdrawalState = StarTransactionPartner; - -//@description The transaction is a transaction with Telegram Ad platform -starTransactionPartnerTelegramAds = StarTransactionPartner; - -//@description The transaction is a transaction with Telegram for API usage @request_count The number of billed requests -starTransactionPartnerTelegramApi request_count:int32 = StarTransactionPartner; - -//@description The transaction is a transaction with a bot @user_id Identifier of the bot @purpose Purpose of the transaction -starTransactionPartnerBot user_id:int53 purpose:BotTransactionPurpose = StarTransactionPartner; - -//@description The transaction is a transaction with a business account @user_id Identifier of the business account user @media The bought media if the transaction wasn't refunded -starTransactionPartnerBusiness user_id:int53 media:vector = StarTransactionPartner; - -//@description The transaction is a transaction with a supergroup or a channel chat @chat_id Identifier of the chat @purpose Purpose of the transaction -starTransactionPartnerChat chat_id:int53 purpose:ChatTransactionPurpose = StarTransactionPartner; - -//@description The transaction is a transaction with another user @user_id Identifier of the user; 0 if the user was anonymous @purpose Purpose of the transaction -starTransactionPartnerUser user_id:int53 purpose:UserTransactionPurpose = StarTransactionPartner; - -//@description The transaction is a transaction with unknown partner -starTransactionPartnerUnsupported = StarTransactionPartner; +//@description The transaction is a transaction of an unsupported type +starTransactionTypeUnsupported = StarTransactionType; //@description Represents a transaction changing the amount of owned Telegram Stars //@id Unique identifier of the transaction -//@star_count The amount of added owned Telegram Stars; negative for outgoing transactions +//@star_amount The amount of added owned Telegram Stars; negative for outgoing transactions //@is_refund True, if the transaction is a refund of a previous transaction //@date Point in time (Unix timestamp) when the transaction was completed -//@partner Source of the incoming transaction, or its recipient for outgoing transactions -starTransaction id:string star_count:int53 is_refund:Bool date:int32 partner:StarTransactionPartner = StarTransaction; +//@type Type of the transaction +starTransaction id:string star_amount:starAmount is_refund:Bool date:int32 type:StarTransactionType = StarTransaction; //@description Represents a list of Telegram Star transactions -//@star_count The amount of owned Telegram Stars +//@star_amount The amount of owned Telegram Stars //@transactions List of transactions with Telegram Stars //@next_offset The offset for the next request. If empty, then there are no more results -starTransactions star_count:int53 transactions:vector next_offset:string = StarTransactions; +starTransactions star_amount:starAmount transactions:vector next_offset:string = StarTransactions; //@class GiveawayParticipantStatus @description Contains information about status of a user in a giveaway @@ -1165,11 +1264,11 @@ usernames active_usernames:vector disabled_usernames:vector edit //@phone_number Phone number of the user //@status Current online status of the user //@profile_photo Profile photo of the user; may be null -//@accent_color_id Identifier of the accent color for name, and backgrounds of profile photo, reply header, and link preview. For Telegram Premium users only -//@background_custom_emoji_id Identifier of a custom emoji to be shown on the reply header and link preview background; 0 if none. For Telegram Premium users only -//@profile_accent_color_id Identifier of the accent color for the user's profile; -1 if none. For Telegram Premium users only -//@profile_background_custom_emoji_id Identifier of a custom emoji to be shown on the background of the user's profile; 0 if none. For Telegram Premium users only -//@emoji_status Emoji status to be shown instead of the default Telegram Premium badge; may be null. For Telegram Premium users only +//@accent_color_id Identifier of the accent color for name, and backgrounds of profile photo, reply header, and link preview +//@background_custom_emoji_id Identifier of a custom emoji to be shown on the reply header and link preview background; 0 if none +//@profile_accent_color_id Identifier of the accent color for the user's profile; -1 if none +//@profile_background_custom_emoji_id Identifier of a custom emoji to be shown on the background of the user's profile; 0 if none +//@emoji_status Emoji status to be shown instead of the default Telegram Premium badge; may be null //@is_contact The user is a contact of the current user //@is_mutual_contact The user is a contact of the current user and the current user is a contact of the user //@is_close_friend The user is a close friend of the current user; implies that the user is a contact @@ -1199,6 +1298,7 @@ user id:int53 access_hash:int64 first_name:string last_name:string usernames:use //@privacy_policy_url The HTTP link to the privacy policy of the bot. If empty, then /privacy command must be used if supported by the bot. If the command isn't supported, then https://telegram.org/privacy-tpa must be opened //@default_group_administrator_rights Default administrator rights for adding the bot to basic group and supergroup chats; may be null //@default_channel_administrator_rights Default administrator rights for adding the bot to channels; may be null +//@affiliate_program Information about the affiliate program of the bot; may be null if none //@web_app_background_light_color Default light background color for bot Web Apps; -1 if not specified //@web_app_background_dark_color Default dark background color for bot Web Apps; -1 if not specified //@web_app_header_light_color Default light header color for bot Web Apps; -1 if not specified @@ -1210,7 +1310,7 @@ user id:int53 access_hash:int64 first_name:string last_name:string usernames:use //@edit_description_link The internal link, which can be used to edit bot description; may be null //@edit_description_media_link The internal link, which can be used to edit the photo or animation shown in the chat with the bot if the chat is empty; may be null //@edit_settings_link The internal link, which can be used to edit bot settings; may be null -botInfo short_description:string description:string photo:photo animation:animation menu_button:botMenuButton commands:vector privacy_policy_url:string default_group_administrator_rights:chatAdministratorRights default_channel_administrator_rights:chatAdministratorRights web_app_background_light_color:int32 web_app_background_dark_color:int32 web_app_header_light_color:int32 web_app_header_dark_color:int32 can_get_revenue_statistics:Bool can_manage_emoji_status:Bool has_media_previews:Bool edit_commands_link:InternalLinkType edit_description_link:InternalLinkType edit_description_media_link:InternalLinkType edit_settings_link:InternalLinkType = BotInfo; +botInfo short_description:string description:string photo:photo animation:animation menu_button:botMenuButton commands:vector privacy_policy_url:string default_group_administrator_rights:chatAdministratorRights default_channel_administrator_rights:chatAdministratorRights affiliate_program:affiliateProgramInfo web_app_background_light_color:int32 web_app_background_dark_color:int32 web_app_header_light_color:int32 web_app_header_dark_color:int32 can_get_revenue_statistics:Bool can_manage_emoji_status:Bool has_media_previews:Bool edit_commands_link:InternalLinkType edit_description_link:InternalLinkType edit_description_media_link:InternalLinkType edit_settings_link:InternalLinkType = BotInfo; //@description Contains full information about a user //@personal_photo User profile photo set by the current user for the contact; may be null. If null and user.profile_photo is null, then the photo is empty; otherwise, it is unknown. @@ -5168,7 +5268,7 @@ targetChatTypes allow_user_chats:Bool allow_bot_chats:Bool allow_group_chats:Boo //@class TargetChat @description Describes the target chat to be opened -//@description The currently opened chat needs to be kept +//@description The currently opened chat and forum topic must be kept targetChatCurrent = TargetChat; //@description The chat needs to be chosen by the user among chats of the specified types @types Allowed types for the chat @@ -6815,6 +6915,11 @@ internalLinkTypeBuyStars star_count:int53 purpose:string = InternalLinkType; //@description The link is a link to the change phone number section of the application internalLinkTypeChangePhoneNumber = InternalLinkType; +//@description The link is an affiliate program link. Call searchChatAffiliateProgram with the given username and referrer to process the link +//@username Username to be passed to searchChatAffiliateProgram +//@referrer Referrer to be passed to searchChatAffiliateProgram +internalLinkTypeChatAffiliateProgram username:string referrer:string = InternalLinkType; + //@description The link is a link to boost a Telegram chat. Call getChatBoostLinkInfo with the given URL to process the link. //-If the chat is found, then call getChatBoostStatus and getAvailableChatBoostSlots to get the current boost status and check whether the chat can be boosted. //-If the user wants to boost the chat and the chat can be boosted, then call boostChat @@ -7060,6 +7165,18 @@ fileTypeSecretThumbnail = FileType; //@description The file is a file from Secure storage used for storing Telegram Passport files fileTypeSecure = FileType; +//@description The file is a self-destructing photo in a private chat +fileTypeSelfDestructingPhoto = FileType; + +//@description The file is a self-destructing video in a private chat +fileTypeSelfDestructingVideo = FileType; + +//@description The file is a self-destructing video note in a private chat +fileTypeSelfDestructingVideoNote = FileType; + +//@description The file is a self-destructing voice note in a private chat +fileTypeSelfDestructingVoiceNote = FileType; + //@description The file is a sticker fileTypeSticker = FileType; @@ -7558,12 +7675,12 @@ chatRevenueTransactions total_count:int32 transactions:vector = Update; //@description The list of supported accent colors has changed //@colors Information about supported colors; colors with identifiers 0 (red), 1 (orange), 2 (purple/violet), 3 (green), 4 (cyan), 5 (blue), 6 (pink) must always be supported //-and aren't included in the list. The exact colors for the accent colors with identifiers 0-6 must be taken from the app theme -//@available_accent_color_ids The list of accent color identifiers, which can be set through setAccentColor and setChatAccentColor. The colors must be shown in the specififed order +//@available_accent_color_ids The list of accent color identifiers, which can be set through setAccentColor and setChatAccentColor. The colors must be shown in the specified order updateAccentColors colors:vector available_accent_color_ids:vector = Update; //@description The list of supported accent colors for user profiles has changed //@colors Information about supported colors -//@available_accent_color_ids The list of accent color identifiers, which can be set through setProfileAccentColor and setChatProfileAccentColor. The colors must be shown in the specififed order +//@available_accent_color_ids The list of accent color identifiers, which can be set through setProfileAccentColor and setChatProfileAccentColor. The colors must be shown in the specified order updateProfileAccentColors colors:vector available_accent_color_ids:vector = Update; //@description Some language pack strings have been updated @localization_target Localization target to which the language pack belongs @language_pack_id Identifier of the updated language pack @strings List of changed language pack strings; empty if all strings have changed @@ -8097,8 +8214,8 @@ updateSavedMessagesTags saved_messages_topic_id:int53 tags:savedMessagesTags = U //@messages The list of messages with active live locations updateActiveLiveLocationMessages messages:vector = Update; -//@description The number of Telegram Stars owned by the current user has changed @star_count The new number of Telegram Stars owned -updateOwnedStarCount star_count:int53 = Update; +//@description The number of Telegram Stars owned by the current user has changed @star_amount The new amount of owned Telegram Stars +updateOwnedStarCount star_amount:starAmount = Update; //@description The revenue earned from sponsored messages in a chat has changed. If chat revenue screen is opened, then getChatRevenueTransactions may be called to fetch new transactions //@chat_id Identifier of the chat @@ -9545,7 +9662,7 @@ answerInlineQuery inline_query_id:int64 is_personal:Bool button:inlineQueryResul //@chat_types Types of the chats to which the message can be sent savePreparedInlineMessage user_id:int53 result:InputInlineQueryResult chat_types:targetChatTypes = PreparedInlineMessageId; -//@description Saves an inline message to be sent by the given user; for bots only +//@description Saves an inline message to be sent by the given user //@bot_user_id Identifier of the bot that created the message //@prepared_message_id Identifier of the prepared message getPreparedInlineMessage bot_user_id:int53 prepared_message_id:string = PreparedInlineMessage; @@ -10120,7 +10237,7 @@ editStoryCover story_sender_chat_id:int53 story_id:int32 cover_frame_timestamp:d //@description Changes privacy settings of a story. The method can be called only for stories posted on behalf of the current user and if story.can_be_edited == true //@story_id Identifier of the story -//@privacy_settings The new privacy settigs for the story +//@privacy_settings The new privacy settings for the story setStoryPrivacySettings story_id:int32 privacy_settings:StoryPrivacySettings = Ok; //@description Toggles whether a story is accessible after expiration. Can be called only if story.can_toggle_is_posted_to_chat_page == true @@ -10548,7 +10665,7 @@ setVideoChatDefaultParticipant chat_id:int53 default_participant_id:MessageSende //@chat_id Identifier of a chat in which the video chat will be created //@title Group call title; if empty, chat title will be used //@start_date Point in time (Unix timestamp) when the group call is expected to be started by an administrator; 0 to start the video chat immediately. The date must be at least 10 seconds and at most 8 days in the future -//@is_rtmp_stream Pass true to create an RTMP stream instead of an ordinary video chat; requires owner privileges +//@is_rtmp_stream Pass true to create an RTMP stream instead of an ordinary video chat createVideoChat chat_id:int53 title:string start_date:int32 is_rtmp_stream:Bool = GroupCallId; //@description Returns RTMP URL for streaming to the chat; requires can_manage_video_chats administrator right @chat_id Chat identifier @@ -10778,9 +10895,12 @@ getAllStickerEmojis sticker_type:StickerType query:string chat_id:int53 return_o //@description Searches for stickers from public sticker sets that correspond to any of the given emoji //@sticker_type Type of the stickers to return -//@emojis Space-separated list of emojis to search for; must be non-empty +//@emojis Space-separated list of emojis to search for +//@query Query to search for; may be empty to search for emoji only +//@input_language_codes List of possible IETF language tags of the user's input language; may be empty if unknown +//@offset The offset from which to return the stickers; must be non-negative //@limit The maximum number of stickers to be returned; 0-100 -searchStickers sticker_type:StickerType emojis:string limit:int32 = Stickers; +searchStickers sticker_type:StickerType emojis:string query:string input_language_codes:vector offset:int32 limit:int32 = Stickers; //@description Returns greeting stickers from regular sticker sets that can be used for the start page of other users getGreetingStickers = Stickers; @@ -10910,6 +11030,9 @@ removeSavedAnimation animation:InputFile = Ok; //@description Returns up to 20 recently used inline bots in the order of their last usage getRecentInlineBots = Users; +//@description Returns the list of bots owned by the current user +getOwnedBots = Users; + //@description Searches for recently used hashtags by their prefix @prefix Hashtag prefix to search for @limit The maximum number of hashtags to be returned searchHashtags prefix:string limit:int32 = Hashtags; @@ -11908,6 +12031,46 @@ editUserStarSubscription user_id:int53 telegram_payment_charge_id:string is_canc reuseStarSubscription subscription_id:string = Ok; +//@description Changes affiliate program for a bot +//@chat_id Identifier of the chat with an owned bot for which affiliate program is changed +//@parameters Parameters of the affiliate program; pass null to close the currently active program. If there is an active program, then commission and program duration can only be increased. +//-If the active program is scheduled to be closed, then it can't be changed anymore +setChatAffiliateProgram chat_id:int53 parameters:affiliateProgramParameters = Ok; + +//@description Searches a chat with an affiliate program. Returns the chat if found and the program is active +//@username Username of the chat +//@referrer The referrer from an internalLinkTypeChatAffiliateProgram link +searchChatAffiliateProgram username:string referrer:string = Chat; + +//@description Searches affiliate programs that can be applied to the given chat +//@chat_id Identifier of the chat for which affiliate programs are searched for. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right +//@sort_order Sort order for the results +//@offset Offset of the first affiliate program to return as received from the previous request; use empty string to get the first chunk of results +//@limit The maximum number of affiliate programs to return +searchAffiliatePrograms chat_id:int53 sort_order:AffiliateProgramSortOrder offset:string limit:int32 = FoundAffiliatePrograms; + +//@description Connects an affiliate program to the given chat. Returns information about the connected affiliate program +//@chat_id Identifier of the chat to which the affiliate program will be connected. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right +//@bot_user_id Identifier of the bot, which affiliate program is connected +connectChatAffiliateProgram chat_id:int53 bot_user_id:int53 = ChatAffiliateProgram; + +//@description Disconnects an affiliate program from the given chat and immediately deactivates its referral link. Returns updated information about the disconnected affiliate program +//@chat_id Identifier of the chat for which the affiliate program is connected +//@url The referral link of the affiliate program +disconnectChatAffiliateProgram chat_id:int53 url:string = ChatAffiliateProgram; + +//@description Returns an affiliate program that were connected to the given chat by identifier of the bot that created the program +//@chat_id Identifier of the chat for which the affiliate program was connected. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right +//@bot_user_id Identifier of the bot that created the program +getChatAffiliateProgram chat_id:int53 bot_user_id:int53 = ChatAffiliateProgram; + +//@description Returns affiliate programs that were connected to the given chat +//@chat_id Identifier of the chat for which the affiliate programs were connected. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right +//@offset Offset of the first affiliate program to return as received from the previous request; use empty string to get the first chunk of results +//@limit The maximum number of affiliate programs to return +getChatAffiliatePrograms chat_id:int53 offset:string limit:int32 = ChatAffiliatePrograms; + + //@description Returns information about features, available to Business users @source Source of the request; pass null if the method is called from settings or some non-standard source getBusinessFeatures source:BusinessFeature = BusinessFeatures; From 626ffe1a7b529e3094efd74794c10bf241fe020d Mon Sep 17 00:00:00 2001 From: c0re100 Date: Fri, 3 Jan 2025 06:02:55 +0800 Subject: [PATCH 32/54] Update to TDLib 1.8.42 --- client/function.go | 290 ++++++++++-- client/type.go | 1004 +++++++++++++++++++++++++++++++++++++---- client/unmarshaler.go | 431 +++++++++++++++++- data/td_api.tl | 324 ++++++++++--- 4 files changed, 1854 insertions(+), 195 deletions(-) diff --git a/client/function.go b/client/function.go index 5b97dd5..c8ffa78 100755 --- a/client/function.go +++ b/client/function.go @@ -2696,8 +2696,6 @@ func (client *Client) SearchChatMessages(req *SearchChatMessagesRequest) (*Found type SearchMessagesRequest struct { // Chat list in which to search messages; pass null to search in all chats regardless of their chat list. Only Main and Archive chat lists are supported ChatList ChatList `json:"chat_list"` - // Pass true to search only for messages in channels - OnlyInChannels bool `json:"only_in_channels"` // Query to search for Query string `json:"query"` // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results @@ -2706,6 +2704,8 @@ type SearchMessagesRequest struct { Limit int32 `json:"limit"` // Additional filter for messages to search; pass null to search for all messages. Filters searchMessagesFilterMention, searchMessagesFilterUnreadMention, searchMessagesFilterUnreadReaction, searchMessagesFilterFailedToSend, and searchMessagesFilterPinned are unsupported in this function Filter SearchMessagesFilter `json:"filter"` + // Additional filter for type of the chat of the searched messages; pass null to search for messages in all chats + ChatTypeFilter SearchMessagesChatTypeFilter `json:"chat_type_filter"` // If not 0, the minimum date of the messages to return MinDate int32 `json:"min_date"` // If not 0, the maximum date of the messages to return @@ -2720,11 +2720,11 @@ func (client *Client) SearchMessages(req *SearchMessagesRequest) (*FoundMessages }, Data: map[string]interface{}{ "chat_list": req.ChatList, - "only_in_channels": req.OnlyInChannels, "query": req.Query, "offset": req.Offset, "limit": req.Limit, "filter": req.Filter, + "chat_type_filter": req.ChatTypeFilter, "min_date": req.MinDate, "max_date": req.MaxDate, }, @@ -13120,6 +13120,8 @@ type CreateCallRequest struct { Protocol *CallProtocol `json:"protocol"` // Pass true to create a video call IsVideo bool `json:"is_video"` + // Identifier of the group call to which the user will be added after exchanging private key via the call; pass 0 if none; currently, ignored + GroupCallId int32 `json:"group_call_id"` } // Creates a new call @@ -13132,6 +13134,7 @@ func (client *Client) CreateCall(req *CreateCallRequest) (*CallId, error) { "user_id": req.UserId, "protocol": req.Protocol, "is_video": req.IsVideo, + "group_call_id": req.GroupCallId, }, }) if err != nil { @@ -13424,6 +13427,32 @@ func (client *Client) CreateVideoChat(req *CreateVideoChatRequest) (*GroupCallId return UnmarshalGroupCallId(result.Data) } +type CreateGroupCallRequest struct { + // Call identifier + CallId int32 `json:"call_id"` +} + +// Creates a group call from a one-to-one call +func (client *Client) CreateGroupCall(req *CreateGroupCallRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "createGroupCall", + }, + Data: map[string]interface{}{ + "call_id": req.CallId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type GetVideoChatRtmpUrlRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -17596,6 +17625,67 @@ func (client *Client) GetBotInfoShortDescription(req *GetBotInfoShortDescription return UnmarshalText(result.Data) } +type SetMessageSenderBotVerificationRequest struct { + // Identifier of the owned bot, which will verify the user or the chat + BotUserId int64 `json:"bot_user_id"` + // Identifier of the user or the supergroup or channel chat, which will be verified by the bot + VerifiedId MessageSender `json:"verified_id"` + // Custom description of verification reason; 0-getOption("bot_verification_custom_description_length_max"). If empty, then "was verified by organization "organization_name"" will be used as description. Can be specified only if the bot is allowed to provide custom description + CustomDescription string `json:"custom_description"` +} + +// Changes the verification status of a user or a chat by an owned bot +func (client *Client) SetMessageSenderBotVerification(req *SetMessageSenderBotVerificationRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setMessageSenderBotVerification", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "verified_id": req.VerifiedId, + "custom_description": req.CustomDescription, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type RemoveMessageSenderBotVerificationRequest struct { + // Identifier of the owned bot, which verified the user or the chat + BotUserId int64 `json:"bot_user_id"` + // Identifier of the user or the supergroup or channel chat, which verification is removed + VerifiedId MessageSender `json:"verified_id"` +} + +// Removes the verification status of a user or a chat by an owned bot +func (client *Client) RemoveMessageSenderBotVerification(req *RemoveMessageSenderBotVerificationRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removeMessageSenderBotVerification", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "verified_id": req.VerifiedId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + // Returns all active sessions of the current user func (client *Client) GetActiveSessions() (*Sessions, error) { result, err := client.Send(Request{ @@ -18693,6 +18783,8 @@ type SendGiftRequest struct { Text *FormattedText `json:"text"` // Pass true to show the current user as sender and gift text only to the gift receiver; otherwise, everyone will be able to see them IsPrivate bool `json:"is_private"` + // Pass true to additionally pay for the gift upgrade and allow the receiver to upgrade it for free + PayForUpgrade bool `json:"pay_for_upgrade"` } // Sends a gift to another user. May return an error with a message "STARGIFT_USAGE_LIMITED" if the gift was sold out @@ -18706,6 +18798,7 @@ func (client *Client) SendGift(req *SendGiftRequest) (*Ok, error) { "user_id": req.UserId, "text": req.Text, "is_private": req.IsPrivate, + "pay_for_upgrade": req.PayForUpgrade, }, }) if err != nil { @@ -18780,6 +18873,99 @@ func (client *Client) ToggleGiftIsSaved(req *ToggleGiftIsSavedRequest) (*Ok, err return UnmarshalOk(result.Data) } +type GetGiftUpgradePreviewRequest struct { + // Identifier of the gift + GiftId JsonInt64 `json:"gift_id"` +} + +// Returns examples of possible upgraded gifts for a regular gift +func (client *Client) GetGiftUpgradePreview(req *GetGiftUpgradePreviewRequest) (*GiftUpgradePreview, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getGiftUpgradePreview", + }, + Data: map[string]interface{}{ + "gift_id": req.GiftId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGiftUpgradePreview(result.Data) +} + +type UpgradeGiftRequest struct { + // Identifier of the user that sent the gift + SenderUserId int64 `json:"sender_user_id"` + // Identifier of the message with the gift in the chat with the user + MessageId int64 `json:"message_id"` + // Pass true to keep the original gift text, sender and receiver in the upgraded gift + KeepOriginalDetails bool `json:"keep_original_details"` +} + +// Upgrades a gift received by the current user. Unless the gift has prepaid_upgrade_star_count > 0, the user must pay gift.upgrade_star_count Telegram Stars for the upgrade +func (client *Client) UpgradeGift(req *UpgradeGiftRequest) (*UpgradeGiftResult, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "upgradeGift", + }, + Data: map[string]interface{}{ + "sender_user_id": req.SenderUserId, + "message_id": req.MessageId, + "keep_original_details": req.KeepOriginalDetails, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalUpgradeGiftResult(result.Data) +} + +type TransferGiftRequest struct { + // Identifier of the user that sent the gift + SenderUserId int64 `json:"sender_user_id"` + // Identifier of the message with the upgraded gift in the chat with the user + MessageId int64 `json:"message_id"` + // Identifier of the user that will receive the gift + ReceiverUserId int64 `json:"receiver_user_id"` + // The amount of Telegram Stars required for the transfer + StarCount int64 `json:"star_count"` +} + +// Sends a gift upgraded by the current user to another user +func (client *Client) TransferGift(req *TransferGiftRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "transferGift", + }, + Data: map[string]interface{}{ + "sender_user_id": req.SenderUserId, + "message_id": req.MessageId, + "receiver_user_id": req.ReceiverUserId, + "star_count": req.StarCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type GetUserGiftsRequest struct { // Identifier of the user UserId int64 `json:"user_id"` @@ -18812,6 +18998,32 @@ func (client *Client) GetUserGifts(req *GetUserGiftsRequest) (*UserGifts, error) return UnmarshalUserGifts(result.Data) } +type GetUserGiftRequest struct { + // Identifier of the message with the gift + MessageId int64 `json:"message_id"` +} + +// Returns information about a gift received or sent by the current user +func (client *Client) GetUserGift(req *GetUserGiftRequest) (*UserGift, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getUserGift", + }, + Data: map[string]interface{}{ + "message_id": req.MessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalUserGift(result.Data) +} + type CreateInvoiceLinkRequest struct { // Unique identifier of business connection on behalf of which to send the request BusinessConnectionId string `json:"business_connection_id"` @@ -22320,8 +22532,8 @@ func (client *Client) SearchChatAffiliateProgram(req *SearchChatAffiliateProgram } type SearchAffiliateProgramsRequest struct { - // Identifier of the chat for which affiliate programs are searched for. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right - ChatId int64 `json:"chat_id"` + // The affiliate for which affiliate programs are searched for + Affiliate AffiliateType `json:"affiliate"` // Sort order for the results SortOrder AffiliateProgramSortOrder `json:"sort_order"` // Offset of the first affiliate program to return as received from the previous request; use empty string to get the first chunk of results @@ -22330,14 +22542,14 @@ type SearchAffiliateProgramsRequest struct { Limit int32 `json:"limit"` } -// Searches affiliate programs that can be applied to the given chat +// Searches affiliate programs that can be connected to the given affiliate func (client *Client) SearchAffiliatePrograms(req *SearchAffiliateProgramsRequest) (*FoundAffiliatePrograms, error) { result, err := client.Send(Request{ meta: meta{ Type: "searchAffiliatePrograms", }, Data: map[string]interface{}{ - "chat_id": req.ChatId, + "affiliate": req.Affiliate, "sort_order": req.SortOrder, "offset": req.Offset, "limit": req.Limit, @@ -22354,21 +22566,21 @@ func (client *Client) SearchAffiliatePrograms(req *SearchAffiliateProgramsReques return UnmarshalFoundAffiliatePrograms(result.Data) } -type ConnectChatAffiliateProgramRequest struct { - // Identifier of the chat to which the affiliate program will be connected. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right - ChatId int64 `json:"chat_id"` +type ConnectAffiliateProgramRequest struct { + // The affiliate to which the affiliate program will be connected + Affiliate AffiliateType `json:"affiliate"` // Identifier of the bot, which affiliate program is connected BotUserId int64 `json:"bot_user_id"` } -// Connects an affiliate program to the given chat. Returns information about the connected affiliate program -func (client *Client) ConnectChatAffiliateProgram(req *ConnectChatAffiliateProgramRequest) (*ChatAffiliateProgram, error) { +// Connects an affiliate program to the given affiliate. Returns information about the connected affiliate program +func (client *Client) ConnectAffiliateProgram(req *ConnectAffiliateProgramRequest) (*ConnectedAffiliateProgram, error) { result, err := client.Send(Request{ meta: meta{ - Type: "connectChatAffiliateProgram", + Type: "connectAffiliateProgram", }, Data: map[string]interface{}{ - "chat_id": req.ChatId, + "affiliate": req.Affiliate, "bot_user_id": req.BotUserId, }, }) @@ -22380,24 +22592,24 @@ func (client *Client) ConnectChatAffiliateProgram(req *ConnectChatAffiliateProgr return nil, buildResponseError(result.Data) } - return UnmarshalChatAffiliateProgram(result.Data) + return UnmarshalConnectedAffiliateProgram(result.Data) } -type DisconnectChatAffiliateProgramRequest struct { - // Identifier of the chat for which the affiliate program is connected - ChatId int64 `json:"chat_id"` +type DisconnectAffiliateProgramRequest struct { + // The affiliate to which the affiliate program is connected + Affiliate AffiliateType `json:"affiliate"` // The referral link of the affiliate program Url string `json:"url"` } -// Disconnects an affiliate program from the given chat and immediately deactivates its referral link. Returns updated information about the disconnected affiliate program -func (client *Client) DisconnectChatAffiliateProgram(req *DisconnectChatAffiliateProgramRequest) (*ChatAffiliateProgram, error) { +// Disconnects an affiliate program from the given affiliate and immediately deactivates its referral link. Returns updated information about the disconnected affiliate program +func (client *Client) DisconnectAffiliateProgram(req *DisconnectAffiliateProgramRequest) (*ConnectedAffiliateProgram, error) { result, err := client.Send(Request{ meta: meta{ - Type: "disconnectChatAffiliateProgram", + Type: "disconnectAffiliateProgram", }, Data: map[string]interface{}{ - "chat_id": req.ChatId, + "affiliate": req.Affiliate, "url": req.Url, }, }) @@ -22409,24 +22621,24 @@ func (client *Client) DisconnectChatAffiliateProgram(req *DisconnectChatAffiliat return nil, buildResponseError(result.Data) } - return UnmarshalChatAffiliateProgram(result.Data) + return UnmarshalConnectedAffiliateProgram(result.Data) } -type GetChatAffiliateProgramRequest struct { - // Identifier of the chat for which the affiliate program was connected. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right - ChatId int64 `json:"chat_id"` +type GetConnectedAffiliateProgramRequest struct { + // The affiliate to which the affiliate program will be connected + Affiliate AffiliateType `json:"affiliate"` // Identifier of the bot that created the program BotUserId int64 `json:"bot_user_id"` } -// Returns an affiliate program that were connected to the given chat by identifier of the bot that created the program -func (client *Client) GetChatAffiliateProgram(req *GetChatAffiliateProgramRequest) (*ChatAffiliateProgram, error) { +// Returns an affiliate program that were connected to the given affiliate by identifier of the bot that created the program +func (client *Client) GetConnectedAffiliateProgram(req *GetConnectedAffiliateProgramRequest) (*ConnectedAffiliateProgram, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getChatAffiliateProgram", + Type: "getConnectedAffiliateProgram", }, Data: map[string]interface{}{ - "chat_id": req.ChatId, + "affiliate": req.Affiliate, "bot_user_id": req.BotUserId, }, }) @@ -22438,26 +22650,26 @@ func (client *Client) GetChatAffiliateProgram(req *GetChatAffiliateProgramReques return nil, buildResponseError(result.Data) } - return UnmarshalChatAffiliateProgram(result.Data) + return UnmarshalConnectedAffiliateProgram(result.Data) } -type GetChatAffiliateProgramsRequest struct { - // Identifier of the chat for which the affiliate programs were connected. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right - ChatId int64 `json:"chat_id"` +type GetConnectedAffiliateProgramsRequest struct { + // The affiliate to which the affiliate program were connected + Affiliate AffiliateType `json:"affiliate"` // Offset of the first affiliate program to return as received from the previous request; use empty string to get the first chunk of results Offset string `json:"offset"` // The maximum number of affiliate programs to return Limit int32 `json:"limit"` } -// Returns affiliate programs that were connected to the given chat -func (client *Client) GetChatAffiliatePrograms(req *GetChatAffiliateProgramsRequest) (*ChatAffiliatePrograms, error) { +// Returns affiliate programs that were connected to the given affiliate +func (client *Client) GetConnectedAffiliatePrograms(req *GetConnectedAffiliateProgramsRequest) (*ConnectedAffiliatePrograms, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getChatAffiliatePrograms", + Type: "getConnectedAffiliatePrograms", }, Data: map[string]interface{}{ - "chat_id": req.ChatId, + "affiliate": req.Affiliate, "offset": req.Offset, "limit": req.Limit, }, @@ -22470,7 +22682,7 @@ func (client *Client) GetChatAffiliatePrograms(req *GetChatAffiliateProgramsRequ return nil, buildResponseError(result.Data) } - return UnmarshalChatAffiliatePrograms(result.Data) + return UnmarshalConnectedAffiliatePrograms(result.Data) } type GetBusinessFeaturesRequest struct { diff --git a/client/type.go b/client/type.go index e2c1ee7..0b77de8 100755 --- a/client/type.go +++ b/client/type.go @@ -24,7 +24,9 @@ const ( ClassChatPhotoStickerType = "ChatPhotoStickerType" ClassInputChatPhoto = "InputChatPhoto" ClassStarSubscriptionType = "StarSubscriptionType" + ClassAffiliateType = "AffiliateType" ClassAffiliateProgramSortOrder = "AffiliateProgramSortOrder" + ClassSentGift = "SentGift" ClassStarTransactionDirection = "StarTransactionDirection" ClassStarTransactionType = "StarTransactionType" ClassGiveawayParticipantStatus = "GiveawayParticipantStatus" @@ -84,6 +86,7 @@ const ( ClassMessageSelfDestructType = "MessageSelfDestructType" ClassInputMessageContent = "InputMessageContent" ClassSearchMessagesFilter = "SearchMessagesFilter" + ClassSearchMessagesChatTypeFilter = "SearchMessagesChatTypeFilter" ClassChatAction = "ChatAction" ClassUserStatus = "UserStatus" ClassEmojiCategorySource = "EmojiCategorySource" @@ -212,6 +215,9 @@ const ( ClassBotCommand = "BotCommand" ClassBotCommands = "BotCommands" ClassBotMenuButton = "BotMenuButton" + ClassBotVerificationParameters = "BotVerificationParameters" + ClassBotVerification = "BotVerification" + ClassVerificationStatus = "VerificationStatus" ClassChatLocation = "ChatLocation" ClassBirthdate = "Birthdate" ClassCloseBirthdayUser = "CloseBirthdayUser" @@ -244,8 +250,8 @@ const ( ClassAffiliateInfo = "AffiliateInfo" ClassFoundAffiliateProgram = "FoundAffiliateProgram" ClassFoundAffiliatePrograms = "FoundAffiliatePrograms" - ClassChatAffiliateProgram = "ChatAffiliateProgram" - ClassChatAffiliatePrograms = "ChatAffiliatePrograms" + ClassConnectedAffiliateProgram = "ConnectedAffiliateProgram" + ClassConnectedAffiliatePrograms = "ConnectedAffiliatePrograms" ClassProductInfo = "ProductInfo" ClassPremiumPaymentOption = "PremiumPaymentOption" ClassPremiumStatePaymentOption = "PremiumStatePaymentOption" @@ -257,10 +263,17 @@ const ( ClassStarGiveawayWinnerOption = "StarGiveawayWinnerOption" ClassStarGiveawayPaymentOption = "StarGiveawayPaymentOption" ClassStarGiveawayPaymentOptions = "StarGiveawayPaymentOptions" + ClassUpgradedGiftModel = "UpgradedGiftModel" + ClassUpgradedGiftSymbol = "UpgradedGiftSymbol" + ClassUpgradedGiftBackdrop = "UpgradedGiftBackdrop" + ClassUpgradedGiftOriginalDetails = "UpgradedGiftOriginalDetails" ClassGift = "Gift" ClassGifts = "Gifts" + ClassUpgradedGift = "UpgradedGift" + ClassUpgradeGiftResult = "UpgradeGiftResult" ClassUserGift = "UserGift" ClassUserGifts = "UserGifts" + ClassGiftUpgradePreview = "GiftUpgradePreview" ClassStarTransaction = "StarTransaction" ClassStarTransactions = "StarTransactions" ClassAccentColor = "AccentColor" @@ -334,6 +347,7 @@ const ( ClassReactionNotificationSettings = "ReactionNotificationSettings" ClassDraftMessage = "DraftMessage" ClassChatFolderIcon = "ChatFolderIcon" + ClassChatFolderName = "ChatFolderName" ClassChatFolder = "ChatFolder" ClassChatFolderInfo = "ChatFolderInfo" ClassChatFolderInviteLink = "ChatFolderInviteLink" @@ -687,6 +701,9 @@ const ( TypeBotCommand = "botCommand" TypeBotCommands = "botCommands" TypeBotMenuButton = "botMenuButton" + TypeBotVerificationParameters = "botVerificationParameters" + TypeBotVerification = "botVerification" + TypeVerificationStatus = "verificationStatus" TypeChatLocation = "chatLocation" TypeBirthdate = "birthdate" TypeCloseBirthdayUser = "closeBirthdayUser" @@ -725,6 +742,9 @@ const ( TypeStarSubscriptionPricing = "starSubscriptionPricing" TypeStarSubscription = "starSubscription" TypeStarSubscriptions = "starSubscriptions" + TypeAffiliateTypeCurrentUser = "affiliateTypeCurrentUser" + TypeAffiliateTypeBot = "affiliateTypeBot" + TypeAffiliateTypeChannel = "affiliateTypeChannel" TypeAffiliateProgramSortOrderProfitability = "affiliateProgramSortOrderProfitability" TypeAffiliateProgramSortOrderCreationDate = "affiliateProgramSortOrderCreationDate" TypeAffiliateProgramSortOrderRevenue = "affiliateProgramSortOrderRevenue" @@ -733,8 +753,8 @@ const ( TypeAffiliateInfo = "affiliateInfo" TypeFoundAffiliateProgram = "foundAffiliateProgram" TypeFoundAffiliatePrograms = "foundAffiliatePrograms" - TypeChatAffiliateProgram = "chatAffiliateProgram" - TypeChatAffiliatePrograms = "chatAffiliatePrograms" + TypeConnectedAffiliateProgram = "connectedAffiliateProgram" + TypeConnectedAffiliatePrograms = "connectedAffiliatePrograms" TypeProductInfo = "productInfo" TypePremiumPaymentOption = "premiumPaymentOption" TypePremiumStatePaymentOption = "premiumStatePaymentOption" @@ -746,10 +766,19 @@ const ( TypeStarGiveawayWinnerOption = "starGiveawayWinnerOption" TypeStarGiveawayPaymentOption = "starGiveawayPaymentOption" TypeStarGiveawayPaymentOptions = "starGiveawayPaymentOptions" + TypeUpgradedGiftModel = "upgradedGiftModel" + TypeUpgradedGiftSymbol = "upgradedGiftSymbol" + TypeUpgradedGiftBackdrop = "upgradedGiftBackdrop" + TypeUpgradedGiftOriginalDetails = "upgradedGiftOriginalDetails" TypeGift = "gift" TypeGifts = "gifts" + TypeUpgradedGift = "upgradedGift" + TypeUpgradeGiftResult = "upgradeGiftResult" + TypeSentGiftRegular = "sentGiftRegular" + TypeSentGiftUpgraded = "sentGiftUpgraded" TypeUserGift = "userGift" TypeUserGifts = "userGifts" + TypeGiftUpgradePreview = "giftUpgradePreview" TypeStarTransactionDirectionIncoming = "starTransactionDirectionIncoming" TypeStarTransactionDirectionOutgoing = "starTransactionDirectionOutgoing" TypeStarTransactionTypePremiumBotDeposit = "starTransactionTypePremiumBotDeposit" @@ -772,7 +801,9 @@ const ( TypeStarTransactionTypeChannelSubscriptionPurchase = "starTransactionTypeChannelSubscriptionPurchase" TypeStarTransactionTypeChannelSubscriptionSale = "starTransactionTypeChannelSubscriptionSale" TypeStarTransactionTypeGiftPurchase = "starTransactionTypeGiftPurchase" + TypeStarTransactionTypeGiftTransfer = "starTransactionTypeGiftTransfer" TypeStarTransactionTypeGiftSale = "starTransactionTypeGiftSale" + TypeStarTransactionTypeGiftUpgrade = "starTransactionTypeGiftUpgrade" TypeStarTransactionTypeChannelPaidReactionSend = "starTransactionTypeChannelPaidReactionSend" TypeStarTransactionTypeChannelPaidReactionReceive = "starTransactionTypeChannelPaidReactionReceive" TypeStarTransactionTypeAffiliateProgramCommission = "starTransactionTypeAffiliateProgramCommission" @@ -934,6 +965,7 @@ const ( TypeChatTypeSupergroup = "chatTypeSupergroup" TypeChatTypeSecret = "chatTypeSecret" TypeChatFolderIcon = "chatFolderIcon" + TypeChatFolderName = "chatFolderName" TypeChatFolder = "chatFolder" TypeChatFolderInfo = "chatFolderInfo" TypeChatFolderInviteLink = "chatFolderInviteLink" @@ -1282,6 +1314,8 @@ const ( TypeMessageGiftedStars = "messageGiftedStars" TypeMessageGiveawayPrizeStars = "messageGiveawayPrizeStars" TypeMessageGift = "messageGift" + TypeMessageUpgradedGift = "messageUpgradedGift" + TypeMessageRefundedUpgradedGift = "messageRefundedUpgradedGift" TypeMessageContactRegistered = "messageContactRegistered" TypeMessageUsersShared = "messageUsersShared" TypeMessageChatShared = "messageChatShared" @@ -1362,6 +1396,9 @@ const ( TypeSearchMessagesFilterUnreadReaction = "searchMessagesFilterUnreadReaction" TypeSearchMessagesFilterFailedToSend = "searchMessagesFilterFailedToSend" TypeSearchMessagesFilterPinned = "searchMessagesFilterPinned" + TypeSearchMessagesChatTypeFilterPrivate = "searchMessagesChatTypeFilterPrivate" + TypeSearchMessagesChatTypeFilterGroup = "searchMessagesChatTypeFilterGroup" + TypeSearchMessagesChatTypeFilterChannel = "searchMessagesChatTypeFilterChannel" TypeChatActionTyping = "chatActionTyping" TypeChatActionRecordingVideo = "chatActionRecordingVideo" TypeChatActionUploadingVideo = "chatActionUploadingVideo" @@ -1467,6 +1504,7 @@ const ( TypeCallDiscardReasonDeclined = "callDiscardReasonDeclined" TypeCallDiscardReasonDisconnected = "callDiscardReasonDisconnected" TypeCallDiscardReasonHungUp = "callDiscardReasonHungUp" + TypeCallDiscardReasonAllowGroupCall = "callDiscardReasonAllowGroupCall" TypeCallProtocol = "callProtocol" TypeCallServerTypeTelegramReflector = "callServerTypeTelegramReflector" TypeCallServerTypeWebrtc = "callServerTypeWebrtc" @@ -1782,6 +1820,7 @@ const ( TypePushMessageContentPremiumGiftCode = "pushMessageContentPremiumGiftCode" TypePushMessageContentGiveaway = "pushMessageContentGiveaway" TypePushMessageContentGift = "pushMessageContentGift" + TypePushMessageContentUpgradedGift = "pushMessageContentUpgradedGift" TypePushMessageContentScreenshotTaken = "pushMessageContentScreenshotTaken" TypePushMessageContentSticker = "pushMessageContentSticker" TypePushMessageContentStory = "pushMessageContentStory" @@ -2029,6 +2068,7 @@ const ( TypeSuggestedActionSubscribeToAnnualPremium = "suggestedActionSubscribeToAnnualPremium" TypeSuggestedActionGiftPremiumForChristmas = "suggestedActionGiftPremiumForChristmas" TypeSuggestedActionSetBirthdate = "suggestedActionSetBirthdate" + TypeSuggestedActionSetProfilePhoto = "suggestedActionSetProfilePhoto" TypeSuggestedActionExtendPremium = "suggestedActionExtendPremium" TypeSuggestedActionExtendStarSubscriptions = "suggestedActionExtendStarSubscriptions" TypeCount = "count" @@ -2336,11 +2376,21 @@ type StarSubscriptionType interface { StarSubscriptionTypeType() string } +// Describes type of affiliate for an affiliate program +type AffiliateType interface { + AffiliateTypeType() string +} + // Describes the order of the found affiliate programs type AffiliateProgramSortOrder interface { AffiliateProgramSortOrderType() string } +// Represents a gift received by a user +type SentGift interface { + SentGiftType() string +} + // Describes direction of a transaction with Telegram Stars type StarTransactionDirection interface { StarTransactionDirectionType() string @@ -2636,6 +2686,11 @@ type SearchMessagesFilter interface { SearchMessagesFilterType() string } +// Represents a filter for type of the chats in which to search messages +type SearchMessagesChatTypeFilter interface { + SearchMessagesChatTypeFilterType() string +} + // Describes the different types of activity in a chat type ChatAction interface { ChatActionType() string @@ -6288,6 +6343,91 @@ func (*BotMenuButton) GetType() string { return TypeBotMenuButton } +// Describes parameters of verification that is provided by a bot +type BotVerificationParameters struct { + meta + // Identifier of the custom emoji that is used as the verification sign + IconCustomEmojiId JsonInt64 `json:"icon_custom_emoji_id"` + // Name of the organization that provides verification + OrganizationName string `json:"organization_name"` + // Default custom description of verification reason to be used as placeholder in setMessageSenderBotVerification; may be null if none + DefaultCustomDescription *FormattedText `json:"default_custom_description"` + // True, if the bot is allowed to provide custom description for verified entities + CanSetCustomDescription bool `json:"can_set_custom_description"` +} + +func (entity *BotVerificationParameters) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BotVerificationParameters + + return json.Marshal((*stub)(entity)) +} + +func (*BotVerificationParameters) GetClass() string { + return ClassBotVerificationParameters +} + +func (*BotVerificationParameters) GetType() string { + return TypeBotVerificationParameters +} + +// Describes verification status provided by a bot +type BotVerification struct { + meta + // Identifier of the bot that provided the verification + BotUserId int64 `json:"bot_user_id"` + // Identifier of the custom emoji that is used as the verification sign + IconCustomEmojiId JsonInt64 `json:"icon_custom_emoji_id"` + // Custom description of verification reason set by the bot + CustomDescription *FormattedText `json:"custom_description"` +} + +func (entity *BotVerification) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BotVerification + + return json.Marshal((*stub)(entity)) +} + +func (*BotVerification) GetClass() string { + return ClassBotVerification +} + +func (*BotVerification) GetType() string { + return TypeBotVerification +} + +// Contains information about verification status of a chat or a user +type VerificationStatus struct { + meta + // True, if the chat or the user is verified by Telegram + IsVerified bool `json:"is_verified"` + // True, if the chat or the user is marked as scam by Telegram + IsScam bool `json:"is_scam"` + // True, if the chat or the user is marked as fake by Telegram + IsFake bool `json:"is_fake"` + // Identifier of the custom emoji to be shown as verification sign provided by a bot for the user; 0 if none + BotVerificationIconCustomEmojiId JsonInt64 `json:"bot_verification_icon_custom_emoji_id"` +} + +func (entity *VerificationStatus) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub VerificationStatus + + return json.Marshal((*stub)(entity)) +} + +func (*VerificationStatus) GetClass() string { + return ClassVerificationStatus +} + +func (*VerificationStatus) GetType() string { + return TypeVerificationStatus +} + // Represents a location to which a chat is connected type ChatLocation struct { meta @@ -7518,6 +7658,85 @@ func (*StarSubscriptions) GetType() string { return TypeStarSubscriptions } +// The affiliate is the current user +type AffiliateTypeCurrentUser struct{ + meta +} + +func (entity *AffiliateTypeCurrentUser) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AffiliateTypeCurrentUser + + return json.Marshal((*stub)(entity)) +} + +func (*AffiliateTypeCurrentUser) GetClass() string { + return ClassAffiliateType +} + +func (*AffiliateTypeCurrentUser) GetType() string { + return TypeAffiliateTypeCurrentUser +} + +func (*AffiliateTypeCurrentUser) AffiliateTypeType() string { + return TypeAffiliateTypeCurrentUser +} + +// The affiliate is a bot owned by the current user +type AffiliateTypeBot struct { + meta + // User identifier of the bot + UserId int64 `json:"user_id"` +} + +func (entity *AffiliateTypeBot) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AffiliateTypeBot + + return json.Marshal((*stub)(entity)) +} + +func (*AffiliateTypeBot) GetClass() string { + return ClassAffiliateType +} + +func (*AffiliateTypeBot) GetType() string { + return TypeAffiliateTypeBot +} + +func (*AffiliateTypeBot) AffiliateTypeType() string { + return TypeAffiliateTypeBot +} + +// The affiliate is a channel chat where the current user has can_post_messages administrator right +type AffiliateTypeChannel struct { + meta + // Identifier of the channel chat + ChatId int64 `json:"chat_id"` +} + +func (entity *AffiliateTypeChannel) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AffiliateTypeChannel + + return json.Marshal((*stub)(entity)) +} + +func (*AffiliateTypeChannel) GetClass() string { + return ClassAffiliateType +} + +func (*AffiliateTypeChannel) GetType() string { + return TypeAffiliateTypeChannel +} + +func (*AffiliateTypeChannel) AffiliateTypeType() string { + return TypeAffiliateTypeChannel +} + // The affiliate programs must be sorted by the profitability type AffiliateProgramSortOrderProfitability struct{ meta @@ -7623,7 +7842,7 @@ type AffiliateProgramInfo struct { meta // Parameters of the affiliate program Parameters *AffiliateProgramParameters `json:"parameters"` - // Point in time (Unix timestamp) when the affiliate program will be closed; 0 if the affiliate program isn't scheduled to be closed. If positive, then the program can't be connected using connectChatAffiliateProgram, but active connections will work until the date + // Point in time (Unix timestamp) when the affiliate program will be closed; 0 if the affiliate program isn't scheduled to be closed. If positive, then the program can't be connected using connectAffiliateProgram, but active connections will work until the date EndDate int32 `json:"end_date"` // The amount of daily revenue per user in Telegram Stars of the bot that created the affiliate program DailyRevenuePerUserAmount *StarAmount `json:"daily_revenue_per_user_amount"` @@ -7678,7 +7897,7 @@ type FoundAffiliateProgram struct { // User identifier of the bot created the program BotUserId int64 `json:"bot_user_id"` // Information about the affiliate program - Parameters *AffiliateProgramInfo `json:"parameters"` + Info *AffiliateProgramInfo `json:"info"` } func (entity *FoundAffiliateProgram) MarshalJSON() ([]byte, error) { @@ -7724,8 +7943,8 @@ func (*FoundAffiliatePrograms) GetType() string { return TypeFoundAffiliatePrograms } -// Describes an affiliate program that was connected to a chat -type ChatAffiliateProgram struct { +// Describes an affiliate program that was connected to an affiliate +type ConnectedAffiliateProgram struct { meta // The link that can be used to refer users if the program is still active Url string `json:"url"` @@ -7743,47 +7962,47 @@ type ChatAffiliateProgram struct { RevenueStarCount JsonInt64 `json:"revenue_star_count"` } -func (entity *ChatAffiliateProgram) MarshalJSON() ([]byte, error) { +func (entity *ConnectedAffiliateProgram) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ChatAffiliateProgram + type stub ConnectedAffiliateProgram return json.Marshal((*stub)(entity)) } -func (*ChatAffiliateProgram) GetClass() string { - return ClassChatAffiliateProgram +func (*ConnectedAffiliateProgram) GetClass() string { + return ClassConnectedAffiliateProgram } -func (*ChatAffiliateProgram) GetType() string { - return TypeChatAffiliateProgram +func (*ConnectedAffiliateProgram) GetType() string { + return TypeConnectedAffiliateProgram } -// Represents a list of affiliate programs that were connected to a chat -type ChatAffiliatePrograms struct { +// Represents a list of affiliate programs that were connected to an affiliate +type ConnectedAffiliatePrograms struct { meta - // The total number of affiliate programs that were connected to the chat + // The total number of affiliate programs that were connected to the affiliate TotalCount int32 `json:"total_count"` // The list of connected affiliate programs - Programs []*ChatAffiliateProgram `json:"programs"` + Programs []*ConnectedAffiliateProgram `json:"programs"` // The offset for the next request. If empty, then there are no more results NextOffset string `json:"next_offset"` } -func (entity *ChatAffiliatePrograms) MarshalJSON() ([]byte, error) { +func (entity *ConnectedAffiliatePrograms) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ChatAffiliatePrograms + type stub ConnectedAffiliatePrograms return json.Marshal((*stub)(entity)) } -func (*ChatAffiliatePrograms) GetClass() string { - return ClassChatAffiliatePrograms +func (*ConnectedAffiliatePrograms) GetClass() string { + return ClassConnectedAffiliatePrograms } -func (*ChatAffiliatePrograms) GetType() string { - return TypeChatAffiliatePrograms +func (*ConnectedAffiliatePrograms) GetType() string { + return TypeConnectedAffiliatePrograms } // Contains information about a product that can be paid with invoice @@ -8167,6 +8386,122 @@ func (*StarGiveawayPaymentOptions) GetType() string { return TypeStarGiveawayPaymentOptions } +// Describes a model of an upgraded gift +type UpgradedGiftModel struct { + meta + // Name of the model + Name string `json:"name"` + // The sticker representing the upgraded gift + Sticker *Sticker `json:"sticker"` + // The number of upgraded gift that receive this model for each 1000 gifts upgraded + RarityPerMille int32 `json:"rarity_per_mille"` +} + +func (entity *UpgradedGiftModel) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftModel + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftModel) GetClass() string { + return ClassUpgradedGiftModel +} + +func (*UpgradedGiftModel) GetType() string { + return TypeUpgradedGiftModel +} + +// Describes a symbol shown on the pattern of an upgraded gift +type UpgradedGiftSymbol struct { + meta + // Name of the symbol + Name string `json:"name"` + // The sticker representing the upgraded gift + Sticker *Sticker `json:"sticker"` + // The number of upgraded gift that receive this symbol for each 1000 gifts upgraded + RarityPerMille int32 `json:"rarity_per_mille"` +} + +func (entity *UpgradedGiftSymbol) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftSymbol + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftSymbol) GetClass() string { + return ClassUpgradedGiftSymbol +} + +func (*UpgradedGiftSymbol) GetType() string { + return TypeUpgradedGiftSymbol +} + +// Describes a backdrop of an upgraded gift +type UpgradedGiftBackdrop struct { + meta + // Name of the backdrop + Name string `json:"name"` + // A color in the center of the backdrop in the RGB format + CenterColor int32 `json:"center_color"` + // A color on the edges of the backdrop in the RGB format + EdgeColor int32 `json:"edge_color"` + // A color to be applied for the symbol in the RGB format + SymbolColor int32 `json:"symbol_color"` + // A color for the text on the backdrop in the RGB format + TextColor int32 `json:"text_color"` + // The number of upgraded gift that receive this backdrop for each 1000 gifts upgraded + RarityPerMille int32 `json:"rarity_per_mille"` +} + +func (entity *UpgradedGiftBackdrop) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftBackdrop + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftBackdrop) GetClass() string { + return ClassUpgradedGiftBackdrop +} + +func (*UpgradedGiftBackdrop) GetType() string { + return TypeUpgradedGiftBackdrop +} + +// Describes the original details about the gift +type UpgradedGiftOriginalDetails struct { + meta + // Identifier of the user that sent the gift; 0 if the gift was private + SenderUserId int64 `json:"sender_user_id"` + // Identifier of the user that received the gift + ReceiverUserId int64 `json:"receiver_user_id"` + // Message added to the gift + Text *FormattedText `json:"text"` + // Point in time (Unix timestamp) when the gift was sent + Date int32 `json:"date"` +} + +func (entity *UpgradedGiftOriginalDetails) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftOriginalDetails + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftOriginalDetails) GetClass() string { + return ClassUpgradedGiftOriginalDetails +} + +func (*UpgradedGiftOriginalDetails) GetType() string { + return TypeUpgradedGiftOriginalDetails +} + // Describes a gift that can be sent to another user type Gift struct { meta @@ -8176,8 +8511,10 @@ type Gift struct { Sticker *Sticker `json:"sticker"` // Number of Telegram Stars that must be paid for the gift StarCount int64 `json:"star_count"` - // Number of Telegram Stars that can be claimed by the receiver instead of the gift by default. If the gift was paid with just bought Telegram Stars, then full value can be claimed + // Number of Telegram Stars that can be claimed by the receiver instead of the regular gift by default. If the gift was paid with just bought Telegram Stars, then full value can be claimed DefaultSellStarCount int64 `json:"default_sell_star_count"` + // Number of Telegram Stars that must be paid to upgrade the gift; 0 if upgrade isn't possible + UpgradeStarCount int64 `json:"upgrade_star_count"` // True, if the gift is a birthday gift IsForBirthday bool `json:"is_for_birthday"` // Number of remaining times the gift can be purchased by all users; 0 if not limited or the gift was sold out @@ -8229,6 +8566,132 @@ func (*Gifts) GetType() string { return TypeGifts } +// Describes an upgraded gift that can be gifted to another user or transferred to TON blockchain as an NFT +type UpgradedGift struct { + meta + // Unique identifier of the gift + Id JsonInt64 `json:"id"` + // The title of the upgraded gift + Title string `json:"title"` + // Unique number of the upgraded gift among gifts upgraded from the same gift + Number int32 `json:"number"` + // Total number of gifts that were upgraded from the same gift + TotalUpgradedCount int32 `json:"total_upgraded_count"` + // The maximum number of gifts that can be upgraded from the same gift + MaxUpgradedCount int32 `json:"max_upgraded_count"` + // User identifier of the user that owns the upgraded gift; 0 if none + OwnerUserId int64 `json:"owner_user_id"` + // Model of the upgraded gift + Model *UpgradedGiftModel `json:"model"` + // Symbol of the upgraded gift + Symbol *UpgradedGiftSymbol `json:"symbol"` + // Backdrop of the upgraded gift + Backdrop *UpgradedGiftBackdrop `json:"backdrop"` + // Information about the originally sent gift; may be null if unknown + OriginalDetails *UpgradedGiftOriginalDetails `json:"original_details"` +} + +func (entity *UpgradedGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGift + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGift) GetClass() string { + return ClassUpgradedGift +} + +func (*UpgradedGift) GetType() string { + return TypeUpgradedGift +} + +// Contains result of gift upgrading +type UpgradeGiftResult struct { + meta + // The upgraded gift + Gift *UpgradedGift `json:"gift"` + // True, if the gift is displayed on the user's profile page + IsSaved bool `json:"is_saved"` + // True, if the gift can be transferred to another user + CanBeTransferred bool `json:"can_be_transferred"` + // Number of Telegram Stars that must be paid to transfer the upgraded gift + TransferStarCount int64 `json:"transfer_star_count"` + // Point in time (Unix timestamp) when the gift can be transferred to TON blockchain as an NFT + ExportDate int32 `json:"export_date"` +} + +func (entity *UpgradeGiftResult) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradeGiftResult + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradeGiftResult) GetClass() string { + return ClassUpgradeGiftResult +} + +func (*UpgradeGiftResult) GetType() string { + return TypeUpgradeGiftResult +} + +// Regular gift +type SentGiftRegular struct { + meta + // The gift + Gift *Gift `json:"gift"` +} + +func (entity *SentGiftRegular) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SentGiftRegular + + return json.Marshal((*stub)(entity)) +} + +func (*SentGiftRegular) GetClass() string { + return ClassSentGift +} + +func (*SentGiftRegular) GetType() string { + return TypeSentGiftRegular +} + +func (*SentGiftRegular) SentGiftType() string { + return TypeSentGiftRegular +} + +// Upgraded gift +type SentGiftUpgraded struct { + meta + // The gift + Gift *UpgradedGift `json:"gift"` +} + +func (entity *SentGiftUpgraded) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SentGiftUpgraded + + return json.Marshal((*stub)(entity)) +} + +func (*SentGiftUpgraded) GetClass() string { + return ClassSentGift +} + +func (*SentGiftUpgraded) GetType() string { + return TypeSentGiftUpgraded +} + +func (*SentGiftUpgraded) SentGiftType() string { + return TypeSentGiftUpgraded +} + // Represents a gift received by a user type UserGift struct { meta @@ -8238,16 +8701,28 @@ type UserGift struct { Text *FormattedText `json:"text"` // True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone are able to see them IsPrivate bool `json:"is_private"` - // True, if the gift is displayed on the user's profile page; may be false only for the receiver of the gift + // True, if the gift is displayed on the user's profile page; only for the receiver of the gift IsSaved bool `json:"is_saved"` + // True, if the gift is a regular gift that can be upgraded to a unique gift; only for the receiver of the gift + CanBeUpgraded bool `json:"can_be_upgraded"` + // True, if the gift is an upgraded gift that can be transferred to another user; only for the receiver of the gift + CanBeTransferred bool `json:"can_be_transferred"` + // True, if the gift was refunded and isn't available anymore + WasRefunded bool `json:"was_refunded"` // Point in time (Unix timestamp) when the gift was sent Date int32 `json:"date"` // The gift - Gift *Gift `json:"gift"` - // Identifier of the message with the gift in the chat with the sender of the gift; can be 0 or an identifier of a deleted message; only for the gift receiver + Gift SentGift `json:"gift"` + // Identifier of the message with the gift in the chat with the sender of the gift; can be 0 or an identifier of a deleted message; only for the receiver of the gift MessageId int64 `json:"message_id"` - // Number of Telegram Stars that can be claimed by the receiver instead of the gift; 0 if the gift can't be sold by the current user + // Number of Telegram Stars that can be claimed by the receiver instead of the regular gift; 0 if the gift can't be sold by the current user SellStarCount int64 `json:"sell_star_count"` + // Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift + PrepaidUpgradeStarCount int64 `json:"prepaid_upgrade_star_count"` + // Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift + TransferStarCount int64 `json:"transfer_star_count"` + // Point in time (Unix timestamp) when the upgraded gift can be transferred to TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift + ExportDate int32 `json:"export_date"` } func (entity *UserGift) MarshalJSON() ([]byte, error) { @@ -8266,6 +8741,49 @@ func (*UserGift) GetType() string { return TypeUserGift } +func (userGift *UserGift) UnmarshalJSON(data []byte) error { + var tmp struct { + SenderUserId int64 `json:"sender_user_id"` + Text *FormattedText `json:"text"` + IsPrivate bool `json:"is_private"` + IsSaved bool `json:"is_saved"` + CanBeUpgraded bool `json:"can_be_upgraded"` + CanBeTransferred bool `json:"can_be_transferred"` + WasRefunded bool `json:"was_refunded"` + Date int32 `json:"date"` + Gift json.RawMessage `json:"gift"` + MessageId int64 `json:"message_id"` + SellStarCount int64 `json:"sell_star_count"` + PrepaidUpgradeStarCount int64 `json:"prepaid_upgrade_star_count"` + TransferStarCount int64 `json:"transfer_star_count"` + ExportDate int32 `json:"export_date"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + userGift.SenderUserId = tmp.SenderUserId + userGift.Text = tmp.Text + userGift.IsPrivate = tmp.IsPrivate + userGift.IsSaved = tmp.IsSaved + userGift.CanBeUpgraded = tmp.CanBeUpgraded + userGift.CanBeTransferred = tmp.CanBeTransferred + userGift.WasRefunded = tmp.WasRefunded + userGift.Date = tmp.Date + userGift.MessageId = tmp.MessageId + userGift.SellStarCount = tmp.SellStarCount + userGift.PrepaidUpgradeStarCount = tmp.PrepaidUpgradeStarCount + userGift.TransferStarCount = tmp.TransferStarCount + userGift.ExportDate = tmp.ExportDate + + fieldGift, _ := UnmarshalSentGift(tmp.Gift) + userGift.Gift = fieldGift + + return nil +} + // Represents a list of gifts received by a user type UserGifts struct { meta @@ -8293,6 +8811,33 @@ func (*UserGifts) GetType() string { return TypeUserGifts } +// Contains examples of possible upgraded gifts for the given regular gift +type GiftUpgradePreview struct { + meta + // Examples of possible models that can be chosen for the gift after upgrade + Models []*UpgradedGiftModel `json:"models"` + // Examples of possible symbols that can be chosen for the gift after upgrade + Symbols []*UpgradedGiftSymbol `json:"symbols"` + // Examples of possible backdrops that can be chosen for the gift after upgrade + Backdrops []*UpgradedGiftBackdrop `json:"backdrops"` +} + +func (entity *GiftUpgradePreview) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftUpgradePreview + + return json.Marshal((*stub)(entity)) +} + +func (*GiftUpgradePreview) GetClass() string { + return ClassGiftUpgradePreview +} + +func (*GiftUpgradePreview) GetType() string { + return TypeGiftUpgradePreview +} + // The transaction is incoming and increases the number of owned Telegram Stars type StarTransactionDirectionIncoming struct{ meta @@ -8990,7 +9535,7 @@ func (*StarTransactionTypeChannelSubscriptionSale) StarTransactionTypeType() str return TypeStarTransactionTypeChannelSubscriptionSale } -// The transaction is a purchase of a gift to another user; for regular users and bots only +// The transaction is a purchase of a regular gift to another user; for regular users and bots only type StarTransactionTypeGiftPurchase struct { meta // Identifier of the user that received the gift @@ -9019,6 +9564,35 @@ func (*StarTransactionTypeGiftPurchase) StarTransactionTypeType() string { return TypeStarTransactionTypeGiftPurchase } +// The transaction is a transfer of an upgraded gift to another user; for regular users only +type StarTransactionTypeGiftTransfer struct { + meta + // Identifier of the user that received the gift + UserId int64 `json:"user_id"` + // The gift + Gift *UpgradedGift `json:"gift"` +} + +func (entity *StarTransactionTypeGiftTransfer) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeGiftTransfer + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeGiftTransfer) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeGiftTransfer) GetType() string { + return TypeStarTransactionTypeGiftTransfer +} + +func (*StarTransactionTypeGiftTransfer) StarTransactionTypeType() string { + return TypeStarTransactionTypeGiftTransfer +} + // The transaction is a sale of a gift received from another user or bot; for regular users only type StarTransactionTypeGiftSale struct { meta @@ -9048,6 +9622,33 @@ func (*StarTransactionTypeGiftSale) StarTransactionTypeType() string { return TypeStarTransactionTypeGiftSale } +// The transaction is an upgrade of a gift; for regular users only +type StarTransactionTypeGiftUpgrade struct { + meta + // The upgraded gift + Gift *UpgradedGift `json:"gift"` +} + +func (entity *StarTransactionTypeGiftUpgrade) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeGiftUpgrade + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeGiftUpgrade) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeGiftUpgrade) GetType() string { + return TypeStarTransactionTypeGiftUpgrade +} + +func (*StarTransactionTypeGiftUpgrade) StarTransactionTypeType() string { + return TypeStarTransactionTypeGiftUpgrade +} + // The transaction is a sending of a paid reaction to a message in a channel chat by the current user; for regular users only type StarTransactionTypeChannelPaidReactionSend struct { meta @@ -9720,18 +10321,14 @@ type User struct { IsMutualContact bool `json:"is_mutual_contact"` // The user is a close friend of the current user; implies that the user is a contact IsCloseFriend bool `json:"is_close_friend"` - // True, if the user is verified - IsVerified bool `json:"is_verified"` + // Information about verification status of the user; may be null if none + VerificationStatus *VerificationStatus `json:"verification_status"` // True, if the user is a Telegram Premium user IsPremium bool `json:"is_premium"` // True, if the user is Telegram support account IsSupport bool `json:"is_support"` // If non-empty, it contains a human-readable description of the reason why access to this user must be restricted RestrictionReason string `json:"restriction_reason"` - // True, if many users reported this user as a scam - IsScam bool `json:"is_scam"` - // True, if many users reported this user as a fake account - IsFake bool `json:"is_fake"` // True, if the user has non-expired stories available to the current user HasActiveStories bool `json:"has_active_stories"` // True, if the user has unread non-expired stories available to the current user @@ -9782,12 +10379,10 @@ func (user *User) UnmarshalJSON(data []byte) error { IsContact bool `json:"is_contact"` IsMutualContact bool `json:"is_mutual_contact"` IsCloseFriend bool `json:"is_close_friend"` - IsVerified bool `json:"is_verified"` + VerificationStatus *VerificationStatus `json:"verification_status"` IsPremium bool `json:"is_premium"` IsSupport bool `json:"is_support"` RestrictionReason string `json:"restriction_reason"` - IsScam bool `json:"is_scam"` - IsFake bool `json:"is_fake"` HasActiveStories bool `json:"has_active_stories"` HasUnreadActiveStories bool `json:"has_unread_active_stories"` RestrictsNewChats bool `json:"restricts_new_chats"` @@ -9817,12 +10412,10 @@ func (user *User) UnmarshalJSON(data []byte) error { user.IsContact = tmp.IsContact user.IsMutualContact = tmp.IsMutualContact user.IsCloseFriend = tmp.IsCloseFriend - user.IsVerified = tmp.IsVerified + user.VerificationStatus = tmp.VerificationStatus user.IsPremium = tmp.IsPremium user.IsSupport = tmp.IsSupport user.RestrictionReason = tmp.RestrictionReason - user.IsScam = tmp.IsScam - user.IsFake = tmp.IsFake user.HasActiveStories = tmp.HasActiveStories user.HasUnreadActiveStories = tmp.HasUnreadActiveStories user.RestrictsNewChats = tmp.RestrictsNewChats @@ -9870,6 +10463,8 @@ type BotInfo struct { WebAppHeaderLightColor int32 `json:"web_app_header_light_color"` // Default dark header color for bot Web Apps; -1 if not specified WebAppHeaderDarkColor int32 `json:"web_app_header_dark_color"` + // Parameters of the verification that can be provided by the bot; may be null if none or the current user isn't the owner of the bot + VerificationParameters *BotVerificationParameters `json:"verification_parameters"` // True, if the bot's revenue statistics are available to the current user CanGetRevenueStatistics bool `json:"can_get_revenue_statistics"` // True, if the bot can manage emoji status of the current user @@ -9918,6 +10513,7 @@ func (botInfo *BotInfo) UnmarshalJSON(data []byte) error { WebAppBackgroundDarkColor int32 `json:"web_app_background_dark_color"` WebAppHeaderLightColor int32 `json:"web_app_header_light_color"` WebAppHeaderDarkColor int32 `json:"web_app_header_dark_color"` + VerificationParameters *BotVerificationParameters `json:"verification_parameters"` CanGetRevenueStatistics bool `json:"can_get_revenue_statistics"` CanManageEmojiStatus bool `json:"can_manage_emoji_status"` HasMediaPreviews bool `json:"has_media_previews"` @@ -9946,6 +10542,7 @@ func (botInfo *BotInfo) UnmarshalJSON(data []byte) error { botInfo.WebAppBackgroundDarkColor = tmp.WebAppBackgroundDarkColor botInfo.WebAppHeaderLightColor = tmp.WebAppHeaderLightColor botInfo.WebAppHeaderDarkColor = tmp.WebAppHeaderDarkColor + botInfo.VerificationParameters = tmp.VerificationParameters botInfo.CanGetRevenueStatistics = tmp.CanGetRevenueStatistics botInfo.CanManageEmojiStatus = tmp.CanManageEmojiStatus botInfo.HasMediaPreviews = tmp.HasMediaPreviews @@ -10004,6 +10601,8 @@ type UserFullInfo struct { GiftCount int32 `json:"gift_count"` // Number of group chats where both the other user and the current user are a member; 0 for the current user GroupInCommonCount int32 `json:"group_in_common_count"` + // Information about verification status of the user provided by a bot; may be null if none or unknown + BotVerification *BotVerification `json:"bot_verification"` // Information about business settings for Telegram Business accounts; may be null if none BusinessInfo *BusinessInfo `json:"business_info"` // For bots, information about the bot; may be null if the user isn't a bot @@ -10046,6 +10645,7 @@ func (userFullInfo *UserFullInfo) UnmarshalJSON(data []byte) error { PersonalChatId int64 `json:"personal_chat_id"` GiftCount int32 `json:"gift_count"` GroupInCommonCount int32 `json:"group_in_common_count"` + BotVerification *BotVerification `json:"bot_verification"` BusinessInfo *BusinessInfo `json:"business_info"` BotInfo *BotInfo `json:"bot_info"` } @@ -10072,6 +10672,7 @@ func (userFullInfo *UserFullInfo) UnmarshalJSON(data []byte) error { userFullInfo.PersonalChatId = tmp.PersonalChatId userFullInfo.GiftCount = tmp.GiftCount userFullInfo.GroupInCommonCount = tmp.GroupInCommonCount + userFullInfo.BotVerification = tmp.BotVerification userFullInfo.BusinessInfo = tmp.BusinessInfo userFullInfo.BotInfo = tmp.BotInfo @@ -11128,12 +11729,8 @@ type ChatInviteLinkInfo struct { CreatesJoinRequest bool `json:"creates_join_request"` // True, if the chat is a public supergroup or channel, i.e. it has a username or it is a location-based supergroup IsPublic bool `json:"is_public"` - // True, if the chat is verified - IsVerified bool `json:"is_verified"` - // True, if many users reported this chat as a scam - IsScam bool `json:"is_scam"` - // True, if many users reported this chat as a fake account - IsFake bool `json:"is_fake"` + // Information about verification status of the chat; may be null if none + VerificationStatus *VerificationStatus `json:"verification_status"` } func (entity *ChatInviteLinkInfo) MarshalJSON() ([]byte, error) { @@ -11166,9 +11763,7 @@ func (chatInviteLinkInfo *ChatInviteLinkInfo) UnmarshalJSON(data []byte) error { SubscriptionInfo *ChatInviteLinkSubscriptionInfo `json:"subscription_info"` CreatesJoinRequest bool `json:"creates_join_request"` IsPublic bool `json:"is_public"` - IsVerified bool `json:"is_verified"` - IsScam bool `json:"is_scam"` - IsFake bool `json:"is_fake"` + VerificationStatus *VerificationStatus `json:"verification_status"` } err := json.Unmarshal(data, &tmp) @@ -11187,9 +11782,7 @@ func (chatInviteLinkInfo *ChatInviteLinkInfo) UnmarshalJSON(data []byte) error { chatInviteLinkInfo.SubscriptionInfo = tmp.SubscriptionInfo chatInviteLinkInfo.CreatesJoinRequest = tmp.CreatesJoinRequest chatInviteLinkInfo.IsPublic = tmp.IsPublic - chatInviteLinkInfo.IsVerified = tmp.IsVerified - chatInviteLinkInfo.IsScam = tmp.IsScam - chatInviteLinkInfo.IsFake = tmp.IsFake + chatInviteLinkInfo.VerificationStatus = tmp.VerificationStatus fieldType, _ := UnmarshalInviteLinkChatType(tmp.Type) chatInviteLinkInfo.Type = fieldType @@ -11279,8 +11872,6 @@ type BasicGroup struct { meta // Group identifier Id int64 `json:"id"` - // Group access hash - AccessHash JsonInt64 `json:"access_hash"` // Number of members in the group MemberCount int32 `json:"member_count"` // Status of the current user in the group @@ -11310,7 +11901,6 @@ func (*BasicGroup) GetType() string { func (basicGroup *BasicGroup) UnmarshalJSON(data []byte) error { var tmp struct { Id int64 `json:"id"` - AccessHash JsonInt64 `json:"access_hash"` MemberCount int32 `json:"member_count"` Status json.RawMessage `json:"status"` IsActive bool `json:"is_active"` @@ -11323,7 +11913,6 @@ func (basicGroup *BasicGroup) UnmarshalJSON(data []byte) error { } basicGroup.Id = tmp.Id - basicGroup.AccessHash = tmp.AccessHash basicGroup.MemberCount = tmp.MemberCount basicGroup.IsActive = tmp.IsActive basicGroup.UpgradedToSupergroupId = tmp.UpgradedToSupergroupId @@ -11408,16 +11997,12 @@ type Supergroup struct { IsBroadcastGroup bool `json:"is_broadcast_group"` // True, if the supergroup is a forum with topics IsForum bool `json:"is_forum"` - // True, if the supergroup or channel is verified - IsVerified bool `json:"is_verified"` + // Information about verification status of the supergroup or channel; may be null if none + VerificationStatus *VerificationStatus `json:"verification_status"` // True, if content of media messages in the supergroup or channel chat must be hidden with 18+ spoiler HasSensitiveContent bool `json:"has_sensitive_content"` // If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted RestrictionReason string `json:"restriction_reason"` - // True, if many users reported this supergroup or channel as a scam - IsScam bool `json:"is_scam"` - // True, if many users reported this supergroup or channel as a fake account - IsFake bool `json:"is_fake"` // True, if the supergroup or channel has non-expired stories available to the current user HasActiveStories bool `json:"has_active_stories"` // True, if the supergroup or channel has unread non-expired stories available to the current user @@ -11459,11 +12044,9 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { IsChannel bool `json:"is_channel"` IsBroadcastGroup bool `json:"is_broadcast_group"` IsForum bool `json:"is_forum"` - IsVerified bool `json:"is_verified"` + VerificationStatus *VerificationStatus `json:"verification_status"` HasSensitiveContent bool `json:"has_sensitive_content"` RestrictionReason string `json:"restriction_reason"` - IsScam bool `json:"is_scam"` - IsFake bool `json:"is_fake"` HasActiveStories bool `json:"has_active_stories"` HasUnreadActiveStories bool `json:"has_unread_active_stories"` } @@ -11489,11 +12072,9 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { supergroup.IsChannel = tmp.IsChannel supergroup.IsBroadcastGroup = tmp.IsBroadcastGroup supergroup.IsForum = tmp.IsForum - supergroup.IsVerified = tmp.IsVerified + supergroup.VerificationStatus = tmp.VerificationStatus supergroup.HasSensitiveContent = tmp.HasSensitiveContent supergroup.RestrictionReason = tmp.RestrictionReason - supergroup.IsScam = tmp.IsScam - supergroup.IsFake = tmp.IsFake supergroup.HasActiveStories = tmp.HasActiveStories supergroup.HasUnreadActiveStories = tmp.HasUnreadActiveStories @@ -11568,6 +12149,8 @@ type SupergroupFullInfo struct { InviteLink *ChatInviteLink `json:"invite_link"` // List of commands of bots in the group BotCommands []*BotCommands `json:"bot_commands"` + // Information about verification status of the supergroup or the channel provided by a bot; may be null if none or unknown + BotVerification *BotVerification `json:"bot_verification"` // Identifier of the basic group from which supergroup was upgraded; 0 if none UpgradedFromBasicGroupId int64 `json:"upgraded_from_basic_group_id"` // Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none @@ -14635,11 +15218,36 @@ func (*ChatFolderIcon) GetType() string { return TypeChatFolderIcon } +// Describes name of a chat folder +type ChatFolderName struct { + meta + // The text of the chat folder name; 1-12 characters without line feeds. May contain only CustomEmoji entities + Text *FormattedText `json:"text"` + // True, if custom emoji in the name must be animated + AnimateCustomEmoji bool `json:"animate_custom_emoji"` +} + +func (entity *ChatFolderName) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatFolderName + + return json.Marshal((*stub)(entity)) +} + +func (*ChatFolderName) GetClass() string { + return ClassChatFolderName +} + +func (*ChatFolderName) GetType() string { + return TypeChatFolderName +} + // Represents a folder for user chats type ChatFolder struct { meta - // The title of the folder; 1-12 characters without line feeds - Title string `json:"title"` + // The name of the folder + Name *ChatFolderName `json:"name"` // The chosen icon for the chat folder; may be null. If null, use getChatFolderDefaultIconName to get default icon name for the folder Icon *ChatFolderIcon `json:"icon"` // The identifier of the chosen color for the chat folder icon; from -1 to 6. If -1, then color is disabled. Can't be changed if folder tags are disabled or the current user doesn't have Telegram Premium subscription @@ -14691,8 +15299,8 @@ type ChatFolderInfo struct { meta // Unique chat folder identifier Id int32 `json:"id"` - // The title of the folder; 1-12 characters without line feeds - Title string `json:"title"` + // The name of the folder + Name *ChatFolderName `json:"name"` // The chosen or default icon for the chat folder Icon *ChatFolderIcon `json:"icon"` // The identifier of the chosen color for the chat folder icon; from -1 to 6. If -1, then color is disabled @@ -26348,21 +26956,31 @@ func (*MessageGiveawayPrizeStars) MessageContentType() string { return TypeMessageGiveawayPrizeStars } -// A gift was received or sent by the current user +// A regular gift was received or sent by the current user type MessageGift struct { meta // The gift Gift *Gift `json:"gift"` // Message added to the gift Text *FormattedText `json:"text"` - // Number of Telegram Stars that can be claimed by the receiver instead of the gift; 0 if the gift can't be sold by the receiver + // Number of Telegram Stars that can be claimed by the receiver instead of the regular gift; 0 if the gift can't be sold by the receiver SellStarCount int64 `json:"sell_star_count"` + // Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift + PrepaidUpgradeStarCount int64 `json:"prepaid_upgrade_star_count"` // True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone will be able to see them IsPrivate bool `json:"is_private"` // True, if the gift is displayed on the user's profile page; only for the receiver of the gift IsSaved bool `json:"is_saved"` + // True, if the gift can be upgraded to a unique gift; only for the receiver of the gift + CanBeUpgraded bool `json:"can_be_upgraded"` // True, if the gift was converted to Telegram Stars; only for the receiver of the gift WasConverted bool `json:"was_converted"` + // True, if the gift was upgraded to a unique gift + WasUpgraded bool `json:"was_upgraded"` + // True, if the gift was refunded and isn't available anymore + WasRefunded bool `json:"was_refunded"` + // Identifier of the service message messageUpgradedGift or messageRefundedUpgradedGift with upgraded version of the gift; can be 0 if none or an identifier of a deleted message. Use getUserGift to get information about the gift + UpgradeMessageId int64 `json:"upgrade_message_id"` } func (entity *MessageGift) MarshalJSON() ([]byte, error) { @@ -26385,6 +27003,74 @@ func (*MessageGift) MessageContentType() string { return TypeMessageGift } +// An upgraded gift was received or sent by the current user +type MessageUpgradedGift struct { + meta + // The gift + Gift *UpgradedGift `json:"gift"` + // True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred gift + IsUpgrade bool `json:"is_upgrade"` + // True, if the gift is displayed on the user's profile page; only for the receiver of the gift + IsSaved bool `json:"is_saved"` + // True, if the gift can be transferred to another user; only for the receiver of the gift + CanBeTransferred bool `json:"can_be_transferred"` + // True, if the gift was transferred to another user; only for the receiver of the gift + WasTransferred bool `json:"was_transferred"` + // Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift + TransferStarCount int64 `json:"transfer_star_count"` + // Point in time (Unix timestamp) when the gift can be transferred to TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift + ExportDate int32 `json:"export_date"` +} + +func (entity *MessageUpgradedGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageUpgradedGift + + return json.Marshal((*stub)(entity)) +} + +func (*MessageUpgradedGift) GetClass() string { + return ClassMessageContent +} + +func (*MessageUpgradedGift) GetType() string { + return TypeMessageUpgradedGift +} + +func (*MessageUpgradedGift) MessageContentType() string { + return TypeMessageUpgradedGift +} + +// A gift which purchase, upgrade or transfer were refunded +type MessageRefundedUpgradedGift struct { + meta + // The gift + Gift *Gift `json:"gift"` + // True, if the gift was obtained by upgrading of a previously received gift + IsUpgrade bool `json:"is_upgrade"` +} + +func (entity *MessageRefundedUpgradedGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageRefundedUpgradedGift + + return json.Marshal((*stub)(entity)) +} + +func (*MessageRefundedUpgradedGift) GetClass() string { + return ClassMessageContent +} + +func (*MessageRefundedUpgradedGift) GetType() string { + return TypeMessageRefundedUpgradedGift +} + +func (*MessageRefundedUpgradedGift) MessageContentType() string { + return TypeMessageRefundedUpgradedGift +} + // A contact has registered with Telegram type MessageContactRegistered struct{ meta @@ -29108,6 +29794,81 @@ func (*SearchMessagesFilterPinned) SearchMessagesFilterType() string { return TypeSearchMessagesFilterPinned } +// Returns only messages in private chats +type SearchMessagesChatTypeFilterPrivate struct{ + meta +} + +func (entity *SearchMessagesChatTypeFilterPrivate) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SearchMessagesChatTypeFilterPrivate + + return json.Marshal((*stub)(entity)) +} + +func (*SearchMessagesChatTypeFilterPrivate) GetClass() string { + return ClassSearchMessagesChatTypeFilter +} + +func (*SearchMessagesChatTypeFilterPrivate) GetType() string { + return TypeSearchMessagesChatTypeFilterPrivate +} + +func (*SearchMessagesChatTypeFilterPrivate) SearchMessagesChatTypeFilterType() string { + return TypeSearchMessagesChatTypeFilterPrivate +} + +// Returns only messages in basic group and supergroup chats +type SearchMessagesChatTypeFilterGroup struct{ + meta +} + +func (entity *SearchMessagesChatTypeFilterGroup) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SearchMessagesChatTypeFilterGroup + + return json.Marshal((*stub)(entity)) +} + +func (*SearchMessagesChatTypeFilterGroup) GetClass() string { + return ClassSearchMessagesChatTypeFilter +} + +func (*SearchMessagesChatTypeFilterGroup) GetType() string { + return TypeSearchMessagesChatTypeFilterGroup +} + +func (*SearchMessagesChatTypeFilterGroup) SearchMessagesChatTypeFilterType() string { + return TypeSearchMessagesChatTypeFilterGroup +} + +// Returns only messages in channel chats +type SearchMessagesChatTypeFilterChannel struct{ + meta +} + +func (entity *SearchMessagesChatTypeFilterChannel) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SearchMessagesChatTypeFilterChannel + + return json.Marshal((*stub)(entity)) +} + +func (*SearchMessagesChatTypeFilterChannel) GetClass() string { + return ClassSearchMessagesChatTypeFilter +} + +func (*SearchMessagesChatTypeFilterChannel) GetType() string { + return TypeSearchMessagesChatTypeFilterChannel +} + +func (*SearchMessagesChatTypeFilterChannel) SearchMessagesChatTypeFilterType() string { + return TypeSearchMessagesChatTypeFilterChannel +} + // The user is typing a message type ChatActionTyping struct{ meta @@ -32615,6 +33376,33 @@ func (*CallDiscardReasonHungUp) CallDiscardReasonType() string { return TypeCallDiscardReasonHungUp } +// The call was ended because it has been used successfully to transfer private encryption key for the associated group call +type CallDiscardReasonAllowGroupCall struct { + meta + // Encrypted using the call private key encryption key for the associated group call + EncryptedGroupCallKey []byte `json:"encrypted_group_call_key"` +} + +func (entity *CallDiscardReasonAllowGroupCall) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CallDiscardReasonAllowGroupCall + + return json.Marshal((*stub)(entity)) +} + +func (*CallDiscardReasonAllowGroupCall) GetClass() string { + return ClassCallDiscardReason +} + +func (*CallDiscardReasonAllowGroupCall) GetType() string { + return TypeCallDiscardReasonAllowGroupCall +} + +func (*CallDiscardReasonAllowGroupCall) CallDiscardReasonType() string { + return TypeCallDiscardReasonAllowGroupCall +} + // Specifies the supported call protocols type CallProtocol struct { meta @@ -33666,6 +34454,8 @@ type Call struct { IsVideo bool `json:"is_video"` // Call state State CallState `json:"state"` + // Identifier of the group call associated with the call; 0 if the group call isn't created yet. The group call can be received through the method getGroupCall + GroupCallId int32 `json:"group_call_id"` } func (entity *Call) MarshalJSON() ([]byte, error) { @@ -33691,6 +34481,7 @@ func (call *Call) UnmarshalJSON(data []byte) error { IsOutgoing bool `json:"is_outgoing"` IsVideo bool `json:"is_video"` State json.RawMessage `json:"state"` + GroupCallId int32 `json:"group_call_id"` } err := json.Unmarshal(data, &tmp) @@ -33702,6 +34493,7 @@ func (call *Call) UnmarshalJSON(data []byte) error { call.UserId = tmp.UserId call.IsOutgoing = tmp.IsOutgoing call.IsVideo = tmp.IsVideo + call.GroupCallId = tmp.GroupCallId fieldState, _ := UnmarshalCallState(tmp.State) call.State = fieldState @@ -34811,8 +35603,6 @@ type InputInlineQueryResultArticle struct { Id string `json:"id"` // URL of the result, if it exists Url string `json:"url"` - // True, if the URL must be not shown - HideUrl bool `json:"hide_url"` // Title of the result Title string `json:"title"` // A short description of the result @@ -34853,7 +35643,6 @@ func (inputInlineQueryResultArticle *InputInlineQueryResultArticle) UnmarshalJSO var tmp struct { Id string `json:"id"` Url string `json:"url"` - HideUrl bool `json:"hide_url"` Title string `json:"title"` Description string `json:"description"` ThumbnailUrl string `json:"thumbnail_url"` @@ -34870,7 +35659,6 @@ func (inputInlineQueryResultArticle *InputInlineQueryResultArticle) UnmarshalJSO inputInlineQueryResultArticle.Id = tmp.Id inputInlineQueryResultArticle.Url = tmp.Url - inputInlineQueryResultArticle.HideUrl = tmp.HideUrl inputInlineQueryResultArticle.Title = tmp.Title inputInlineQueryResultArticle.Description = tmp.Description inputInlineQueryResultArticle.ThumbnailUrl = tmp.ThumbnailUrl @@ -35615,8 +36403,6 @@ type InlineQueryResultArticle struct { Id string `json:"id"` // URL of the result, if it exists Url string `json:"url"` - // True, if the URL must be not shown - HideUrl bool `json:"hide_url"` // Title of the result Title string `json:"title"` // A short description of the result @@ -42661,6 +43447,33 @@ func (*PushMessageContentGift) PushMessageContentType() string { return TypePushMessageContentGift } +// A message with an upgraded gift +type PushMessageContentUpgradedGift struct { + meta + // True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred gift + IsUpgrade bool `json:"is_upgrade"` +} + +func (entity *PushMessageContentUpgradedGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentUpgradedGift + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentUpgradedGift) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentUpgradedGift) GetType() string { + return TypePushMessageContentUpgradedGift +} + +func (*PushMessageContentUpgradedGift) PushMessageContentType() string { + return TypePushMessageContentUpgradedGift +} + // A screenshot of a message in the chat has been taken type PushMessageContentScreenshotTaken struct{ meta @@ -49580,6 +50393,31 @@ func (*SuggestedActionSetBirthdate) SuggestedActionType() string { return TypeSuggestedActionSetBirthdate } +// Suggests the user to set profile photo +type SuggestedActionSetProfilePhoto struct{ + meta +} + +func (entity *SuggestedActionSetProfilePhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedActionSetProfilePhoto + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedActionSetProfilePhoto) GetClass() string { + return ClassSuggestedAction +} + +func (*SuggestedActionSetProfilePhoto) GetType() string { + return TypeSuggestedActionSetProfilePhoto +} + +func (*SuggestedActionSetProfilePhoto) SuggestedActionType() string { + return TypeSuggestedActionSetProfilePhoto +} + // Suggests the user to extend their expiring Telegram Premium subscription type SuggestedActionExtendPremium struct { meta @@ -51187,7 +52025,7 @@ func (*VectorPathCommandLine) VectorPathCommandType() string { return TypeVectorPathCommandLine } -// A cubic Bézier curve to a given point +// A cubic Bézier curve to a given point type VectorPathCommandCubicBezierCurve struct { meta // The start control point of the curve diff --git a/client/unmarshaler.go b/client/unmarshaler.go index ec11136..4d60653 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -693,6 +693,43 @@ func UnmarshalListOfStarSubscriptionType(dataList []json.RawMessage) ([]StarSubs return list, nil } +func UnmarshalAffiliateType(data json.RawMessage) (AffiliateType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeAffiliateTypeCurrentUser: + return UnmarshalAffiliateTypeCurrentUser(data) + + case TypeAffiliateTypeBot: + return UnmarshalAffiliateTypeBot(data) + + case TypeAffiliateTypeChannel: + return UnmarshalAffiliateTypeChannel(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfAffiliateType(dataList []json.RawMessage) ([]AffiliateType, error) { + list := []AffiliateType{} + + for _, data := range dataList { + entity, err := UnmarshalAffiliateType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalAffiliateProgramSortOrder(data json.RawMessage) (AffiliateProgramSortOrder, error) { var meta meta @@ -730,6 +767,40 @@ func UnmarshalListOfAffiliateProgramSortOrder(dataList []json.RawMessage) ([]Aff return list, nil } +func UnmarshalSentGift(data json.RawMessage) (SentGift, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeSentGiftRegular: + return UnmarshalSentGiftRegular(data) + + case TypeSentGiftUpgraded: + return UnmarshalSentGiftUpgraded(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfSentGift(dataList []json.RawMessage) ([]SentGift, error) { + list := []SentGift{} + + for _, data := range dataList { + entity, err := UnmarshalSentGift(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalStarTransactionDirection(data json.RawMessage) (StarTransactionDirection, error) { var meta meta @@ -833,9 +904,15 @@ func UnmarshalStarTransactionType(data json.RawMessage) (StarTransactionType, er case TypeStarTransactionTypeGiftPurchase: return UnmarshalStarTransactionTypeGiftPurchase(data) + case TypeStarTransactionTypeGiftTransfer: + return UnmarshalStarTransactionTypeGiftTransfer(data) + case TypeStarTransactionTypeGiftSale: return UnmarshalStarTransactionTypeGiftSale(data) + case TypeStarTransactionTypeGiftUpgrade: + return UnmarshalStarTransactionTypeGiftUpgrade(data) + case TypeStarTransactionTypeChannelPaidReactionSend: return UnmarshalStarTransactionTypeChannelPaidReactionSend(data) @@ -3341,6 +3418,12 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessageGift: return UnmarshalMessageGift(data) + case TypeMessageUpgradedGift: + return UnmarshalMessageUpgradedGift(data) + + case TypeMessageRefundedUpgradedGift: + return UnmarshalMessageRefundedUpgradedGift(data) + case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) @@ -3753,6 +3836,43 @@ func UnmarshalListOfSearchMessagesFilter(dataList []json.RawMessage) ([]SearchMe return list, nil } +func UnmarshalSearchMessagesChatTypeFilter(data json.RawMessage) (SearchMessagesChatTypeFilter, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeSearchMessagesChatTypeFilterPrivate: + return UnmarshalSearchMessagesChatTypeFilterPrivate(data) + + case TypeSearchMessagesChatTypeFilterGroup: + return UnmarshalSearchMessagesChatTypeFilterGroup(data) + + case TypeSearchMessagesChatTypeFilterChannel: + return UnmarshalSearchMessagesChatTypeFilterChannel(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfSearchMessagesChatTypeFilter(dataList []json.RawMessage) ([]SearchMessagesChatTypeFilter, error) { + list := []SearchMessagesChatTypeFilter{} + + for _, data := range dataList { + entity, err := UnmarshalSearchMessagesChatTypeFilter(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalChatAction(data json.RawMessage) (ChatAction, error) { var meta meta @@ -4346,6 +4466,9 @@ func UnmarshalCallDiscardReason(data json.RawMessage) (CallDiscardReason, error) case TypeCallDiscardReasonHungUp: return UnmarshalCallDiscardReasonHungUp(data) + case TypeCallDiscardReasonAllowGroupCall: + return UnmarshalCallDiscardReasonAllowGroupCall(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -6081,6 +6204,9 @@ func UnmarshalPushMessageContent(data json.RawMessage) (PushMessageContent, erro case TypePushMessageContentGift: return UnmarshalPushMessageContentGift(data) + case TypePushMessageContentUpgradedGift: + return UnmarshalPushMessageContentUpgradedGift(data) + case TypePushMessageContentScreenshotTaken: return UnmarshalPushMessageContentScreenshotTaken(data) @@ -7333,6 +7459,9 @@ func UnmarshalSuggestedAction(data json.RawMessage) (SuggestedAction, error) { case TypeSuggestedActionSetBirthdate: return UnmarshalSuggestedActionSetBirthdate(data) + case TypeSuggestedActionSetProfilePhoto: + return UnmarshalSuggestedActionSetProfilePhoto(data) + case TypeSuggestedActionExtendPremium: return UnmarshalSuggestedActionExtendPremium(data) @@ -9078,6 +9207,30 @@ func UnmarshalBotMenuButton(data json.RawMessage) (*BotMenuButton, error) { return &resp, err } +func UnmarshalBotVerificationParameters(data json.RawMessage) (*BotVerificationParameters, error) { + var resp BotVerificationParameters + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBotVerification(data json.RawMessage) (*BotVerification, error) { + var resp BotVerification + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalVerificationStatus(data json.RawMessage) (*VerificationStatus, error) { + var resp VerificationStatus + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatLocation(data json.RawMessage) (*ChatLocation, error) { var resp ChatLocation @@ -9382,6 +9535,30 @@ func UnmarshalStarSubscriptions(data json.RawMessage) (*StarSubscriptions, error return &resp, err } +func UnmarshalAffiliateTypeCurrentUser(data json.RawMessage) (*AffiliateTypeCurrentUser, error) { + var resp AffiliateTypeCurrentUser + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAffiliateTypeBot(data json.RawMessage) (*AffiliateTypeBot, error) { + var resp AffiliateTypeBot + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAffiliateTypeChannel(data json.RawMessage) (*AffiliateTypeChannel, error) { + var resp AffiliateTypeChannel + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalAffiliateProgramSortOrderProfitability(data json.RawMessage) (*AffiliateProgramSortOrderProfitability, error) { var resp AffiliateProgramSortOrderProfitability @@ -9446,16 +9623,16 @@ func UnmarshalFoundAffiliatePrograms(data json.RawMessage) (*FoundAffiliateProgr return &resp, err } -func UnmarshalChatAffiliateProgram(data json.RawMessage) (*ChatAffiliateProgram, error) { - var resp ChatAffiliateProgram +func UnmarshalConnectedAffiliateProgram(data json.RawMessage) (*ConnectedAffiliateProgram, error) { + var resp ConnectedAffiliateProgram err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalChatAffiliatePrograms(data json.RawMessage) (*ChatAffiliatePrograms, error) { - var resp ChatAffiliatePrograms +func UnmarshalConnectedAffiliatePrograms(data json.RawMessage) (*ConnectedAffiliatePrograms, error) { + var resp ConnectedAffiliatePrograms err := json.Unmarshal(data, &resp) @@ -9550,6 +9727,38 @@ func UnmarshalStarGiveawayPaymentOptions(data json.RawMessage) (*StarGiveawayPay return &resp, err } +func UnmarshalUpgradedGiftModel(data json.RawMessage) (*UpgradedGiftModel, error) { + var resp UpgradedGiftModel + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftSymbol(data json.RawMessage) (*UpgradedGiftSymbol, error) { + var resp UpgradedGiftSymbol + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftBackdrop(data json.RawMessage) (*UpgradedGiftBackdrop, error) { + var resp UpgradedGiftBackdrop + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftOriginalDetails(data json.RawMessage) (*UpgradedGiftOriginalDetails, error) { + var resp UpgradedGiftOriginalDetails + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalGift(data json.RawMessage) (*Gift, error) { var resp Gift @@ -9566,6 +9775,38 @@ func UnmarshalGifts(data json.RawMessage) (*Gifts, error) { return &resp, err } +func UnmarshalUpgradedGift(data json.RawMessage) (*UpgradedGift, error) { + var resp UpgradedGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradeGiftResult(data json.RawMessage) (*UpgradeGiftResult, error) { + var resp UpgradeGiftResult + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSentGiftRegular(data json.RawMessage) (*SentGiftRegular, error) { + var resp SentGiftRegular + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSentGiftUpgraded(data json.RawMessage) (*SentGiftUpgraded, error) { + var resp SentGiftUpgraded + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUserGift(data json.RawMessage) (*UserGift, error) { var resp UserGift @@ -9582,6 +9823,14 @@ func UnmarshalUserGifts(data json.RawMessage) (*UserGifts, error) { return &resp, err } +func UnmarshalGiftUpgradePreview(data json.RawMessage) (*GiftUpgradePreview, error) { + var resp GiftUpgradePreview + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarTransactionDirectionIncoming(data json.RawMessage) (*StarTransactionDirectionIncoming, error) { var resp StarTransactionDirectionIncoming @@ -9758,6 +10007,14 @@ func UnmarshalStarTransactionTypeGiftPurchase(data json.RawMessage) (*StarTransa return &resp, err } +func UnmarshalStarTransactionTypeGiftTransfer(data json.RawMessage) (*StarTransactionTypeGiftTransfer, error) { + var resp StarTransactionTypeGiftTransfer + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarTransactionTypeGiftSale(data json.RawMessage) (*StarTransactionTypeGiftSale, error) { var resp StarTransactionTypeGiftSale @@ -9766,6 +10023,14 @@ func UnmarshalStarTransactionTypeGiftSale(data json.RawMessage) (*StarTransactio return &resp, err } +func UnmarshalStarTransactionTypeGiftUpgrade(data json.RawMessage) (*StarTransactionTypeGiftUpgrade, error) { + var resp StarTransactionTypeGiftUpgrade + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarTransactionTypeChannelPaidReactionSend(data json.RawMessage) (*StarTransactionTypeChannelPaidReactionSend, error) { var resp StarTransactionTypeChannelPaidReactionSend @@ -11054,6 +11319,14 @@ func UnmarshalChatFolderIcon(data json.RawMessage) (*ChatFolderIcon, error) { return &resp, err } +func UnmarshalChatFolderName(data json.RawMessage) (*ChatFolderName, error) { + var resp ChatFolderName + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatFolder(data json.RawMessage) (*ChatFolder, error) { var resp ChatFolder @@ -13838,6 +14111,22 @@ func UnmarshalMessageGift(data json.RawMessage) (*MessageGift, error) { return &resp, err } +func UnmarshalMessageUpgradedGift(data json.RawMessage) (*MessageUpgradedGift, error) { + var resp MessageUpgradedGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageRefundedUpgradedGift(data json.RawMessage) (*MessageRefundedUpgradedGift, error) { + var resp MessageRefundedUpgradedGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageContactRegistered(data json.RawMessage) (*MessageContactRegistered, error) { var resp MessageContactRegistered @@ -14478,6 +14767,30 @@ func UnmarshalSearchMessagesFilterPinned(data json.RawMessage) (*SearchMessagesF return &resp, err } +func UnmarshalSearchMessagesChatTypeFilterPrivate(data json.RawMessage) (*SearchMessagesChatTypeFilterPrivate, error) { + var resp SearchMessagesChatTypeFilterPrivate + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSearchMessagesChatTypeFilterGroup(data json.RawMessage) (*SearchMessagesChatTypeFilterGroup, error) { + var resp SearchMessagesChatTypeFilterGroup + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSearchMessagesChatTypeFilterChannel(data json.RawMessage) (*SearchMessagesChatTypeFilterChannel, error) { + var resp SearchMessagesChatTypeFilterChannel + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatActionTyping(data json.RawMessage) (*ChatActionTyping, error) { var resp ChatActionTyping @@ -15318,6 +15631,14 @@ func UnmarshalCallDiscardReasonHungUp(data json.RawMessage) (*CallDiscardReasonH return &resp, err } +func UnmarshalCallDiscardReasonAllowGroupCall(data json.RawMessage) (*CallDiscardReasonAllowGroupCall, error) { + var resp CallDiscardReasonAllowGroupCall + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalCallProtocol(data json.RawMessage) (*CallProtocol, error) { var resp CallProtocol @@ -17838,6 +18159,14 @@ func UnmarshalPushMessageContentGift(data json.RawMessage) (*PushMessageContentG return &resp, err } +func UnmarshalPushMessageContentUpgradedGift(data json.RawMessage) (*PushMessageContentUpgradedGift, error) { + var resp PushMessageContentUpgradedGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPushMessageContentScreenshotTaken(data json.RawMessage) (*PushMessageContentScreenshotTaken, error) { var resp PushMessageContentScreenshotTaken @@ -19814,6 +20143,14 @@ func UnmarshalSuggestedActionSetBirthdate(data json.RawMessage) (*SuggestedActio return &resp, err } +func UnmarshalSuggestedActionSetProfilePhoto(data json.RawMessage) (*SuggestedActionSetProfilePhoto, error) { + var resp SuggestedActionSetProfilePhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalSuggestedActionExtendPremium(data json.RawMessage) (*SuggestedActionExtendPremium, error) { var resp SuggestedActionExtendPremium @@ -21895,6 +22232,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeBotMenuButton: return UnmarshalBotMenuButton(data) + case TypeBotVerificationParameters: + return UnmarshalBotVerificationParameters(data) + + case TypeBotVerification: + return UnmarshalBotVerification(data) + + case TypeVerificationStatus: + return UnmarshalVerificationStatus(data) + case TypeChatLocation: return UnmarshalChatLocation(data) @@ -22009,6 +22355,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarSubscriptions: return UnmarshalStarSubscriptions(data) + case TypeAffiliateTypeCurrentUser: + return UnmarshalAffiliateTypeCurrentUser(data) + + case TypeAffiliateTypeBot: + return UnmarshalAffiliateTypeBot(data) + + case TypeAffiliateTypeChannel: + return UnmarshalAffiliateTypeChannel(data) + case TypeAffiliateProgramSortOrderProfitability: return UnmarshalAffiliateProgramSortOrderProfitability(data) @@ -22033,11 +22388,11 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeFoundAffiliatePrograms: return UnmarshalFoundAffiliatePrograms(data) - case TypeChatAffiliateProgram: - return UnmarshalChatAffiliateProgram(data) + case TypeConnectedAffiliateProgram: + return UnmarshalConnectedAffiliateProgram(data) - case TypeChatAffiliatePrograms: - return UnmarshalChatAffiliatePrograms(data) + case TypeConnectedAffiliatePrograms: + return UnmarshalConnectedAffiliatePrograms(data) case TypeProductInfo: return UnmarshalProductInfo(data) @@ -22072,18 +22427,45 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarGiveawayPaymentOptions: return UnmarshalStarGiveawayPaymentOptions(data) + case TypeUpgradedGiftModel: + return UnmarshalUpgradedGiftModel(data) + + case TypeUpgradedGiftSymbol: + return UnmarshalUpgradedGiftSymbol(data) + + case TypeUpgradedGiftBackdrop: + return UnmarshalUpgradedGiftBackdrop(data) + + case TypeUpgradedGiftOriginalDetails: + return UnmarshalUpgradedGiftOriginalDetails(data) + case TypeGift: return UnmarshalGift(data) case TypeGifts: return UnmarshalGifts(data) + case TypeUpgradedGift: + return UnmarshalUpgradedGift(data) + + case TypeUpgradeGiftResult: + return UnmarshalUpgradeGiftResult(data) + + case TypeSentGiftRegular: + return UnmarshalSentGiftRegular(data) + + case TypeSentGiftUpgraded: + return UnmarshalSentGiftUpgraded(data) + case TypeUserGift: return UnmarshalUserGift(data) case TypeUserGifts: return UnmarshalUserGifts(data) + case TypeGiftUpgradePreview: + return UnmarshalGiftUpgradePreview(data) + case TypeStarTransactionDirectionIncoming: return UnmarshalStarTransactionDirectionIncoming(data) @@ -22150,9 +22532,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarTransactionTypeGiftPurchase: return UnmarshalStarTransactionTypeGiftPurchase(data) + case TypeStarTransactionTypeGiftTransfer: + return UnmarshalStarTransactionTypeGiftTransfer(data) + case TypeStarTransactionTypeGiftSale: return UnmarshalStarTransactionTypeGiftSale(data) + case TypeStarTransactionTypeGiftUpgrade: + return UnmarshalStarTransactionTypeGiftUpgrade(data) + case TypeStarTransactionTypeChannelPaidReactionSend: return UnmarshalStarTransactionTypeChannelPaidReactionSend(data) @@ -22636,6 +23024,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatFolderIcon: return UnmarshalChatFolderIcon(data) + case TypeChatFolderName: + return UnmarshalChatFolderName(data) + case TypeChatFolder: return UnmarshalChatFolder(data) @@ -23680,6 +24071,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageGift: return UnmarshalMessageGift(data) + case TypeMessageUpgradedGift: + return UnmarshalMessageUpgradedGift(data) + + case TypeMessageRefundedUpgradedGift: + return UnmarshalMessageRefundedUpgradedGift(data) + case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) @@ -23920,6 +24317,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSearchMessagesFilterPinned: return UnmarshalSearchMessagesFilterPinned(data) + case TypeSearchMessagesChatTypeFilterPrivate: + return UnmarshalSearchMessagesChatTypeFilterPrivate(data) + + case TypeSearchMessagesChatTypeFilterGroup: + return UnmarshalSearchMessagesChatTypeFilterGroup(data) + + case TypeSearchMessagesChatTypeFilterChannel: + return UnmarshalSearchMessagesChatTypeFilterChannel(data) + case TypeChatActionTyping: return UnmarshalChatActionTyping(data) @@ -24235,6 +24641,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeCallDiscardReasonHungUp: return UnmarshalCallDiscardReasonHungUp(data) + case TypeCallDiscardReasonAllowGroupCall: + return UnmarshalCallDiscardReasonAllowGroupCall(data) + case TypeCallProtocol: return UnmarshalCallProtocol(data) @@ -25180,6 +25589,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePushMessageContentGift: return UnmarshalPushMessageContentGift(data) + case TypePushMessageContentUpgradedGift: + return UnmarshalPushMessageContentUpgradedGift(data) + case TypePushMessageContentScreenshotTaken: return UnmarshalPushMessageContentScreenshotTaken(data) @@ -25921,6 +26333,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSuggestedActionSetBirthdate: return UnmarshalSuggestedActionSetBirthdate(data) + case TypeSuggestedActionSetProfilePhoto: + return UnmarshalSuggestedActionSetProfilePhoto(data) + case TypeSuggestedActionExtendPremium: return UnmarshalSuggestedActionExtendPremium(data) diff --git a/data/td_api.tl b/data/td_api.tl index 1512e66..9a83811 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -608,6 +608,27 @@ botCommands bot_user_id:int53 commands:vector = BotCommands; botMenuButton text:string url:string = BotMenuButton; +//@description Describes parameters of verification that is provided by a bot +//@icon_custom_emoji_id Identifier of the custom emoji that is used as the verification sign +//@organization_name Name of the organization that provides verification +//@default_custom_description Default custom description of verification reason to be used as placeholder in setMessageSenderBotVerification; may be null if none +//@can_set_custom_description True, if the bot is allowed to provide custom description for verified entities +botVerificationParameters icon_custom_emoji_id:int64 organization_name:string default_custom_description:formattedText can_set_custom_description:Bool = BotVerificationParameters; + +//@description Describes verification status provided by a bot +//@bot_user_id Identifier of the bot that provided the verification +//@icon_custom_emoji_id Identifier of the custom emoji that is used as the verification sign +//@custom_description Custom description of verification reason set by the bot +botVerification bot_user_id:int53 icon_custom_emoji_id:int64 custom_description:formattedText = BotVerification; + +//@description Contains information about verification status of a chat or a user +//@is_verified True, if the chat or the user is verified by Telegram +//@is_scam True, if the chat or the user is marked as scam by Telegram +//@is_fake True, if the chat or the user is marked as fake by Telegram +//@bot_verification_icon_custom_emoji_id Identifier of the custom emoji to be shown as verification sign provided by a bot for the user; 0 if none +verificationStatus is_verified:Bool is_scam:Bool is_fake:Bool bot_verification_icon_custom_emoji_id:int64 = VerificationStatus; + + //@description Represents a location to which a chat is connected @location The location @address Location address; 1-64 characters, as defined by the chat owner chatLocation location:location address:string = ChatLocation; @@ -857,6 +878,18 @@ starSubscription id:string chat_id:int53 expiration_date:int32 is_canceled:Bool starSubscriptions star_amount:starAmount subscriptions:vector required_star_count:int53 next_offset:string = StarSubscriptions; +//@class AffiliateType @description Describes type of affiliate for an affiliate program + +//@description The affiliate is the current user +affiliateTypeCurrentUser = AffiliateType; + +//@description The affiliate is a bot owned by the current user @user_id User identifier of the bot +affiliateTypeBot user_id:int53 = AffiliateType; + +//@description The affiliate is a channel chat where the current user has can_post_messages administrator right @chat_id Identifier of the channel chat +affiliateTypeChannel chat_id:int53 = AffiliateType; + + //@class AffiliateProgramSortOrder @description Describes the order of the found affiliate programs //@description The affiliate programs must be sorted by the profitability @@ -878,7 +911,7 @@ affiliateProgramParameters commission_per_mille:int32 month_count:int32 = Affili //@description Contains information about an active affiliate program //@parameters Parameters of the affiliate program //@end_date Point in time (Unix timestamp) when the affiliate program will be closed; 0 if the affiliate program isn't scheduled to be closed. -//-If positive, then the program can't be connected using connectChatAffiliateProgram, but active connections will work until the date +//-If positive, then the program can't be connected using connectAffiliateProgram, but active connections will work until the date //@daily_revenue_per_user_amount The amount of daily revenue per user in Telegram Stars of the bot that created the affiliate program affiliateProgramInfo parameters:affiliateProgramParameters end_date:int32 daily_revenue_per_user_amount:starAmount = AffiliateProgramInfo; @@ -890,8 +923,8 @@ affiliateInfo commission_per_mille:int32 affiliate_chat_id:int53 star_amount:sta //@description Describes a found affiliate program //@bot_user_id User identifier of the bot created the program -//@parameters Information about the affiliate program -foundAffiliateProgram bot_user_id:int53 parameters:affiliateProgramInfo = FoundAffiliateProgram; +//@info Information about the affiliate program +foundAffiliateProgram bot_user_id:int53 info:affiliateProgramInfo = FoundAffiliateProgram; //@description Represents a list of found affiliate programs //@total_count The total number of found affiliate programs @@ -899,7 +932,7 @@ foundAffiliateProgram bot_user_id:int53 parameters:affiliateProgramInfo = FoundA //@next_offset The offset for the next request. If empty, then there are no more results foundAffiliatePrograms total_count:int32 programs:vector next_offset:string = FoundAffiliatePrograms; -//@description Describes an affiliate program that was connected to a chat +//@description Describes an affiliate program that was connected to an affiliate //@url The link that can be used to refer users if the program is still active //@bot_user_id User identifier of the bot created the program //@parameters The parameters of the affiliate program @@ -907,13 +940,13 @@ foundAffiliatePrograms total_count:int32 programs:vector //@is_disconnected True, if the program was canceled by the bot, or disconnected by the chat owner and isn't available anymore //@user_count The number of users that used the affiliate program //@revenue_star_count The number of Telegram Stars that were earned by the affiliate program -chatAffiliateProgram url:string bot_user_id:int53 parameters:affiliateProgramParameters connection_date:int32 is_disconnected:Bool user_count:int64 revenue_star_count:int64 = ChatAffiliateProgram; +connectedAffiliateProgram url:string bot_user_id:int53 parameters:affiliateProgramParameters connection_date:int32 is_disconnected:Bool user_count:int64 revenue_star_count:int64 = ConnectedAffiliateProgram; -//@description Represents a list of affiliate programs that were connected to a chat -//@total_count The total number of affiliate programs that were connected to the chat +//@description Represents a list of affiliate programs that were connected to an affiliate +//@total_count The total number of affiliate programs that were connected to the affiliate //@programs The list of connected affiliate programs //@next_offset The offset for the next request. If empty, then there are no more results -chatAffiliatePrograms total_count:int32 programs:vector next_offset:string = ChatAffiliatePrograms; +connectedAffiliatePrograms total_count:int32 programs:vector next_offset:string = ConnectedAffiliatePrograms; //@description Contains information about a product that can be paid with invoice @@ -994,31 +1027,98 @@ starGiveawayPaymentOption currency:string amount:int53 star_count:int53 store_pr //@description Contains a list of options for creating Telegram Star giveaway @options The list of options starGiveawayPaymentOptions options:vector = StarGiveawayPaymentOptions; + +//@description Describes a model of an upgraded gift +//@name Name of the model +//@sticker The sticker representing the upgraded gift +//@rarity_per_mille The number of upgraded gift that receive this model for each 1000 gifts upgraded +upgradedGiftModel name:string sticker:sticker rarity_per_mille:int32 = UpgradedGiftModel; + +//@description Describes a symbol shown on the pattern of an upgraded gift +//@name Name of the symbol +//@sticker The sticker representing the upgraded gift +//@rarity_per_mille The number of upgraded gift that receive this symbol for each 1000 gifts upgraded +upgradedGiftSymbol name:string sticker:sticker rarity_per_mille:int32 = UpgradedGiftSymbol; + +//@description Describes a backdrop of an upgraded gift +//@name Name of the backdrop +//@center_color A color in the center of the backdrop in the RGB format +//@edge_color A color on the edges of the backdrop in the RGB format +//@symbol_color A color to be applied for the symbol in the RGB format +//@text_color A color for the text on the backdrop in the RGB format +//@rarity_per_mille The number of upgraded gift that receive this backdrop for each 1000 gifts upgraded +upgradedGiftBackdrop name:string center_color:int32 edge_color:int32 symbol_color:int32 text_color:int32 rarity_per_mille:int32 = UpgradedGiftBackdrop; + +//@description Describes the original details about the gift +//@sender_user_id Identifier of the user that sent the gift; 0 if the gift was private +//@receiver_user_id Identifier of the user that received the gift +//@text Message added to the gift +//@date Point in time (Unix timestamp) when the gift was sent +upgradedGiftOriginalDetails sender_user_id:int53 receiver_user_id:int53 text:formattedText date:int32 = UpgradedGiftOriginalDetails; + //@description Describes a gift that can be sent to another user //@id Unique identifier of the gift //@sticker The sticker representing the gift //@star_count Number of Telegram Stars that must be paid for the gift -//@default_sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the gift by default. If the gift was paid with just bought Telegram Stars, then full value can be claimed +//@default_sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the regular gift by default. If the gift was paid with just bought Telegram Stars, then full value can be claimed +//@upgrade_star_count Number of Telegram Stars that must be paid to upgrade the gift; 0 if upgrade isn't possible //@is_for_birthday True, if the gift is a birthday gift //@remaining_count Number of remaining times the gift can be purchased by all users; 0 if not limited or the gift was sold out //@total_count Number of total times the gift can be purchased by all users; 0 if not limited //@first_send_date Point in time (Unix timestamp) when the gift was send for the first time; for sold out gifts only //@last_send_date Point in time (Unix timestamp) when the gift was send for the last time; for sold out gifts only -gift id:int64 sticker:sticker star_count:int53 default_sell_star_count:int53 is_for_birthday:Bool remaining_count:int32 total_count:int32 first_send_date:int32 last_send_date:int32 = Gift; +gift id:int64 sticker:sticker star_count:int53 default_sell_star_count:int53 upgrade_star_count:int53 is_for_birthday:Bool remaining_count:int32 total_count:int32 first_send_date:int32 last_send_date:int32 = Gift; //@description Contains a list of gifts that can be sent to another user @gifts The list of gifts gifts gifts:vector = Gifts; +//@description Describes an upgraded gift that can be gifted to another user or transferred to TON blockchain as an NFT +//@id Unique identifier of the gift +//@title The title of the upgraded gift +//@number Unique number of the upgraded gift among gifts upgraded from the same gift +//@total_upgraded_count Total number of gifts that were upgraded from the same gift +//@max_upgraded_count The maximum number of gifts that can be upgraded from the same gift +//@owner_user_id User identifier of the user that owns the upgraded gift; 0 if none +//@model Model of the upgraded gift +//@symbol Symbol of the upgraded gift +//@backdrop Backdrop of the upgraded gift +//@original_details Information about the originally sent gift; may be null if unknown +upgradedGift id:int64 title:string number:int32 total_upgraded_count:int32 max_upgraded_count:int32 owner_user_id:int53 model:upgradedGiftModel symbol:upgradedGiftSymbol backdrop:upgradedGiftBackdrop original_details:upgradedGiftOriginalDetails = UpgradedGift; + +//@description Contains result of gift upgrading +//@gift The upgraded gift +//@is_saved True, if the gift is displayed on the user's profile page +//@can_be_transferred True, if the gift can be transferred to another user +//@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift +//@export_date Point in time (Unix timestamp) when the gift can be transferred to TON blockchain as an NFT +upgradeGiftResult gift:upgradedGift is_saved:Bool can_be_transferred:Bool transfer_star_count:int53 export_date:int32 = UpgradeGiftResult; + + +//@class SentGift @description Represents a gift received by a user + +//@description Regular gift @gift The gift +sentGiftRegular gift:gift = SentGift; + +//@description Upgraded gift @gift The gift +sentGiftUpgraded gift:upgradedGift = SentGift; + + //@description Represents a gift received by a user //@sender_user_id Identifier of the user that sent the gift; 0 if unknown //@text Message added to the gift //@is_private True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone are able to see them -//@is_saved True, if the gift is displayed on the user's profile page; may be false only for the receiver of the gift +//@is_saved True, if the gift is displayed on the user's profile page; only for the receiver of the gift +//@can_be_upgraded True, if the gift is a regular gift that can be upgraded to a unique gift; only for the receiver of the gift +//@can_be_transferred True, if the gift is an upgraded gift that can be transferred to another user; only for the receiver of the gift +//@was_refunded True, if the gift was refunded and isn't available anymore //@date Point in time (Unix timestamp) when the gift was sent //@gift The gift -//@message_id Identifier of the message with the gift in the chat with the sender of the gift; can be 0 or an identifier of a deleted message; only for the gift receiver -//@sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the gift; 0 if the gift can't be sold by the current user -userGift sender_user_id:int53 text:formattedText is_private:Bool is_saved:Bool date:int32 gift:gift message_id:int53 sell_star_count:int53 = UserGift; +//@message_id Identifier of the message with the gift in the chat with the sender of the gift; can be 0 or an identifier of a deleted message; only for the receiver of the gift +//@sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the regular gift; 0 if the gift can't be sold by the current user +//@prepaid_upgrade_star_count Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift +//@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift +//@export_date Point in time (Unix timestamp) when the upgraded gift can be transferred to TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift +userGift sender_user_id:int53 text:formattedText is_private:Bool is_saved:Bool can_be_upgraded:Bool can_be_transferred:Bool was_refunded:Bool date:int32 gift:SentGift message_id:int53 sell_star_count:int53 prepaid_upgrade_star_count:int53 transfer_star_count:int53 export_date:int32 = UserGift; //@description Represents a list of gifts received by a user //@total_count The total number of received gifts @@ -1026,6 +1126,12 @@ userGift sender_user_id:int53 text:formattedText is_private:Bool is_saved:Bool d //@next_offset The offset for the next request. If empty, then there are no more results userGifts total_count:int32 gifts:vector next_offset:string = UserGifts; +//@description Contains examples of possible upgraded gifts for the given regular gift +//@models Examples of possible models that can be chosen for the gift after upgrade +//@symbols Examples of possible symbols that can be chosen for the gift after upgrade +//@backdrops Examples of possible backdrops that can be chosen for the gift after upgrade +giftUpgradePreview models:vector symbols:vector backdrops:vector = GiftUpgradePreview; + //@class StarTransactionDirection @description Describes direction of a transaction with Telegram Stars @@ -1129,12 +1235,18 @@ starTransactionTypeChannelSubscriptionPurchase chat_id:int53 subscription_period //@subscription_period The number of seconds between consecutive Telegram Star debitings starTransactionTypeChannelSubscriptionSale user_id:int53 subscription_period:int32 = StarTransactionType; -//@description The transaction is a purchase of a gift to another user; for regular users and bots only @user_id Identifier of the user that received the gift @gift The gift +//@description The transaction is a purchase of a regular gift to another user; for regular users and bots only @user_id Identifier of the user that received the gift @gift The gift starTransactionTypeGiftPurchase user_id:int53 gift:gift = StarTransactionType; +//@description The transaction is a transfer of an upgraded gift to another user; for regular users only @user_id Identifier of the user that received the gift @gift The gift +starTransactionTypeGiftTransfer user_id:int53 gift:upgradedGift = StarTransactionType; + //@description The transaction is a sale of a gift received from another user or bot; for regular users only @user_id Identifier of the user that sent the gift @gift The gift starTransactionTypeGiftSale user_id:int53 gift:gift = StarTransactionType; +//@description The transaction is an upgrade of a gift; for regular users only @gift The upgraded gift +starTransactionTypeGiftUpgrade gift:upgradedGift = StarTransactionType; + //@description The transaction is a sending of a paid reaction to a message in a channel chat by the current user; for regular users only //@chat_id Identifier of the channel chat //@message_id Identifier of the reacted message; can be 0 or an identifier of a deleted message @@ -1272,12 +1384,10 @@ usernames active_usernames:vector disabled_usernames:vector edit //@is_contact The user is a contact of the current user //@is_mutual_contact The user is a contact of the current user and the current user is a contact of the user //@is_close_friend The user is a close friend of the current user; implies that the user is a contact -//@is_verified True, if the user is verified +//@verification_status Information about verification status of the user; may be null if none //@is_premium True, if the user is a Telegram Premium user //@is_support True, if the user is Telegram support account //@restriction_reason If non-empty, it contains a human-readable description of the reason why access to this user must be restricted -//@is_scam True, if many users reported this user as a scam -//@is_fake True, if many users reported this user as a fake account //@has_active_stories True, if the user has non-expired stories available to the current user //@has_unread_active_stories True, if the user has unread non-expired stories available to the current user //@restricts_new_chats True, if the user may restrict new chats with non-contacts. Use canSendMessageToUser to check whether the current user can message the user or try to create a chat with them @@ -1285,7 +1395,7 @@ usernames active_usernames:vector disabled_usernames:vector edit //@type Type of the user //@language_code IETF language tag of the user's language; only available to bots //@added_to_attachment_menu True, if the user added the current bot to attachment menu; only available to bots -user id:int53 access_hash:int64 first_name:string last_name:string usernames:usernames phone_number:string status:UserStatus profile_photo:profilePhoto accent_color_id:int32 background_custom_emoji_id:int64 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 emoji_status:emojiStatus is_contact:Bool is_mutual_contact:Bool is_close_friend:Bool is_verified:Bool is_premium:Bool is_support:Bool restriction_reason:string is_scam:Bool is_fake:Bool has_active_stories:Bool has_unread_active_stories:Bool restricts_new_chats:Bool have_access:Bool type:UserType language_code:string added_to_attachment_menu:Bool = User; +user id:int53 access_hash:int64 first_name:string last_name:string usernames:usernames phone_number:string status:UserStatus profile_photo:profilePhoto accent_color_id:int32 background_custom_emoji_id:int64 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 emoji_status:emojiStatus is_contact:Bool is_mutual_contact:Bool is_close_friend:Bool verification_status:verificationStatus is_premium:Bool is_support:Bool restriction_reason:string has_active_stories:Bool has_unread_active_stories:Bool restricts_new_chats:Bool have_access:Bool type:UserType language_code:string added_to_attachment_menu:Bool = User; //@description Contains information about a bot @@ -1303,6 +1413,7 @@ user id:int53 access_hash:int64 first_name:string last_name:string usernames:use //@web_app_background_dark_color Default dark background color for bot Web Apps; -1 if not specified //@web_app_header_light_color Default light header color for bot Web Apps; -1 if not specified //@web_app_header_dark_color Default dark header color for bot Web Apps; -1 if not specified +//@verification_parameters Parameters of the verification that can be provided by the bot; may be null if none or the current user isn't the owner of the bot //@can_get_revenue_statistics True, if the bot's revenue statistics are available to the current user //@can_manage_emoji_status True, if the bot can manage emoji status of the current user //@has_media_previews True, if the bot has media previews @@ -1310,7 +1421,7 @@ user id:int53 access_hash:int64 first_name:string last_name:string usernames:use //@edit_description_link The internal link, which can be used to edit bot description; may be null //@edit_description_media_link The internal link, which can be used to edit the photo or animation shown in the chat with the bot if the chat is empty; may be null //@edit_settings_link The internal link, which can be used to edit bot settings; may be null -botInfo short_description:string description:string photo:photo animation:animation menu_button:botMenuButton commands:vector privacy_policy_url:string default_group_administrator_rights:chatAdministratorRights default_channel_administrator_rights:chatAdministratorRights affiliate_program:affiliateProgramInfo web_app_background_light_color:int32 web_app_background_dark_color:int32 web_app_header_light_color:int32 web_app_header_dark_color:int32 can_get_revenue_statistics:Bool can_manage_emoji_status:Bool has_media_previews:Bool edit_commands_link:InternalLinkType edit_description_link:InternalLinkType edit_description_media_link:InternalLinkType edit_settings_link:InternalLinkType = BotInfo; +botInfo short_description:string description:string photo:photo animation:animation menu_button:botMenuButton commands:vector privacy_policy_url:string default_group_administrator_rights:chatAdministratorRights default_channel_administrator_rights:chatAdministratorRights affiliate_program:affiliateProgramInfo web_app_background_light_color:int32 web_app_background_dark_color:int32 web_app_header_light_color:int32 web_app_header_dark_color:int32 verification_parameters:botVerificationParameters can_get_revenue_statistics:Bool can_manage_emoji_status:Bool has_media_previews:Bool edit_commands_link:InternalLinkType edit_description_link:InternalLinkType edit_description_media_link:InternalLinkType edit_settings_link:InternalLinkType = BotInfo; //@description Contains full information about a user //@personal_photo User profile photo set by the current user for the contact; may be null. If null and user.profile_photo is null, then the photo is empty; otherwise, it is unknown. @@ -1334,9 +1445,10 @@ botInfo short_description:string description:string photo:photo animation:animat //@personal_chat_id Identifier of the personal chat of the user; 0 if none //@gift_count Number of gifts saved to profile by the user //@group_in_common_count Number of group chats where both the other user and the current user are a member; 0 for the current user +//@bot_verification Information about verification status of the user provided by a bot; may be null if none or unknown //@business_info Information about business settings for Telegram Business accounts; may be null if none //@bot_info For bots, information about the bot; may be null if the user isn't a bot -userFullInfo personal_photo:chatPhoto photo:chatPhoto public_photo:chatPhoto block_list:BlockList can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool has_private_forwards:Bool has_restricted_voice_and_video_note_messages:Bool has_posted_to_profile_stories:Bool has_sponsored_messages_enabled:Bool need_phone_number_privacy_exception:Bool set_chat_background:Bool bio:formattedText birthdate:birthdate personal_chat_id:int53 gift_count:int32 group_in_common_count:int32 business_info:businessInfo bot_info:botInfo = UserFullInfo; +userFullInfo personal_photo:chatPhoto photo:chatPhoto public_photo:chatPhoto block_list:BlockList can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool has_private_forwards:Bool has_restricted_voice_and_video_note_messages:Bool has_posted_to_profile_stories:Bool has_sponsored_messages_enabled:Bool need_phone_number_privacy_exception:Bool set_chat_background:Bool bio:formattedText birthdate:birthdate personal_chat_id:int53 gift_count:int32 group_in_common_count:int32 bot_verification:botVerification business_info:businessInfo bot_info:botInfo = UserFullInfo; //@description Represents a list of users @total_count Approximate total number of users found @user_ids A list of user identifiers users total_count:int32 user_ids:vector = Users; @@ -1518,10 +1630,8 @@ chatInviteLinkSubscriptionInfo pricing:starSubscriptionPricing can_reuse:Bool fo //@subscription_info Information about subscription plan that must be paid by the user to use the link; may be null if the link doesn't require subscription //@creates_join_request True, if the link only creates join request //@is_public True, if the chat is a public supergroup or channel, i.e. it has a username or it is a location-based supergroup -//@is_verified True, if the chat is verified -//@is_scam True, if many users reported this chat as a scam -//@is_fake True, if many users reported this chat as a fake account -chatInviteLinkInfo chat_id:int53 accessible_for:int32 type:InviteLinkChatType title:string photo:chatPhotoInfo accent_color_id:int32 description:string member_count:int32 member_user_ids:vector subscription_info:chatInviteLinkSubscriptionInfo creates_join_request:Bool is_public:Bool is_verified:Bool is_scam:Bool is_fake:Bool = ChatInviteLinkInfo; +//@verification_status Information about verification status of the chat; may be null if none +chatInviteLinkInfo chat_id:int53 accessible_for:int32 type:InviteLinkChatType title:string photo:chatPhotoInfo accent_color_id:int32 description:string member_count:int32 member_user_ids:vector subscription_info:chatInviteLinkSubscriptionInfo creates_join_request:Bool is_public:Bool verification_status:verificationStatus = ChatInviteLinkInfo; //@description Describes a user that sent a join request and waits for administrator approval @user_id User identifier @date Point in time (Unix timestamp) when the user sent the join request @bio A short bio of the user @@ -1536,12 +1646,11 @@ chatJoinRequestsInfo total_count:int32 user_ids:vector = ChatJoinRequests //@description Represents a basic group of 0-200 users (must be upgraded to a supergroup to accommodate more than 200 users) //@id Group identifier -//@access_hash Group access hash //@member_count Number of members in the group //@status Status of the current user in the group //@is_active True, if the group is active //@upgraded_to_supergroup_id Identifier of the supergroup to which this group was upgraded; 0 if none -basicGroup id:int53 access_hash:int64 member_count:int32 status:ChatMemberStatus is_active:Bool upgraded_to_supergroup_id:int53 = BasicGroup; +basicGroup id:int53 member_count:int32 status:ChatMemberStatus is_active:Bool upgraded_to_supergroup_id:int53 = BasicGroup; //@description Contains full information about a basic group //@photo Chat photo; may be null if empty or unknown. If non-null, then it is the same photo as in chat.photo @@ -1578,14 +1687,12 @@ basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int53 memb //@is_channel True, if the supergroup is a channel //@is_broadcast_group True, if the supergroup is a broadcast group, i.e. only administrators can send messages and there is no limit on the number of members //@is_forum True, if the supergroup is a forum with topics -//@is_verified True, if the supergroup or channel is verified +//@verification_status Information about verification status of the supergroup or channel; may be null if none //@has_sensitive_content True, if content of media messages in the supergroup or channel chat must be hidden with 18+ spoiler //@restriction_reason If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted -//@is_scam True, if many users reported this supergroup or channel as a scam -//@is_fake True, if many users reported this supergroup or channel as a fake account //@has_active_stories True, if the supergroup or channel has non-expired stories available to the current user //@has_unread_active_stories True, if the supergroup or channel has unread non-expired stories available to the current user -supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 boost_level:int32 has_linked_chat:Bool has_location:Bool sign_messages:Bool show_message_sender:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool is_verified:Bool has_sensitive_content:Bool restriction_reason:string is_scam:Bool is_fake:Bool has_active_stories:Bool has_unread_active_stories:Bool = Supergroup; +supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 boost_level:int32 has_linked_chat:Bool has_location:Bool sign_messages:Bool show_message_sender:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool verification_status:verificationStatus has_sensitive_content:Bool restriction_reason:string has_active_stories:Bool has_unread_active_stories:Bool = Supergroup; //@description Contains full information about a supergroup or channel //@photo Chat photo; may be null if empty or unknown. If non-null, then it is the same photo as in chat.photo @@ -1620,9 +1727,10 @@ supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:Chat //@location Location to which the supergroup is connected; may be null if none //@invite_link Primary invite link for the chat; may be null. For chat administrators with can_invite_users right only //@bot_commands List of commands of bots in the group +//@bot_verification Information about verification status of the supergroup or the channel provided by a bot; may be null if none or unknown //@upgraded_from_basic_group_id Identifier of the basic group from which supergroup was upgraded; 0 if none //@upgraded_from_max_message_id Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none -supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_enable_paid_reaction:Bool can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_get_revenue_statistics:Bool can_get_star_revenue_statistics:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool can_have_sponsored_messages:Bool has_aggressive_anti_spam_enabled:Bool has_paid_media_allowed:Bool has_pinned_stories:Bool my_boost_count:int32 unrestrict_boost_count:int32 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; +supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_enable_paid_reaction:Bool can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_get_revenue_statistics:Bool can_get_star_revenue_statistics:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool can_have_sponsored_messages:Bool has_aggressive_anti_spam_enabled:Bool has_paid_media_allowed:Bool has_pinned_stories:Bool my_boost_count:int32 unrestrict_boost_count:int32 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector bot_verification:botVerification upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; //@class SecretChatState @description Describes the current secret chat state @@ -2140,8 +2248,13 @@ chatTypeSecret secret_chat_id:int32 user_id:int53 = ChatType; //-"Favorite", "Flower", "Game", "Home", "Love", "Mask", "Party", "Sport", "Study", "Trade", "Travel", "Work", "Airplane", "Book", "Light", "Like", "Money", "Note", "Palette" chatFolderIcon name:string = ChatFolderIcon; +//@description Describes name of a chat folder +//@text The text of the chat folder name; 1-12 characters without line feeds. May contain only CustomEmoji entities +//@animate_custom_emoji True, if custom emoji in the name must be animated +chatFolderName text:formattedText animate_custom_emoji:Bool = ChatFolderName; + //@description Represents a folder for user chats -//@title The title of the folder; 1-12 characters without line feeds +//@name The name of the folder //@icon The chosen icon for the chat folder; may be null. If null, use getChatFolderDefaultIconName to get default icon name for the folder //@color_id The identifier of the chosen color for the chat folder icon; from -1 to 6. If -1, then color is disabled. Can't be changed if folder tags are disabled or the current user doesn't have Telegram Premium subscription //@is_shareable True, if at least one link has been created for the folder @@ -2156,16 +2269,16 @@ chatFolderIcon name:string = ChatFolderIcon; //@include_bots True, if bots need to be included //@include_groups True, if basic groups and supergroups need to be included //@include_channels True, if channels need to be included -chatFolder title:string icon:chatFolderIcon color_id:int32 is_shareable:Bool pinned_chat_ids:vector included_chat_ids:vector excluded_chat_ids:vector exclude_muted:Bool exclude_read:Bool exclude_archived:Bool include_contacts:Bool include_non_contacts:Bool include_bots:Bool include_groups:Bool include_channels:Bool = ChatFolder; +chatFolder name:chatFolderName icon:chatFolderIcon color_id:int32 is_shareable:Bool pinned_chat_ids:vector included_chat_ids:vector excluded_chat_ids:vector exclude_muted:Bool exclude_read:Bool exclude_archived:Bool include_contacts:Bool include_non_contacts:Bool include_bots:Bool include_groups:Bool include_channels:Bool = ChatFolder; //@description Contains basic information about a chat folder //@id Unique chat folder identifier -//@title The title of the folder; 1-12 characters without line feeds +//@name The name of the folder //@icon The chosen or default icon for the chat folder //@color_id The identifier of the chosen color for the chat folder icon; from -1 to 6. If -1, then color is disabled //@is_shareable True, if at least one link has been created for the folder //@has_my_invite_links True, if the chat folder has invite links created by the current user -chatFolderInfo id:int32 title:string icon:chatFolderIcon color_id:int32 is_shareable:Bool has_my_invite_links:Bool = ChatFolderInfo; +chatFolderInfo id:int32 name:chatFolderName icon:chatFolderIcon color_id:int32 is_shareable:Bool has_my_invite_links:Bool = ChatFolderInfo; //@description Contains a chat folder invite link //@invite_link The chat folder invite link @@ -3890,14 +4003,33 @@ messageGiftedStars gifter_user_id:int53 receiver_user_id:int53 currency:string a //@sticker A sticker to be shown in the message; may be null if unknown messageGiveawayPrizeStars star_count:int53 transaction_id:string boosted_chat_id:int53 giveaway_message_id:int53 is_unclaimed:Bool sticker:sticker = MessageContent; -//@description A gift was received or sent by the current user +//@description A regular gift was received or sent by the current user //@gift The gift //@text Message added to the gift -//@sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the gift; 0 if the gift can't be sold by the receiver +//@sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the regular gift; 0 if the gift can't be sold by the receiver +//@prepaid_upgrade_star_count Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift //@is_private True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone will be able to see them //@is_saved True, if the gift is displayed on the user's profile page; only for the receiver of the gift +//@can_be_upgraded True, if the gift can be upgraded to a unique gift; only for the receiver of the gift //@was_converted True, if the gift was converted to Telegram Stars; only for the receiver of the gift -messageGift gift:gift text:formattedText sell_star_count:int53 is_private:Bool is_saved:Bool was_converted:Bool = MessageContent; +//@was_upgraded True, if the gift was upgraded to a unique gift +//@was_refunded True, if the gift was refunded and isn't available anymore +//@upgrade_message_id Identifier of the service message messageUpgradedGift or messageRefundedUpgradedGift with upgraded version of the gift; can be 0 if none or an identifier of a deleted message. +//-Use getUserGift to get information about the gift +messageGift gift:gift text:formattedText sell_star_count:int53 prepaid_upgrade_star_count:int53 is_private:Bool is_saved:Bool can_be_upgraded:Bool was_converted:Bool was_upgraded:Bool was_refunded:Bool upgrade_message_id:int53 = MessageContent; + +//@description An upgraded gift was received or sent by the current user +//@gift The gift +//@is_upgrade True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred gift +//@is_saved True, if the gift is displayed on the user's profile page; only for the receiver of the gift +//@can_be_transferred True, if the gift can be transferred to another user; only for the receiver of the gift +//@was_transferred True, if the gift was transferred to another user; only for the receiver of the gift +//@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift +//@export_date Point in time (Unix timestamp) when the gift can be transferred to TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift +messageUpgradedGift gift:upgradedGift is_upgrade:Bool is_saved:Bool can_be_transferred:Bool was_transferred:Bool transfer_star_count:int53 export_date:int32 = MessageContent; + +//@description A gift which purchase, upgrade or transfer were refunded @gift The gift @is_upgrade True, if the gift was obtained by upgrading of a previously received gift +messageRefundedUpgradedGift gift:gift is_upgrade:Bool = MessageContent; //@description A contact has registered with Telegram messageContactRegistered = MessageContent; @@ -4308,6 +4440,18 @@ searchMessagesFilterFailedToSend = SearchMessagesFilter; searchMessagesFilterPinned = SearchMessagesFilter; +//@class SearchMessagesChatTypeFilter @description Represents a filter for type of the chats in which to search messages + +//@description Returns only messages in private chats +searchMessagesChatTypeFilterPrivate = SearchMessagesChatTypeFilter; + +//@description Returns only messages in basic group and supergroup chats +searchMessagesChatTypeFilterGroup = SearchMessagesChatTypeFilter; + +//@description Returns only messages in channel chats +searchMessagesChatTypeFilterChannel = SearchMessagesChatTypeFilter; + + //@class ChatAction @description Describes the different types of activity in a chat //@description The user is typing a message @@ -4898,6 +5042,10 @@ callDiscardReasonDisconnected = CallDiscardReason; //@description The call was ended because one of the parties hung up callDiscardReasonHungUp = CallDiscardReason; +//@description The call was ended because it has been used successfully to transfer private encryption key for the associated group call +//@encrypted_group_call_key Encrypted using the call private key encryption key for the associated group call +callDiscardReasonAllowGroupCall encrypted_group_call_key:bytes = CallDiscardReason; + //@description Specifies the supported call protocols //@udp_p2p True, if UDP peer-to-peer connections are supported @@ -5088,7 +5236,8 @@ callProblemPixelatedVideo = CallProblem; //@is_outgoing True, if the call is outgoing //@is_video True, if the call is a video call //@state Call state -call id:int32 user_id:int53 is_outgoing:Bool is_video:Bool state:CallState = Call; +//@group_call_id Identifier of the group call associated with the call; 0 if the group call isn't created yet. The group call can be received through the method getGroupCall +call id:int32 user_id:int53 is_outgoing:Bool is_video:Bool state:CallState group_call_id:int32 = Call; //@class FirebaseAuthenticationSettings @description Contains settings for Firebase Authentication in the official applications @@ -5297,7 +5446,6 @@ inputInlineQueryResultAnimation id:string title:string thumbnail_url:string thum //@description Represents a link to an article or web page //@id Unique identifier of the query result //@url URL of the result, if it exists -//@hide_url True, if the URL must be not shown //@title Title of the result //@param_description A short description of the result //@thumbnail_url URL of the result thumbnail, if it exists @@ -5305,7 +5453,7 @@ inputInlineQueryResultAnimation id:string title:string thumbnail_url:string thum //@thumbnail_height Thumbnail height, if known //@reply_markup The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard or null //@input_message_content The content of the message to be sent. Must be one of the following types: inputMessageText, inputMessageInvoice, inputMessageLocation, inputMessageVenue or inputMessageContact -inputInlineQueryResultArticle id:string url:string hide_url:Bool title:string description:string thumbnail_url:string thumbnail_width:int32 thumbnail_height:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; +inputInlineQueryResultArticle id:string url:string title:string description:string thumbnail_url:string thumbnail_width:int32 thumbnail_height:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; //@description Represents a link to an MP3 audio file //@id Unique identifier of the query result @@ -5419,11 +5567,10 @@ inputInlineQueryResultVoiceNote id:string title:string voice_note_url:string voi //@description Represents a link to an article or web page //@id Unique identifier of the query result //@url URL of the result, if it exists -//@hide_url True, if the URL must be not shown //@title Title of the result //@param_description A short description of the result //@thumbnail Result thumbnail in JPEG format; may be null -inlineQueryResultArticle id:string url:string hide_url:Bool title:string description:string thumbnail:thumbnail = InlineQueryResult; +inlineQueryResultArticle id:string url:string title:string description:string thumbnail:thumbnail = InlineQueryResult; //@description Represents a user contact //@id Unique identifier of the query result @@ -6388,6 +6535,10 @@ pushMessageContentGiveaway winner_count:int32 prize:GiveawayPrize is_pinned:Bool //@description A message with a gift @star_count Number of Telegram Stars that sender paid for the gift pushMessageContentGift star_count:int53 = PushMessageContent; +//@description A message with an upgraded gift +//@is_upgrade True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred gift +pushMessageContentUpgradedGift is_upgrade:Bool = PushMessageContent; + //@description A screenshot of a message in the chat has been taken pushMessageContentScreenshotTaken = PushMessageContent; @@ -7434,6 +7585,9 @@ suggestedActionGiftPremiumForChristmas = SuggestedAction; //@description Suggests the user to set birthdate suggestedActionSetBirthdate = SuggestedAction; +//@description Suggests the user to set profile photo +suggestedActionSetProfilePhoto = SuggestedAction; + //@description Suggests the user to extend their expiring Telegram Premium subscription @manage_premium_subscription_url A URL for managing Telegram Premium subscription suggestedActionExtendPremium manage_premium_subscription_url:string = SuggestedAction; @@ -7698,7 +7852,7 @@ point x:double y:double = Point; //@description A straight line to a given point @end_point The end point of the straight line vectorPathCommandLine end_point:point = VectorPathCommand; -//@description A cubic Bézier curve to a given point @start_control_point The start control point of the curve @end_control_point The end control point of the curve @end_point The end point of the curve +//@description A cubic Bézier curve to a given point @start_control_point The start control point of the curve @end_control_point The end control point of the curve @end_point The end point of the curve vectorPathCommandCubicBezierCurve start_control_point:point end_control_point:point end_point:point = VectorPathCommand; @@ -8866,14 +9020,14 @@ searchChatMessages chat_id:int53 query:string sender_id:MessageSender from_messa //@description Searches for messages in all chats except secret chats. Returns the results in reverse chronological order (i.e., in order of decreasing (date, chat_id, message_id)). //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit //@chat_list Chat list in which to search messages; pass null to search in all chats regardless of their chat list. Only Main and Archive chat lists are supported -//@only_in_channels Pass true to search only for messages in channels //@query Query to search for //@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results //@limit The maximum number of messages to be returned; up to 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit //@filter Additional filter for messages to search; pass null to search for all messages. Filters searchMessagesFilterMention, searchMessagesFilterUnreadMention, searchMessagesFilterUnreadReaction, searchMessagesFilterFailedToSend, and searchMessagesFilterPinned are unsupported in this function +//@chat_type_filter Additional filter for type of the chat of the searched messages; pass null to search for messages in all chats //@min_date If not 0, the minimum date of the messages to return //@max_date If not 0, the maximum date of the messages to return -searchMessages chat_list:ChatList only_in_channels:Bool query:string offset:string limit:int32 filter:SearchMessagesFilter min_date:int32 max_date:int32 = FoundMessages; +searchMessages chat_list:ChatList query:string offset:string limit:int32 filter:SearchMessagesFilter chat_type_filter:SearchMessagesChatTypeFilter min_date:int32 max_date:int32 = FoundMessages; //@description Searches for messages in secret chats. Returns the results in reverse chronological order. For optimal performance, the number of returned messages is chosen by TDLib //@chat_id Identifier of the chat in which to search. Specify 0 to search in all secret chats @@ -10624,8 +10778,12 @@ processChatJoinRequest chat_id:int53 user_id:int53 approve:Bool = Ok; processChatJoinRequests chat_id:int53 invite_link:string approve:Bool = Ok; -//@description Creates a new call @user_id Identifier of the user to be called @protocol The call protocols supported by the application @is_video Pass true to create a video call -createCall user_id:int53 protocol:callProtocol is_video:Bool = CallId; +//@description Creates a new call +//@user_id Identifier of the user to be called +//@protocol The call protocols supported by the application +//@is_video Pass true to create a video call +//@group_call_id Identifier of the group call to which the user will be added after exchanging private key via the call; pass 0 if none; currently, ignored +createCall user_id:int53 protocol:callProtocol is_video:Bool group_call_id:int32 = CallId; //@description Accepts an incoming call @call_id Call identifier @protocol The call protocols supported by the application acceptCall call_id:int32 protocol:callProtocol = Ok; @@ -10668,6 +10826,9 @@ setVideoChatDefaultParticipant chat_id:int53 default_participant_id:MessageSende //@is_rtmp_stream Pass true to create an RTMP stream instead of an ordinary video chat createVideoChat chat_id:int53 title:string start_date:int32 is_rtmp_stream:Bool = GroupCallId; +//@description Creates a group call from a one-to-one call @call_id Call identifier +createGroupCall call_id:int32 = Ok; + //@description Returns RTMP URL for streaming to the chat; requires can_manage_video_chats administrator right @chat_id Chat identifier getVideoChatRtmpUrl chat_id:int53 = RtmpUrl; @@ -11304,6 +11465,19 @@ setBotInfoShortDescription bot_user_id:int53 language_code:string short_descript getBotInfoShortDescription bot_user_id:int53 language_code:string = Text; +//@description Changes the verification status of a user or a chat by an owned bot +//@bot_user_id Identifier of the owned bot, which will verify the user or the chat +//@verified_id Identifier of the user or the supergroup or channel chat, which will be verified by the bot +//@custom_description Custom description of verification reason; 0-getOption("bot_verification_custom_description_length_max"). +//-If empty, then "was verified by organization "organization_name"" will be used as description. Can be specified only if the bot is allowed to provide custom description +setMessageSenderBotVerification bot_user_id:int53 verified_id:MessageSender custom_description:string = Ok; + +//@description Removes the verification status of a user or a chat by an owned bot +//@bot_user_id Identifier of the owned bot, which verified the user or the chat +//@verified_id Identifier of the user or the supergroup or channel chat, which verification is removed +removeMessageSenderBotVerification bot_user_id:int53 verified_id:MessageSender = Ok; + + //@description Returns all active sessions of the current user getActiveSessions = Sessions; @@ -11486,7 +11660,8 @@ getAvailableGifts = Gifts; //@user_id Identifier of the user that will receive the gift //@text Text to show along with the gift; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed //@is_private Pass true to show the current user as sender and gift text only to the gift receiver; otherwise, everyone will be able to see them -sendGift gift_id:int64 user_id:int53 text:formattedText is_private:Bool = Ok; +//@pay_for_upgrade Pass true to additionally pay for the gift upgrade and allow the receiver to upgrade it for free +sendGift gift_id:int64 user_id:int53 text:formattedText is_private:Bool pay_for_upgrade:Bool = Ok; //@description Sells a gift received by the current user for Telegram Stars //@sender_user_id Identifier of the user that sent the gift @@ -11499,12 +11674,31 @@ sellGift sender_user_id:int53 message_id:int53 = Ok; //@is_saved Pass true to display the gift on the user's profile page; pass false to remove it from the profile page toggleGiftIsSaved sender_user_id:int53 message_id:int53 is_saved:Bool = Ok; +//@description Returns examples of possible upgraded gifts for a regular gift @gift_id Identifier of the gift +getGiftUpgradePreview gift_id:int64 = GiftUpgradePreview; + +//@description Upgrades a gift received by the current user. Unless the gift has prepaid_upgrade_star_count > 0, the user must pay gift.upgrade_star_count Telegram Stars for the upgrade +//@sender_user_id Identifier of the user that sent the gift +//@message_id Identifier of the message with the gift in the chat with the user +//@keep_original_details Pass true to keep the original gift text, sender and receiver in the upgraded gift +upgradeGift sender_user_id:int53 message_id:int53 keep_original_details:Bool = UpgradeGiftResult; + +//@description Sends a gift upgraded by the current user to another user +//@sender_user_id Identifier of the user that sent the gift +//@message_id Identifier of the message with the upgraded gift in the chat with the user +//@receiver_user_id Identifier of the user that will receive the gift +//@star_count The amount of Telegram Stars required for the transfer +transferGift sender_user_id:int53 message_id:int53 receiver_user_id:int53 star_count:int53 = Ok; + //@description Returns gifts saved to profile by the given user //@user_id Identifier of the user //@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results //@limit The maximum number of gifts to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned objects is chosen by TDLib and can be smaller than the specified limit getUserGifts user_id:int53 offset:string limit:int32 = UserGifts; +//@description Returns information about a gift received or sent by the current user @message_id Identifier of the message with the gift +getUserGift message_id:int53 = UserGift; + //@description Creates a link for the given invoice; for bots only //@business_connection_id Unique identifier of business connection on behalf of which to send the request @@ -12042,33 +12236,33 @@ setChatAffiliateProgram chat_id:int53 parameters:affiliateProgramParameters = Ok //@referrer The referrer from an internalLinkTypeChatAffiliateProgram link searchChatAffiliateProgram username:string referrer:string = Chat; -//@description Searches affiliate programs that can be applied to the given chat -//@chat_id Identifier of the chat for which affiliate programs are searched for. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right +//@description Searches affiliate programs that can be connected to the given affiliate +//@affiliate The affiliate for which affiliate programs are searched for //@sort_order Sort order for the results //@offset Offset of the first affiliate program to return as received from the previous request; use empty string to get the first chunk of results //@limit The maximum number of affiliate programs to return -searchAffiliatePrograms chat_id:int53 sort_order:AffiliateProgramSortOrder offset:string limit:int32 = FoundAffiliatePrograms; +searchAffiliatePrograms affiliate:AffiliateType sort_order:AffiliateProgramSortOrder offset:string limit:int32 = FoundAffiliatePrograms; -//@description Connects an affiliate program to the given chat. Returns information about the connected affiliate program -//@chat_id Identifier of the chat to which the affiliate program will be connected. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right +//@description Connects an affiliate program to the given affiliate. Returns information about the connected affiliate program +//@affiliate The affiliate to which the affiliate program will be connected //@bot_user_id Identifier of the bot, which affiliate program is connected -connectChatAffiliateProgram chat_id:int53 bot_user_id:int53 = ChatAffiliateProgram; +connectAffiliateProgram affiliate:AffiliateType bot_user_id:int53 = ConnectedAffiliateProgram; -//@description Disconnects an affiliate program from the given chat and immediately deactivates its referral link. Returns updated information about the disconnected affiliate program -//@chat_id Identifier of the chat for which the affiliate program is connected +//@description Disconnects an affiliate program from the given affiliate and immediately deactivates its referral link. Returns updated information about the disconnected affiliate program +//@affiliate The affiliate to which the affiliate program is connected //@url The referral link of the affiliate program -disconnectChatAffiliateProgram chat_id:int53 url:string = ChatAffiliateProgram; +disconnectAffiliateProgram affiliate:AffiliateType url:string = ConnectedAffiliateProgram; -//@description Returns an affiliate program that were connected to the given chat by identifier of the bot that created the program -//@chat_id Identifier of the chat for which the affiliate program was connected. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right +//@description Returns an affiliate program that were connected to the given affiliate by identifier of the bot that created the program +//@affiliate The affiliate to which the affiliate program will be connected //@bot_user_id Identifier of the bot that created the program -getChatAffiliateProgram chat_id:int53 bot_user_id:int53 = ChatAffiliateProgram; +getConnectedAffiliateProgram affiliate:AffiliateType bot_user_id:int53 = ConnectedAffiliateProgram; -//@description Returns affiliate programs that were connected to the given chat -//@chat_id Identifier of the chat for which the affiliate programs were connected. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right +//@description Returns affiliate programs that were connected to the given affiliate +//@affiliate The affiliate to which the affiliate program were connected //@offset Offset of the first affiliate program to return as received from the previous request; use empty string to get the first chunk of results //@limit The maximum number of affiliate programs to return -getChatAffiliatePrograms chat_id:int53 offset:string limit:int32 = ChatAffiliatePrograms; +getConnectedAffiliatePrograms affiliate:AffiliateType offset:string limit:int32 = ConnectedAffiliatePrograms; //@description Returns information about features, available to Business users @source Source of the request; pass null if the method is called from settings or some non-standard source From 2a5a6d2b765a271ee5e1ee310fc6eba80cd2a900 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Fri, 3 Jan 2025 06:16:40 +0800 Subject: [PATCH 33/54] Merge upstream fix --- client/client.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/client/client.go b/client/client.go index 89a7f39..ad67a7c 100644 --- a/client/client.go +++ b/client/client.go @@ -86,15 +86,15 @@ func NewClient(authorizationStateHandler AuthorizationStateHandler, options ...O client.extraGenerator = UuidV4Generator() client.catchTimeout = 60 * time.Second - for _, option := range options { - option(client) - } - tdlibInstance.addClient(client) go client.processPendingResponse() go client.receiver() + for _, option := range options { + go option(client) + } + err := Authorize(client, authorizationStateHandler) if err != nil { return nil, err @@ -155,6 +155,10 @@ func (client *Client) processResponse(response *Response) { if needGc { client.listenerStore.gc() } + + if typ.GetType() == TypeUpdateAuthorizationState && typ.(*UpdateAuthorizationState).AuthorizationState.AuthorizationStateType() == TypeAuthorizationStateClosed { + close(client.responses) + } } func (client *Client) receiver() { @@ -257,7 +261,3 @@ func (client *Client) AddEventReceiver(msgType Type, channelCapacity int) *Liste return listener } - -func (client *Client) Stop() { - client.Destroy() -} From bda4018ed37f5fa80fb6b2188533d81d70327651 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Sat, 25 Jan 2025 06:30:12 +0800 Subject: [PATCH 34/54] Update to TDLib 1.8.44 --- client/function.go | 331 ++++++++++++++++---- client/type.go | 705 ++++++++++++++++++++++++++++++++++++------ client/unmarshaler.go | 150 ++++++++- data/td_api.tl | 284 +++++++++++------ 4 files changed, 1211 insertions(+), 259 deletions(-) diff --git a/client/function.go b/client/function.go index c8ffa78..02621ab 100755 --- a/client/function.go +++ b/client/function.go @@ -1931,6 +1931,90 @@ func (client *Client) OpenChatSimilarChat(req *OpenChatSimilarChatRequest) (*Ok, return UnmarshalOk(result.Data) } +type GetBotSimilarBotsRequest struct { + // User identifier of the target bot + BotUserId int64 `json:"bot_user_id"` +} + +// Returns a list of bots similar to the given bot +func (client *Client) GetBotSimilarBots(req *GetBotSimilarBotsRequest) (*Users, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getBotSimilarBots", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalUsers(result.Data) +} + +type GetBotSimilarBotCountRequest struct { + // User identifier of the target bot + BotUserId int64 `json:"bot_user_id"` + // Pass true to get the number of bots without sending network requests, or -1 if the number of bots is unknown locally + ReturnLocal bool `json:"return_local"` +} + +// Returns approximate number of bots similar to the given bot +func (client *Client) GetBotSimilarBotCount(req *GetBotSimilarBotCountRequest) (*Count, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getBotSimilarBotCount", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "return_local": req.ReturnLocal, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalCount(result.Data) +} + +type OpenBotSimilarBotRequest struct { + // Identifier of the original bot, which similar bots were requested + BotUserId int64 `json:"bot_user_id"` + // Identifier of the opened bot + OpenedBotUserId int64 `json:"opened_bot_user_id"` +} + +// Informs TDLib that a bot was opened from the list of similar bots +func (client *Client) OpenBotSimilarBot(req *OpenBotSimilarBotRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "openBotSimilarBot", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "opened_bot_user_id": req.OpenedBotUserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type GetTopChatsRequest struct { // Category of chats to be returned Category TopChatCategory `json:"category"` @@ -4159,7 +4243,7 @@ type DeleteChatMessagesBySenderRequest struct { SenderId MessageSender `json:"sender_id"` } -// Deletes all messages sent by the specified message sender in a chat. Supported only for supergroups; requires can_delete_messages administrator privileges +// Deletes all messages sent by the specified message sender in a chat. Supported only for supergroups; requires can_delete_messages administrator right func (client *Client) DeleteChatMessagesBySender(req *DeleteChatMessagesBySenderRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -8117,6 +8201,9 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeUnsupportedProxy: return UnmarshalInternalLinkTypeUnsupportedProxy(result.Data) + case TypeInternalLinkTypeUpgradedGift: + return UnmarshalInternalLinkTypeUpgradedGift(result.Data) + case TypeInternalLinkTypeUserPhoneNumber: return UnmarshalInternalLinkTypeUserPhoneNumber(result.Data) @@ -11789,7 +11876,7 @@ func (client *Client) ToggleBotIsAddedToAttachmentMenu(req *ToggleBotIsAddedToAt } // Returns up to 8 emoji statuses, which must be shown right after the default Premium Badge in the emoji status list for self status -func (client *Client) GetThemedEmojiStatuses() (*EmojiStatuses, error) { +func (client *Client) GetThemedEmojiStatuses() (*EmojiStatusCustomEmojis, error) { result, err := client.Send(Request{ meta: meta{ Type: "getThemedEmojiStatuses", @@ -11804,7 +11891,7 @@ func (client *Client) GetThemedEmojiStatuses() (*EmojiStatuses, error) { return nil, buildResponseError(result.Data) } - return UnmarshalEmojiStatuses(result.Data) + return UnmarshalEmojiStatusCustomEmojis(result.Data) } // Returns recent emoji statuses for self status @@ -11826,8 +11913,27 @@ func (client *Client) GetRecentEmojiStatuses() (*EmojiStatuses, error) { return UnmarshalEmojiStatuses(result.Data) } +// Returns available upgraded gift emoji statuses for self status +func (client *Client) GetUpgradedGiftEmojiStatuses() (*EmojiStatuses, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getUpgradedGiftEmojiStatuses", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalEmojiStatuses(result.Data) +} + // Returns default emoji statuses for self status -func (client *Client) GetDefaultEmojiStatuses() (*EmojiStatuses, error) { +func (client *Client) GetDefaultEmojiStatuses() (*EmojiStatusCustomEmojis, error) { result, err := client.Send(Request{ meta: meta{ Type: "getDefaultEmojiStatuses", @@ -11842,7 +11948,7 @@ func (client *Client) GetDefaultEmojiStatuses() (*EmojiStatuses, error) { return nil, buildResponseError(result.Data) } - return UnmarshalEmojiStatuses(result.Data) + return UnmarshalEmojiStatusCustomEmojis(result.Data) } // Clears the list of recently used emoji statuses for self status @@ -11865,7 +11971,7 @@ func (client *Client) ClearRecentEmojiStatuses() (*Ok, error) { } // Returns up to 8 emoji statuses, which must be shown in the emoji status list for chats -func (client *Client) GetThemedChatEmojiStatuses() (*EmojiStatuses, error) { +func (client *Client) GetThemedChatEmojiStatuses() (*EmojiStatusCustomEmojis, error) { result, err := client.Send(Request{ meta: meta{ Type: "getThemedChatEmojiStatuses", @@ -11880,11 +11986,11 @@ func (client *Client) GetThemedChatEmojiStatuses() (*EmojiStatuses, error) { return nil, buildResponseError(result.Data) } - return UnmarshalEmojiStatuses(result.Data) + return UnmarshalEmojiStatusCustomEmojis(result.Data) } // Returns default emoji statuses for chats -func (client *Client) GetDefaultChatEmojiStatuses() (*EmojiStatuses, error) { +func (client *Client) GetDefaultChatEmojiStatuses() (*EmojiStatusCustomEmojis, error) { result, err := client.Send(Request{ meta: meta{ Type: "getDefaultChatEmojiStatuses", @@ -11899,11 +12005,11 @@ func (client *Client) GetDefaultChatEmojiStatuses() (*EmojiStatuses, error) { return nil, buildResponseError(result.Data) } - return UnmarshalEmojiStatuses(result.Data) + return UnmarshalEmojiStatusCustomEmojis(result.Data) } // Returns the list of emoji statuses, which can't be used as chat emoji status, even they are from a sticker set with is_allowed_as_chat_emoji_status == true -func (client *Client) GetDisallowedChatEmojiStatuses() (*EmojiStatuses, error) { +func (client *Client) GetDisallowedChatEmojiStatuses() (*EmojiStatusCustomEmojis, error) { result, err := client.Send(Request{ meta: meta{ Type: "getDisallowedChatEmojiStatuses", @@ -11918,7 +12024,7 @@ func (client *Client) GetDisallowedChatEmojiStatuses() (*EmojiStatuses, error) { return nil, buildResponseError(result.Data) } - return UnmarshalEmojiStatuses(result.Data) + return UnmarshalEmojiStatusCustomEmojis(result.Data) } type DownloadFileRequest struct { @@ -18755,7 +18861,7 @@ func (client *Client) DeleteSavedCredentials() (*Ok, error) { return UnmarshalOk(result.Data) } -// Returns gifts that can be sent to other users +// Returns gifts that can be sent to other users and channel chats func (client *Client) GetAvailableGifts() (*Gifts, error) { result, err := client.Send(Request{ meta: meta{ @@ -18777,17 +18883,17 @@ func (client *Client) GetAvailableGifts() (*Gifts, error) { type SendGiftRequest struct { // Identifier of the gift to send GiftId JsonInt64 `json:"gift_id"` - // Identifier of the user that will receive the gift - UserId int64 `json:"user_id"` + // Identifier of the user or the channel chat that will receive the gift + OwnerId MessageSender `json:"owner_id"` // Text to show along with the gift; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed Text *FormattedText `json:"text"` - // Pass true to show the current user as sender and gift text only to the gift receiver; otherwise, everyone will be able to see them + // Pass true to show gift text and sender only to the gift receiver; otherwise, everyone will be able to see them IsPrivate bool `json:"is_private"` // Pass true to additionally pay for the gift upgrade and allow the receiver to upgrade it for free PayForUpgrade bool `json:"pay_for_upgrade"` } -// Sends a gift to another user. May return an error with a message "STARGIFT_USAGE_LIMITED" if the gift was sold out +// Sends a gift to another user or channel chat. May return an error with a message "STARGIFT_USAGE_LIMITED" if the gift was sold out func (client *Client) SendGift(req *SendGiftRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -18795,7 +18901,7 @@ func (client *Client) SendGift(req *SendGiftRequest) (*Ok, error) { }, Data: map[string]interface{}{ "gift_id": req.GiftId, - "user_id": req.UserId, + "owner_id": req.OwnerId, "text": req.Text, "is_private": req.IsPrivate, "pay_for_upgrade": req.PayForUpgrade, @@ -18813,21 +18919,18 @@ func (client *Client) SendGift(req *SendGiftRequest) (*Ok, error) { } type SellGiftRequest struct { - // Identifier of the user that sent the gift - SenderUserId int64 `json:"sender_user_id"` - // Identifier of the message with the gift in the chat with the user - MessageId int64 `json:"message_id"` + // Identifier of the gift + ReceivedGiftId string `json:"received_gift_id"` } -// Sells a gift received by the current user for Telegram Stars +// Sells a gift for Telegram Stars func (client *Client) SellGift(req *SellGiftRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ Type: "sellGift", }, Data: map[string]interface{}{ - "sender_user_id": req.SenderUserId, - "message_id": req.MessageId, + "received_gift_id": req.ReceivedGiftId, }, }) if err != nil { @@ -18842,23 +18945,20 @@ func (client *Client) SellGift(req *SellGiftRequest) (*Ok, error) { } type ToggleGiftIsSavedRequest struct { - // Identifier of the user that sent the gift - SenderUserId int64 `json:"sender_user_id"` - // Identifier of the message with the gift in the chat with the user - MessageId int64 `json:"message_id"` - // Pass true to display the gift on the user's profile page; pass false to remove it from the profile page + // Identifier of the gift + ReceivedGiftId string `json:"received_gift_id"` + // Pass true to display the gift on the user's or the channel's profile page; pass false to remove it from the profile page IsSaved bool `json:"is_saved"` } -// Toggles whether a gift is shown on the current user's profile page +// Toggles whether a gift is shown on the current user's or the channel's profile page; requires can_post_messages administrator right in the chat func (client *Client) ToggleGiftIsSaved(req *ToggleGiftIsSavedRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ Type: "toggleGiftIsSaved", }, Data: map[string]interface{}{ - "sender_user_id": req.SenderUserId, - "message_id": req.MessageId, + "received_gift_id": req.ReceivedGiftId, "is_saved": req.IsSaved, }, }) @@ -18873,6 +18973,35 @@ func (client *Client) ToggleGiftIsSaved(req *ToggleGiftIsSavedRequest) (*Ok, err return UnmarshalOk(result.Data) } +type ToggleChatGiftNotificationsRequest struct { + // Identifier of the channel chat + ChatId int64 `json:"chat_id"` + // Pass true to enable notifications about new gifts owned by the channel chat; pass false to disable the notifications + AreEnabled bool `json:"are_enabled"` +} + +// Toggles whether notifications for new gifts received by a channel chat are sent to the current user; requires can_post_messages administrator right in the chat +func (client *Client) ToggleChatGiftNotifications(req *ToggleChatGiftNotificationsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleChatGiftNotifications", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "are_enabled": req.AreEnabled, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type GetGiftUpgradePreviewRequest struct { // Identifier of the gift GiftId JsonInt64 `json:"gift_id"` @@ -18900,24 +19029,24 @@ func (client *Client) GetGiftUpgradePreview(req *GetGiftUpgradePreviewRequest) ( } type UpgradeGiftRequest struct { - // Identifier of the user that sent the gift - SenderUserId int64 `json:"sender_user_id"` - // Identifier of the message with the gift in the chat with the user - MessageId int64 `json:"message_id"` + // Identifier of the gift + ReceivedGiftId string `json:"received_gift_id"` // Pass true to keep the original gift text, sender and receiver in the upgraded gift KeepOriginalDetails bool `json:"keep_original_details"` + // The amount of Telegram Stars required to pay for the upgrade. It the gift has prepaid_upgrade_star_count > 0, then pass 0, otherwise, pass gift.upgrade_star_count + StarCount int64 `json:"star_count"` } -// Upgrades a gift received by the current user. Unless the gift has prepaid_upgrade_star_count > 0, the user must pay gift.upgrade_star_count Telegram Stars for the upgrade +// Upgrades a regular gift func (client *Client) UpgradeGift(req *UpgradeGiftRequest) (*UpgradeGiftResult, error) { result, err := client.Send(Request{ meta: meta{ Type: "upgradeGift", }, Data: map[string]interface{}{ - "sender_user_id": req.SenderUserId, - "message_id": req.MessageId, + "received_gift_id": req.ReceivedGiftId, "keep_original_details": req.KeepOriginalDetails, + "star_count": req.StarCount, }, }) if err != nil { @@ -18932,26 +19061,23 @@ func (client *Client) UpgradeGift(req *UpgradeGiftRequest) (*UpgradeGiftResult, } type TransferGiftRequest struct { - // Identifier of the user that sent the gift - SenderUserId int64 `json:"sender_user_id"` - // Identifier of the message with the upgraded gift in the chat with the user - MessageId int64 `json:"message_id"` - // Identifier of the user that will receive the gift - ReceiverUserId int64 `json:"receiver_user_id"` - // The amount of Telegram Stars required for the transfer + // Identifier of the gift + ReceivedGiftId string `json:"received_gift_id"` + // Identifier of the user or the channel chat that will receive the gift + NewOwnerId MessageSender `json:"new_owner_id"` + // The amount of Telegram Stars required to pay for the transfer StarCount int64 `json:"star_count"` } -// Sends a gift upgraded by the current user to another user +// Sends an upgraded gift to another user or a channel chat func (client *Client) TransferGift(req *TransferGiftRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ Type: "transferGift", }, Data: map[string]interface{}{ - "sender_user_id": req.SenderUserId, - "message_id": req.MessageId, - "receiver_user_id": req.ReceiverUserId, + "received_gift_id": req.ReceivedGiftId, + "new_owner_id": req.NewOwnerId, "star_count": req.StarCount, }, }) @@ -18966,23 +19092,41 @@ func (client *Client) TransferGift(req *TransferGiftRequest) (*Ok, error) { return UnmarshalOk(result.Data) } -type GetUserGiftsRequest struct { - // Identifier of the user - UserId int64 `json:"user_id"` +type GetReceivedGiftsRequest struct { + // Identifier of the gift receiver + OwnerId MessageSender `json:"owner_id"` + // Pass true to exclude gifts that aren't saved to the chat's profile page. Always true for gifts received by other users and channel chats without can_post_messages administrator right + ExcludeUnsaved bool `json:"exclude_unsaved"` + // Pass true to exclude gifts that are saved to the chat's profile page; for channel chats with can_post_messages administrator right only + ExcludeSaved bool `json:"exclude_saved"` + // Pass true to exclude gifts that can be purchased unlimited number of times; for channel chats with can_post_messages administrator right only + ExcludeUnlimited bool `json:"exclude_unlimited"` + // Pass true to exclude gifts that can be purchased limited number of times; for channel chats with can_post_messages administrator right only + ExcludeLimited bool `json:"exclude_limited"` + // Pass true to exclude upgraded gifts; for channel chats with can_post_messages administrator right only + ExcludeUpgraded bool `json:"exclude_upgraded"` + // Pass true to sort results by gift price instead of send date; for channel chats with can_post_messages administrator right only + SortByPrice bool `json:"sort_by_price"` // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results Offset string `json:"offset"` // The maximum number of gifts to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned objects is chosen by TDLib and can be smaller than the specified limit Limit int32 `json:"limit"` } -// Returns gifts saved to profile by the given user -func (client *Client) GetUserGifts(req *GetUserGiftsRequest) (*UserGifts, error) { +// Returns gifts received by the given user or chat +func (client *Client) GetReceivedGifts(req *GetReceivedGiftsRequest) (*ReceivedGifts, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getUserGifts", + Type: "getReceivedGifts", }, Data: map[string]interface{}{ - "user_id": req.UserId, + "owner_id": req.OwnerId, + "exclude_unsaved": req.ExcludeUnsaved, + "exclude_saved": req.ExcludeSaved, + "exclude_unlimited": req.ExcludeUnlimited, + "exclude_limited": req.ExcludeLimited, + "exclude_upgraded": req.ExcludeUpgraded, + "sort_by_price": req.SortByPrice, "offset": req.Offset, "limit": req.Limit, }, @@ -18995,22 +19139,22 @@ func (client *Client) GetUserGifts(req *GetUserGiftsRequest) (*UserGifts, error) return nil, buildResponseError(result.Data) } - return UnmarshalUserGifts(result.Data) + return UnmarshalReceivedGifts(result.Data) } -type GetUserGiftRequest struct { - // Identifier of the message with the gift - MessageId int64 `json:"message_id"` +type GetReceivedGiftRequest struct { + // Identifier of the gift + ReceivedGiftId string `json:"received_gift_id"` } -// Returns information about a gift received or sent by the current user -func (client *Client) GetUserGift(req *GetUserGiftRequest) (*UserGift, error) { +// Returns information about a received gift +func (client *Client) GetReceivedGift(req *GetReceivedGiftRequest) (*ReceivedGift, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getUserGift", + Type: "getReceivedGift", }, Data: map[string]interface{}{ - "message_id": req.MessageId, + "received_gift_id": req.ReceivedGiftId, }, }) if err != nil { @@ -19021,7 +19165,62 @@ func (client *Client) GetUserGift(req *GetUserGiftRequest) (*UserGift, error) { return nil, buildResponseError(result.Data) } - return UnmarshalUserGift(result.Data) + return UnmarshalReceivedGift(result.Data) +} + +type GetUpgradedGiftRequest struct { + // Unique name of the upgraded gift + Name string `json:"name"` +} + +// Returns information about an upgraded gift by its name +func (client *Client) GetUpgradedGift(req *GetUpgradedGiftRequest) (*UpgradedGift, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getUpgradedGift", + }, + Data: map[string]interface{}{ + "name": req.Name, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalUpgradedGift(result.Data) +} + +type GetUpgradedGiftWithdrawalUrlRequest struct { + // Identifier of the gift + ReceivedGiftId string `json:"received_gift_id"` + // The 2-step verification password of the current user + Password string `json:"password"` +} + +// Returns a URL for upgraded gift withdrawal in the TON blockchain as an NFT; requires owner privileges for gifts owned by a chat +func (client *Client) GetUpgradedGiftWithdrawalUrl(req *GetUpgradedGiftWithdrawalUrlRequest) (*HttpUrl, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getUpgradedGiftWithdrawalUrl", + }, + Data: map[string]interface{}{ + "received_gift_id": req.ReceivedGiftId, + "password": req.Password, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalHttpUrl(result.Data) } type CreateInvoiceLinkRequest struct { diff --git a/client/type.go b/client/type.go index 0b77de8..1603b60 100755 --- a/client/type.go +++ b/client/type.go @@ -32,6 +32,7 @@ const ( ClassGiveawayParticipantStatus = "GiveawayParticipantStatus" ClassGiveawayInfo = "GiveawayInfo" ClassGiveawayPrize = "GiveawayPrize" + ClassEmojiStatusType = "EmojiStatusType" ClassChatMemberStatus = "ChatMemberStatus" ClassChatMembersFilter = "ChatMembersFilter" ClassSupergroupMembersFilter = "SupergroupMembersFilter" @@ -265,14 +266,15 @@ const ( ClassStarGiveawayPaymentOptions = "StarGiveawayPaymentOptions" ClassUpgradedGiftModel = "UpgradedGiftModel" ClassUpgradedGiftSymbol = "UpgradedGiftSymbol" + ClassUpgradedGiftBackdropColors = "UpgradedGiftBackdropColors" ClassUpgradedGiftBackdrop = "UpgradedGiftBackdrop" ClassUpgradedGiftOriginalDetails = "UpgradedGiftOriginalDetails" ClassGift = "Gift" ClassGifts = "Gifts" ClassUpgradedGift = "UpgradedGift" ClassUpgradeGiftResult = "UpgradeGiftResult" - ClassUserGift = "UserGift" - ClassUserGifts = "UserGifts" + ClassReceivedGift = "ReceivedGift" + ClassReceivedGifts = "ReceivedGifts" ClassGiftUpgradePreview = "GiftUpgradePreview" ClassStarTransaction = "StarTransaction" ClassStarTransactions = "StarTransactions" @@ -281,6 +283,7 @@ const ( ClassProfileAccentColor = "ProfileAccentColor" ClassEmojiStatus = "EmojiStatus" ClassEmojiStatuses = "EmojiStatuses" + ClassEmojiStatusCustomEmojis = "EmojiStatusCustomEmojis" ClassUsernames = "Usernames" ClassUser = "User" ClassBotInfo = "BotInfo" @@ -768,6 +771,7 @@ const ( TypeStarGiveawayPaymentOptions = "starGiveawayPaymentOptions" TypeUpgradedGiftModel = "upgradedGiftModel" TypeUpgradedGiftSymbol = "upgradedGiftSymbol" + TypeUpgradedGiftBackdropColors = "upgradedGiftBackdropColors" TypeUpgradedGiftBackdrop = "upgradedGiftBackdrop" TypeUpgradedGiftOriginalDetails = "upgradedGiftOriginalDetails" TypeGift = "gift" @@ -776,8 +780,8 @@ const ( TypeUpgradeGiftResult = "upgradeGiftResult" TypeSentGiftRegular = "sentGiftRegular" TypeSentGiftUpgraded = "sentGiftUpgraded" - TypeUserGift = "userGift" - TypeUserGifts = "userGifts" + TypeReceivedGift = "receivedGift" + TypeReceivedGifts = "receivedGifts" TypeGiftUpgradePreview = "giftUpgradePreview" TypeStarTransactionDirectionIncoming = "starTransactionDirectionIncoming" TypeStarTransactionDirectionOutgoing = "starTransactionDirectionOutgoing" @@ -822,8 +826,11 @@ const ( TypeAccentColor = "accentColor" TypeProfileAccentColors = "profileAccentColors" TypeProfileAccentColor = "profileAccentColor" + TypeEmojiStatusTypeCustomEmoji = "emojiStatusTypeCustomEmoji" + TypeEmojiStatusTypeUpgradedGift = "emojiStatusTypeUpgradedGift" TypeEmojiStatus = "emojiStatus" TypeEmojiStatuses = "emojiStatuses" + TypeEmojiStatusCustomEmojis = "emojiStatusCustomEmojis" TypeUsernames = "usernames" TypeUser = "user" TypeBotInfo = "botInfo" @@ -1130,6 +1137,7 @@ const ( TypeLinkPreviewTypeSupergroupBoost = "linkPreviewTypeSupergroupBoost" TypeLinkPreviewTypeTheme = "linkPreviewTypeTheme" TypeLinkPreviewTypeUnsupported = "linkPreviewTypeUnsupported" + TypeLinkPreviewTypeUpgradedGift = "linkPreviewTypeUpgradedGift" TypeLinkPreviewTypeUser = "linkPreviewTypeUser" TypeLinkPreviewTypeVideo = "linkPreviewTypeVideo" TypeLinkPreviewTypeVideoChat = "linkPreviewTypeVideoChat" @@ -1444,6 +1452,7 @@ const ( TypeStoryAreaTypeMessage = "storyAreaTypeMessage" TypeStoryAreaTypeLink = "storyAreaTypeLink" TypeStoryAreaTypeWeather = "storyAreaTypeWeather" + TypeStoryAreaTypeUpgradedGift = "storyAreaTypeUpgradedGift" TypeStoryArea = "storyArea" TypeInputStoryAreaTypeLocation = "inputStoryAreaTypeLocation" TypeInputStoryAreaTypeFoundVenue = "inputStoryAreaTypeFoundVenue" @@ -1452,6 +1461,7 @@ const ( TypeInputStoryAreaTypeMessage = "inputStoryAreaTypeMessage" TypeInputStoryAreaTypeLink = "inputStoryAreaTypeLink" TypeInputStoryAreaTypeWeather = "inputStoryAreaTypeWeather" + TypeInputStoryAreaTypeUpgradedGift = "inputStoryAreaTypeUpgradedGift" TypeInputStoryArea = "inputStoryArea" TypeInputStoryAreas = "inputStoryAreas" TypeStoryVideo = "storyVideo" @@ -1980,6 +1990,7 @@ const ( TypeInternalLinkTypeThemeSettings = "internalLinkTypeThemeSettings" TypeInternalLinkTypeUnknownDeepLink = "internalLinkTypeUnknownDeepLink" TypeInternalLinkTypeUnsupportedProxy = "internalLinkTypeUnsupportedProxy" + TypeInternalLinkTypeUpgradedGift = "internalLinkTypeUpgradedGift" TypeInternalLinkTypeUserPhoneNumber = "internalLinkTypeUserPhoneNumber" TypeInternalLinkTypeUserToken = "internalLinkTypeUserToken" TypeInternalLinkTypeVideoChat = "internalLinkTypeVideoChat" @@ -2386,7 +2397,7 @@ type AffiliateProgramSortOrder interface { AffiliateProgramSortOrderType() string } -// Represents a gift received by a user +// Represents content of a gift received by a user or a channel chat type SentGift interface { SentGiftType() string } @@ -2416,6 +2427,11 @@ type GiveawayPrize interface { GiveawayPrizeType() string } +// Describes type of emoji status +type EmojiStatusType interface { + EmojiStatusTypeType() string +} + // Provides information about the status of a member in a chat type ChatMemberStatus interface { ChatMemberStatusType() string @@ -6379,7 +6395,7 @@ type BotVerification struct { BotUserId int64 `json:"bot_user_id"` // Identifier of the custom emoji that is used as the verification sign IconCustomEmojiId JsonInt64 `json:"icon_custom_emoji_id"` - // Custom description of verification reason set by the bot + // Custom description of verification reason set by the bot. Can contain only Mention, Hashtag, Cashtag, PhoneNumber, BankCardNumber, Url, and EmailAddress entities CustomDescription *FormattedText `json:"custom_description"` } @@ -8440,11 +8456,9 @@ func (*UpgradedGiftSymbol) GetType() string { return TypeUpgradedGiftSymbol } -// Describes a backdrop of an upgraded gift -type UpgradedGiftBackdrop struct { +// Describes colors of a backdrop of an upgraded gift +type UpgradedGiftBackdropColors struct { meta - // Name of the backdrop - Name string `json:"name"` // A color in the center of the backdrop in the RGB format CenterColor int32 `json:"center_color"` // A color on the edges of the backdrop in the RGB format @@ -8453,6 +8467,31 @@ type UpgradedGiftBackdrop struct { SymbolColor int32 `json:"symbol_color"` // A color for the text on the backdrop in the RGB format TextColor int32 `json:"text_color"` +} + +func (entity *UpgradedGiftBackdropColors) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftBackdropColors + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftBackdropColors) GetClass() string { + return ClassUpgradedGiftBackdropColors +} + +func (*UpgradedGiftBackdropColors) GetType() string { + return TypeUpgradedGiftBackdropColors +} + +// Describes a backdrop of an upgraded gift +type UpgradedGiftBackdrop struct { + meta + // Name of the backdrop + Name string `json:"name"` + // Colors of the backdrop + Colors *UpgradedGiftBackdropColors `json:"colors"` // The number of upgraded gift that receive this backdrop for each 1000 gifts upgraded RarityPerMille int32 `json:"rarity_per_mille"` } @@ -8476,10 +8515,10 @@ func (*UpgradedGiftBackdrop) GetType() string { // Describes the original details about the gift type UpgradedGiftOriginalDetails struct { meta - // Identifier of the user that sent the gift; 0 if the gift was private - SenderUserId int64 `json:"sender_user_id"` - // Identifier of the user that received the gift - ReceiverUserId int64 `json:"receiver_user_id"` + // Identifier of the user or the chat that sent the gift; may be null if the gift was private + SenderId MessageSender `json:"sender_id"` + // Identifier of the user or the chat that received the gift + ReceiverId MessageSender `json:"receiver_id"` // Message added to the gift Text *FormattedText `json:"text"` // Point in time (Unix timestamp) when the gift was sent @@ -8502,7 +8541,32 @@ func (*UpgradedGiftOriginalDetails) GetType() string { return TypeUpgradedGiftOriginalDetails } -// Describes a gift that can be sent to another user +func (upgradedGiftOriginalDetails *UpgradedGiftOriginalDetails) UnmarshalJSON(data []byte) error { + var tmp struct { + SenderId json.RawMessage `json:"sender_id"` + ReceiverId json.RawMessage `json:"receiver_id"` + Text *FormattedText `json:"text"` + Date int32 `json:"date"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + upgradedGiftOriginalDetails.Text = tmp.Text + upgradedGiftOriginalDetails.Date = tmp.Date + + fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) + upgradedGiftOriginalDetails.SenderId = fieldSenderId + + fieldReceiverId, _ := UnmarshalMessageSender(tmp.ReceiverId) + upgradedGiftOriginalDetails.ReceiverId = fieldReceiverId + + return nil +} + +// Describes a gift that can be sent to another user or channel chat type Gift struct { meta // Unique identifier of the gift @@ -8517,9 +8581,9 @@ type Gift struct { UpgradeStarCount int64 `json:"upgrade_star_count"` // True, if the gift is a birthday gift IsForBirthday bool `json:"is_for_birthday"` - // Number of remaining times the gift can be purchased by all users; 0 if not limited or the gift was sold out + // Number of remaining times the gift can be purchased; 0 if not limited or the gift was sold out RemainingCount int32 `json:"remaining_count"` - // Number of total times the gift can be purchased by all users; 0 if not limited + // Number of total times the gift can be purchased; 0 if not limited TotalCount int32 `json:"total_count"` // Point in time (Unix timestamp) when the gift was send for the first time; for sold out gifts only FirstSendDate int32 `json:"first_send_date"` @@ -8543,7 +8607,7 @@ func (*Gift) GetType() string { return TypeGift } -// Contains a list of gifts that can be sent to another user +// Contains a list of gifts that can be sent to another user or channel chat type Gifts struct { meta // The list of gifts @@ -8566,21 +8630,27 @@ func (*Gifts) GetType() string { return TypeGifts } -// Describes an upgraded gift that can be gifted to another user or transferred to TON blockchain as an NFT +// Describes an upgraded gift that can be transferred to another owner or transferred to the TON blockchain as an NFT type UpgradedGift struct { meta // Unique identifier of the gift Id JsonInt64 `json:"id"` // The title of the upgraded gift Title string `json:"title"` + // Unique name of the upgraded gift that can be used with internalLinkTypeUpgradedGift + Name string `json:"name"` // Unique number of the upgraded gift among gifts upgraded from the same gift Number int32 `json:"number"` // Total number of gifts that were upgraded from the same gift TotalUpgradedCount int32 `json:"total_upgraded_count"` // The maximum number of gifts that can be upgraded from the same gift MaxUpgradedCount int32 `json:"max_upgraded_count"` - // User identifier of the user that owns the upgraded gift; 0 if none - OwnerUserId int64 `json:"owner_user_id"` + // Identifier of the user or the chat that owns the upgraded gift; may be null if none or unknown + OwnerId MessageSender `json:"owner_id"` + // Address of the gift NFT owner in TON blockchain; may be empty if none + OwnerAddress string `json:"owner_address"` + // Name of the owner for the case when owner identifier and address aren't known + OwnerName string `json:"owner_name"` // Model of the upgraded gift Model *UpgradedGiftModel `json:"model"` // Symbol of the upgraded gift @@ -8607,18 +8677,61 @@ func (*UpgradedGift) GetType() string { return TypeUpgradedGift } +func (upgradedGift *UpgradedGift) UnmarshalJSON(data []byte) error { + var tmp struct { + Id JsonInt64 `json:"id"` + Title string `json:"title"` + Name string `json:"name"` + Number int32 `json:"number"` + TotalUpgradedCount int32 `json:"total_upgraded_count"` + MaxUpgradedCount int32 `json:"max_upgraded_count"` + OwnerId json.RawMessage `json:"owner_id"` + OwnerAddress string `json:"owner_address"` + OwnerName string `json:"owner_name"` + Model *UpgradedGiftModel `json:"model"` + Symbol *UpgradedGiftSymbol `json:"symbol"` + Backdrop *UpgradedGiftBackdrop `json:"backdrop"` + OriginalDetails *UpgradedGiftOriginalDetails `json:"original_details"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + upgradedGift.Id = tmp.Id + upgradedGift.Title = tmp.Title + upgradedGift.Name = tmp.Name + upgradedGift.Number = tmp.Number + upgradedGift.TotalUpgradedCount = tmp.TotalUpgradedCount + upgradedGift.MaxUpgradedCount = tmp.MaxUpgradedCount + upgradedGift.OwnerAddress = tmp.OwnerAddress + upgradedGift.OwnerName = tmp.OwnerName + upgradedGift.Model = tmp.Model + upgradedGift.Symbol = tmp.Symbol + upgradedGift.Backdrop = tmp.Backdrop + upgradedGift.OriginalDetails = tmp.OriginalDetails + + fieldOwnerId, _ := UnmarshalMessageSender(tmp.OwnerId) + upgradedGift.OwnerId = fieldOwnerId + + return nil +} + // Contains result of gift upgrading type UpgradeGiftResult struct { meta // The upgraded gift Gift *UpgradedGift `json:"gift"` - // True, if the gift is displayed on the user's profile page + // Unique identifier of the received gift for the current user + ReceivedGiftId string `json:"received_gift_id"` + // True, if the gift is displayed on the user's or the channel's profile page IsSaved bool `json:"is_saved"` - // True, if the gift can be transferred to another user + // True, if the gift can be transferred to another owner CanBeTransferred bool `json:"can_be_transferred"` // Number of Telegram Stars that must be paid to transfer the upgraded gift TransferStarCount int64 `json:"transfer_star_count"` - // Point in time (Unix timestamp) when the gift can be transferred to TON blockchain as an NFT + // Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT ExportDate int32 `json:"export_date"` } @@ -8692,20 +8805,22 @@ func (*SentGiftUpgraded) SentGiftType() string { return TypeSentGiftUpgraded } -// Represents a gift received by a user -type UserGift struct { +// Represents a gift received by a user or a chat +type ReceivedGift struct { meta - // Identifier of the user that sent the gift; 0 if unknown - SenderUserId int64 `json:"sender_user_id"` + // Unique identifier of the received gift for the current user; only for the receiver of the gift + ReceivedGiftId string `json:"received_gift_id"` + // Identifier of a user or a chat that sent the gift; may be null if unknown + SenderId MessageSender `json:"sender_id"` // Message added to the gift Text *FormattedText `json:"text"` // True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone are able to see them IsPrivate bool `json:"is_private"` - // True, if the gift is displayed on the user's profile page; only for the receiver of the gift + // True, if the gift is displayed on the chat's profile page; only for the receiver of the gift IsSaved bool `json:"is_saved"` // True, if the gift is a regular gift that can be upgraded to a unique gift; only for the receiver of the gift CanBeUpgraded bool `json:"can_be_upgraded"` - // True, if the gift is an upgraded gift that can be transferred to another user; only for the receiver of the gift + // True, if the gift is an upgraded gift that can be transferred to another owner; only for the receiver of the gift CanBeTransferred bool `json:"can_be_transferred"` // True, if the gift was refunded and isn't available anymore WasRefunded bool `json:"was_refunded"` @@ -8713,37 +8828,36 @@ type UserGift struct { Date int32 `json:"date"` // The gift Gift SentGift `json:"gift"` - // Identifier of the message with the gift in the chat with the sender of the gift; can be 0 or an identifier of a deleted message; only for the receiver of the gift - MessageId int64 `json:"message_id"` // Number of Telegram Stars that can be claimed by the receiver instead of the regular gift; 0 if the gift can't be sold by the current user SellStarCount int64 `json:"sell_star_count"` // Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift PrepaidUpgradeStarCount int64 `json:"prepaid_upgrade_star_count"` // Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift TransferStarCount int64 `json:"transfer_star_count"` - // Point in time (Unix timestamp) when the upgraded gift can be transferred to TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift + // Point in time (Unix timestamp) when the upgraded gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift ExportDate int32 `json:"export_date"` } -func (entity *UserGift) MarshalJSON() ([]byte, error) { +func (entity *ReceivedGift) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub UserGift + type stub ReceivedGift return json.Marshal((*stub)(entity)) } -func (*UserGift) GetClass() string { - return ClassUserGift +func (*ReceivedGift) GetClass() string { + return ClassReceivedGift } -func (*UserGift) GetType() string { - return TypeUserGift +func (*ReceivedGift) GetType() string { + return TypeReceivedGift } -func (userGift *UserGift) UnmarshalJSON(data []byte) error { +func (receivedGift *ReceivedGift) UnmarshalJSON(data []byte) error { var tmp struct { - SenderUserId int64 `json:"sender_user_id"` + ReceivedGiftId string `json:"received_gift_id"` + SenderId json.RawMessage `json:"sender_id"` Text *FormattedText `json:"text"` IsPrivate bool `json:"is_private"` IsSaved bool `json:"is_saved"` @@ -8752,7 +8866,6 @@ func (userGift *UserGift) UnmarshalJSON(data []byte) error { WasRefunded bool `json:"was_refunded"` Date int32 `json:"date"` Gift json.RawMessage `json:"gift"` - MessageId int64 `json:"message_id"` SellStarCount int64 `json:"sell_star_count"` PrepaidUpgradeStarCount int64 `json:"prepaid_upgrade_star_count"` TransferStarCount int64 `json:"transfer_star_count"` @@ -8764,51 +8877,55 @@ func (userGift *UserGift) UnmarshalJSON(data []byte) error { return err } - userGift.SenderUserId = tmp.SenderUserId - userGift.Text = tmp.Text - userGift.IsPrivate = tmp.IsPrivate - userGift.IsSaved = tmp.IsSaved - userGift.CanBeUpgraded = tmp.CanBeUpgraded - userGift.CanBeTransferred = tmp.CanBeTransferred - userGift.WasRefunded = tmp.WasRefunded - userGift.Date = tmp.Date - userGift.MessageId = tmp.MessageId - userGift.SellStarCount = tmp.SellStarCount - userGift.PrepaidUpgradeStarCount = tmp.PrepaidUpgradeStarCount - userGift.TransferStarCount = tmp.TransferStarCount - userGift.ExportDate = tmp.ExportDate + receivedGift.ReceivedGiftId = tmp.ReceivedGiftId + receivedGift.Text = tmp.Text + receivedGift.IsPrivate = tmp.IsPrivate + receivedGift.IsSaved = tmp.IsSaved + receivedGift.CanBeUpgraded = tmp.CanBeUpgraded + receivedGift.CanBeTransferred = tmp.CanBeTransferred + receivedGift.WasRefunded = tmp.WasRefunded + receivedGift.Date = tmp.Date + receivedGift.SellStarCount = tmp.SellStarCount + receivedGift.PrepaidUpgradeStarCount = tmp.PrepaidUpgradeStarCount + receivedGift.TransferStarCount = tmp.TransferStarCount + receivedGift.ExportDate = tmp.ExportDate + + fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) + receivedGift.SenderId = fieldSenderId fieldGift, _ := UnmarshalSentGift(tmp.Gift) - userGift.Gift = fieldGift + receivedGift.Gift = fieldGift return nil } -// Represents a list of gifts received by a user -type UserGifts struct { +// Represents a list of gifts received by a user or a chat +type ReceivedGifts struct { meta // The total number of received gifts TotalCount int32 `json:"total_count"` // The list of gifts - Gifts []*UserGift `json:"gifts"` + Gifts []*ReceivedGift `json:"gifts"` + // True, if notifications about new gifts of the owner are enabled + AreNotificationsEnabled bool `json:"are_notifications_enabled"` // The offset for the next request. If empty, then there are no more results NextOffset string `json:"next_offset"` } -func (entity *UserGifts) MarshalJSON() ([]byte, error) { +func (entity *ReceivedGifts) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub UserGifts + type stub ReceivedGifts return json.Marshal((*stub)(entity)) } -func (*UserGifts) GetClass() string { - return ClassUserGifts +func (*ReceivedGifts) GetClass() string { + return ClassReceivedGifts } -func (*UserGifts) GetType() string { - return TypeUserGifts +func (*ReceivedGifts) GetType() string { + return TypeReceivedGifts } // Contains examples of possible upgraded gifts for the given regular gift @@ -9535,11 +9652,11 @@ func (*StarTransactionTypeChannelSubscriptionSale) StarTransactionTypeType() str return TypeStarTransactionTypeChannelSubscriptionSale } -// The transaction is a purchase of a regular gift to another user; for regular users and bots only +// The transaction is a purchase of a regular gift; for regular users and bots only type StarTransactionTypeGiftPurchase struct { meta - // Identifier of the user that received the gift - UserId int64 `json:"user_id"` + // Identifier of the user or the channel that received the gift + OwnerId MessageSender `json:"owner_id"` // The gift Gift *Gift `json:"gift"` } @@ -9564,11 +9681,30 @@ func (*StarTransactionTypeGiftPurchase) StarTransactionTypeType() string { return TypeStarTransactionTypeGiftPurchase } -// The transaction is a transfer of an upgraded gift to another user; for regular users only +func (starTransactionTypeGiftPurchase *StarTransactionTypeGiftPurchase) UnmarshalJSON(data []byte) error { + var tmp struct { + OwnerId json.RawMessage `json:"owner_id"` + Gift *Gift `json:"gift"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + starTransactionTypeGiftPurchase.Gift = tmp.Gift + + fieldOwnerId, _ := UnmarshalMessageSender(tmp.OwnerId) + starTransactionTypeGiftPurchase.OwnerId = fieldOwnerId + + return nil +} + +// The transaction is a transfer of an upgraded gift; for regular users only type StarTransactionTypeGiftTransfer struct { meta - // Identifier of the user that received the gift - UserId int64 `json:"user_id"` + // Identifier of the user or the channel that received the gift + OwnerId MessageSender `json:"owner_id"` // The gift Gift *UpgradedGift `json:"gift"` } @@ -9593,7 +9729,26 @@ func (*StarTransactionTypeGiftTransfer) StarTransactionTypeType() string { return TypeStarTransactionTypeGiftTransfer } -// The transaction is a sale of a gift received from another user or bot; for regular users only +func (starTransactionTypeGiftTransfer *StarTransactionTypeGiftTransfer) UnmarshalJSON(data []byte) error { + var tmp struct { + OwnerId json.RawMessage `json:"owner_id"` + Gift *UpgradedGift `json:"gift"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + starTransactionTypeGiftTransfer.Gift = tmp.Gift + + fieldOwnerId, _ := UnmarshalMessageSender(tmp.OwnerId) + starTransactionTypeGiftTransfer.OwnerId = fieldOwnerId + + return nil +} + +// The transaction is a sale of a received gift; for regular users and channel chats only type StarTransactionTypeGiftSale struct { meta // Identifier of the user that sent the gift @@ -10211,11 +10366,75 @@ func (*ProfileAccentColor) GetType() string { return TypeProfileAccentColor } -// Describes a custom emoji to be shown instead of the Telegram Premium badge -type EmojiStatus struct { +// A custom emoji set as emoji status +type EmojiStatusTypeCustomEmoji struct { meta // Identifier of the custom emoji in stickerFormatTgs format CustomEmojiId JsonInt64 `json:"custom_emoji_id"` +} + +func (entity *EmojiStatusTypeCustomEmoji) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub EmojiStatusTypeCustomEmoji + + return json.Marshal((*stub)(entity)) +} + +func (*EmojiStatusTypeCustomEmoji) GetClass() string { + return ClassEmojiStatusType +} + +func (*EmojiStatusTypeCustomEmoji) GetType() string { + return TypeEmojiStatusTypeCustomEmoji +} + +func (*EmojiStatusTypeCustomEmoji) EmojiStatusTypeType() string { + return TypeEmojiStatusTypeCustomEmoji +} + +// An upgraded gift set as emoji status +type EmojiStatusTypeUpgradedGift struct { + meta + // Identifier of the upgraded gift + UpgradedGiftId JsonInt64 `json:"upgraded_gift_id"` + // The title of the upgraded gift + GiftTitle string `json:"gift_title"` + // Unique name of the upgraded gift that can be used with internalLinkTypeUpgradedGift + GiftName string `json:"gift_name"` + // Custom emoji identifier of the model of the upgraded gift + ModelCustomEmojiId JsonInt64 `json:"model_custom_emoji_id"` + // Custom emoji identifier of the symbol of the upgraded gift + SymbolCustomEmojiId JsonInt64 `json:"symbol_custom_emoji_id"` + // Colors of the backdrop of the upgraded gift + BackdropColors *UpgradedGiftBackdropColors `json:"backdrop_colors"` +} + +func (entity *EmojiStatusTypeUpgradedGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub EmojiStatusTypeUpgradedGift + + return json.Marshal((*stub)(entity)) +} + +func (*EmojiStatusTypeUpgradedGift) GetClass() string { + return ClassEmojiStatusType +} + +func (*EmojiStatusTypeUpgradedGift) GetType() string { + return TypeEmojiStatusTypeUpgradedGift +} + +func (*EmojiStatusTypeUpgradedGift) EmojiStatusTypeType() string { + return TypeEmojiStatusTypeUpgradedGift +} + +// Describes an emoji to be shown instead of the Telegram Premium badge +type EmojiStatus struct { + meta + // Type of the emoji status + Type EmojiStatusType `json:"type"` // Point in time (Unix timestamp) when the status will expire; 0 if never ExpirationDate int32 `json:"expiration_date"` } @@ -10236,11 +10455,30 @@ func (*EmojiStatus) GetType() string { return TypeEmojiStatus } -// Contains a list of custom emoji identifiers for emoji statuses +func (emojiStatus *EmojiStatus) UnmarshalJSON(data []byte) error { + var tmp struct { + Type json.RawMessage `json:"type"` + ExpirationDate int32 `json:"expiration_date"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + emojiStatus.ExpirationDate = tmp.ExpirationDate + + fieldType, _ := UnmarshalEmojiStatusType(tmp.Type) + emojiStatus.Type = fieldType + + return nil +} + +// Contains a list of emoji statuses type EmojiStatuses struct { meta - // The list of custom emoji identifiers - CustomEmojiIds []JsonInt64 `json:"custom_emoji_ids"` + // The list of emoji statuses identifiers + EmojiStatuses []*EmojiStatus `json:"emoji_statuses"` } func (entity *EmojiStatuses) MarshalJSON() ([]byte, error) { @@ -10259,6 +10497,29 @@ func (*EmojiStatuses) GetType() string { return TypeEmojiStatuses } +// Contains a list of custom emoji identifiers for emoji statuses +type EmojiStatusCustomEmojis struct { + meta + // The list of custom emoji identifiers + CustomEmojiIds []JsonInt64 `json:"custom_emoji_ids"` +} + +func (entity *EmojiStatusCustomEmojis) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub EmojiStatusCustomEmojis + + return json.Marshal((*stub)(entity)) +} + +func (*EmojiStatusCustomEmojis) GetClass() string { + return ClassEmojiStatusCustomEmojis +} + +func (*EmojiStatusCustomEmojis) GetType() string { + return TypeEmojiStatusCustomEmojis +} + // Describes usernames assigned to a user, a supergroup, or a channel type Usernames struct { meta @@ -10597,7 +10858,7 @@ type UserFullInfo struct { Birthdate *Birthdate `json:"birthdate"` // Identifier of the personal chat of the user; 0 if none PersonalChatId int64 `json:"personal_chat_id"` - // Number of gifts saved to profile by the user + // Number of saved to profile gifts for other users or the total number of received gifts for the current user GiftCount int32 `json:"gift_count"` // Number of group chats where both the other user and the current user are a member; 0 for the current user GroupInCommonCount int32 `json:"group_in_common_count"` @@ -12123,6 +12384,8 @@ type SupergroupFullInfo struct { CanGetRevenueStatistics bool `json:"can_get_revenue_statistics"` // True, if the supergroup or channel Telegram Star revenue statistics are available CanGetStarRevenueStatistics bool `json:"can_get_star_revenue_statistics"` + // True, if the user can send a gift to the supergroup or channel using sendGift or transferGift + CanSendGift bool `json:"can_send_gift"` // True, if aggressive anti-spam checks can be enabled or disabled in the supergroup CanToggleAggressiveAntiSpam bool `json:"can_toggle_aggressive_anti_spam"` // 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, so this option affects only private non-forum supergroups without a linked chat. The value of this field is only available to chat administrators @@ -12135,6 +12398,8 @@ type SupergroupFullInfo struct { HasPaidMediaAllowed bool `json:"has_paid_media_allowed"` // True, if the supergroup or channel has pinned stories HasPinnedStories bool `json:"has_pinned_stories"` + // Number of saved to profile gifts for channels without can_post_messages administrator right, otherwise, the total number of received gifts + GiftCount int32 `json:"gift_count"` // Number of times the current user boosted the supergroup or channel MyBoostCount int32 `json:"my_boost_count"` // Number of times the supergroup must be boosted by a user to ignore slow mode and chat permission restrictions; 0 if unspecified @@ -21133,6 +21398,33 @@ func (*LinkPreviewTypeUnsupported) LinkPreviewTypeType() string { return TypeLinkPreviewTypeUnsupported } +// The link is a link to an upgraded gift +type LinkPreviewTypeUpgradedGift struct { + meta + // The gift + Gift *UpgradedGift `json:"gift"` +} + +func (entity *LinkPreviewTypeUpgradedGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeUpgradedGift + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeUpgradedGift) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeUpgradedGift) GetType() string { + return TypeLinkPreviewTypeUpgradedGift +} + +func (*LinkPreviewTypeUpgradedGift) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeUpgradedGift +} + // The link is a link to a user type LinkPreviewTypeUser struct { meta @@ -22560,6 +22852,10 @@ type PaidMediaVideo struct { meta // The video Video *Video `json:"video"` + // Cover of the video; may be null if none + Cover *Photo `json:"cover"` + // Timestamp from which the video playing must start, in seconds + StartTimestamp int32 `json:"start_timestamp"` } func (entity *PaidMediaVideo) MarshalJSON() ([]byte, error) { @@ -25042,6 +25338,10 @@ type MessageVideo struct { Video *Video `json:"video"` // Alternative qualities of the video AlternativeVideos []*AlternativeVideo `json:"alternative_videos"` + // Cover of the video; may be null if none + Cover *Photo `json:"cover"` + // Timestamp from which the video playing must start, in seconds + StartTimestamp int32 `json:"start_timestamp"` // Video caption Caption *FormattedText `json:"caption"` // True, if the caption must be shown above the video; otherwise, the caption must be shown below the video @@ -26956,11 +27256,15 @@ func (*MessageGiveawayPrizeStars) MessageContentType() string { return TypeMessageGiveawayPrizeStars } -// A regular gift was received or sent by the current user +// A regular gift was received or sent by the current user, or the current user was notified about a channel gift type MessageGift struct { meta // The gift Gift *Gift `json:"gift"` + // Sender of the gift + SenderId MessageSender `json:"sender_id"` + // Unique identifier of the received gift for the current user; only for the receiver of the gift + ReceivedGiftId string `json:"received_gift_id"` // Message added to the gift Text *FormattedText `json:"text"` // Number of Telegram Stars that can be claimed by the receiver instead of the regular gift; 0 if the gift can't be sold by the receiver @@ -26969,7 +27273,7 @@ type MessageGift struct { PrepaidUpgradeStarCount int64 `json:"prepaid_upgrade_star_count"` // True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone will be able to see them IsPrivate bool `json:"is_private"` - // True, if the gift is displayed on the user's profile page; only for the receiver of the gift + // True, if the gift is displayed on the user's or the channel's profile page; only for the receiver of the gift IsSaved bool `json:"is_saved"` // True, if the gift can be upgraded to a unique gift; only for the receiver of the gift CanBeUpgraded bool `json:"can_be_upgraded"` @@ -26979,8 +27283,8 @@ type MessageGift struct { WasUpgraded bool `json:"was_upgraded"` // True, if the gift was refunded and isn't available anymore WasRefunded bool `json:"was_refunded"` - // Identifier of the service message messageUpgradedGift or messageRefundedUpgradedGift with upgraded version of the gift; can be 0 if none or an identifier of a deleted message. Use getUserGift to get information about the gift - UpgradeMessageId int64 `json:"upgrade_message_id"` + // Identifier of the corresponding upgraded gift; may be empty if unknown. Use getReceivedGift to get information about the gift + UpgradedReceivedGiftId string `json:"upgraded_received_gift_id"` } func (entity *MessageGift) MarshalJSON() ([]byte, error) { @@ -27003,22 +27307,67 @@ func (*MessageGift) MessageContentType() string { return TypeMessageGift } -// An upgraded gift was received or sent by the current user +func (messageGift *MessageGift) UnmarshalJSON(data []byte) error { + var tmp struct { + Gift *Gift `json:"gift"` + SenderId json.RawMessage `json:"sender_id"` + ReceivedGiftId string `json:"received_gift_id"` + Text *FormattedText `json:"text"` + SellStarCount int64 `json:"sell_star_count"` + PrepaidUpgradeStarCount int64 `json:"prepaid_upgrade_star_count"` + IsPrivate bool `json:"is_private"` + IsSaved bool `json:"is_saved"` + CanBeUpgraded bool `json:"can_be_upgraded"` + WasConverted bool `json:"was_converted"` + WasUpgraded bool `json:"was_upgraded"` + WasRefunded bool `json:"was_refunded"` + UpgradedReceivedGiftId string `json:"upgraded_received_gift_id"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageGift.Gift = tmp.Gift + messageGift.ReceivedGiftId = tmp.ReceivedGiftId + messageGift.Text = tmp.Text + messageGift.SellStarCount = tmp.SellStarCount + messageGift.PrepaidUpgradeStarCount = tmp.PrepaidUpgradeStarCount + messageGift.IsPrivate = tmp.IsPrivate + messageGift.IsSaved = tmp.IsSaved + messageGift.CanBeUpgraded = tmp.CanBeUpgraded + messageGift.WasConverted = tmp.WasConverted + messageGift.WasUpgraded = tmp.WasUpgraded + messageGift.WasRefunded = tmp.WasRefunded + messageGift.UpgradedReceivedGiftId = tmp.UpgradedReceivedGiftId + + fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) + messageGift.SenderId = fieldSenderId + + return nil +} + +// An upgraded gift was received or sent by the current user, or the current user was notified about a channel gift type MessageUpgradedGift struct { meta // The gift Gift *UpgradedGift `json:"gift"` + // Sender of the gift; may be null for anonymous gifts + SenderId MessageSender `json:"sender_id"` + // Unique identifier of the received gift for the current user; only for the receiver of the gift + ReceivedGiftId string `json:"received_gift_id"` // True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred gift IsUpgrade bool `json:"is_upgrade"` - // True, if the gift is displayed on the user's profile page; only for the receiver of the gift + // True, if the gift is displayed on the user's or the channel's profile page; only for the receiver of the gift IsSaved bool `json:"is_saved"` - // True, if the gift can be transferred to another user; only for the receiver of the gift + // True, if the gift can be transferred to another owner; only for the receiver of the gift CanBeTransferred bool `json:"can_be_transferred"` - // True, if the gift was transferred to another user; only for the receiver of the gift + // True, if the gift was transferred to another owner; only for the receiver of the gift WasTransferred bool `json:"was_transferred"` // Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift TransferStarCount int64 `json:"transfer_star_count"` - // Point in time (Unix timestamp) when the gift can be transferred to TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift + // Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift ExportDate int32 `json:"export_date"` } @@ -27042,11 +27391,46 @@ func (*MessageUpgradedGift) MessageContentType() string { return TypeMessageUpgradedGift } +func (messageUpgradedGift *MessageUpgradedGift) UnmarshalJSON(data []byte) error { + var tmp struct { + Gift *UpgradedGift `json:"gift"` + SenderId json.RawMessage `json:"sender_id"` + ReceivedGiftId string `json:"received_gift_id"` + IsUpgrade bool `json:"is_upgrade"` + IsSaved bool `json:"is_saved"` + CanBeTransferred bool `json:"can_be_transferred"` + WasTransferred bool `json:"was_transferred"` + TransferStarCount int64 `json:"transfer_star_count"` + ExportDate int32 `json:"export_date"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageUpgradedGift.Gift = tmp.Gift + messageUpgradedGift.ReceivedGiftId = tmp.ReceivedGiftId + messageUpgradedGift.IsUpgrade = tmp.IsUpgrade + messageUpgradedGift.IsSaved = tmp.IsSaved + messageUpgradedGift.CanBeTransferred = tmp.CanBeTransferred + messageUpgradedGift.WasTransferred = tmp.WasTransferred + messageUpgradedGift.TransferStarCount = tmp.TransferStarCount + messageUpgradedGift.ExportDate = tmp.ExportDate + + fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) + messageUpgradedGift.SenderId = fieldSenderId + + return nil +} + // A gift which purchase, upgrade or transfer were refunded type MessageRefundedUpgradedGift struct { meta // The gift Gift *Gift `json:"gift"` + // Sender of the gift + SenderId MessageSender `json:"sender_id"` // True, if the gift was obtained by upgrading of a previously received gift IsUpgrade bool `json:"is_upgrade"` } @@ -27071,6 +27455,27 @@ func (*MessageRefundedUpgradedGift) MessageContentType() string { return TypeMessageRefundedUpgradedGift } +func (messageRefundedUpgradedGift *MessageRefundedUpgradedGift) UnmarshalJSON(data []byte) error { + var tmp struct { + Gift *Gift `json:"gift"` + SenderId json.RawMessage `json:"sender_id"` + IsUpgrade bool `json:"is_upgrade"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageRefundedUpgradedGift.Gift = tmp.Gift + messageRefundedUpgradedGift.IsUpgrade = tmp.IsUpgrade + + fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) + messageRefundedUpgradedGift.SenderId = fieldSenderId + + return nil +} + // A contact has registered with Telegram type MessageContactRegistered struct{ meta @@ -28040,6 +28445,10 @@ func (*InputPaidMediaTypePhoto) InputPaidMediaTypeType() string { // The media is a video type InputPaidMediaTypeVideo struct { meta + // Cover of the video; pass null to skip cover uploading + Cover InputFile `json:"cover"` + // Timestamp from which the video playing must start, in seconds + StartTimestamp int32 `json:"start_timestamp"` // Duration of the video, in seconds Duration int32 `json:"duration"` // True, if the video is expected to be streamed @@ -28066,6 +28475,29 @@ func (*InputPaidMediaTypeVideo) InputPaidMediaTypeType() string { return TypeInputPaidMediaTypeVideo } +func (inputPaidMediaTypeVideo *InputPaidMediaTypeVideo) UnmarshalJSON(data []byte) error { + var tmp struct { + Cover json.RawMessage `json:"cover"` + StartTimestamp int32 `json:"start_timestamp"` + Duration int32 `json:"duration"` + SupportsStreaming bool `json:"supports_streaming"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + inputPaidMediaTypeVideo.StartTimestamp = tmp.StartTimestamp + inputPaidMediaTypeVideo.Duration = tmp.Duration + inputPaidMediaTypeVideo.SupportsStreaming = tmp.SupportsStreaming + + fieldCover, _ := UnmarshalInputFile(tmp.Cover) + inputPaidMediaTypeVideo.Cover = fieldCover + + return nil +} + // Describes a paid media to be sent type InputPaidMedia struct { meta @@ -28767,6 +29199,10 @@ type InputMessageVideo struct { Video InputFile `json:"video"` // Video thumbnail; pass null to skip thumbnail uploading Thumbnail *InputThumbnail `json:"thumbnail"` + // Cover of the video; pass null to skip cover uploading; not supported in secret chats and for self-destructing messages + Cover InputFile `json:"cover"` + // Timestamp from which the video playing must start, in seconds + StartTimestamp int32 `json:"start_timestamp"` // File identifiers of the stickers added to the video, if applicable AddedStickerFileIds []int32 `json:"added_sticker_file_ids"` // Duration of the video, in seconds @@ -28811,6 +29247,8 @@ func (inputMessageVideo *InputMessageVideo) UnmarshalJSON(data []byte) error { var tmp struct { Video json.RawMessage `json:"video"` Thumbnail *InputThumbnail `json:"thumbnail"` + Cover json.RawMessage `json:"cover"` + StartTimestamp int32 `json:"start_timestamp"` AddedStickerFileIds []int32 `json:"added_sticker_file_ids"` Duration int32 `json:"duration"` Width int32 `json:"width"` @@ -28828,6 +29266,7 @@ func (inputMessageVideo *InputMessageVideo) UnmarshalJSON(data []byte) error { } inputMessageVideo.Thumbnail = tmp.Thumbnail + inputMessageVideo.StartTimestamp = tmp.StartTimestamp inputMessageVideo.AddedStickerFileIds = tmp.AddedStickerFileIds inputMessageVideo.Duration = tmp.Duration inputMessageVideo.Width = tmp.Width @@ -28840,6 +29279,9 @@ func (inputMessageVideo *InputMessageVideo) UnmarshalJSON(data []byte) error { fieldVideo, _ := UnmarshalInputFile(tmp.Video) inputMessageVideo.Video = fieldVideo + fieldCover, _ := UnmarshalInputFile(tmp.Cover) + inputMessageVideo.Cover = fieldCover + fieldSelfDestructType, _ := UnmarshalMessageSelfDestructType(tmp.SelfDestructType) inputMessageVideo.SelfDestructType = fieldSelfDestructType @@ -29270,8 +29712,12 @@ type InputMessageForwarded struct { FromChatId int64 `json:"from_chat_id"` // Identifier of the message to forward. A message can be forwarded only if messageProperties.can_be_forwarded MessageId int64 `json:"message_id"` - // True, if a game message is being shared from a launched game; applies only to game messages + // Pass true if a game message is being shared from a launched game; applies only to game messages InGameShare bool `json:"in_game_share"` + // Pass true to replace video start timestamp in the forwarded message + ReplaceVideoStartTimestamp bool `json:"replace_video_start_timestamp"` + // The new video start timestamp; ignored if replace_video_start_timestamp == false + NewVideoStartTimestamp int32 `json:"new_video_start_timestamp"` // Options to be used to copy content of the message without reference to the original sender; pass null to forward the message as usual CopyOptions *MessageCopyOptions `json:"copy_options"` } @@ -31238,6 +31684,33 @@ func (*StoryAreaTypeWeather) StoryAreaTypeType() string { return TypeStoryAreaTypeWeather } +// An area with an upgraded gift +type StoryAreaTypeUpgradedGift struct { + meta + // Unique name of the upgraded gift + GiftName string `json:"gift_name"` +} + +func (entity *StoryAreaTypeUpgradedGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryAreaTypeUpgradedGift + + return json.Marshal((*stub)(entity)) +} + +func (*StoryAreaTypeUpgradedGift) GetClass() string { + return ClassStoryAreaType +} + +func (*StoryAreaTypeUpgradedGift) GetType() string { + return TypeStoryAreaTypeUpgradedGift +} + +func (*StoryAreaTypeUpgradedGift) StoryAreaTypeType() string { + return TypeStoryAreaTypeUpgradedGift +} + // Describes a clickable rectangle area on a story media type StoryArea struct { meta @@ -31508,6 +31981,33 @@ func (*InputStoryAreaTypeWeather) InputStoryAreaTypeType() string { return TypeInputStoryAreaTypeWeather } +// An area with an upgraded gift +type InputStoryAreaTypeUpgradedGift struct { + meta + // Unique name of the upgraded gift + GiftName string `json:"gift_name"` +} + +func (entity *InputStoryAreaTypeUpgradedGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputStoryAreaTypeUpgradedGift + + return json.Marshal((*stub)(entity)) +} + +func (*InputStoryAreaTypeUpgradedGift) GetClass() string { + return ClassInputStoryAreaType +} + +func (*InputStoryAreaTypeUpgradedGift) GetType() string { + return TypeInputStoryAreaTypeUpgradedGift +} + +func (*InputStoryAreaTypeUpgradedGift) InputStoryAreaTypeType() string { + return TypeInputStoryAreaTypeUpgradedGift +} + // Describes a clickable rectangle area on a story media to be added type InputStoryArea struct { meta @@ -31555,7 +32055,7 @@ func (inputStoryArea *InputStoryArea) UnmarshalJSON(data []byte) error { // Contains a list of story areas to be added type InputStoryAreas struct { meta - // List of input story areas. Currently, a story can have up to 10 inputStoryAreaTypeLocation, inputStoryAreaTypeFoundVenue, and inputStoryAreaTypePreviousVenue areas, up to getOption("story_suggested_reaction_area_count_max") inputStoryAreaTypeSuggestedReaction areas, up to 1 inputStoryAreaTypeMessage area, up to getOption("story_link_area_count_max") inputStoryAreaTypeLink areas if the current user is a Telegram Premium user, and up to 3 inputStoryAreaTypeWeather areas + // List of input story areas. Currently, a story can have up to 10 inputStoryAreaTypeLocation, inputStoryAreaTypeFoundVenue, and inputStoryAreaTypePreviousVenue areas, up to getOption("story_suggested_reaction_area_count_max") inputStoryAreaTypeSuggestedReaction areas, up to 1 inputStoryAreaTypeMessage area, up to getOption("story_link_area_count_max") inputStoryAreaTypeLink areas if the current user is a Telegram Premium user, up to 3 inputStoryAreaTypeWeather areas, and up to 1 inputStoryAreaTypeUpgradedGift area Areas []*InputStoryArea `json:"areas"` } @@ -47975,6 +48475,33 @@ func (*InternalLinkTypeUnsupportedProxy) InternalLinkTypeType() string { return TypeInternalLinkTypeUnsupportedProxy } +// The link is a link to an upgraded gift. Call getUpgradedGift with the given name to process the link +type InternalLinkTypeUpgradedGift struct { + meta + // Name of the unique gift + Name string `json:"name"` +} + +func (entity *InternalLinkTypeUpgradedGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeUpgradedGift + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeUpgradedGift) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeUpgradedGift) GetType() string { + return TypeInternalLinkTypeUpgradedGift +} + +func (*InternalLinkTypeUpgradedGift) InternalLinkTypeType() string { + return TypeInternalLinkTypeUpgradedGift +} + // The link is a link to a user by its phone number. Call searchUserByPhoneNumber with the given phone number to process the link. If the user is found, then call createPrivateChat and open user's profile information screen or the chat itself. If draft text isn't empty, then put the draft text in the input field type InternalLinkTypeUserPhoneNumber struct { meta diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 4d60653..64c650d 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -1055,6 +1055,40 @@ func UnmarshalListOfGiveawayPrize(dataList []json.RawMessage) ([]GiveawayPrize, return list, nil } +func UnmarshalEmojiStatusType(data json.RawMessage) (EmojiStatusType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeEmojiStatusTypeCustomEmoji: + return UnmarshalEmojiStatusTypeCustomEmoji(data) + + case TypeEmojiStatusTypeUpgradedGift: + return UnmarshalEmojiStatusTypeUpgradedGift(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfEmojiStatusType(dataList []json.RawMessage) ([]EmojiStatusType, error) { + list := []EmojiStatusType{} + + for _, data := range dataList { + entity, err := UnmarshalEmojiStatusType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalChatMemberStatus(data json.RawMessage) (ChatMemberStatus, error) { var meta meta @@ -2610,6 +2644,9 @@ func UnmarshalLinkPreviewType(data json.RawMessage) (LinkPreviewType, error) { case TypeLinkPreviewTypeUnsupported: return UnmarshalLinkPreviewTypeUnsupported(data) + case TypeLinkPreviewTypeUpgradedGift: + return UnmarshalLinkPreviewTypeUpgradedGift(data) + case TypeLinkPreviewTypeUser: return UnmarshalLinkPreviewTypeUser(data) @@ -4093,6 +4130,9 @@ func UnmarshalStoryAreaType(data json.RawMessage) (StoryAreaType, error) { case TypeStoryAreaTypeWeather: return UnmarshalStoryAreaTypeWeather(data) + case TypeStoryAreaTypeUpgradedGift: + return UnmarshalStoryAreaTypeUpgradedGift(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -4142,6 +4182,9 @@ func UnmarshalInputStoryAreaType(data json.RawMessage) (InputStoryAreaType, erro case TypeInputStoryAreaTypeWeather: return UnmarshalInputStoryAreaTypeWeather(data) + case TypeInputStoryAreaTypeUpgradedGift: + return UnmarshalInputStoryAreaTypeUpgradedGift(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -7003,6 +7046,9 @@ func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { case TypeInternalLinkTypeUnsupportedProxy: return UnmarshalInternalLinkTypeUnsupportedProxy(data) + case TypeInternalLinkTypeUpgradedGift: + return UnmarshalInternalLinkTypeUpgradedGift(data) + case TypeInternalLinkTypeUserPhoneNumber: return UnmarshalInternalLinkTypeUserPhoneNumber(data) @@ -9743,6 +9789,14 @@ func UnmarshalUpgradedGiftSymbol(data json.RawMessage) (*UpgradedGiftSymbol, err return &resp, err } +func UnmarshalUpgradedGiftBackdropColors(data json.RawMessage) (*UpgradedGiftBackdropColors, error) { + var resp UpgradedGiftBackdropColors + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpgradedGiftBackdrop(data json.RawMessage) (*UpgradedGiftBackdrop, error) { var resp UpgradedGiftBackdrop @@ -9807,16 +9861,16 @@ func UnmarshalSentGiftUpgraded(data json.RawMessage) (*SentGiftUpgraded, error) return &resp, err } -func UnmarshalUserGift(data json.RawMessage) (*UserGift, error) { - var resp UserGift +func UnmarshalReceivedGift(data json.RawMessage) (*ReceivedGift, error) { + var resp ReceivedGift err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalUserGifts(data json.RawMessage) (*UserGifts, error) { - var resp UserGifts +func UnmarshalReceivedGifts(data json.RawMessage) (*ReceivedGifts, error) { + var resp ReceivedGifts err := json.Unmarshal(data, &resp) @@ -10175,6 +10229,22 @@ func UnmarshalProfileAccentColor(data json.RawMessage) (*ProfileAccentColor, err return &resp, err } +func UnmarshalEmojiStatusTypeCustomEmoji(data json.RawMessage) (*EmojiStatusTypeCustomEmoji, error) { + var resp EmojiStatusTypeCustomEmoji + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalEmojiStatusTypeUpgradedGift(data json.RawMessage) (*EmojiStatusTypeUpgradedGift, error) { + var resp EmojiStatusTypeUpgradedGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalEmojiStatus(data json.RawMessage) (*EmojiStatus, error) { var resp EmojiStatus @@ -10191,6 +10261,14 @@ func UnmarshalEmojiStatuses(data json.RawMessage) (*EmojiStatuses, error) { return &resp, err } +func UnmarshalEmojiStatusCustomEmojis(data json.RawMessage) (*EmojiStatusCustomEmojis, error) { + var resp EmojiStatusCustomEmojis + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUsernames(data json.RawMessage) (*Usernames, error) { var resp Usernames @@ -12639,6 +12717,14 @@ func UnmarshalLinkPreviewTypeUnsupported(data json.RawMessage) (*LinkPreviewType return &resp, err } +func UnmarshalLinkPreviewTypeUpgradedGift(data json.RawMessage) (*LinkPreviewTypeUpgradedGift, error) { + var resp LinkPreviewTypeUpgradedGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalLinkPreviewTypeUser(data json.RawMessage) (*LinkPreviewTypeUser, error) { var resp LinkPreviewTypeUser @@ -15151,6 +15237,14 @@ func UnmarshalStoryAreaTypeWeather(data json.RawMessage) (*StoryAreaTypeWeather, return &resp, err } +func UnmarshalStoryAreaTypeUpgradedGift(data json.RawMessage) (*StoryAreaTypeUpgradedGift, error) { + var resp StoryAreaTypeUpgradedGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStoryArea(data json.RawMessage) (*StoryArea, error) { var resp StoryArea @@ -15215,6 +15309,14 @@ func UnmarshalInputStoryAreaTypeWeather(data json.RawMessage) (*InputStoryAreaTy return &resp, err } +func UnmarshalInputStoryAreaTypeUpgradedGift(data json.RawMessage) (*InputStoryAreaTypeUpgradedGift, error) { + var resp InputStoryAreaTypeUpgradedGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInputStoryArea(data json.RawMessage) (*InputStoryArea, error) { var resp InputStoryArea @@ -19439,6 +19541,14 @@ func UnmarshalInternalLinkTypeUnsupportedProxy(data json.RawMessage) (*InternalL return &resp, err } +func UnmarshalInternalLinkTypeUpgradedGift(data json.RawMessage) (*InternalLinkTypeUpgradedGift, error) { + var resp InternalLinkTypeUpgradedGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInternalLinkTypeUserPhoneNumber(data json.RawMessage) (*InternalLinkTypeUserPhoneNumber, error) { var resp InternalLinkTypeUserPhoneNumber @@ -22433,6 +22543,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpgradedGiftSymbol: return UnmarshalUpgradedGiftSymbol(data) + case TypeUpgradedGiftBackdropColors: + return UnmarshalUpgradedGiftBackdropColors(data) + case TypeUpgradedGiftBackdrop: return UnmarshalUpgradedGiftBackdrop(data) @@ -22457,11 +22570,11 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSentGiftUpgraded: return UnmarshalSentGiftUpgraded(data) - case TypeUserGift: - return UnmarshalUserGift(data) + case TypeReceivedGift: + return UnmarshalReceivedGift(data) - case TypeUserGifts: - return UnmarshalUserGifts(data) + case TypeReceivedGifts: + return UnmarshalReceivedGifts(data) case TypeGiftUpgradePreview: return UnmarshalGiftUpgradePreview(data) @@ -22595,12 +22708,21 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeProfileAccentColor: return UnmarshalProfileAccentColor(data) + case TypeEmojiStatusTypeCustomEmoji: + return UnmarshalEmojiStatusTypeCustomEmoji(data) + + case TypeEmojiStatusTypeUpgradedGift: + return UnmarshalEmojiStatusTypeUpgradedGift(data) + case TypeEmojiStatus: return UnmarshalEmojiStatus(data) case TypeEmojiStatuses: return UnmarshalEmojiStatuses(data) + case TypeEmojiStatusCustomEmojis: + return UnmarshalEmojiStatusCustomEmojis(data) + case TypeUsernames: return UnmarshalUsernames(data) @@ -23519,6 +23641,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeLinkPreviewTypeUnsupported: return UnmarshalLinkPreviewTypeUnsupported(data) + case TypeLinkPreviewTypeUpgradedGift: + return UnmarshalLinkPreviewTypeUpgradedGift(data) + case TypeLinkPreviewTypeUser: return UnmarshalLinkPreviewTypeUser(data) @@ -24461,6 +24586,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStoryAreaTypeWeather: return UnmarshalStoryAreaTypeWeather(data) + case TypeStoryAreaTypeUpgradedGift: + return UnmarshalStoryAreaTypeUpgradedGift(data) + case TypeStoryArea: return UnmarshalStoryArea(data) @@ -24485,6 +24613,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInputStoryAreaTypeWeather: return UnmarshalInputStoryAreaTypeWeather(data) + case TypeInputStoryAreaTypeUpgradedGift: + return UnmarshalInputStoryAreaTypeUpgradedGift(data) + case TypeInputStoryArea: return UnmarshalInputStoryArea(data) @@ -26069,6 +26200,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInternalLinkTypeUnsupportedProxy: return UnmarshalInternalLinkTypeUnsupportedProxy(data) + case TypeInternalLinkTypeUpgradedGift: + return UnmarshalInternalLinkTypeUpgradedGift(data) + case TypeInternalLinkTypeUserPhoneNumber: return UnmarshalInternalLinkTypeUserPhoneNumber(data) diff --git a/data/td_api.tl b/data/td_api.tl index 9a83811..f0ffcfb 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -618,7 +618,7 @@ botVerificationParameters icon_custom_emoji_id:int64 organization_name:string de //@description Describes verification status provided by a bot //@bot_user_id Identifier of the bot that provided the verification //@icon_custom_emoji_id Identifier of the custom emoji that is used as the verification sign -//@custom_description Custom description of verification reason set by the bot +//@custom_description Custom description of verification reason set by the bot. Can contain only Mention, Hashtag, Cashtag, PhoneNumber, BankCardNumber, Url, and EmailAddress entities botVerification bot_user_id:int53 icon_custom_emoji_id:int64 custom_description:formattedText = BotVerification; //@description Contains information about verification status of a chat or a user @@ -1040,61 +1040,69 @@ upgradedGiftModel name:string sticker:sticker rarity_per_mille:int32 = UpgradedG //@rarity_per_mille The number of upgraded gift that receive this symbol for each 1000 gifts upgraded upgradedGiftSymbol name:string sticker:sticker rarity_per_mille:int32 = UpgradedGiftSymbol; -//@description Describes a backdrop of an upgraded gift -//@name Name of the backdrop +//@description Describes colors of a backdrop of an upgraded gift //@center_color A color in the center of the backdrop in the RGB format //@edge_color A color on the edges of the backdrop in the RGB format //@symbol_color A color to be applied for the symbol in the RGB format //@text_color A color for the text on the backdrop in the RGB format +upgradedGiftBackdropColors center_color:int32 edge_color:int32 symbol_color:int32 text_color:int32 = UpgradedGiftBackdropColors; + +//@description Describes a backdrop of an upgraded gift +//@name Name of the backdrop +//@colors Colors of the backdrop //@rarity_per_mille The number of upgraded gift that receive this backdrop for each 1000 gifts upgraded -upgradedGiftBackdrop name:string center_color:int32 edge_color:int32 symbol_color:int32 text_color:int32 rarity_per_mille:int32 = UpgradedGiftBackdrop; +upgradedGiftBackdrop name:string colors:upgradedGiftBackdropColors rarity_per_mille:int32 = UpgradedGiftBackdrop; //@description Describes the original details about the gift -//@sender_user_id Identifier of the user that sent the gift; 0 if the gift was private -//@receiver_user_id Identifier of the user that received the gift +//@sender_id Identifier of the user or the chat that sent the gift; may be null if the gift was private +//@receiver_id Identifier of the user or the chat that received the gift //@text Message added to the gift //@date Point in time (Unix timestamp) when the gift was sent -upgradedGiftOriginalDetails sender_user_id:int53 receiver_user_id:int53 text:formattedText date:int32 = UpgradedGiftOriginalDetails; +upgradedGiftOriginalDetails sender_id:MessageSender receiver_id:MessageSender text:formattedText date:int32 = UpgradedGiftOriginalDetails; -//@description Describes a gift that can be sent to another user +//@description Describes a gift that can be sent to another user or channel chat //@id Unique identifier of the gift //@sticker The sticker representing the gift //@star_count Number of Telegram Stars that must be paid for the gift //@default_sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the regular gift by default. If the gift was paid with just bought Telegram Stars, then full value can be claimed //@upgrade_star_count Number of Telegram Stars that must be paid to upgrade the gift; 0 if upgrade isn't possible //@is_for_birthday True, if the gift is a birthday gift -//@remaining_count Number of remaining times the gift can be purchased by all users; 0 if not limited or the gift was sold out -//@total_count Number of total times the gift can be purchased by all users; 0 if not limited +//@remaining_count Number of remaining times the gift can be purchased; 0 if not limited or the gift was sold out +//@total_count Number of total times the gift can be purchased; 0 if not limited //@first_send_date Point in time (Unix timestamp) when the gift was send for the first time; for sold out gifts only //@last_send_date Point in time (Unix timestamp) when the gift was send for the last time; for sold out gifts only gift id:int64 sticker:sticker star_count:int53 default_sell_star_count:int53 upgrade_star_count:int53 is_for_birthday:Bool remaining_count:int32 total_count:int32 first_send_date:int32 last_send_date:int32 = Gift; -//@description Contains a list of gifts that can be sent to another user @gifts The list of gifts +//@description Contains a list of gifts that can be sent to another user or channel chat @gifts The list of gifts gifts gifts:vector = Gifts; -//@description Describes an upgraded gift that can be gifted to another user or transferred to TON blockchain as an NFT +//@description Describes an upgraded gift that can be transferred to another owner or transferred to the TON blockchain as an NFT //@id Unique identifier of the gift //@title The title of the upgraded gift +//@name Unique name of the upgraded gift that can be used with internalLinkTypeUpgradedGift //@number Unique number of the upgraded gift among gifts upgraded from the same gift //@total_upgraded_count Total number of gifts that were upgraded from the same gift //@max_upgraded_count The maximum number of gifts that can be upgraded from the same gift -//@owner_user_id User identifier of the user that owns the upgraded gift; 0 if none +//@owner_id Identifier of the user or the chat that owns the upgraded gift; may be null if none or unknown +//@owner_address Address of the gift NFT owner in TON blockchain; may be empty if none +//@owner_name Name of the owner for the case when owner identifier and address aren't known //@model Model of the upgraded gift //@symbol Symbol of the upgraded gift //@backdrop Backdrop of the upgraded gift //@original_details Information about the originally sent gift; may be null if unknown -upgradedGift id:int64 title:string number:int32 total_upgraded_count:int32 max_upgraded_count:int32 owner_user_id:int53 model:upgradedGiftModel symbol:upgradedGiftSymbol backdrop:upgradedGiftBackdrop original_details:upgradedGiftOriginalDetails = UpgradedGift; +upgradedGift id:int64 title:string name:string number:int32 total_upgraded_count:int32 max_upgraded_count:int32 owner_id:MessageSender owner_address:string owner_name:string model:upgradedGiftModel symbol:upgradedGiftSymbol backdrop:upgradedGiftBackdrop original_details:upgradedGiftOriginalDetails = UpgradedGift; //@description Contains result of gift upgrading //@gift The upgraded gift -//@is_saved True, if the gift is displayed on the user's profile page -//@can_be_transferred True, if the gift can be transferred to another user +//@received_gift_id Unique identifier of the received gift for the current user +//@is_saved True, if the gift is displayed on the user's or the channel's profile page +//@can_be_transferred True, if the gift can be transferred to another owner //@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift -//@export_date Point in time (Unix timestamp) when the gift can be transferred to TON blockchain as an NFT -upgradeGiftResult gift:upgradedGift is_saved:Bool can_be_transferred:Bool transfer_star_count:int53 export_date:int32 = UpgradeGiftResult; +//@export_date Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT +upgradeGiftResult gift:upgradedGift received_gift_id:string is_saved:Bool can_be_transferred:Bool transfer_star_count:int53 export_date:int32 = UpgradeGiftResult; -//@class SentGift @description Represents a gift received by a user +//@class SentGift @description Represents content of a gift received by a user or a channel chat //@description Regular gift @gift The gift sentGiftRegular gift:gift = SentGift; @@ -1103,28 +1111,29 @@ sentGiftRegular gift:gift = SentGift; sentGiftUpgraded gift:upgradedGift = SentGift; -//@description Represents a gift received by a user -//@sender_user_id Identifier of the user that sent the gift; 0 if unknown +//@description Represents a gift received by a user or a chat +//@received_gift_id Unique identifier of the received gift for the current user; only for the receiver of the gift +//@sender_id Identifier of a user or a chat that sent the gift; may be null if unknown //@text Message added to the gift //@is_private True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone are able to see them -//@is_saved True, if the gift is displayed on the user's profile page; only for the receiver of the gift +//@is_saved True, if the gift is displayed on the chat's profile page; only for the receiver of the gift //@can_be_upgraded True, if the gift is a regular gift that can be upgraded to a unique gift; only for the receiver of the gift -//@can_be_transferred True, if the gift is an upgraded gift that can be transferred to another user; only for the receiver of the gift +//@can_be_transferred True, if the gift is an upgraded gift that can be transferred to another owner; only for the receiver of the gift //@was_refunded True, if the gift was refunded and isn't available anymore //@date Point in time (Unix timestamp) when the gift was sent //@gift The gift -//@message_id Identifier of the message with the gift in the chat with the sender of the gift; can be 0 or an identifier of a deleted message; only for the receiver of the gift //@sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the regular gift; 0 if the gift can't be sold by the current user //@prepaid_upgrade_star_count Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift //@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift -//@export_date Point in time (Unix timestamp) when the upgraded gift can be transferred to TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift -userGift sender_user_id:int53 text:formattedText is_private:Bool is_saved:Bool can_be_upgraded:Bool can_be_transferred:Bool was_refunded:Bool date:int32 gift:SentGift message_id:int53 sell_star_count:int53 prepaid_upgrade_star_count:int53 transfer_star_count:int53 export_date:int32 = UserGift; +//@export_date Point in time (Unix timestamp) when the upgraded gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift +receivedGift received_gift_id:string sender_id:MessageSender text:formattedText is_private:Bool is_saved:Bool can_be_upgraded:Bool can_be_transferred:Bool was_refunded:Bool date:int32 gift:SentGift sell_star_count:int53 prepaid_upgrade_star_count:int53 transfer_star_count:int53 export_date:int32 = ReceivedGift; -//@description Represents a list of gifts received by a user +//@description Represents a list of gifts received by a user or a chat //@total_count The total number of received gifts //@gifts The list of gifts +//@are_notifications_enabled True, if notifications about new gifts of the owner are enabled //@next_offset The offset for the next request. If empty, then there are no more results -userGifts total_count:int32 gifts:vector next_offset:string = UserGifts; +receivedGifts total_count:int32 gifts:vector are_notifications_enabled:Bool next_offset:string = ReceivedGifts; //@description Contains examples of possible upgraded gifts for the given regular gift //@models Examples of possible models that can be chosen for the gift after upgrade @@ -1235,13 +1244,13 @@ starTransactionTypeChannelSubscriptionPurchase chat_id:int53 subscription_period //@subscription_period The number of seconds between consecutive Telegram Star debitings starTransactionTypeChannelSubscriptionSale user_id:int53 subscription_period:int32 = StarTransactionType; -//@description The transaction is a purchase of a regular gift to another user; for regular users and bots only @user_id Identifier of the user that received the gift @gift The gift -starTransactionTypeGiftPurchase user_id:int53 gift:gift = StarTransactionType; +//@description The transaction is a purchase of a regular gift; for regular users and bots only @owner_id Identifier of the user or the channel that received the gift @gift The gift +starTransactionTypeGiftPurchase owner_id:MessageSender gift:gift = StarTransactionType; -//@description The transaction is a transfer of an upgraded gift to another user; for regular users only @user_id Identifier of the user that received the gift @gift The gift -starTransactionTypeGiftTransfer user_id:int53 gift:upgradedGift = StarTransactionType; +//@description The transaction is a transfer of an upgraded gift; for regular users only @owner_id Identifier of the user or the channel that received the gift @gift The gift +starTransactionTypeGiftTransfer owner_id:MessageSender gift:upgradedGift = StarTransactionType; -//@description The transaction is a sale of a gift received from another user or bot; for regular users only @user_id Identifier of the user that sent the gift @gift The gift +//@description The transaction is a sale of a received gift; for regular users and channel chats only @user_id Identifier of the user that sent the gift @gift The gift starTransactionTypeGiftSale user_id:int53 gift:gift = StarTransactionType; //@description The transaction is an upgrade of a gift; for regular users only @gift The upgraded gift @@ -1351,13 +1360,32 @@ profileAccentColors palette_colors:vector background_colors:vector //@min_channel_chat_boost_level The minimum chat boost level required to use the color in a channel chat profileAccentColor id:int32 light_theme_colors:profileAccentColors dark_theme_colors:profileAccentColors min_supergroup_chat_boost_level:int32 min_channel_chat_boost_level:int32 = ProfileAccentColor; -//@description Describes a custom emoji to be shown instead of the Telegram Premium badge -//@custom_emoji_id Identifier of the custom emoji in stickerFormatTgs format + +//@class EmojiStatusType @description Describes type of emoji status + +//@description A custom emoji set as emoji status @custom_emoji_id Identifier of the custom emoji in stickerFormatTgs format +emojiStatusTypeCustomEmoji custom_emoji_id:int64 = EmojiStatusType; + +//@description An upgraded gift set as emoji status +//@upgraded_gift_id Identifier of the upgraded gift +//@gift_title The title of the upgraded gift +//@gift_name Unique name of the upgraded gift that can be used with internalLinkTypeUpgradedGift +//@model_custom_emoji_id Custom emoji identifier of the model of the upgraded gift +//@symbol_custom_emoji_id Custom emoji identifier of the symbol of the upgraded gift +//@backdrop_colors Colors of the backdrop of the upgraded gift +emojiStatusTypeUpgradedGift upgraded_gift_id:int64 gift_title:string gift_name:string model_custom_emoji_id:int64 symbol_custom_emoji_id:int64 backdrop_colors:upgradedGiftBackdropColors = EmojiStatusType; + + +//@description Describes an emoji to be shown instead of the Telegram Premium badge +//@type Type of the emoji status //@expiration_date Point in time (Unix timestamp) when the status will expire; 0 if never -emojiStatus custom_emoji_id:int64 expiration_date:int32 = EmojiStatus; +emojiStatus type:EmojiStatusType expiration_date:int32 = EmojiStatus; + +//@description Contains a list of emoji statuses @emoji_statuses The list of emoji statuses identifiers +emojiStatuses emoji_statuses:vector = EmojiStatuses; //@description Contains a list of custom emoji identifiers for emoji statuses @custom_emoji_ids The list of custom emoji identifiers -emojiStatuses custom_emoji_ids:vector = EmojiStatuses; +emojiStatusCustomEmojis custom_emoji_ids:vector = EmojiStatusCustomEmojis; //@description Describes usernames assigned to a user, a supergroup, or a channel @@ -1443,7 +1471,7 @@ botInfo short_description:string description:string photo:photo animation:animat //@bio A short user bio; may be null for bots //@birthdate Birthdate of the user; may be null if unknown //@personal_chat_id Identifier of the personal chat of the user; 0 if none -//@gift_count Number of gifts saved to profile by the user +//@gift_count Number of saved to profile gifts for other users or the total number of received gifts for the current user //@group_in_common_count Number of group chats where both the other user and the current user are a member; 0 for the current user //@bot_verification Information about verification status of the user provided by a bot; may be null if none or unknown //@business_info Information about business settings for Telegram Business accounts; may be null if none @@ -1713,6 +1741,7 @@ supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:Chat //@can_get_statistics True, if the supergroup or channel statistics are available //@can_get_revenue_statistics True, if the supergroup or channel revenue statistics are available //@can_get_star_revenue_statistics True, if the supergroup or channel Telegram Star revenue statistics are available +//@can_send_gift True, if the user can send a gift to the supergroup or channel using sendGift or transferGift //@can_toggle_aggressive_anti_spam True, if aggressive anti-spam checks can be enabled or disabled in the supergroup //@is_all_history_available 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, //-so this option affects only private non-forum supergroups without a linked chat. The value of this field is only available to chat administrators @@ -1720,6 +1749,7 @@ supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:Chat //@has_aggressive_anti_spam_enabled True, if aggressive anti-spam checks are enabled in the supergroup. The value of this field is only available to chat administrators //@has_paid_media_allowed True, if paid media can be sent and forwarded to the channel chat; for channels only //@has_pinned_stories True, if the supergroup or channel has pinned stories +//@gift_count Number of saved to profile gifts for channels without can_post_messages administrator right, otherwise, the total number of received gifts //@my_boost_count Number of times the current user boosted the supergroup or channel //@unrestrict_boost_count Number of times the supergroup must be boosted by a user to ignore slow mode and chat permission restrictions; 0 if unspecified //@sticker_set_id Identifier of the supergroup sticker set that must be shown before user sticker sets; 0 if none @@ -1730,7 +1760,7 @@ supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:Chat //@bot_verification Information about verification status of the supergroup or the channel provided by a bot; may be null if none or unknown //@upgraded_from_basic_group_id Identifier of the basic group from which supergroup was upgraded; 0 if none //@upgraded_from_max_message_id Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none -supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_enable_paid_reaction:Bool can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_get_revenue_statistics:Bool can_get_star_revenue_statistics:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool can_have_sponsored_messages:Bool has_aggressive_anti_spam_enabled:Bool has_paid_media_allowed:Bool has_pinned_stories:Bool my_boost_count:int32 unrestrict_boost_count:int32 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector bot_verification:botVerification upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; +supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_enable_paid_reaction:Bool can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_get_revenue_statistics:Bool can_get_star_revenue_statistics:Bool can_send_gift:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool can_have_sponsored_messages:Bool has_aggressive_anti_spam_enabled:Bool has_paid_media_allowed:Bool has_pinned_stories:Bool gift_count:int32 my_boost_count:int32 unrestrict_boost_count:int32 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector bot_verification:botVerification upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; //@class SecretChatState @description Describes the current secret chat state @@ -3124,6 +3154,9 @@ linkPreviewTypeTheme documents:vector settings:themeSettings = LinkPre //@description The link preview type is unsupported yet linkPreviewTypeUnsupported = LinkPreviewType; +//@description The link is a link to an upgraded gift @gift The gift +linkPreviewTypeUpgradedGift gift:upgradedGift = LinkPreviewType; + //@description The link is a link to a user @photo Photo of the user; may be null if none @is_bot True, if the user is a bot linkPreviewTypeUser photo:chatPhoto is_bot:Bool = LinkPreviewType; @@ -3382,8 +3415,11 @@ paidMediaPreview width:int32 height:int32 duration:int32 minithumbnail:minithumb //@description The media is a photo @photo The photo paidMediaPhoto photo:photo = PaidMedia; -//@description The media is a video @video The video -paidMediaVideo video:video = PaidMedia; +//@description The media is a video +//@video The video +//@cover Cover of the video; may be null if none +//@start_timestamp Timestamp from which the video playing must start, in seconds +paidMediaVideo video:video cover:photo start_timestamp:int32 = PaidMedia; //@description The media is unsupported paidMediaUnsupported = PaidMedia; @@ -3725,11 +3761,13 @@ messageSticker sticker:sticker is_premium:Bool = MessageContent; //@description A video message //@video The video description //@alternative_videos Alternative qualities of the video +//@cover Cover of the video; may be null if none +//@start_timestamp Timestamp from which the video playing must start, in seconds //@caption Video caption //@show_caption_above_media True, if the caption must be shown above the video; otherwise, the caption must be shown below the video //@has_spoiler True, if the video preview must be covered by a spoiler animation //@is_secret True, if the video thumbnail must be blurred and the video must be shown only while tapped -messageVideo video:video alternative_videos:vector caption:formattedText show_caption_above_media:Bool has_spoiler:Bool is_secret:Bool = MessageContent; +messageVideo video:video alternative_videos:vector cover:photo start_timestamp:int32 caption:formattedText show_caption_above_media:Bool has_spoiler:Bool is_secret:Bool = MessageContent; //@description A video note message @video_note The video note description @is_viewed True, if at least one of the recipients has viewed the video note @is_secret True, if the video note thumbnail must be blurred and the video note must be shown only while tapped messageVideoNote video_note:videoNote is_viewed:Bool is_secret:Bool = MessageContent; @@ -4003,33 +4041,39 @@ messageGiftedStars gifter_user_id:int53 receiver_user_id:int53 currency:string a //@sticker A sticker to be shown in the message; may be null if unknown messageGiveawayPrizeStars star_count:int53 transaction_id:string boosted_chat_id:int53 giveaway_message_id:int53 is_unclaimed:Bool sticker:sticker = MessageContent; -//@description A regular gift was received or sent by the current user +//@description A regular gift was received or sent by the current user, or the current user was notified about a channel gift //@gift The gift +//@sender_id Sender of the gift +//@received_gift_id Unique identifier of the received gift for the current user; only for the receiver of the gift //@text Message added to the gift //@sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the regular gift; 0 if the gift can't be sold by the receiver //@prepaid_upgrade_star_count Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift //@is_private True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone will be able to see them -//@is_saved True, if the gift is displayed on the user's profile page; only for the receiver of the gift +//@is_saved True, if the gift is displayed on the user's or the channel's profile page; only for the receiver of the gift //@can_be_upgraded True, if the gift can be upgraded to a unique gift; only for the receiver of the gift //@was_converted True, if the gift was converted to Telegram Stars; only for the receiver of the gift //@was_upgraded True, if the gift was upgraded to a unique gift //@was_refunded True, if the gift was refunded and isn't available anymore -//@upgrade_message_id Identifier of the service message messageUpgradedGift or messageRefundedUpgradedGift with upgraded version of the gift; can be 0 if none or an identifier of a deleted message. -//-Use getUserGift to get information about the gift -messageGift gift:gift text:formattedText sell_star_count:int53 prepaid_upgrade_star_count:int53 is_private:Bool is_saved:Bool can_be_upgraded:Bool was_converted:Bool was_upgraded:Bool was_refunded:Bool upgrade_message_id:int53 = MessageContent; +//@upgraded_received_gift_id Identifier of the corresponding upgraded gift; may be empty if unknown. Use getReceivedGift to get information about the gift +messageGift gift:gift sender_id:MessageSender received_gift_id:string text:formattedText sell_star_count:int53 prepaid_upgrade_star_count:int53 is_private:Bool is_saved:Bool can_be_upgraded:Bool was_converted:Bool was_upgraded:Bool was_refunded:Bool upgraded_received_gift_id:string = MessageContent; -//@description An upgraded gift was received or sent by the current user +//@description An upgraded gift was received or sent by the current user, or the current user was notified about a channel gift //@gift The gift +//@sender_id Sender of the gift; may be null for anonymous gifts +//@received_gift_id Unique identifier of the received gift for the current user; only for the receiver of the gift //@is_upgrade True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred gift -//@is_saved True, if the gift is displayed on the user's profile page; only for the receiver of the gift -//@can_be_transferred True, if the gift can be transferred to another user; only for the receiver of the gift -//@was_transferred True, if the gift was transferred to another user; only for the receiver of the gift +//@is_saved True, if the gift is displayed on the user's or the channel's profile page; only for the receiver of the gift +//@can_be_transferred True, if the gift can be transferred to another owner; only for the receiver of the gift +//@was_transferred True, if the gift was transferred to another owner; only for the receiver of the gift //@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift -//@export_date Point in time (Unix timestamp) when the gift can be transferred to TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift -messageUpgradedGift gift:upgradedGift is_upgrade:Bool is_saved:Bool can_be_transferred:Bool was_transferred:Bool transfer_star_count:int53 export_date:int32 = MessageContent; +//@export_date Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift +messageUpgradedGift gift:upgradedGift sender_id:MessageSender received_gift_id:string is_upgrade:Bool is_saved:Bool can_be_transferred:Bool was_transferred:Bool transfer_star_count:int53 export_date:int32 = MessageContent; -//@description A gift which purchase, upgrade or transfer were refunded @gift The gift @is_upgrade True, if the gift was obtained by upgrading of a previously received gift -messageRefundedUpgradedGift gift:gift is_upgrade:Bool = MessageContent; +//@description A gift which purchase, upgrade or transfer were refunded +//@gift The gift +//@sender_id Sender of the gift +//@is_upgrade True, if the gift was obtained by upgrading of a previously received gift +messageRefundedUpgradedGift gift:gift sender_id:MessageSender is_upgrade:Bool = MessageContent; //@description A contact has registered with Telegram messageContactRegistered = MessageContent; @@ -4144,9 +4188,11 @@ inputThumbnail thumbnail:InputFile width:int32 height:int32 = InputThumbnail; inputPaidMediaTypePhoto = InputPaidMediaType; //@description The media is a video +//@cover Cover of the video; pass null to skip cover uploading +//@start_timestamp Timestamp from which the video playing must start, in seconds //@duration Duration of the video, in seconds //@supports_streaming True, if the video is expected to be streamed -inputPaidMediaTypeVideo duration:int32 supports_streaming:Bool = InputPaidMediaType; +inputPaidMediaTypeVideo cover:InputFile start_timestamp:int32 duration:int32 supports_streaming:Bool = InputPaidMediaType; //@description Describes a paid media to be sent @@ -4270,6 +4316,8 @@ inputMessageSticker sticker:InputFile thumbnail:inputThumbnail width:int32 heigh //@description A video message //@video Video to be sent. The video is expected to be re-encoded to MPEG4 format with H.264 codec by the sender //@thumbnail Video thumbnail; pass null to skip thumbnail uploading +//@cover Cover of the video; pass null to skip cover uploading; not supported in secret chats and for self-destructing messages +//@start_timestamp Timestamp from which the video playing must start, in seconds //@added_sticker_file_ids File identifiers of the stickers added to the video, if applicable //@duration Duration of the video, in seconds //@width Video width @@ -4279,7 +4327,7 @@ inputMessageSticker sticker:InputFile thumbnail:inputThumbnail width:int32 heigh //@show_caption_above_media True, if the caption must be shown above the video; otherwise, the caption must be shown below the video; not supported in secret chats //@self_destruct_type Video self-destruct type; pass null if none; private chats only //@has_spoiler True, if the video preview must be covered by a spoiler animation; not supported in secret chats -inputMessageVideo video:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector duration:int32 width:int32 height:int32 supports_streaming:Bool caption:formattedText show_caption_above_media:Bool self_destruct_type:MessageSelfDestructType has_spoiler:Bool = InputMessageContent; +inputMessageVideo video:InputFile thumbnail:inputThumbnail cover:InputFile start_timestamp:int32 added_sticker_file_ids:vector duration:int32 width:int32 height:int32 supports_streaming:Bool caption:formattedText show_caption_above_media:Bool self_destruct_type:MessageSelfDestructType has_spoiler:Bool = InputMessageContent; //@description A video note message //@video_note Video note to be sent. The video is expected to be encoded to MPEG4 format with H.264 codec and have no data outside of the visible circle @@ -4350,9 +4398,11 @@ inputMessageStory story_sender_chat_id:int53 story_id:int32 = InputMessageConten //@description A forwarded message //@from_chat_id Identifier for the chat this forwarded message came from //@message_id Identifier of the message to forward. A message can be forwarded only if messageProperties.can_be_forwarded -//@in_game_share True, if a game message is being shared from a launched game; applies only to game messages +//@in_game_share Pass true if a game message is being shared from a launched game; applies only to game messages +//@replace_video_start_timestamp Pass true to replace video start timestamp in the forwarded message +//@new_video_start_timestamp The new video start timestamp; ignored if replace_video_start_timestamp == false //@copy_options Options to be used to copy content of the message without reference to the original sender; pass null to forward the message as usual -inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool copy_options:messageCopyOptions = InputMessageContent; +inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool replace_video_start_timestamp:Bool new_video_start_timestamp:int32 copy_options:messageCopyOptions = InputMessageContent; //@description Contains properties of a message and describes actions that can be done with the message right now @@ -4656,6 +4706,10 @@ storyAreaTypeLink url:string = StoryAreaType; //@background_color A color of the area background in the ARGB format storyAreaTypeWeather temperature:double emoji:string background_color:int32 = StoryAreaType; +//@description An area with an upgraded gift +//@gift_name Unique name of the upgraded gift +storyAreaTypeUpgradedGift gift_name:string = StoryAreaType; + //@description Describes a clickable rectangle area on a story media @position Position of the area @type Type of the area storyArea position:storyAreaPosition type:StoryAreaType = StoryArea; @@ -4697,6 +4751,9 @@ inputStoryAreaTypeLink url:string = InputStoryAreaType; //@background_color A color of the area background in the ARGB format inputStoryAreaTypeWeather temperature:double emoji:string background_color:int32 = InputStoryAreaType; +//@description An area with an upgraded gift @gift_name Unique name of the upgraded gift +inputStoryAreaTypeUpgradedGift gift_name:string = InputStoryAreaType; + //@description Describes a clickable rectangle area on a story media to be added @position Position of the area @type Type of the area inputStoryArea position:storyAreaPosition type:InputStoryAreaType = InputStoryArea; @@ -4705,8 +4762,9 @@ inputStoryArea position:storyAreaPosition type:InputStoryAreaType = InputStoryAr //-up to 10 inputStoryAreaTypeLocation, inputStoryAreaTypeFoundVenue, and inputStoryAreaTypePreviousVenue areas, //-up to getOption("story_suggested_reaction_area_count_max") inputStoryAreaTypeSuggestedReaction areas, //-up to 1 inputStoryAreaTypeMessage area, -//-up to getOption("story_link_area_count_max") inputStoryAreaTypeLink areas if the current user is a Telegram Premium user, and -//-up to 3 inputStoryAreaTypeWeather areas +//-up to getOption("story_link_area_count_max") inputStoryAreaTypeLink areas if the current user is a Telegram Premium user, +//-up to 3 inputStoryAreaTypeWeather areas, and +//-up to 1 inputStoryAreaTypeUpgradedGift area inputStoryAreas areas:vector = InputStoryAreas; @@ -7217,6 +7275,9 @@ internalLinkTypeUnknownDeepLink link:string = InternalLinkType; //@description The link is a link to an unsupported proxy. An alert can be shown to the user internalLinkTypeUnsupportedProxy = InternalLinkType; +//@description The link is a link to an upgraded gift. Call getUpgradedGift with the given name to process the link @name Name of the unique gift +internalLinkTypeUpgradedGift name:string = InternalLinkType; + //@description The link is a link to a user by its phone number. Call searchUserByPhoneNumber with the given phone number to process the link. //-If the user is found, then call createPrivateChat and open user's profile information screen or the chat itself. If draft text isn't empty, then put the draft text in the input field //@phone_number Phone number of the user @@ -8886,6 +8947,19 @@ getChatSimilarChatCount chat_id:int53 return_local:Bool = Count; //@opened_chat_id Identifier of the opened chat openChatSimilarChat chat_id:int53 opened_chat_id:int53 = Ok; +//@description Returns a list of bots similar to the given bot @bot_user_id User identifier of the target bot +getBotSimilarBots bot_user_id:int53 = Users; + +//@description Returns approximate number of bots similar to the given bot +//@bot_user_id User identifier of the target bot +//@return_local Pass true to get the number of bots without sending network requests, or -1 if the number of bots is unknown locally +getBotSimilarBotCount bot_user_id:int53 return_local:Bool = Count; + +//@description Informs TDLib that a bot was opened from the list of similar bots +//@bot_user_id Identifier of the original bot, which similar bots were requested +//@opened_bot_user_id Identifier of the opened bot +openBotSimilarBot bot_user_id:int53 opened_bot_user_id:int53 = Ok; + //@description Returns a list of frequently used chats @category Category of chats to be returned @limit The maximum number of chats to be returned; up to 30 getTopChats category:TopChatCategory limit:int32 = Chats; @@ -9292,7 +9366,7 @@ addLocalMessage chat_id:int53 sender_id:MessageSender reply_to:InputMessageReply //@revoke Pass true to delete messages for all chat members. Always true for supergroups, channels and secret chats deleteMessages chat_id:int53 message_ids:vector revoke:Bool = Ok; -//@description Deletes all messages sent by the specified message sender in a chat. Supported only for supergroups; requires can_delete_messages administrator privileges @chat_id Chat identifier @sender_id Identifier of the sender of messages to delete +//@description Deletes all messages sent by the specified message sender in a chat. Supported only for supergroups; requires can_delete_messages administrator right @chat_id Chat identifier @sender_id Identifier of the sender of messages to delete deleteChatMessagesBySender chat_id:int53 sender_id:MessageSender = Ok; //@description Deletes all messages between the specified dates in a chat. Supported only for private chats and basic groups. Messages sent in the last 30 seconds will not be deleted @@ -10549,26 +10623,29 @@ toggleBotIsAddedToAttachmentMenu bot_user_id:int53 is_added:Bool allow_write_acc //@description Returns up to 8 emoji statuses, which must be shown right after the default Premium Badge in the emoji status list for self status -getThemedEmojiStatuses = EmojiStatuses; +getThemedEmojiStatuses = EmojiStatusCustomEmojis; //@description Returns recent emoji statuses for self status getRecentEmojiStatuses = EmojiStatuses; +//@description Returns available upgraded gift emoji statuses for self status +getUpgradedGiftEmojiStatuses = EmojiStatuses; + //@description Returns default emoji statuses for self status -getDefaultEmojiStatuses = EmojiStatuses; +getDefaultEmojiStatuses = EmojiStatusCustomEmojis; //@description Clears the list of recently used emoji statuses for self status clearRecentEmojiStatuses = Ok; //@description Returns up to 8 emoji statuses, which must be shown in the emoji status list for chats -getThemedChatEmojiStatuses = EmojiStatuses; +getThemedChatEmojiStatuses = EmojiStatusCustomEmojis; //@description Returns default emoji statuses for chats -getDefaultChatEmojiStatuses = EmojiStatuses; +getDefaultChatEmojiStatuses = EmojiStatusCustomEmojis; //@description Returns the list of emoji statuses, which can't be used as chat emoji status, even they are from a sticker set with is_allowed_as_chat_emoji_status == true -getDisallowedChatEmojiStatuses = EmojiStatuses; +getDisallowedChatEmojiStatuses = EmojiStatusCustomEmojis; //@description Downloads a file from the cloud. Download progress and completion of the download will be notified through updateFile updates @@ -11652,52 +11729,67 @@ deleteSavedOrderInfo = Ok; deleteSavedCredentials = Ok; -//@description Returns gifts that can be sent to other users +//@description Returns gifts that can be sent to other users and channel chats getAvailableGifts = Gifts; -//@description Sends a gift to another user. May return an error with a message "STARGIFT_USAGE_LIMITED" if the gift was sold out +//@description Sends a gift to another user or channel chat. May return an error with a message "STARGIFT_USAGE_LIMITED" if the gift was sold out //@gift_id Identifier of the gift to send -//@user_id Identifier of the user that will receive the gift +//@owner_id Identifier of the user or the channel chat that will receive the gift //@text Text to show along with the gift; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed -//@is_private Pass true to show the current user as sender and gift text only to the gift receiver; otherwise, everyone will be able to see them +//@is_private Pass true to show gift text and sender only to the gift receiver; otherwise, everyone will be able to see them //@pay_for_upgrade Pass true to additionally pay for the gift upgrade and allow the receiver to upgrade it for free -sendGift gift_id:int64 user_id:int53 text:formattedText is_private:Bool pay_for_upgrade:Bool = Ok; +sendGift gift_id:int64 owner_id:MessageSender text:formattedText is_private:Bool pay_for_upgrade:Bool = Ok; -//@description Sells a gift received by the current user for Telegram Stars -//@sender_user_id Identifier of the user that sent the gift -//@message_id Identifier of the message with the gift in the chat with the user -sellGift sender_user_id:int53 message_id:int53 = Ok; +//@description Sells a gift for Telegram Stars @received_gift_id Identifier of the gift +sellGift received_gift_id:string = Ok; -//@description Toggles whether a gift is shown on the current user's profile page -//@sender_user_id Identifier of the user that sent the gift -//@message_id Identifier of the message with the gift in the chat with the user -//@is_saved Pass true to display the gift on the user's profile page; pass false to remove it from the profile page -toggleGiftIsSaved sender_user_id:int53 message_id:int53 is_saved:Bool = Ok; +//@description Toggles whether a gift is shown on the current user's or the channel's profile page; requires can_post_messages administrator right in the chat +//@received_gift_id Identifier of the gift +//@is_saved Pass true to display the gift on the user's or the channel's profile page; pass false to remove it from the profile page +toggleGiftIsSaved received_gift_id:string is_saved:Bool = Ok; + +//@description Toggles whether notifications for new gifts received by a channel chat are sent to the current user; requires can_post_messages administrator right in the chat +//@chat_id Identifier of the channel chat +//@are_enabled Pass true to enable notifications about new gifts owned by the channel chat; pass false to disable the notifications +toggleChatGiftNotifications chat_id:int53 are_enabled:Bool = Ok; //@description Returns examples of possible upgraded gifts for a regular gift @gift_id Identifier of the gift getGiftUpgradePreview gift_id:int64 = GiftUpgradePreview; -//@description Upgrades a gift received by the current user. Unless the gift has prepaid_upgrade_star_count > 0, the user must pay gift.upgrade_star_count Telegram Stars for the upgrade -//@sender_user_id Identifier of the user that sent the gift -//@message_id Identifier of the message with the gift in the chat with the user +//@description Upgrades a regular gift +//@received_gift_id Identifier of the gift //@keep_original_details Pass true to keep the original gift text, sender and receiver in the upgraded gift -upgradeGift sender_user_id:int53 message_id:int53 keep_original_details:Bool = UpgradeGiftResult; +//@star_count The amount of Telegram Stars required to pay for the upgrade. It the gift has prepaid_upgrade_star_count > 0, then pass 0, otherwise, pass gift.upgrade_star_count +upgradeGift received_gift_id:string keep_original_details:Bool star_count:int53 = UpgradeGiftResult; -//@description Sends a gift upgraded by the current user to another user -//@sender_user_id Identifier of the user that sent the gift -//@message_id Identifier of the message with the upgraded gift in the chat with the user -//@receiver_user_id Identifier of the user that will receive the gift -//@star_count The amount of Telegram Stars required for the transfer -transferGift sender_user_id:int53 message_id:int53 receiver_user_id:int53 star_count:int53 = Ok; +//@description Sends an upgraded gift to another user or a channel chat +//@received_gift_id Identifier of the gift +//@new_owner_id Identifier of the user or the channel chat that will receive the gift +//@star_count The amount of Telegram Stars required to pay for the transfer +transferGift received_gift_id:string new_owner_id:MessageSender star_count:int53 = Ok; -//@description Returns gifts saved to profile by the given user -//@user_id Identifier of the user +//@description Returns gifts received by the given user or chat +//@owner_id Identifier of the gift receiver +//@exclude_unsaved Pass true to exclude gifts that aren't saved to the chat's profile page. Always true for gifts received by other users and channel chats without can_post_messages administrator right +//@exclude_saved Pass true to exclude gifts that are saved to the chat's profile page; for channel chats with can_post_messages administrator right only +//@exclude_unlimited Pass true to exclude gifts that can be purchased unlimited number of times; for channel chats with can_post_messages administrator right only +//@exclude_limited Pass true to exclude gifts that can be purchased limited number of times; for channel chats with can_post_messages administrator right only +//@exclude_upgraded Pass true to exclude upgraded gifts; for channel chats with can_post_messages administrator right only +//@sort_by_price Pass true to sort results by gift price instead of send date; for channel chats with can_post_messages administrator right only //@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results //@limit The maximum number of gifts to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned objects is chosen by TDLib and can be smaller than the specified limit -getUserGifts user_id:int53 offset:string limit:int32 = UserGifts; +getReceivedGifts owner_id:MessageSender exclude_unsaved:Bool exclude_saved:Bool exclude_unlimited:Bool exclude_limited:Bool exclude_upgraded:Bool sort_by_price:Bool offset:string limit:int32 = ReceivedGifts; -//@description Returns information about a gift received or sent by the current user @message_id Identifier of the message with the gift -getUserGift message_id:int53 = UserGift; +//@description Returns information about a received gift @received_gift_id Identifier of the gift +getReceivedGift received_gift_id:string = ReceivedGift; + +//@description Returns information about an upgraded gift by its name @name Unique name of the upgraded gift +getUpgradedGift name:string = UpgradedGift; + +//@description Returns a URL for upgraded gift withdrawal in the TON blockchain as an NFT; requires owner privileges for gifts owned by a chat +//@received_gift_id Identifier of the gift +//@password The 2-step verification password of the current user +getUpgradedGiftWithdrawalUrl received_gift_id:string password:string = HttpUrl; //@description Creates a link for the given invoice; for bots only From baee9b059de55dff8e759bc22a6abf275ac2933e Mon Sep 17 00:00:00 2001 From: c0re100 Date: Fri, 14 Feb 2025 02:21:05 +0800 Subject: [PATCH 35/54] Update to TDLib 1.8.45 --- client/function.go | 77 +++++++++++++------ client/type.go | 172 +++++++++++++++++++++++++++++++++++++++++- client/unmarshaler.go | 98 ++++++++++++++++++++++++ data/td_api.tl | 75 ++++++++++++------ 4 files changed, 374 insertions(+), 48 deletions(-) diff --git a/client/function.go b/client/function.go index 02621ab..46a1a11 100755 --- a/client/function.go +++ b/client/function.go @@ -5963,6 +5963,32 @@ func (client *Client) RemoveMessageReaction(req *RemoveMessageReactionRequest) ( return UnmarshalOk(result.Data) } +type GetChatAvailablePaidMessageReactionSendersRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` +} + +// Returns the list of message sender identifiers, which can be used to send a paid reaction in a chat +func (client *Client) GetChatAvailablePaidMessageReactionSenders(req *GetChatAvailablePaidMessageReactionSendersRequest) (*MessageSenders, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatAvailablePaidMessageReactionSenders", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessageSenders(result.Data) +} + type AddPendingPaidMessageReactionRequest struct { // Identifier of the chat to which the message belongs ChatId int64 `json:"chat_id"` @@ -5970,10 +5996,8 @@ type AddPendingPaidMessageReactionRequest struct { MessageId int64 `json:"message_id"` // Number of Telegram Stars to be used for the reaction. The total number of pending paid reactions must not exceed getOption("paid_reaction_star_count_max") StarCount int64 `json:"star_count"` - // Pass true if the user didn't choose anonymity explicitly, for example, the reaction is set from the message bubble - UseDefaultIsAnonymous bool `json:"use_default_is_anonymous"` - // Pass true to make paid reaction of the user on the message anonymous; pass false to make the user's profile visible among top reactors. Ignored if use_default_is_anonymous == true - IsAnonymous bool `json:"is_anonymous"` + // Type of the paid reaction; pass null if the user didn't choose reaction type explicitly, for example, the reaction is set from the message bubble + Type PaidReactionType `json:"type"` } // Adds the paid message reaction to a message. Use getMessageAvailableReactions to check whether the reaction is available for the message @@ -5986,8 +6010,7 @@ func (client *Client) AddPendingPaidMessageReaction(req *AddPendingPaidMessageRe "chat_id": req.ChatId, "message_id": req.MessageId, "star_count": req.StarCount, - "use_default_is_anonymous": req.UseDefaultIsAnonymous, - "is_anonymous": req.IsAnonymous, + "type": req.Type, }, }) if err != nil { @@ -6059,25 +6082,25 @@ func (client *Client) RemovePendingPaidMessageReactions(req *RemovePendingPaidMe return UnmarshalOk(result.Data) } -type TogglePaidMessageReactionIsAnonymousRequest struct { +type SetPaidMessageReactionTypeRequest struct { // Identifier of the chat to which the message belongs ChatId int64 `json:"chat_id"` // Identifier of the message MessageId int64 `json:"message_id"` - // Pass true to make paid reaction of the user on the message anonymous; pass false to make the user's profile visible among top reactors - IsAnonymous bool `json:"is_anonymous"` + // New type of the paid reaction + Type PaidReactionType `json:"type"` } -// Changes whether the paid message reaction of the user to a message is anonymous. The message must have paid reaction added by the user -func (client *Client) TogglePaidMessageReactionIsAnonymous(req *TogglePaidMessageReactionIsAnonymousRequest) (*Ok, error) { +// Changes type of paid message reaction of the current user on a message. The message must have paid reaction added by the current user +func (client *Client) SetPaidMessageReactionType(req *SetPaidMessageReactionTypeRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "togglePaidMessageReactionIsAnonymous", + Type: "setPaidMessageReactionType", }, Data: map[string]interface{}{ "chat_id": req.ChatId, "message_id": req.MessageId, - "is_anonymous": req.IsAnonymous, + "type": req.Type, }, }) if err != nil { @@ -7318,7 +7341,7 @@ func (client *Client) GetWebAppLinkUrl(req *GetWebAppLinkUrlRequest) (*HttpUrl, type GetMainWebAppRequest struct { // Identifier of the chat in which the Web App is opened; pass 0 if none ChatId int64 `json:"chat_id"` - // Identifier of the target bot + // Identifier of the target bot. If the bot is restricted for the current user, then show an error instead of calling the method BotUserId int64 `json:"bot_user_id"` // Start parameter from internalLinkTypeMainWebApp StartParameter string `json:"start_parameter"` @@ -7351,7 +7374,7 @@ func (client *Client) GetMainWebApp(req *GetMainWebAppRequest) (*MainWebApp, err } type GetWebAppUrlRequest struct { - // Identifier of the target bot + // Identifier of the target bot. If the bot is restricted for the current user, then show an error instead of calling the method BotUserId int64 `json:"bot_user_id"` // The URL from a keyboardButtonTypeWebApp button, inlineQueryResultsButtonTypeWebApp button, or an empty string when the bot is opened from the side menu Url string `json:"url"` @@ -7417,7 +7440,7 @@ func (client *Client) SendWebAppData(req *SendWebAppDataRequest) (*Ok, error) { type OpenWebAppRequest struct { // Identifier of the chat in which the Web App is opened. The Web App can't be opened in secret chats ChatId int64 `json:"chat_id"` - // Identifier of the bot, providing the Web App + // Identifier of the bot, providing the Web App. If the bot is restricted for the current user, then show an error instead of calling the method BotUserId int64 `json:"bot_user_id"` // The URL from an inlineKeyboardButtonTypeWebApp button, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an empty string otherwise Url string `json:"url"` @@ -12551,13 +12574,13 @@ func (client *Client) SearchFileDownloads(req *SearchFileDownloadsRequest) (*Fou } type SetApplicationVerificationTokenRequest struct { - // Unique identifier for the verification process as received from updateApplicationVerificationRequired + // Unique identifier for the verification process as received from updateApplicationVerificationRequired or updateApplicationRecaptchaVerificationRequired VerificationId int64 `json:"verification_id"` - // Play Integrity API token for the Android application, or secret from push notification for the iOS application; pass an empty string to abort verification and receive error VERIFICATION_FAILED for the request + // Play Integrity API token for the Android application, or secret from push notification for the iOS application for application verification, or reCAPTCHA token for reCAPTCHA verifications; pass an empty string to abort verification and receive error VERIFICATION_FAILED for the request Token string `json:"token"` } -// Application verification has been completed. Can be called before authorization +// Application or reCAPTCHA verification has been completed. Can be called before authorization func (client *Client) SetApplicationVerificationToken(req *SetApplicationVerificationTokenRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -19097,15 +19120,15 @@ type GetReceivedGiftsRequest struct { OwnerId MessageSender `json:"owner_id"` // Pass true to exclude gifts that aren't saved to the chat's profile page. Always true for gifts received by other users and channel chats without can_post_messages administrator right ExcludeUnsaved bool `json:"exclude_unsaved"` - // Pass true to exclude gifts that are saved to the chat's profile page; for channel chats with can_post_messages administrator right only + // Pass true to exclude gifts that are saved to the chat's profile page. Always false for gifts received by other users and channel chats without can_post_messages administrator right ExcludeSaved bool `json:"exclude_saved"` - // Pass true to exclude gifts that can be purchased unlimited number of times; for channel chats with can_post_messages administrator right only + // Pass true to exclude gifts that can be purchased unlimited number of times ExcludeUnlimited bool `json:"exclude_unlimited"` - // Pass true to exclude gifts that can be purchased limited number of times; for channel chats with can_post_messages administrator right only + // Pass true to exclude gifts that can be purchased limited number of times ExcludeLimited bool `json:"exclude_limited"` - // Pass true to exclude upgraded gifts; for channel chats with can_post_messages administrator right only + // Pass true to exclude upgraded gifts ExcludeUpgraded bool `json:"exclude_upgraded"` - // Pass true to sort results by gift price instead of send date; for channel chats with can_post_messages administrator right only + // Pass true to sort results by gift price instead of send date SortByPrice bool `json:"sort_by_price"` // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results Offset string `json:"offset"` @@ -24375,6 +24398,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateApplicationVerificationRequired: return UnmarshalUpdateApplicationVerificationRequired(result.Data) + case TypeUpdateApplicationRecaptchaVerificationRequired: + return UnmarshalUpdateApplicationRecaptchaVerificationRequired(result.Data) + case TypeUpdateCall: return UnmarshalUpdateCall(result.Data) @@ -24480,6 +24506,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateDefaultReactionType: return UnmarshalUpdateDefaultReactionType(result.Data) + case TypeUpdateDefaultPaidReactionType: + return UnmarshalUpdateDefaultPaidReactionType(result.Data) + case TypeUpdateSavedMessagesTags: return UnmarshalUpdateSavedMessagesTags(result.Data) diff --git a/client/type.go b/client/type.go index 1603b60..8743a91 100755 --- a/client/type.go +++ b/client/type.go @@ -42,6 +42,7 @@ const ( ClassMessageReadDate = "MessageReadDate" ClassMessageOrigin = "MessageOrigin" ClassReactionType = "ReactionType" + ClassPaidReactionType = "PaidReactionType" ClassMessageEffectType = "MessageEffectType" ClassMessageSendingState = "MessageSendingState" ClassMessageReplyTo = "MessageReplyTo" @@ -904,6 +905,9 @@ const ( TypeReactionTypeEmoji = "reactionTypeEmoji" TypeReactionTypeCustomEmoji = "reactionTypeCustomEmoji" TypeReactionTypePaid = "reactionTypePaid" + TypePaidReactionTypeRegular = "paidReactionTypeRegular" + TypePaidReactionTypeAnonymous = "paidReactionTypeAnonymous" + TypePaidReactionTypeChat = "paidReactionTypeChat" TypePaidReactor = "paidReactor" TypeMessageForwardInfo = "messageForwardInfo" TypeMessageImportInfo = "messageImportInfo" @@ -2217,6 +2221,7 @@ const ( TypeUpdateFileDownload = "updateFileDownload" TypeUpdateFileRemovedFromDownloads = "updateFileRemovedFromDownloads" TypeUpdateApplicationVerificationRequired = "updateApplicationVerificationRequired" + TypeUpdateApplicationRecaptchaVerificationRequired = "updateApplicationRecaptchaVerificationRequired" TypeUpdateCall = "updateCall" TypeUpdateGroupCall = "updateGroupCall" TypeUpdateGroupCallParticipant = "updateGroupCallParticipant" @@ -2252,6 +2257,7 @@ const ( TypeUpdateActiveEmojiReactions = "updateActiveEmojiReactions" TypeUpdateAvailableMessageEffects = "updateAvailableMessageEffects" TypeUpdateDefaultReactionType = "updateDefaultReactionType" + TypeUpdateDefaultPaidReactionType = "updateDefaultPaidReactionType" TypeUpdateSavedMessagesTags = "updateSavedMessagesTags" TypeUpdateActiveLiveLocationMessages = "updateActiveLiveLocationMessages" TypeUpdateOwnedStarCount = "updateOwnedStarCount" @@ -2477,6 +2483,11 @@ type ReactionType interface { ReactionTypeType() string } +// Describes type of paid message reaction +type PaidReactionType interface { + PaidReactionTypeType() string +} + // Describes type of emoji effect type MessageEffectType interface { MessageEffectTypeType() string @@ -8651,6 +8662,8 @@ type UpgradedGift struct { OwnerAddress string `json:"owner_address"` // Name of the owner for the case when owner identifier and address aren't known OwnerName string `json:"owner_name"` + // Address of the gift NFT in TON blockchain; may be empty if none + GiftAddress string `json:"gift_address"` // Model of the upgraded gift Model *UpgradedGiftModel `json:"model"` // Symbol of the upgraded gift @@ -8688,6 +8701,7 @@ func (upgradedGift *UpgradedGift) UnmarshalJSON(data []byte) error { OwnerId json.RawMessage `json:"owner_id"` OwnerAddress string `json:"owner_address"` OwnerName string `json:"owner_name"` + GiftAddress string `json:"gift_address"` Model *UpgradedGiftModel `json:"model"` Symbol *UpgradedGiftSymbol `json:"symbol"` Backdrop *UpgradedGiftBackdrop `json:"backdrop"` @@ -8707,6 +8721,7 @@ func (upgradedGift *UpgradedGift) UnmarshalJSON(data []byte) error { upgradedGift.MaxUpgradedCount = tmp.MaxUpgradedCount upgradedGift.OwnerAddress = tmp.OwnerAddress upgradedGift.OwnerName = tmp.OwnerName + upgradedGift.GiftAddress = tmp.GiftAddress upgradedGift.Model = tmp.Model upgradedGift.Symbol = tmp.Symbol upgradedGift.Backdrop = tmp.Backdrop @@ -13166,6 +13181,83 @@ func (*ReactionTypePaid) ReactionTypeType() string { return TypeReactionTypePaid } +// A paid reaction on behalf of the current user +type PaidReactionTypeRegular struct{ + meta +} + +func (entity *PaidReactionTypeRegular) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PaidReactionTypeRegular + + return json.Marshal((*stub)(entity)) +} + +func (*PaidReactionTypeRegular) GetClass() string { + return ClassPaidReactionType +} + +func (*PaidReactionTypeRegular) GetType() string { + return TypePaidReactionTypeRegular +} + +func (*PaidReactionTypeRegular) PaidReactionTypeType() string { + return TypePaidReactionTypeRegular +} + +// An anonymous paid reaction +type PaidReactionTypeAnonymous struct{ + meta +} + +func (entity *PaidReactionTypeAnonymous) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PaidReactionTypeAnonymous + + return json.Marshal((*stub)(entity)) +} + +func (*PaidReactionTypeAnonymous) GetClass() string { + return ClassPaidReactionType +} + +func (*PaidReactionTypeAnonymous) GetType() string { + return TypePaidReactionTypeAnonymous +} + +func (*PaidReactionTypeAnonymous) PaidReactionTypeType() string { + return TypePaidReactionTypeAnonymous +} + +// A paid reaction on behalf of an owned chat +type PaidReactionTypeChat struct { + meta + // Identifier of the chat + ChatId int64 `json:"chat_id"` +} + +func (entity *PaidReactionTypeChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PaidReactionTypeChat + + return json.Marshal((*stub)(entity)) +} + +func (*PaidReactionTypeChat) GetClass() string { + return ClassPaidReactionType +} + +func (*PaidReactionTypeChat) GetType() string { + return TypePaidReactionTypeChat +} + +func (*PaidReactionTypeChat) PaidReactionTypeType() string { + return TypePaidReactionTypeChat +} + // Contains information about a user that added paid reactions type PaidReactor struct { meta @@ -21459,6 +21551,10 @@ type LinkPreviewTypeVideo struct { meta // The video description Video *Video `json:"video"` + // Cover of the video; may be null if none + Cover *Photo `json:"cover"` + // Timestamp from which the video playing must start, in seconds + StartTimestamp int32 `json:"start_timestamp"` } func (entity *LinkPreviewTypeVideo) MarshalJSON() ([]byte, error) { @@ -48591,7 +48687,7 @@ func (*InternalLinkTypeVideoChat) InternalLinkTypeType() string { return TypeInternalLinkTypeVideoChat } -// The link is a link to a Web App. Call searchPublicChat with the given bot username, check that the user is a bot, then call searchWebApp with the received bot and the given web_app_short_name. Process received foundWebApp by showing a confirmation dialog if needed. If the bot can be added to attachment or side menu, but isn't added yet, then show a disclaimer about Mini Apps being third-party applications instead of the dialog and ask the user to accept their Terms of service. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. Then, call getWebAppLinkUrl and open the returned URL as a Web App +// The link is a link to a Web App. Call searchPublicChat with the given bot username, check that the user is a bot. If the bot is restricted for the current user, then show an error message. Otherwise, call searchWebApp with the received bot and the given web_app_short_name. Process received foundWebApp by showing a confirmation dialog if needed. If the bot can be added to attachment or side menu, but isn't added yet, then show a disclaimer about Mini Apps being third-party applications instead of the dialog and ask the user to accept their Terms of service. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. Then, call getWebAppLinkUrl and open the returned URL as a Web App type InternalLinkTypeWebApp struct { meta // Username of the bot that owns the Web App @@ -55542,6 +55638,37 @@ func (*UpdateApplicationVerificationRequired) UpdateType() string { return TypeUpdateApplicationVerificationRequired } +// A request can't be completed unless reCAPTCHA verification is performed; for official mobile applications only. The method setApplicationVerificationToken must be called once the verification is completed or failed +type UpdateApplicationRecaptchaVerificationRequired struct { + meta + // Unique identifier for the verification process + VerificationId int64 `json:"verification_id"` + // The action for the check + Action string `json:"action"` + // Identifier of the reCAPTCHA key + RecaptchaKeyId string `json:"recaptcha_key_id"` +} + +func (entity *UpdateApplicationRecaptchaVerificationRequired) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateApplicationRecaptchaVerificationRequired + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateApplicationRecaptchaVerificationRequired) GetClass() string { + return ClassUpdate +} + +func (*UpdateApplicationRecaptchaVerificationRequired) GetType() string { + return TypeUpdateApplicationRecaptchaVerificationRequired +} + +func (*UpdateApplicationRecaptchaVerificationRequired) UpdateType() string { + return TypeUpdateApplicationRecaptchaVerificationRequired +} + // New call was created or information about a call was updated type UpdateCall struct { meta @@ -56737,6 +56864,49 @@ func (updateDefaultReactionType *UpdateDefaultReactionType) UnmarshalJSON(data [ return nil } +// The type of default paid reaction has changed +type UpdateDefaultPaidReactionType struct { + meta + // The new type of the default paid reaction + Type PaidReactionType `json:"type"` +} + +func (entity *UpdateDefaultPaidReactionType) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateDefaultPaidReactionType + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateDefaultPaidReactionType) GetClass() string { + return ClassUpdate +} + +func (*UpdateDefaultPaidReactionType) GetType() string { + return TypeUpdateDefaultPaidReactionType +} + +func (*UpdateDefaultPaidReactionType) UpdateType() string { + return TypeUpdateDefaultPaidReactionType +} + +func (updateDefaultPaidReactionType *UpdateDefaultPaidReactionType) UnmarshalJSON(data []byte) error { + var tmp struct { + Type json.RawMessage `json:"type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldType, _ := UnmarshalPaidReactionType(tmp.Type) + updateDefaultPaidReactionType.Type = fieldType + + return nil +} + // Tags used in Saved Messages or a Saved Messages topic have changed type UpdateSavedMessagesTags struct { meta diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 64c650d..313cb84 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -1464,6 +1464,43 @@ func UnmarshalListOfReactionType(dataList []json.RawMessage) ([]ReactionType, er return list, nil } +func UnmarshalPaidReactionType(data json.RawMessage) (PaidReactionType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypePaidReactionTypeRegular: + return UnmarshalPaidReactionTypeRegular(data) + + case TypePaidReactionTypeAnonymous: + return UnmarshalPaidReactionTypeAnonymous(data) + + case TypePaidReactionTypeChat: + return UnmarshalPaidReactionTypeChat(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfPaidReactionType(dataList []json.RawMessage) ([]PaidReactionType, error) { + list := []PaidReactionType{} + + for _, data := range dataList { + entity, err := UnmarshalPaidReactionType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalMessageEffectType(data json.RawMessage) (MessageEffectType, error) { var meta meta @@ -8158,6 +8195,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateApplicationVerificationRequired: return UnmarshalUpdateApplicationVerificationRequired(data) + case TypeUpdateApplicationRecaptchaVerificationRequired: + return UnmarshalUpdateApplicationRecaptchaVerificationRequired(data) + case TypeUpdateCall: return UnmarshalUpdateCall(data) @@ -8263,6 +8303,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateDefaultReactionType: return UnmarshalUpdateDefaultReactionType(data) + case TypeUpdateDefaultPaidReactionType: + return UnmarshalUpdateDefaultPaidReactionType(data) + case TypeUpdateSavedMessagesTags: return UnmarshalUpdateSavedMessagesTags(data) @@ -10853,6 +10896,30 @@ func UnmarshalReactionTypePaid(data json.RawMessage) (*ReactionTypePaid, error) return &resp, err } +func UnmarshalPaidReactionTypeRegular(data json.RawMessage) (*PaidReactionTypeRegular, error) { + var resp PaidReactionTypeRegular + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPaidReactionTypeAnonymous(data json.RawMessage) (*PaidReactionTypeAnonymous, error) { + var resp PaidReactionTypeAnonymous + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPaidReactionTypeChat(data json.RawMessage) (*PaidReactionTypeChat, error) { + var resp PaidReactionTypeChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPaidReactor(data json.RawMessage) (*PaidReactor, error) { var resp PaidReactor @@ -21357,6 +21424,14 @@ func UnmarshalUpdateApplicationVerificationRequired(data json.RawMessage) (*Upda return &resp, err } +func UnmarshalUpdateApplicationRecaptchaVerificationRequired(data json.RawMessage) (*UpdateApplicationRecaptchaVerificationRequired, error) { + var resp UpdateApplicationRecaptchaVerificationRequired + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateCall(data json.RawMessage) (*UpdateCall, error) { var resp UpdateCall @@ -21637,6 +21712,14 @@ func UnmarshalUpdateDefaultReactionType(data json.RawMessage) (*UpdateDefaultRea return &resp, err } +func UnmarshalUpdateDefaultPaidReactionType(data json.RawMessage) (*UpdateDefaultPaidReactionType, error) { + var resp UpdateDefaultPaidReactionType + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateSavedMessagesTags(data json.RawMessage) (*UpdateSavedMessagesTags, error) { var resp UpdateSavedMessagesTags @@ -22942,6 +23025,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeReactionTypePaid: return UnmarshalReactionTypePaid(data) + case TypePaidReactionTypeRegular: + return UnmarshalPaidReactionTypeRegular(data) + + case TypePaidReactionTypeAnonymous: + return UnmarshalPaidReactionTypeAnonymous(data) + + case TypePaidReactionTypeChat: + return UnmarshalPaidReactionTypeChat(data) + case TypePaidReactor: return UnmarshalPaidReactor(data) @@ -26881,6 +26973,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateApplicationVerificationRequired: return UnmarshalUpdateApplicationVerificationRequired(data) + case TypeUpdateApplicationRecaptchaVerificationRequired: + return UnmarshalUpdateApplicationRecaptchaVerificationRequired(data) + case TypeUpdateCall: return UnmarshalUpdateCall(data) @@ -26986,6 +27081,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateDefaultReactionType: return UnmarshalUpdateDefaultReactionType(data) + case TypeUpdateDefaultPaidReactionType: + return UnmarshalUpdateDefaultPaidReactionType(data) + case TypeUpdateSavedMessagesTags: return UnmarshalUpdateSavedMessagesTags(data) diff --git a/data/td_api.tl b/data/td_api.tl index f0ffcfb..28709bd 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -1086,11 +1086,12 @@ gifts gifts:vector = Gifts; //@owner_id Identifier of the user or the chat that owns the upgraded gift; may be null if none or unknown //@owner_address Address of the gift NFT owner in TON blockchain; may be empty if none //@owner_name Name of the owner for the case when owner identifier and address aren't known +//@gift_address Address of the gift NFT in TON blockchain; may be empty if none //@model Model of the upgraded gift //@symbol Symbol of the upgraded gift //@backdrop Backdrop of the upgraded gift //@original_details Information about the originally sent gift; may be null if unknown -upgradedGift id:int64 title:string name:string number:int32 total_upgraded_count:int32 max_upgraded_count:int32 owner_id:MessageSender owner_address:string owner_name:string model:upgradedGiftModel symbol:upgradedGiftSymbol backdrop:upgradedGiftBackdrop original_details:upgradedGiftOriginalDetails = UpgradedGift; +upgradedGift id:int64 title:string name:string number:int32 total_upgraded_count:int32 max_upgraded_count:int32 owner_id:MessageSender owner_address:string owner_name:string gift_address:string model:upgradedGiftModel symbol:upgradedGiftSymbol backdrop:upgradedGiftBackdrop original_details:upgradedGiftOriginalDetails = UpgradedGift; //@description Contains result of gift upgrading //@gift The upgraded gift @@ -1874,6 +1875,18 @@ reactionTypeCustomEmoji custom_emoji_id:int64 = ReactionType; reactionTypePaid = ReactionType; +//@class PaidReactionType @description Describes type of paid message reaction + +//@description A paid reaction on behalf of the current user +paidReactionTypeRegular = PaidReactionType; + +//@description An anonymous paid reaction +paidReactionTypeAnonymous = PaidReactionType; + +//@description A paid reaction on behalf of an owned chat @chat_id Identifier of the chat +paidReactionTypeChat chat_id:int53 = PaidReactionType; + + //@description Contains information about a user that added paid reactions //@sender_id Identifier of the user or chat that added the reactions; may be null for anonymous reactors that aren't the current user //@star_count Number of Telegram Stars added @@ -3160,8 +3173,11 @@ linkPreviewTypeUpgradedGift gift:upgradedGift = LinkPreviewType; //@description The link is a link to a user @photo Photo of the user; may be null if none @is_bot True, if the user is a bot linkPreviewTypeUser photo:chatPhoto is_bot:Bool = LinkPreviewType; -//@description The link is a link to a video @video The video description -linkPreviewTypeVideo video:video = LinkPreviewType; +//@description The link is a link to a video +//@video The video description +//@cover Cover of the video; may be null if none +//@start_timestamp Timestamp from which the video playing must start, in seconds +linkPreviewTypeVideo video:video cover:photo start_timestamp:int32 = LinkPreviewType; //@description The link is a link to a video chat //@photo Photo of the chat with the video chat; may be null if none @@ -7296,9 +7312,10 @@ internalLinkTypeUserToken token:string = InternalLinkType; //@is_live_stream True, if the video chat is expected to be a live stream in a channel or a broadcast group internalLinkTypeVideoChat chat_username:string invite_hash:string is_live_stream:Bool = InternalLinkType; -//@description The link is a link to a Web App. Call searchPublicChat with the given bot username, check that the user is a bot, then call searchWebApp with the received bot and the given web_app_short_name. -//-Process received foundWebApp by showing a confirmation dialog if needed. If the bot can be added to attachment or side menu, but isn't added yet, then show a disclaimer about Mini Apps being third-party applications -//-instead of the dialog and ask the user to accept their Terms of service. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. +//@description The link is a link to a Web App. Call searchPublicChat with the given bot username, check that the user is a bot. If the bot is restricted for the current user, then show an error message. +//-Otherwise, call searchWebApp with the received bot and the given web_app_short_name. Process received foundWebApp by showing a confirmation dialog if needed. +//-If the bot can be added to attachment or side menu, but isn't added yet, then show a disclaimer about Mini Apps being third-party applications instead of the dialog +//-and ask the user to accept their Terms of service. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. //-Then, call getWebAppLinkUrl and open the returned URL as a Web App //@bot_username Username of the bot that owns the Web App //@web_app_short_name Short name of the Web App @@ -8291,6 +8308,13 @@ updateFileRemovedFromDownloads file_id:int32 counts:downloadedFileCounts = Updat //@cloud_project_number Cloud project number to pass to the Play Integrity API on Android updateApplicationVerificationRequired verification_id:int53 nonce:string cloud_project_number:int64 = Update; +//@description A request can't be completed unless reCAPTCHA verification is performed; for official mobile applications only. +//-The method setApplicationVerificationToken must be called once the verification is completed or failed +//@verification_id Unique identifier for the verification process +//@action The action for the check +//@recaptcha_key_id Identifier of the reCAPTCHA key +updateApplicationRecaptchaVerificationRequired verification_id:int53 action:string recaptcha_key_id:string = Update; + //@description New call was created or information about a call was updated @call New data about a call updateCall call:call = Update; @@ -8420,6 +8444,9 @@ updateAvailableMessageEffects reaction_effect_ids:vector sticker_effect_i //@description The type of default reaction has changed @reaction_type The new type of the default reaction updateDefaultReactionType reaction_type:ReactionType = Update; +//@description The type of default paid reaction has changed @type The new type of the default paid reaction +updateDefaultPaidReactionType type:PaidReactionType = Update; + //@description Tags used in Saved Messages or a Saved Messages topic have changed //@saved_messages_topic_id Identifier of Saved Messages topic which tags were changed; 0 if tags for the whole chat has changed //@tags The new tags @@ -9701,13 +9728,15 @@ addMessageReaction chat_id:int53 message_id:int53 reaction_type:ReactionType is_ //@reaction_type Type of the reaction to remove. The paid reaction can't be removed removeMessageReaction chat_id:int53 message_id:int53 reaction_type:ReactionType = Ok; +//@description Returns the list of message sender identifiers, which can be used to send a paid reaction in a chat @chat_id Chat identifier +getChatAvailablePaidMessageReactionSenders chat_id:int53 = MessageSenders; + //@description Adds the paid message reaction to a message. Use getMessageAvailableReactions to check whether the reaction is available for the message //@chat_id Identifier of the chat to which the message belongs //@message_id Identifier of the message //@star_count Number of Telegram Stars to be used for the reaction. The total number of pending paid reactions must not exceed getOption("paid_reaction_star_count_max") -//@use_default_is_anonymous Pass true if the user didn't choose anonymity explicitly, for example, the reaction is set from the message bubble -//@is_anonymous Pass true to make paid reaction of the user on the message anonymous; pass false to make the user's profile visible among top reactors. Ignored if use_default_is_anonymous == true -addPendingPaidMessageReaction chat_id:int53 message_id:int53 star_count:int53 use_default_is_anonymous:Bool is_anonymous:Bool = Ok; +//@type Type of the paid reaction; pass null if the user didn't choose reaction type explicitly, for example, the reaction is set from the message bubble +addPendingPaidMessageReaction chat_id:int53 message_id:int53 star_count:int53 type:PaidReactionType = Ok; //@description Applies all pending paid reactions on a message @chat_id Identifier of the chat to which the message belongs @message_id Identifier of the message commitPendingPaidMessageReactions chat_id:int53 message_id:int53 = Ok; @@ -9715,11 +9744,11 @@ commitPendingPaidMessageReactions chat_id:int53 message_id:int53 = Ok; //@description Removes all pending paid reactions on a message @chat_id Identifier of the chat to which the message belongs @message_id Identifier of the message removePendingPaidMessageReactions chat_id:int53 message_id:int53 = Ok; -//@description Changes whether the paid message reaction of the user to a message is anonymous. The message must have paid reaction added by the user +//@description Changes type of paid message reaction of the current user on a message. The message must have paid reaction added by the current user //@chat_id Identifier of the chat to which the message belongs //@message_id Identifier of the message -//@is_anonymous Pass true to make paid reaction of the user on the message anonymous; pass false to make the user's profile visible among top reactors -togglePaidMessageReactionIsAnonymous chat_id:int53 message_id:int53 is_anonymous:Bool = Ok; +//@type New type of the paid reaction +setPaidMessageReactionType chat_id:int53 message_id:int53 type:PaidReactionType = Ok; //@description Sets reactions on a message; for bots only //@chat_id Identifier of the chat to which the message belongs @@ -9920,13 +9949,13 @@ getWebAppLinkUrl chat_id:int53 bot_user_id:int53 web_app_short_name:string start //@description Returns information needed to open the main Web App of a bot //@chat_id Identifier of the chat in which the Web App is opened; pass 0 if none -//@bot_user_id Identifier of the target bot +//@bot_user_id Identifier of the target bot. If the bot is restricted for the current user, then show an error instead of calling the method //@start_parameter Start parameter from internalLinkTypeMainWebApp //@parameters Parameters to use to open the Web App getMainWebApp chat_id:int53 bot_user_id:int53 start_parameter:string parameters:webAppOpenParameters = MainWebApp; //@description Returns an HTTPS URL of a Web App to open from the side menu, a keyboardButtonTypeWebApp button, or an inlineQueryResultsButtonTypeWebApp button -//@bot_user_id Identifier of the target bot +//@bot_user_id Identifier of the target bot. If the bot is restricted for the current user, then show an error instead of calling the method //@url The URL from a keyboardButtonTypeWebApp button, inlineQueryResultsButtonTypeWebApp button, or an empty string when the bot is opened from the side menu //@parameters Parameters to use to open the Web App getWebAppUrl bot_user_id:int53 url:string parameters:webAppOpenParameters = HttpUrl; @@ -9940,7 +9969,7 @@ sendWebAppData bot_user_id:int53 button_text:string data:string = Ok; //@description Informs TDLib that a Web App is being opened from the attachment menu, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an inlineKeyboardButtonTypeWebApp button. //-For each bot, a confirmation alert about data sent to the bot must be shown once //@chat_id Identifier of the chat in which the Web App is opened. The Web App can't be opened in secret chats -//@bot_user_id Identifier of the bot, providing the Web App +//@bot_user_id Identifier of the bot, providing the Web App. If the bot is restricted for the current user, then show an error instead of calling the method //@url The URL from an inlineKeyboardButtonTypeWebApp button, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an empty string otherwise //@message_thread_id If not 0, the message thread identifier in which the message will be sent //@reply_to Information about the message or story to be replied in the message sent by the Web App; pass null if none @@ -10736,9 +10765,9 @@ removeAllFilesFromDownloads only_active:Bool only_completed:Bool delete_from_cac searchFileDownloads query:string only_active:Bool only_completed:Bool offset:string limit:int32 = FoundFileDownloads; -//@description Application verification has been completed. Can be called before authorization -//@verification_id Unique identifier for the verification process as received from updateApplicationVerificationRequired -//@token Play Integrity API token for the Android application, or secret from push notification for the iOS application; +//@description Application or reCAPTCHA verification has been completed. Can be called before authorization +//@verification_id Unique identifier for the verification process as received from updateApplicationVerificationRequired or updateApplicationRecaptchaVerificationRequired +//@token Play Integrity API token for the Android application, or secret from push notification for the iOS application for application verification, or reCAPTCHA token for reCAPTCHA verifications; //-pass an empty string to abort verification and receive error VERIFICATION_FAILED for the request setApplicationVerificationToken verification_id:int53 token:string = Ok; @@ -11771,11 +11800,11 @@ transferGift received_gift_id:string new_owner_id:MessageSender star_count:int53 //@description Returns gifts received by the given user or chat //@owner_id Identifier of the gift receiver //@exclude_unsaved Pass true to exclude gifts that aren't saved to the chat's profile page. Always true for gifts received by other users and channel chats without can_post_messages administrator right -//@exclude_saved Pass true to exclude gifts that are saved to the chat's profile page; for channel chats with can_post_messages administrator right only -//@exclude_unlimited Pass true to exclude gifts that can be purchased unlimited number of times; for channel chats with can_post_messages administrator right only -//@exclude_limited Pass true to exclude gifts that can be purchased limited number of times; for channel chats with can_post_messages administrator right only -//@exclude_upgraded Pass true to exclude upgraded gifts; for channel chats with can_post_messages administrator right only -//@sort_by_price Pass true to sort results by gift price instead of send date; for channel chats with can_post_messages administrator right only +//@exclude_saved Pass true to exclude gifts that are saved to the chat's profile page. Always false for gifts received by other users and channel chats without can_post_messages administrator right +//@exclude_unlimited Pass true to exclude gifts that can be purchased unlimited number of times +//@exclude_limited Pass true to exclude gifts that can be purchased limited number of times +//@exclude_upgraded Pass true to exclude upgraded gifts +//@sort_by_price Pass true to sort results by gift price instead of send date //@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results //@limit The maximum number of gifts to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned objects is chosen by TDLib and can be smaller than the specified limit getReceivedGifts owner_id:MessageSender exclude_unsaved:Bool exclude_saved:Bool exclude_unlimited:Bool exclude_limited:Bool exclude_upgraded:Bool sort_by_price:Bool offset:string limit:int32 = ReceivedGifts; From 8de0893227be3fe8ea3d3582e1e5cc9fe34954bf Mon Sep 17 00:00:00 2001 From: c0re100 Date: Fri, 7 Mar 2025 22:22:55 +0800 Subject: [PATCH 36/54] Update to TDLib 1.8.46 --- client/function.go | 177 +++++++++++-- client/type.go | 581 +++++++++++++++++++++++++++++++++++++++--- client/unmarshaler.go | 214 +++++++++++++++- data/td_api.tl | 212 +++++++++++---- 4 files changed, 1076 insertions(+), 108 deletions(-) diff --git a/client/function.go b/client/function.go index 46a1a11..51e31dc 100755 --- a/client/function.go +++ b/client/function.go @@ -4085,7 +4085,7 @@ type SendQuickReplyShortcutMessagesRequest struct { SendingId int32 `json:"sending_id"` } -// Sends messages from a quick reply shortcut. Requires Telegram Business subscription +// Sends messages from a quick reply shortcut. Requires Telegram Business subscription. Can't be used to send paid messages func (client *Client) SendQuickReplyShortcutMessages(req *SendQuickReplyShortcutMessagesRequest) (*Messages, error) { result, err := client.Send(Request{ meta: meta{ @@ -4115,6 +4115,8 @@ type ResendMessagesRequest struct { MessageIds []int64 `json:"message_ids"` // New manually chosen quote from the message to be replied; pass null if none. Ignored if more than one message is re-sent, or if messageSendingStateFailed.need_another_reply_quote == false Quote *InputTextQuote `json:"quote"` + // The number of Telegram Stars the user agreed to pay to send the messages. Ignored if messageSendingStateFailed.required_paid_message_star_count == 0 + PaidMessageStarCount int64 `json:"paid_message_star_count"` } // Resends messages which failed to send. Can be called only for messages for which messageSendingStateFailed.can_retry is true and after specified in messageSendingStateFailed.retry_after time passed. If a message is re-sent, the corresponding failed to send message is deleted. Returns the sent messages in the same order as the message identifiers passed in message_ids. If a message can't be re-sent, null will be returned instead of the message @@ -4127,6 +4129,7 @@ func (client *Client) ResendMessages(req *ResendMessagesRequest) (*Messages, err "chat_id": req.ChatId, "message_ids": req.MessageIds, "quote": req.Quote, + "paid_message_star_count": req.PaidMessageStarCount, }, }) if err != nil { @@ -13249,7 +13252,7 @@ type CreateCallRequest struct { Protocol *CallProtocol `json:"protocol"` // Pass true to create a video call IsVideo bool `json:"is_video"` - // Identifier of the group call to which the user will be added after exchanging private key via the call; pass 0 if none; currently, ignored + // Identifier of the group call to which the user will be added after exchanging private key via the call; pass 0 if none GroupCallId int32 `json:"group_call_id"` } @@ -13730,6 +13733,8 @@ type JoinGroupCallRequest struct { IsMyVideoEnabled bool `json:"is_my_video_enabled"` // If non-empty, invite hash to be used to join the group call without being muted by administrators InviteHash string `json:"invite_hash"` + // Fingerprint of the encryption key for E2E group calls not bound to a chat; pass 0 for voice chats + KeyFingerprint JsonInt64 `json:"key_fingerprint"` } // Joins an active group call. Returns join response payload for tgcalls @@ -13746,6 +13751,7 @@ func (client *Client) JoinGroupCall(req *JoinGroupCallRequest) (*Text, error) { "is_muted": req.IsMuted, "is_my_video_enabled": req.IsMyVideoEnabled, "invite_hash": req.InviteHash, + "key_fingerprint": req.KeyFingerprint, }, }) if err != nil { @@ -14750,7 +14756,7 @@ type SuggestUserProfilePhotoRequest struct { Photo InputChatPhoto `json:"photo"` } -// Suggests a profile photo to another regular user with common messages +// Suggests a profile photo to another regular user with common messages and allowing non-paid messages func (client *Client) SuggestUserProfilePhoto(req *SuggestUserProfilePhotoRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -16072,11 +16078,11 @@ func (client *Client) GetLinkPreview(req *GetLinkPreviewRequest) (*LinkPreview, type GetWebPageInstantViewRequest struct { // The web page URL Url string `json:"url"` - // Pass true to get full instant view for the web page - ForceFull bool `json:"force_full"` + // Pass true to get only locally available information without sending network requests + OnlyLocal bool `json:"only_local"` } -// Returns an instant view version of a web page if available. Returns a 404 error if the web page has no instant view page +// Returns an instant view version of a web page if available. This is an offline request if only_local is true. Returns a 404 error if the web page has no instant view page func (client *Client) GetWebPageInstantView(req *GetWebPageInstantViewRequest) (*WebPageInstantView, error) { result, err := client.Send(Request{ meta: meta{ @@ -16084,7 +16090,7 @@ func (client *Client) GetWebPageInstantView(req *GetWebPageInstantViewRequest) ( }, Data: map[string]interface{}{ "url": req.Url, - "force_full": req.ForceFull, + "only_local": req.OnlyLocal, }, }) if err != nil { @@ -18908,7 +18914,7 @@ type SendGiftRequest struct { GiftId JsonInt64 `json:"gift_id"` // Identifier of the user or the channel chat that will receive the gift OwnerId MessageSender `json:"owner_id"` - // Text to show along with the gift; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed + // Text to show along with the gift; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed. Must be empty if the receiver enabled paid messages Text *FormattedText `json:"text"` // Pass true to show gift text and sender only to the gift receiver; otherwise, everyone will be able to see them IsPrivate bool `json:"is_private"` @@ -18974,7 +18980,7 @@ type ToggleGiftIsSavedRequest struct { IsSaved bool `json:"is_saved"` } -// Toggles whether a gift is shown on the current user's or the channel's profile page; requires can_post_messages administrator right in the chat +// Toggles whether a gift is shown on the current user's or the channel's profile page; requires can_post_messages administrator right in the channel chat func (client *Client) ToggleGiftIsSaved(req *ToggleGiftIsSavedRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -18996,6 +19002,35 @@ func (client *Client) ToggleGiftIsSaved(req *ToggleGiftIsSavedRequest) (*Ok, err return UnmarshalOk(result.Data) } +type SetPinnedGiftsRequest struct { + // Identifier of the user or the channel chat that received the gifts + OwnerId MessageSender `json:"owner_id"` + // New list of pinned gifts. All gifts must be upgraded and saved on the profile page first. There can be up to getOption("pinned_gift_count_max") pinned gifts + ReceivedGiftIds []string `json:"received_gift_ids"` +} + +// Changes the list of pinned gifts on the current user's or the channel's profile page; requires can_post_messages administrator right in the channel chat +func (client *Client) SetPinnedGifts(req *SetPinnedGiftsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setPinnedGifts", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "received_gift_ids": req.ReceivedGiftIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type ToggleChatGiftNotificationsRequest struct { // Identifier of the channel chat ChatId int64 `json:"chat_id"` @@ -20007,6 +20042,90 @@ func (client *Client) GetNewChatPrivacySettings() (*NewChatPrivacySettings, erro return UnmarshalNewChatPrivacySettings(result.Data) } +type GetPaidMessageRevenueRequest struct { + // Identifier of the user + UserId int64 `json:"user_id"` +} + +// Returns the total number of Telegram Stars received by the current user for paid messages from the given user +func (client *Client) GetPaidMessageRevenue(req *GetPaidMessageRevenueRequest) (*StarCount, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getPaidMessageRevenue", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStarCount(result.Data) +} + +type AllowUnpaidMessagesFromUserRequest struct { + // Identifier of the user + UserId int64 `json:"user_id"` + // Pass true to refund the user previously paid messages + RefundPayments bool `json:"refund_payments"` +} + +// Allows the specified user to send unpaid private messages to the current user by adding a rule to userPrivacySettingAllowUnpaidMessages +func (client *Client) AllowUnpaidMessagesFromUser(req *AllowUnpaidMessagesFromUserRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "allowUnpaidMessagesFromUser", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "refund_payments": req.RefundPayments, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetChatPaidMessageStarCountRequest struct { + // Identifier of the supergroup chat + ChatId int64 `json:"chat_id"` + // The new number of Telegram Stars that must be paid for each message that is sent to the supergroup chat unless the sender is an administrator of the chat; 0-getOption("paid_message_star_count_max"). The supergroup will receive getOption("paid_message_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for message sending + PaidMessageStarCount int64 `json:"paid_message_star_count"` +} + +// Changes the amount of Telegram Stars that must be paid to send a message to a supergroup chat; requires can_restrict_members administrator right and supergroupFullInfo.can_enable_paid_messages +func (client *Client) SetChatPaidMessageStarCount(req *SetChatPaidMessageStarCountRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setChatPaidMessageStarCount", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "paid_message_star_count": req.PaidMessageStarCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type CanSendMessageToUserRequest struct { // Identifier of the other user UserId int64 `json:"user_id"` @@ -20037,6 +20156,9 @@ func (client *Client) CanSendMessageToUser(req *CanSendMessageToUserRequest) (Ca case TypeCanSendMessageToUserResultOk: return UnmarshalCanSendMessageToUserResultOk(result.Data) + case TypeCanSendMessageToUserResultUserHasPaidMessages: + return UnmarshalCanSendMessageToUserResultUserHasPaidMessages(result.Data) + case TypeCanSendMessageToUserResultUserIsDeleted: return UnmarshalCanSendMessageToUserResultUserIsDeleted(result.Data) @@ -20476,7 +20598,7 @@ func (client *Client) GetChatRevenueTransactions(req *GetChatRevenueTransactions } type GetStarRevenueStatisticsRequest struct { - // Identifier of the owner of the Telegram Stars; can be identifier of an owned bot, or identifier of a channel chat with supergroupFullInfo.can_get_star_revenue_statistics == true + // Identifier of the owner of the Telegram Stars; can be identifier of the current user, an owned bot, or a supergroup or a channel chat with supergroupFullInfo.can_get_star_revenue_statistics == true OwnerId MessageSender `json:"owner_id"` // Pass true if a dark theme is used by the application IsDark bool `json:"is_dark"` @@ -20505,7 +20627,7 @@ func (client *Client) GetStarRevenueStatistics(req *GetStarRevenueStatisticsRequ } type GetStarWithdrawalUrlRequest struct { - // Identifier of the owner of the Telegram Stars; can be identifier of an owned bot, or identifier of an owned channel chat + // Identifier of the owner of the Telegram Stars; can be identifier of the current user, an owned bot, or an owned supergroup or channel chat OwnerId MessageSender `json:"owner_id"` // The number of Telegram Stars to withdraw. Must be at least getOption("star_withdrawal_count_min") StarCount int64 `json:"star_count"` @@ -22236,16 +22358,35 @@ func (client *Client) GetPremiumState() (*PremiumState, error) { return UnmarshalPremiumState(result.Data) } -type GetPremiumGiftCodePaymentOptionsRequest struct { - // Identifier of the supergroup or channel chat, which will be automatically boosted by receivers of the gift codes and which is administered by the user; 0 if none +// Returns available options for gifting Telegram Premium to a user +func (client *Client) GetPremiumGiftPaymentOptions() (*PremiumGiftPaymentOptions, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getPremiumGiftPaymentOptions", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPremiumGiftPaymentOptions(result.Data) +} + +type GetPremiumGiveawayPaymentOptionsRequest struct { + // Identifier of the supergroup or channel chat, which will be automatically boosted by receivers of the gift codes and which is administered by the user BoostedChatId int64 `json:"boosted_chat_id"` } -// Returns available options for Telegram Premium gift code or Telegram Premium giveaway creation -func (client *Client) GetPremiumGiftCodePaymentOptions(req *GetPremiumGiftCodePaymentOptionsRequest) (*PremiumGiftCodePaymentOptions, error) { +// Returns available options for creating of Telegram Premium giveaway or manual distribution of Telegram Premium among chat members +func (client *Client) GetPremiumGiveawayPaymentOptions(req *GetPremiumGiveawayPaymentOptionsRequest) (*PremiumGiveawayPaymentOptions, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getPremiumGiftCodePaymentOptions", + Type: "getPremiumGiveawayPaymentOptions", }, Data: map[string]interface{}{ "boosted_chat_id": req.BoostedChatId, @@ -22259,7 +22400,7 @@ func (client *Client) GetPremiumGiftCodePaymentOptions(req *GetPremiumGiftCodePa return nil, buildResponseError(result.Data) } - return UnmarshalPremiumGiftCodePaymentOptions(result.Data) + return UnmarshalPremiumGiveawayPaymentOptions(result.Data) } type CheckPremiumGiftCodeRequest struct { @@ -22452,7 +22593,7 @@ func (client *Client) GetStarGiveawayPaymentOptions() (*StarGiveawayPaymentOptio } type GetStarTransactionsRequest struct { - // Identifier of the owner of the Telegram Stars; can be the identifier of the current user, identifier of an owned bot, or identifier of a channel chat with supergroupFullInfo.can_get_star_revenue_statistics == true + // Identifier of the owner of the Telegram Stars; can be the identifier of the current user, identifier of an owned bot, or identifier of a supergroup or a channel chat with supergroupFullInfo.can_get_star_revenue_statistics == true OwnerId MessageSender `json:"owner_id"` // If non-empty, only transactions related to the Star Subscription will be returned SubscriptionId string `json:"subscription_id"` diff --git a/client/type.go b/client/type.go index 8743a91..c4f4597 100755 --- a/client/type.go +++ b/client/type.go @@ -257,8 +257,10 @@ const ( ClassProductInfo = "ProductInfo" ClassPremiumPaymentOption = "PremiumPaymentOption" ClassPremiumStatePaymentOption = "PremiumStatePaymentOption" - ClassPremiumGiftCodePaymentOption = "PremiumGiftCodePaymentOption" - ClassPremiumGiftCodePaymentOptions = "PremiumGiftCodePaymentOptions" + ClassPremiumGiftPaymentOption = "PremiumGiftPaymentOption" + ClassPremiumGiftPaymentOptions = "PremiumGiftPaymentOptions" + ClassPremiumGiveawayPaymentOption = "PremiumGiveawayPaymentOption" + ClassPremiumGiveawayPaymentOptions = "PremiumGiveawayPaymentOptions" ClassPremiumGiftCodeInfo = "PremiumGiftCodeInfo" ClassStarPaymentOption = "StarPaymentOption" ClassStarPaymentOptions = "StarPaymentOptions" @@ -371,6 +373,7 @@ const ( ClassFailedToAddMember = "FailedToAddMember" ClassFailedToAddMembers = "FailedToAddMembers" ClassCreatedBasicGroupChat = "CreatedBasicGroupChat" + ClassAccountInfo = "AccountInfo" ClassKeyboardButton = "KeyboardButton" ClassInlineKeyboardButton = "InlineKeyboardButton" ClassThemeParameters = "ThemeParameters" @@ -568,6 +571,7 @@ const ( ClassText = "Text" ClassSeconds = "Seconds" ClassFileDownloadedPrefixSize = "FileDownloadedPrefixSize" + ClassStarCount = "StarCount" ClassDeepLinkInfo = "DeepLinkInfo" ClassProxy = "Proxy" ClassProxies = "Proxies" @@ -762,8 +766,10 @@ const ( TypeProductInfo = "productInfo" TypePremiumPaymentOption = "premiumPaymentOption" TypePremiumStatePaymentOption = "premiumStatePaymentOption" - TypePremiumGiftCodePaymentOption = "premiumGiftCodePaymentOption" - TypePremiumGiftCodePaymentOptions = "premiumGiftCodePaymentOptions" + TypePremiumGiftPaymentOption = "premiumGiftPaymentOption" + TypePremiumGiftPaymentOptions = "premiumGiftPaymentOptions" + TypePremiumGiveawayPaymentOption = "premiumGiveawayPaymentOption" + TypePremiumGiveawayPaymentOptions = "premiumGiveawayPaymentOptions" TypePremiumGiftCodeInfo = "premiumGiftCodeInfo" TypeStarPaymentOption = "starPaymentOption" TypeStarPaymentOptions = "starPaymentOptions" @@ -812,6 +818,9 @@ const ( TypeStarTransactionTypeChannelPaidReactionSend = "starTransactionTypeChannelPaidReactionSend" TypeStarTransactionTypeChannelPaidReactionReceive = "starTransactionTypeChannelPaidReactionReceive" TypeStarTransactionTypeAffiliateProgramCommission = "starTransactionTypeAffiliateProgramCommission" + TypeStarTransactionTypePaidMessageSend = "starTransactionTypePaidMessageSend" + TypeStarTransactionTypePaidMessageReceive = "starTransactionTypePaidMessageReceive" + TypeStarTransactionTypePremiumPurchase = "starTransactionTypePremiumPurchase" TypeStarTransactionTypeUnsupported = "starTransactionTypeUnsupported" TypeStarTransaction = "starTransaction" TypeStarTransactions = "starTransactions" @@ -1005,6 +1014,7 @@ const ( TypeCreatedBasicGroupChat = "createdBasicGroupChat" TypePublicChatTypeHasUsername = "publicChatTypeHasUsername" TypePublicChatTypeIsLocationBased = "publicChatTypeIsLocationBased" + TypeAccountInfo = "accountInfo" TypeChatActionBarReportSpam = "chatActionBarReportSpam" TypeChatActionBarInviteMembers = "chatActionBarInviteMembers" TypeChatActionBarReportAddBlock = "chatActionBarReportAddBlock" @@ -1755,11 +1765,13 @@ const ( TypeBusinessFeaturePromotionAnimation = "businessFeaturePromotionAnimation" TypePremiumState = "premiumState" TypeStorePaymentPurposePremiumSubscription = "storePaymentPurposePremiumSubscription" + TypeStorePaymentPurposePremiumGift = "storePaymentPurposePremiumGift" TypeStorePaymentPurposePremiumGiftCodes = "storePaymentPurposePremiumGiftCodes" TypeStorePaymentPurposePremiumGiveaway = "storePaymentPurposePremiumGiveaway" TypeStorePaymentPurposeStarGiveaway = "storePaymentPurposeStarGiveaway" TypeStorePaymentPurposeStars = "storePaymentPurposeStars" TypeStorePaymentPurposeGiftedStars = "storePaymentPurposeGiftedStars" + TypeTelegramPaymentPurposePremiumGift = "telegramPaymentPurposePremiumGift" TypeTelegramPaymentPurposePremiumGiftCodes = "telegramPaymentPurposePremiumGiftCodes" TypeTelegramPaymentPurposePremiumGiveaway = "telegramPaymentPurposePremiumGiveaway" TypeTelegramPaymentPurposeStars = "telegramPaymentPurposeStars" @@ -1843,6 +1855,9 @@ const ( TypePushMessageContentVideoNote = "pushMessageContentVideoNote" TypePushMessageContentVoiceNote = "pushMessageContentVoiceNote" TypePushMessageContentBasicGroupChatCreate = "pushMessageContentBasicGroupChatCreate" + TypePushMessageContentVideoChatStarted = "pushMessageContentVideoChatStarted" + TypePushMessageContentVideoChatEnded = "pushMessageContentVideoChatEnded" + TypePushMessageContentInviteVideoChatParticipants = "pushMessageContentInviteVideoChatParticipants" TypePushMessageContentChatAddMembers = "pushMessageContentChatAddMembers" TypePushMessageContentChatChangePhoto = "pushMessageContentChatChangePhoto" TypePushMessageContentChatChangeTitle = "pushMessageContentChatChangeTitle" @@ -1853,6 +1868,7 @@ const ( TypePushMessageContentChatJoinByRequest = "pushMessageContentChatJoinByRequest" TypePushMessageContentRecurringPayment = "pushMessageContentRecurringPayment" TypePushMessageContentSuggestProfilePhoto = "pushMessageContentSuggestProfilePhoto" + TypePushMessageContentProximityAlertTriggered = "pushMessageContentProximityAlertTriggered" TypePushMessageContentMessageForwards = "pushMessageContentMessageForwards" TypePushMessageContentMediaAlbum = "pushMessageContentMediaAlbum" TypeNotificationTypeNewMessage = "notificationTypeNewMessage" @@ -1906,9 +1922,11 @@ const ( TypeUserPrivacySettingAllowFindingByPhoneNumber = "userPrivacySettingAllowFindingByPhoneNumber" TypeUserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages = "userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages" TypeUserPrivacySettingAutosaveGifts = "userPrivacySettingAutosaveGifts" + TypeUserPrivacySettingAllowUnpaidMessages = "userPrivacySettingAllowUnpaidMessages" TypeReadDatePrivacySettings = "readDatePrivacySettings" TypeNewChatPrivacySettings = "newChatPrivacySettings" TypeCanSendMessageToUserResultOk = "canSendMessageToUserResultOk" + TypeCanSendMessageToUserResultUserHasPaidMessages = "canSendMessageToUserResultUserHasPaidMessages" TypeCanSendMessageToUserResultUserIsDeleted = "canSendMessageToUserResultUserIsDeleted" TypeCanSendMessageToUserResultUserRestrictsNewChats = "canSendMessageToUserResultUserRestrictsNewChats" TypeAccountTtl = "accountTtl" @@ -2090,6 +2108,7 @@ const ( TypeText = "text" TypeSeconds = "seconds" TypeFileDownloadedPrefixSize = "fileDownloadedPrefixSize" + TypeStarCount = "starCount" TypeDeepLinkInfo = "deepLinkInfo" TypeTextParseModeMarkdown = "textParseModeMarkdown" TypeTextParseModeHTML = "textParseModeHTML" @@ -5975,6 +5994,8 @@ func (poll *Poll) UnmarshalJSON(data []byte) error { // Describes an alternative re-encoded quality of a video file type AlternativeVideo struct { meta + // Unique identifier of the alternative video, which is used in the HLS file + Id JsonInt64 `json:"id"` // Video width Width int32 `json:"width"` // Video height @@ -8148,15 +8169,71 @@ func (*PremiumStatePaymentOption) GetType() string { return TypePremiumStatePaymentOption } -// Describes an option for creating Telegram Premium gift codes or Telegram Premium giveaway. Use telegramPaymentPurposePremiumGiftCodes or telegramPaymentPurposePremiumGiveaway for out-of-store payments -type PremiumGiftCodePaymentOption struct { +// Describes an option for gifting Telegram Premium to a user. Use telegramPaymentPurposePremiumGift for out-of-store payments or payments in Telegram Stars +type PremiumGiftPaymentOption struct { + meta + // ISO 4217 currency code for the payment + Currency string `json:"currency"` + // The amount to pay, in the smallest units of the currency + Amount int64 `json:"amount"` + // The alternative amount of Telegram Stars to pay; 0 if payment in Telegram Stars is not possible + StarCount int64 `json:"star_count"` + // The discount associated with this option, as a percentage + DiscountPercentage int32 `json:"discount_percentage"` + // Number of months the Telegram Premium subscription will be active + MonthCount int32 `json:"month_count"` + // Identifier of the store product associated with the option + StoreProductId string `json:"store_product_id"` + // A sticker to be shown along with the option; may be null if unknown + Sticker *Sticker `json:"sticker"` +} + +func (entity *PremiumGiftPaymentOption) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumGiftPaymentOption + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumGiftPaymentOption) GetClass() string { + return ClassPremiumGiftPaymentOption +} + +func (*PremiumGiftPaymentOption) GetType() string { + return TypePremiumGiftPaymentOption +} + +// Contains a list of options for gifting Telegram Premium to a user +type PremiumGiftPaymentOptions struct { + meta + // The list of options sorted by Telegram Premium subscription duration + Options []*PremiumGiftPaymentOption `json:"options"` +} + +func (entity *PremiumGiftPaymentOptions) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumGiftPaymentOptions + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumGiftPaymentOptions) GetClass() string { + return ClassPremiumGiftPaymentOptions +} + +func (*PremiumGiftPaymentOptions) GetType() string { + return TypePremiumGiftPaymentOptions +} + +// Describes an option for creating of Telegram Premium giveaway or manual distribution of Telegram Premium among chat members. Use telegramPaymentPurposePremiumGiftCodes or telegramPaymentPurposePremiumGiveaway for out-of-store payments +type PremiumGiveawayPaymentOption struct { meta // ISO 4217 currency code for Telegram Premium gift code payment Currency string `json:"currency"` // The amount to pay, in the smallest units of the currency Amount int64 `json:"amount"` - // The discount associated with this option, as a percentage - DiscountPercentage int32 `json:"discount_percentage"` // Number of users which will be able to activate the gift codes WinnerCount int32 `json:"winner_count"` // Number of months the Telegram Premium subscription will be active @@ -8165,47 +8242,45 @@ type PremiumGiftCodePaymentOption struct { StoreProductId string `json:"store_product_id"` // Number of times the store product must be paid StoreProductQuantity int32 `json:"store_product_quantity"` - // A sticker to be shown along with the gift code; may be null if unknown - Sticker *Sticker `json:"sticker"` } -func (entity *PremiumGiftCodePaymentOption) MarshalJSON() ([]byte, error) { +func (entity *PremiumGiveawayPaymentOption) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub PremiumGiftCodePaymentOption + type stub PremiumGiveawayPaymentOption return json.Marshal((*stub)(entity)) } -func (*PremiumGiftCodePaymentOption) GetClass() string { - return ClassPremiumGiftCodePaymentOption +func (*PremiumGiveawayPaymentOption) GetClass() string { + return ClassPremiumGiveawayPaymentOption } -func (*PremiumGiftCodePaymentOption) GetType() string { - return TypePremiumGiftCodePaymentOption +func (*PremiumGiveawayPaymentOption) GetType() string { + return TypePremiumGiveawayPaymentOption } -// Contains a list of options for creating Telegram Premium gift codes or Telegram Premium giveaway -type PremiumGiftCodePaymentOptions struct { +// Contains a list of options for creating of Telegram Premium giveaway or manual distribution of Telegram Premium among chat members +type PremiumGiveawayPaymentOptions struct { meta // The list of options - Options []*PremiumGiftCodePaymentOption `json:"options"` + Options []*PremiumGiveawayPaymentOption `json:"options"` } -func (entity *PremiumGiftCodePaymentOptions) MarshalJSON() ([]byte, error) { +func (entity *PremiumGiveawayPaymentOptions) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub PremiumGiftCodePaymentOptions + type stub PremiumGiveawayPaymentOptions return json.Marshal((*stub)(entity)) } -func (*PremiumGiftCodePaymentOptions) GetClass() string { - return ClassPremiumGiftCodePaymentOptions +func (*PremiumGiveawayPaymentOptions) GetClass() string { + return ClassPremiumGiveawayPaymentOptions } -func (*PremiumGiftCodePaymentOptions) GetType() string { - return TypePremiumGiftCodePaymentOptions +func (*PremiumGiveawayPaymentOptions) GetType() string { + return TypePremiumGiveawayPaymentOptions } // Contains information about a Telegram Premium gift code @@ -8353,7 +8428,7 @@ func (*StarGiveawayWinnerOption) GetType() string { return TypeStarGiveawayWinnerOption } -// Describes an option for creating Telegram Star giveaway. Use telegramPaymentPurposeStarGiveaway for out-of-store payments +// Describes an option for creating of Telegram Star giveaway. Use telegramPaymentPurposeStarGiveaway for out-of-store payments type StarGiveawayPaymentOption struct { meta // ISO 4217 currency code for the payment @@ -8390,7 +8465,7 @@ func (*StarGiveawayPaymentOption) GetType() string { return TypeStarGiveawayPaymentOption } -// Contains a list of options for creating Telegram Star giveaway +// Contains a list of options for creating of Telegram Star giveaway type StarGiveawayPaymentOptions struct { meta // The list of options @@ -8833,6 +8908,8 @@ type ReceivedGift struct { IsPrivate bool `json:"is_private"` // True, if the gift is displayed on the chat's profile page; only for the receiver of the gift IsSaved bool `json:"is_saved"` + // True, if the gift is pinned to the top of the chat's profile page + IsPinned bool `json:"is_pinned"` // True, if the gift is a regular gift that can be upgraded to a unique gift; only for the receiver of the gift CanBeUpgraded bool `json:"can_be_upgraded"` // True, if the gift is an upgraded gift that can be transferred to another owner; only for the receiver of the gift @@ -8876,6 +8953,7 @@ func (receivedGift *ReceivedGift) UnmarshalJSON(data []byte) error { Text *FormattedText `json:"text"` IsPrivate bool `json:"is_private"` IsSaved bool `json:"is_saved"` + IsPinned bool `json:"is_pinned"` CanBeUpgraded bool `json:"can_be_upgraded"` CanBeTransferred bool `json:"can_be_transferred"` WasRefunded bool `json:"was_refunded"` @@ -8896,6 +8974,7 @@ func (receivedGift *ReceivedGift) UnmarshalJSON(data []byte) error { receivedGift.Text = tmp.Text receivedGift.IsPrivate = tmp.IsPrivate receivedGift.IsSaved = tmp.IsSaved + receivedGift.IsPinned = tmp.IsPinned receivedGift.CanBeUpgraded = tmp.CanBeUpgraded receivedGift.CanBeTransferred = tmp.CanBeTransferred receivedGift.WasRefunded = tmp.WasRefunded @@ -9178,7 +9257,7 @@ func (*StarTransactionTypeGiveawayDeposit) StarTransactionTypeType() string { return TypeStarTransactionTypeGiveawayDeposit } -// The transaction is a withdrawal of earned Telegram Stars to Fragment; for bots and channel chats only +// The transaction is a withdrawal of earned Telegram Stars to Fragment; for regular users, bots, supergroup and channel chats only type StarTransactionTypeFragmentWithdrawal struct { meta // State of the withdrawal; may be null for refunds from Fragment @@ -9795,6 +9874,8 @@ func (*StarTransactionTypeGiftSale) StarTransactionTypeType() string { // The transaction is an upgrade of a gift; for regular users only type StarTransactionTypeGiftUpgrade struct { meta + // Identifier of the user that initially sent the gift + UserId int64 `json:"user_id"` // The upgraded gift Gift *UpgradedGift `json:"gift"` } @@ -9906,6 +9987,122 @@ func (*StarTransactionTypeAffiliateProgramCommission) StarTransactionTypeType() return TypeStarTransactionTypeAffiliateProgramCommission } +// The transaction is a sending of a paid message; for regular users only +type StarTransactionTypePaidMessageSend struct { + meta + // Identifier of the chat that received the payment + ChatId int64 `json:"chat_id"` + // Number of sent paid messages + MessageCount int32 `json:"message_count"` +} + +func (entity *StarTransactionTypePaidMessageSend) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypePaidMessageSend + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypePaidMessageSend) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypePaidMessageSend) GetType() string { + return TypeStarTransactionTypePaidMessageSend +} + +func (*StarTransactionTypePaidMessageSend) StarTransactionTypeType() string { + return TypeStarTransactionTypePaidMessageSend +} + +// The transaction is a receiving of a paid message; for regular users and supergroup chats only +type StarTransactionTypePaidMessageReceive struct { + meta + // Identifier of the sender of the message + SenderId MessageSender `json:"sender_id"` + // Number of received paid messages + MessageCount int32 `json:"message_count"` + // The number of Telegram Stars received by the Telegram for each 1000 Telegram Stars paid for message sending + CommissionPerMille int32 `json:"commission_per_mille"` + // The amount of Telegram Stars that were received by Telegram; can be negative for refunds + CommissionStarAmount *StarAmount `json:"commission_star_amount"` +} + +func (entity *StarTransactionTypePaidMessageReceive) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypePaidMessageReceive + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypePaidMessageReceive) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypePaidMessageReceive) GetType() string { + return TypeStarTransactionTypePaidMessageReceive +} + +func (*StarTransactionTypePaidMessageReceive) StarTransactionTypeType() string { + return TypeStarTransactionTypePaidMessageReceive +} + +func (starTransactionTypePaidMessageReceive *StarTransactionTypePaidMessageReceive) UnmarshalJSON(data []byte) error { + var tmp struct { + SenderId json.RawMessage `json:"sender_id"` + MessageCount int32 `json:"message_count"` + CommissionPerMille int32 `json:"commission_per_mille"` + CommissionStarAmount *StarAmount `json:"commission_star_amount"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + starTransactionTypePaidMessageReceive.MessageCount = tmp.MessageCount + starTransactionTypePaidMessageReceive.CommissionPerMille = tmp.CommissionPerMille + starTransactionTypePaidMessageReceive.CommissionStarAmount = tmp.CommissionStarAmount + + fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) + starTransactionTypePaidMessageReceive.SenderId = fieldSenderId + + return nil +} + +// The transaction is a purchase of Telegram Premium subscription; for regular users only +type StarTransactionTypePremiumPurchase struct { + meta + // Identifier of the user that received the Telegram Premium subscription + UserId int64 `json:"user_id"` + // Number of months the Telegram Premium subscription will be active + MonthCount int32 `json:"month_count"` + // A sticker to be shown in the transaction information; may be null if unknown + Sticker *Sticker `json:"sticker"` +} + +func (entity *StarTransactionTypePremiumPurchase) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypePremiumPurchase + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypePremiumPurchase) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypePremiumPurchase) GetType() string { + return TypeStarTransactionTypePremiumPurchase +} + +func (*StarTransactionTypePremiumPurchase) StarTransactionTypeType() string { + return TypeStarTransactionTypePremiumPurchase +} + // The transaction is a transaction of an unsupported type type StarTransactionTypeUnsupported struct{ meta @@ -10611,6 +10808,8 @@ type User struct { HasUnreadActiveStories bool `json:"has_unread_active_stories"` // True, if the user may restrict new chats with non-contacts. Use canSendMessageToUser to check whether the current user can message the user or try to create a chat with them RestrictsNewChats bool `json:"restricts_new_chats"` + // Number of Telegram Stars that must be paid by general user for each sent message to the user. If positive and userFullInfo is unknown, use canSendMessageToUser to check whether the current user must pay + PaidMessageStarCount int64 `json:"paid_message_star_count"` // If false, the user is inaccessible, and the only information known about the user is inside this class. Identifier of the user can't be passed to any method HaveAccess bool `json:"have_access"` // Type of the user @@ -10662,6 +10861,7 @@ func (user *User) UnmarshalJSON(data []byte) error { HasActiveStories bool `json:"has_active_stories"` HasUnreadActiveStories bool `json:"has_unread_active_stories"` RestrictsNewChats bool `json:"restricts_new_chats"` + PaidMessageStarCount int64 `json:"paid_message_star_count"` HaveAccess bool `json:"have_access"` Type json.RawMessage `json:"type"` LanguageCode string `json:"language_code"` @@ -10695,6 +10895,7 @@ func (user *User) UnmarshalJSON(data []byte) error { user.HasActiveStories = tmp.HasActiveStories user.HasUnreadActiveStories = tmp.HasUnreadActiveStories user.RestrictsNewChats = tmp.RestrictsNewChats + user.PaidMessageStarCount = tmp.PaidMessageStarCount user.HaveAccess = tmp.HaveAccess user.LanguageCode = tmp.LanguageCode user.AddedToAttachmentMenu = tmp.AddedToAttachmentMenu @@ -10877,6 +11078,10 @@ type UserFullInfo struct { GiftCount int32 `json:"gift_count"` // Number of group chats where both the other user and the current user are a member; 0 for the current user GroupInCommonCount int32 `json:"group_in_common_count"` + // Number of Telegram Stars that must be paid by the user for each sent message to the current user + IncomingPaidMessageStarCount int64 `json:"incoming_paid_message_star_count"` + // Number of Telegram Stars that must be paid by the current user for each sent message to the user + OutgoingPaidMessageStarCount int64 `json:"outgoing_paid_message_star_count"` // Information about verification status of the user provided by a bot; may be null if none or unknown BotVerification *BotVerification `json:"bot_verification"` // Information about business settings for Telegram Business accounts; may be null if none @@ -10921,6 +11126,8 @@ func (userFullInfo *UserFullInfo) UnmarshalJSON(data []byte) error { PersonalChatId int64 `json:"personal_chat_id"` GiftCount int32 `json:"gift_count"` GroupInCommonCount int32 `json:"group_in_common_count"` + IncomingPaidMessageStarCount int64 `json:"incoming_paid_message_star_count"` + OutgoingPaidMessageStarCount int64 `json:"outgoing_paid_message_star_count"` BotVerification *BotVerification `json:"bot_verification"` BusinessInfo *BusinessInfo `json:"business_info"` BotInfo *BotInfo `json:"bot_info"` @@ -10948,6 +11155,8 @@ func (userFullInfo *UserFullInfo) UnmarshalJSON(data []byte) error { userFullInfo.PersonalChatId = tmp.PersonalChatId userFullInfo.GiftCount = tmp.GiftCount userFullInfo.GroupInCommonCount = tmp.GroupInCommonCount + userFullInfo.IncomingPaidMessageStarCount = tmp.IncomingPaidMessageStarCount + userFullInfo.OutgoingPaidMessageStarCount = tmp.OutgoingPaidMessageStarCount userFullInfo.BotVerification = tmp.BotVerification userFullInfo.BusinessInfo = tmp.BusinessInfo userFullInfo.BotInfo = tmp.BotInfo @@ -12279,6 +12488,8 @@ type Supergroup struct { HasSensitiveContent bool `json:"has_sensitive_content"` // If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted RestrictionReason string `json:"restriction_reason"` + // Number of Telegram Stars that must be paid by non-administrator users of the supergroup chat for each sent message + PaidMessageStarCount int64 `json:"paid_message_star_count"` // True, if the supergroup or channel has non-expired stories available to the current user HasActiveStories bool `json:"has_active_stories"` // True, if the supergroup or channel has unread non-expired stories available to the current user @@ -12323,6 +12534,7 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { VerificationStatus *VerificationStatus `json:"verification_status"` HasSensitiveContent bool `json:"has_sensitive_content"` RestrictionReason string `json:"restriction_reason"` + PaidMessageStarCount int64 `json:"paid_message_star_count"` HasActiveStories bool `json:"has_active_stories"` HasUnreadActiveStories bool `json:"has_unread_active_stories"` } @@ -12351,6 +12563,7 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { supergroup.VerificationStatus = tmp.VerificationStatus supergroup.HasSensitiveContent = tmp.HasSensitiveContent supergroup.RestrictionReason = tmp.RestrictionReason + supergroup.PaidMessageStarCount = tmp.PaidMessageStarCount supergroup.HasActiveStories = tmp.HasActiveStories supergroup.HasUnreadActiveStories = tmp.HasUnreadActiveStories @@ -12381,6 +12594,8 @@ type SupergroupFullInfo struct { SlowModeDelay int32 `json:"slow_mode_delay"` // 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 `json:"slow_mode_delay_expires_in"` + // True, if paid messages can be enabled in the supergroup chat; for supergroup only + CanEnablePaidMessages bool `json:"can_enable_paid_messages"` // True, if paid reaction can be enabled in the channel chat; for channels only CanEnablePaidReaction bool `json:"can_enable_paid_reaction"` // True, if members of the chat can be retrieved via getSupergroupMembers or searchChatMembers @@ -13767,6 +13982,8 @@ type MessageSendingStateFailed struct { NeedAnotherReplyQuote bool `json:"need_another_reply_quote"` // True, if the message can be re-sent only if the message to be replied is removed. This will be done automatically by resendMessages NeedDropReply bool `json:"need_drop_reply"` + // The number of Telegram Stars that must be paid to send the message; 0 if the current amount is correct + RequiredPaidMessageStarCount int64 `json:"required_paid_message_star_count"` // Time left before the message can be re-sent, in seconds. No update is sent when this field changes RetryAfter float64 `json:"retry_after"` } @@ -14113,6 +14330,8 @@ type Message struct { SenderBusinessBotUserId int64 `json:"sender_business_bot_user_id"` // Number of times the sender of the message boosted the supergroup at the time the message was sent; 0 if none or unknown. For messages sent by the current user, supergroupFullInfo.my_boost_count must be used instead SenderBoostCount int32 `json:"sender_boost_count"` + // The number of Telegram Stars the sender paid to send the message + PaidMessageStarCount int64 `json:"paid_message_star_count"` // For channel posts and anonymous group messages, optional author signature AuthorSignature string `json:"author_signature"` // Unique identifier of an album this message belongs to; 0 if none. Only audios, documents, photos and videos can be grouped together in albums @@ -14176,6 +14395,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { ViaBotUserId int64 `json:"via_bot_user_id"` SenderBusinessBotUserId int64 `json:"sender_business_bot_user_id"` SenderBoostCount int32 `json:"sender_boost_count"` + PaidMessageStarCount int64 `json:"paid_message_star_count"` AuthorSignature string `json:"author_signature"` MediaAlbumId JsonInt64 `json:"media_album_id"` EffectId JsonInt64 `json:"effect_id"` @@ -14214,6 +14434,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { message.ViaBotUserId = tmp.ViaBotUserId message.SenderBusinessBotUserId = tmp.SenderBusinessBotUserId message.SenderBoostCount = tmp.SenderBoostCount + message.PaidMessageStarCount = tmp.PaidMessageStarCount message.AuthorSignature = tmp.AuthorSignature message.MediaAlbumId = tmp.MediaAlbumId message.EffectId = tmp.EffectId @@ -16643,6 +16864,37 @@ func (*PublicChatTypeIsLocationBased) PublicChatTypeType() string { return TypePublicChatTypeIsLocationBased } +// Contains basic information about another user that started a chat with the current user +type AccountInfo struct { + meta + // Month when the user was registered in Telegram; 0-12; may be 0 if unknown + RegistrationMonth int32 `json:"registration_month"` + // Year when the user was registered in Telegram; 0-9999; may be 0 if unknown + RegistrationYear int32 `json:"registration_year"` + // A two-letter ISO 3166-1 alpha-2 country code based on the phone number of the user; may be empty if unknown + PhoneNumberCountryCode string `json:"phone_number_country_code"` + // Point in time (Unix timestamp) when the user changed name last time; 0 if unknown + LastNameChangeDate int32 `json:"last_name_change_date"` + // Point in time (Unix timestamp) when the user changed photo last time; 0 if unknown + LastPhotoChangeDate int32 `json:"last_photo_change_date"` +} + +func (entity *AccountInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AccountInfo + + return json.Marshal((*stub)(entity)) +} + +func (*AccountInfo) GetClass() string { + return ClassAccountInfo +} + +func (*AccountInfo) GetType() string { + return TypeAccountInfo +} + // The chat can be reported as spam using the method reportChat with an empty option_id and message_ids. If the chat is a private chat with a user with an emoji status, then a notice about emoji status usage must be shown type ChatActionBarReportSpam struct { meta @@ -16700,6 +16952,8 @@ type ChatActionBarReportAddBlock struct { meta // If true, the chat was automatically archived and can be moved back to the main chat list using addChatToList simultaneously with setting chat notification settings to default using setChatNotificationSettings CanUnarchive bool `json:"can_unarchive"` + // Basic information about the other user in the chat; may be null if unknown + AccountInfo *AccountInfo `json:"account_info"` } func (entity *ChatActionBarReportAddBlock) MarshalJSON() ([]byte, error) { @@ -28798,9 +29052,11 @@ type MessageSendOptions struct { ProtectContent bool `json:"protect_content"` // Pass true to allow the message to ignore regular broadcast limits for a small fee; for bots only AllowPaidBroadcast bool `json:"allow_paid_broadcast"` + // The number of Telegram Stars the user agreed to pay to send the messages + PaidMessageStarCount int64 `json:"paid_message_star_count"` // Pass true if the user explicitly chosen a sticker or a custom emoji from an installed sticker set; applicable only to sendMessage and sendMessageAlbum UpdateOrderOfInstalledStickerSets bool `json:"update_order_of_installed_sticker_sets"` - // Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, live location messages and self-destructing messages can't be scheduled + // Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, to a chat with paid messages, live location messages and self-destructing messages can't be scheduled SchedulingState MessageSchedulingState `json:"scheduling_state"` // Identifier of the effect to apply to the message; pass 0 if none; applicable only to sendMessage and sendMessageAlbum in private chats EffectId JsonInt64 `json:"effect_id"` @@ -28832,6 +29088,7 @@ func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { FromBackground bool `json:"from_background"` ProtectContent bool `json:"protect_content"` AllowPaidBroadcast bool `json:"allow_paid_broadcast"` + PaidMessageStarCount int64 `json:"paid_message_star_count"` UpdateOrderOfInstalledStickerSets bool `json:"update_order_of_installed_sticker_sets"` SchedulingState json.RawMessage `json:"scheduling_state"` EffectId JsonInt64 `json:"effect_id"` @@ -28848,6 +29105,7 @@ func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { messageSendOptions.FromBackground = tmp.FromBackground messageSendOptions.ProtectContent = tmp.ProtectContent messageSendOptions.AllowPaidBroadcast = tmp.AllowPaidBroadcast + messageSendOptions.PaidMessageStarCount = tmp.PaidMessageStarCount messageSendOptions.UpdateOrderOfInstalledStickerSets = tmp.UpdateOrderOfInstalledStickerSets messageSendOptions.EffectId = tmp.EffectId messageSendOptions.SendingId = tmp.SendingId @@ -34594,6 +34852,8 @@ type GroupCall struct { meta // Group call identifier Id int32 `json:"id"` + // Identifier of one-to-one call from which the group call was created; 0 if unknown + FromCallId int32 `json:"from_call_id"` // Group call title Title string `json:"title"` // Point in time (Unix timestamp) when the group call is expected to be started by an administrator; 0 if it is already active or was ended @@ -41754,10 +42014,43 @@ func (*StorePaymentPurposePremiumSubscription) StorePaymentPurposeType() string return TypeStorePaymentPurposePremiumSubscription } -// The user creating Telegram Premium gift codes for other users +// The user gifting Telegram Premium to another user +type StorePaymentPurposePremiumGift struct { + meta + // ISO 4217 currency code of the payment currency + Currency string `json:"currency"` + // Paid amount, in the smallest units of the currency + Amount int64 `json:"amount"` + // Identifiers of the user which will receive Telegram Premium + UserId int64 `json:"user_id"` + // Text to show along with the gift codes; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed + Text *FormattedText `json:"text"` +} + +func (entity *StorePaymentPurposePremiumGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StorePaymentPurposePremiumGift + + return json.Marshal((*stub)(entity)) +} + +func (*StorePaymentPurposePremiumGift) GetClass() string { + return ClassStorePaymentPurpose +} + +func (*StorePaymentPurposePremiumGift) GetType() string { + return TypeStorePaymentPurposePremiumGift +} + +func (*StorePaymentPurposePremiumGift) StorePaymentPurposeType() string { + return TypeStorePaymentPurposePremiumGift +} + +// The user boosting a chat by creating Telegram Premium gift codes for other users type StorePaymentPurposePremiumGiftCodes struct { meta - // Identifier of the supergroup or channel chat, which will be automatically boosted by the users for duration of the Premium subscription and which is administered by the user; 0 if none + // Identifier of the supergroup or channel chat, which will be automatically boosted by the users for duration of the Premium subscription and which is administered by the user BoostedChatId int64 `json:"boosted_chat_id"` // ISO 4217 currency code of the payment currency Currency string `json:"currency"` @@ -41919,10 +42212,45 @@ func (*StorePaymentPurposeGiftedStars) StorePaymentPurposeType() string { return TypeStorePaymentPurposeGiftedStars } -// The user creating Telegram Premium gift codes for other users +// The user gifting Telegram Premium to another user +type TelegramPaymentPurposePremiumGift struct { + meta + // ISO 4217 currency code of the payment currency + Currency string `json:"currency"` + // Paid amount, in the smallest units of the currency + Amount int64 `json:"amount"` + // Identifier of the user which will receive Telegram Premium + UserId int64 `json:"user_id"` + // Number of months the Telegram Premium subscription will be active for the user + MonthCount int32 `json:"month_count"` + // Text to show to the user receiving Telegram Premium; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed + Text *FormattedText `json:"text"` +} + +func (entity *TelegramPaymentPurposePremiumGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TelegramPaymentPurposePremiumGift + + return json.Marshal((*stub)(entity)) +} + +func (*TelegramPaymentPurposePremiumGift) GetClass() string { + return ClassTelegramPaymentPurpose +} + +func (*TelegramPaymentPurposePremiumGift) GetType() string { + return TypeTelegramPaymentPurposePremiumGift +} + +func (*TelegramPaymentPurposePremiumGift) TelegramPaymentPurposeType() string { + return TypeTelegramPaymentPurposePremiumGift +} + +// The user boosting a chat by creating Telegram Premium gift codes for other users type TelegramPaymentPurposePremiumGiftCodes struct { meta - // Identifier of the supergroup or channel chat, which will be automatically boosted by the users for duration of the Premium subscription and which is administered by the user; 0 if none + // Identifier of the supergroup or channel chat, which will be automatically boosted by the users for duration of the Premium subscription and which is administered by the user BoostedChatId int64 `json:"boosted_chat_id"` // ISO 4217 currency code of the payment currency Currency string `json:"currency"` @@ -44129,6 +44457,8 @@ func (*PushMessageContentSticker) PushMessageContentType() string { // A message with a story type PushMessageContentStory struct { meta + // True, if the user was mentioned in the story + IsMention bool `json:"is_mention"` // True, if the message is a pinned message with the specified content IsPinned bool `json:"is_pinned"` } @@ -44298,6 +44628,83 @@ func (*PushMessageContentBasicGroupChatCreate) PushMessageContentType() string { return TypePushMessageContentBasicGroupChatCreate } +// A video chat or live stream was started +type PushMessageContentVideoChatStarted struct{ + meta +} + +func (entity *PushMessageContentVideoChatStarted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentVideoChatStarted + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentVideoChatStarted) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentVideoChatStarted) GetType() string { + return TypePushMessageContentVideoChatStarted +} + +func (*PushMessageContentVideoChatStarted) PushMessageContentType() string { + return TypePushMessageContentVideoChatStarted +} + +// A video chat or live stream has ended +type PushMessageContentVideoChatEnded struct{ + meta +} + +func (entity *PushMessageContentVideoChatEnded) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentVideoChatEnded + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentVideoChatEnded) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentVideoChatEnded) GetType() string { + return TypePushMessageContentVideoChatEnded +} + +func (*PushMessageContentVideoChatEnded) PushMessageContentType() string { + return TypePushMessageContentVideoChatEnded +} + +// An invitation of participants to a video chat or live stream +type PushMessageContentInviteVideoChatParticipants struct { + meta + // True, if the current user was invited to the video chat or the live stream + IsCurrentUser bool `json:"is_current_user"` +} + +func (entity *PushMessageContentInviteVideoChatParticipants) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentInviteVideoChatParticipants + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentInviteVideoChatParticipants) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentInviteVideoChatParticipants) GetType() string { + return TypePushMessageContentInviteVideoChatParticipants +} + +func (*PushMessageContentInviteVideoChatParticipants) PushMessageContentType() string { + return TypePushMessageContentInviteVideoChatParticipants +} + // New chat members were invited to a group type PushMessageContentChatAddMembers struct { meta @@ -44568,6 +44975,33 @@ func (*PushMessageContentSuggestProfilePhoto) PushMessageContentType() string { return TypePushMessageContentSuggestProfilePhoto } +// A user in the chat came within proximity alert range from the current user +type PushMessageContentProximityAlertTriggered struct { + meta + // The distance to the user + Distance int32 `json:"distance"` +} + +func (entity *PushMessageContentProximityAlertTriggered) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentProximityAlertTriggered + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentProximityAlertTriggered) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentProximityAlertTriggered) GetType() string { + return TypePushMessageContentProximityAlertTriggered +} + +func (*PushMessageContentProximityAlertTriggered) PushMessageContentType() string { + return TypePushMessageContentProximityAlertTriggered +} + // A forwarded messages type PushMessageContentMessageForwards struct { meta @@ -46091,6 +46525,31 @@ func (*UserPrivacySettingAutosaveGifts) UserPrivacySettingType() string { return TypeUserPrivacySettingAutosaveGifts } +// A privacy setting for managing whether the user can receive messages without additional payment +type UserPrivacySettingAllowUnpaidMessages struct{ + meta +} + +func (entity *UserPrivacySettingAllowUnpaidMessages) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserPrivacySettingAllowUnpaidMessages + + return json.Marshal((*stub)(entity)) +} + +func (*UserPrivacySettingAllowUnpaidMessages) GetClass() string { + return ClassUserPrivacySetting +} + +func (*UserPrivacySettingAllowUnpaidMessages) GetType() string { + return TypeUserPrivacySettingAllowUnpaidMessages +} + +func (*UserPrivacySettingAllowUnpaidMessages) UserPrivacySettingType() string { + return TypeUserPrivacySettingAllowUnpaidMessages +} + // Contains privacy settings for message read date in private chats. Read dates are always shown to the users that can see online status of the current user regardless of this setting type ReadDatePrivacySettings struct { meta @@ -46114,11 +46573,13 @@ func (*ReadDatePrivacySettings) GetType() string { return TypeReadDatePrivacySettings } -// Contains privacy settings for new chats with non-contacts +// Contains privacy settings for chats with non-contacts type NewChatPrivacySettings struct { meta // True, if non-contacts users are able to write first to the current user. Telegram Premium subscribers are able to write first regardless of this setting AllowNewChatsFromUnknownUsers bool `json:"allow_new_chats_from_unknown_users"` + // Number of Telegram Stars that must be paid for every incoming private message by non-contacts; 0-getOption("paid_message_star_count_max"). If positive, then allow_new_chats_from_unknown_users must be true. The current user will receive getOption("paid_message_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for message sending + IncomingPaidMessageStarCount int64 `json:"incoming_paid_message_star_count"` } func (entity *NewChatPrivacySettings) MarshalJSON() ([]byte, error) { @@ -46162,6 +46623,33 @@ func (*CanSendMessageToUserResultOk) CanSendMessageToUserResultType() string { return TypeCanSendMessageToUserResultOk } +// The user can be messaged, but the messages are paid +type CanSendMessageToUserResultUserHasPaidMessages struct { + meta + // Number of Telegram Stars that must be paid by the current user for each sent message to the user + OutgoingPaidMessageStarCount int64 `json:"outgoing_paid_message_star_count"` +} + +func (entity *CanSendMessageToUserResultUserHasPaidMessages) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CanSendMessageToUserResultUserHasPaidMessages + + return json.Marshal((*stub)(entity)) +} + +func (*CanSendMessageToUserResultUserHasPaidMessages) GetClass() string { + return ClassCanSendMessageToUserResult +} + +func (*CanSendMessageToUserResultUserHasPaidMessages) GetType() string { + return TypeCanSendMessageToUserResultUserHasPaidMessages +} + +func (*CanSendMessageToUserResultUserHasPaidMessages) CanSendMessageToUserResultType() string { + return TypeCanSendMessageToUserResultUserHasPaidMessages +} + // The user can't be messaged, because they are deleted or unknown type CanSendMessageToUserResultUserIsDeleted struct{ meta @@ -48172,7 +48660,7 @@ func (*InternalLinkTypePremiumFeatures) InternalLinkTypeType() string { return TypeInternalLinkTypePremiumFeatures } -// The link is a link to the screen for gifting Telegram Premium subscriptions to friends via inputInvoiceTelegram with telegramPaymentPurposePremiumGiftCodes payments or in-store purchases +// The link is a link to the screen for gifting Telegram Premium subscriptions to friends via inputInvoiceTelegram with telegramPaymentPurposePremiumGift payments or in-store purchases type InternalLinkTypePremiumGift struct { meta // Referrer specified in the link @@ -51185,6 +51673,29 @@ func (*FileDownloadedPrefixSize) GetType() string { return TypeFileDownloadedPrefixSize } +// Contains a number of Telegram Stars +type StarCount struct { + meta + // Number of Telegram Stars + StarCount int64 `json:"star_count"` +} + +func (entity *StarCount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarCount + + return json.Marshal((*stub)(entity)) +} + +func (*StarCount) GetClass() string { + return ClassStarCount +} + +func (*StarCount) GetType() string { + return TypeStarCount +} + // Contains information about a tg: deep link type DeepLinkInfo struct { meta diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 313cb84..62cd54e 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -922,6 +922,15 @@ func UnmarshalStarTransactionType(data json.RawMessage) (StarTransactionType, er case TypeStarTransactionTypeAffiliateProgramCommission: return UnmarshalStarTransactionTypeAffiliateProgramCommission(data) + case TypeStarTransactionTypePaidMessageSend: + return UnmarshalStarTransactionTypePaidMessageSend(data) + + case TypeStarTransactionTypePaidMessageReceive: + return UnmarshalStarTransactionTypePaidMessageReceive(data) + + case TypeStarTransactionTypePremiumPurchase: + return UnmarshalStarTransactionTypePremiumPurchase(data) + case TypeStarTransactionTypeUnsupported: return UnmarshalStarTransactionTypeUnsupported(data) @@ -5726,6 +5735,9 @@ func UnmarshalStorePaymentPurpose(data json.RawMessage) (StorePaymentPurpose, er case TypeStorePaymentPurposePremiumSubscription: return UnmarshalStorePaymentPurposePremiumSubscription(data) + case TypeStorePaymentPurposePremiumGift: + return UnmarshalStorePaymentPurposePremiumGift(data) + case TypeStorePaymentPurposePremiumGiftCodes: return UnmarshalStorePaymentPurposePremiumGiftCodes(data) @@ -5769,6 +5781,9 @@ func UnmarshalTelegramPaymentPurpose(data json.RawMessage) (TelegramPaymentPurpo } switch meta.Type { + case TypeTelegramPaymentPurposePremiumGift: + return UnmarshalTelegramPaymentPurposePremiumGift(data) + case TypeTelegramPaymentPurposePremiumGiftCodes: return UnmarshalTelegramPaymentPurposePremiumGiftCodes(data) @@ -6311,6 +6326,15 @@ func UnmarshalPushMessageContent(data json.RawMessage) (PushMessageContent, erro case TypePushMessageContentBasicGroupChatCreate: return UnmarshalPushMessageContentBasicGroupChatCreate(data) + case TypePushMessageContentVideoChatStarted: + return UnmarshalPushMessageContentVideoChatStarted(data) + + case TypePushMessageContentVideoChatEnded: + return UnmarshalPushMessageContentVideoChatEnded(data) + + case TypePushMessageContentInviteVideoChatParticipants: + return UnmarshalPushMessageContentInviteVideoChatParticipants(data) + case TypePushMessageContentChatAddMembers: return UnmarshalPushMessageContentChatAddMembers(data) @@ -6341,6 +6365,9 @@ func UnmarshalPushMessageContent(data json.RawMessage) (PushMessageContent, erro case TypePushMessageContentSuggestProfilePhoto: return UnmarshalPushMessageContentSuggestProfilePhoto(data) + case TypePushMessageContentProximityAlertTriggered: + return UnmarshalPushMessageContentProximityAlertTriggered(data) + case TypePushMessageContentMessageForwards: return UnmarshalPushMessageContentMessageForwards(data) @@ -6678,6 +6705,9 @@ func UnmarshalUserPrivacySetting(data json.RawMessage) (UserPrivacySetting, erro case TypeUserPrivacySettingAutosaveGifts: return UnmarshalUserPrivacySettingAutosaveGifts(data) + case TypeUserPrivacySettingAllowUnpaidMessages: + return UnmarshalUserPrivacySettingAllowUnpaidMessages(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -6709,6 +6739,9 @@ func UnmarshalCanSendMessageToUserResult(data json.RawMessage) (CanSendMessageTo case TypeCanSendMessageToUserResultOk: return UnmarshalCanSendMessageToUserResultOk(data) + case TypeCanSendMessageToUserResultUserHasPaidMessages: + return UnmarshalCanSendMessageToUserResultUserHasPaidMessages(data) + case TypeCanSendMessageToUserResultUserIsDeleted: return UnmarshalCanSendMessageToUserResultUserIsDeleted(data) @@ -9752,16 +9785,32 @@ func UnmarshalPremiumStatePaymentOption(data json.RawMessage) (*PremiumStatePaym return &resp, err } -func UnmarshalPremiumGiftCodePaymentOption(data json.RawMessage) (*PremiumGiftCodePaymentOption, error) { - var resp PremiumGiftCodePaymentOption +func UnmarshalPremiumGiftPaymentOption(data json.RawMessage) (*PremiumGiftPaymentOption, error) { + var resp PremiumGiftPaymentOption err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalPremiumGiftCodePaymentOptions(data json.RawMessage) (*PremiumGiftCodePaymentOptions, error) { - var resp PremiumGiftCodePaymentOptions +func UnmarshalPremiumGiftPaymentOptions(data json.RawMessage) (*PremiumGiftPaymentOptions, error) { + var resp PremiumGiftPaymentOptions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPremiumGiveawayPaymentOption(data json.RawMessage) (*PremiumGiveawayPaymentOption, error) { + var resp PremiumGiveawayPaymentOption + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPremiumGiveawayPaymentOptions(data json.RawMessage) (*PremiumGiveawayPaymentOptions, error) { + var resp PremiumGiveawayPaymentOptions err := json.Unmarshal(data, &resp) @@ -10152,6 +10201,30 @@ func UnmarshalStarTransactionTypeAffiliateProgramCommission(data json.RawMessage return &resp, err } +func UnmarshalStarTransactionTypePaidMessageSend(data json.RawMessage) (*StarTransactionTypePaidMessageSend, error) { + var resp StarTransactionTypePaidMessageSend + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypePaidMessageReceive(data json.RawMessage) (*StarTransactionTypePaidMessageReceive, error) { + var resp StarTransactionTypePaidMessageReceive + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypePremiumPurchase(data json.RawMessage) (*StarTransactionTypePremiumPurchase, error) { + var resp StarTransactionTypePremiumPurchase + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarTransactionTypeUnsupported(data json.RawMessage) (*StarTransactionTypeUnsupported, error) { var resp StarTransactionTypeUnsupported @@ -11696,6 +11769,14 @@ func UnmarshalPublicChatTypeIsLocationBased(data json.RawMessage) (*PublicChatTy return &resp, err } +func UnmarshalAccountInfo(data json.RawMessage) (*AccountInfo, error) { + var resp AccountInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatActionBarReportSpam(data json.RawMessage) (*ChatActionBarReportSpam, error) { var resp ChatActionBarReportSpam @@ -17696,6 +17777,14 @@ func UnmarshalStorePaymentPurposePremiumSubscription(data json.RawMessage) (*Sto return &resp, err } +func UnmarshalStorePaymentPurposePremiumGift(data json.RawMessage) (*StorePaymentPurposePremiumGift, error) { + var resp StorePaymentPurposePremiumGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStorePaymentPurposePremiumGiftCodes(data json.RawMessage) (*StorePaymentPurposePremiumGiftCodes, error) { var resp StorePaymentPurposePremiumGiftCodes @@ -17736,6 +17825,14 @@ func UnmarshalStorePaymentPurposeGiftedStars(data json.RawMessage) (*StorePaymen return &resp, err } +func UnmarshalTelegramPaymentPurposePremiumGift(data json.RawMessage) (*TelegramPaymentPurposePremiumGift, error) { + var resp TelegramPaymentPurposePremiumGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalTelegramPaymentPurposePremiumGiftCodes(data json.RawMessage) (*TelegramPaymentPurposePremiumGiftCodes, error) { var resp TelegramPaymentPurposePremiumGiftCodes @@ -18400,6 +18497,30 @@ func UnmarshalPushMessageContentBasicGroupChatCreate(data json.RawMessage) (*Pus return &resp, err } +func UnmarshalPushMessageContentVideoChatStarted(data json.RawMessage) (*PushMessageContentVideoChatStarted, error) { + var resp PushMessageContentVideoChatStarted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentVideoChatEnded(data json.RawMessage) (*PushMessageContentVideoChatEnded, error) { + var resp PushMessageContentVideoChatEnded + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentInviteVideoChatParticipants(data json.RawMessage) (*PushMessageContentInviteVideoChatParticipants, error) { + var resp PushMessageContentInviteVideoChatParticipants + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPushMessageContentChatAddMembers(data json.RawMessage) (*PushMessageContentChatAddMembers, error) { var resp PushMessageContentChatAddMembers @@ -18480,6 +18601,14 @@ func UnmarshalPushMessageContentSuggestProfilePhoto(data json.RawMessage) (*Push return &resp, err } +func UnmarshalPushMessageContentProximityAlertTriggered(data json.RawMessage) (*PushMessageContentProximityAlertTriggered, error) { + var resp PushMessageContentProximityAlertTriggered + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPushMessageContentMessageForwards(data json.RawMessage) (*PushMessageContentMessageForwards, error) { var resp PushMessageContentMessageForwards @@ -18904,6 +19033,14 @@ func UnmarshalUserPrivacySettingAutosaveGifts(data json.RawMessage) (*UserPrivac return &resp, err } +func UnmarshalUserPrivacySettingAllowUnpaidMessages(data json.RawMessage) (*UserPrivacySettingAllowUnpaidMessages, error) { + var resp UserPrivacySettingAllowUnpaidMessages + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalReadDatePrivacySettings(data json.RawMessage) (*ReadDatePrivacySettings, error) { var resp ReadDatePrivacySettings @@ -18928,6 +19065,14 @@ func UnmarshalCanSendMessageToUserResultOk(data json.RawMessage) (*CanSendMessag return &resp, err } +func UnmarshalCanSendMessageToUserResultUserHasPaidMessages(data json.RawMessage) (*CanSendMessageToUserResultUserHasPaidMessages, error) { + var resp CanSendMessageToUserResultUserHasPaidMessages + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalCanSendMessageToUserResultUserIsDeleted(data json.RawMessage) (*CanSendMessageToUserResultUserIsDeleted, error) { var resp CanSendMessageToUserResultUserIsDeleted @@ -20376,6 +20521,14 @@ func UnmarshalFileDownloadedPrefixSize(data json.RawMessage) (*FileDownloadedPre return &resp, err } +func UnmarshalStarCount(data json.RawMessage) (*StarCount, error) { + var resp StarCount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalDeepLinkInfo(data json.RawMessage) (*DeepLinkInfo, error) { var resp DeepLinkInfo @@ -22596,11 +22749,17 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePremiumStatePaymentOption: return UnmarshalPremiumStatePaymentOption(data) - case TypePremiumGiftCodePaymentOption: - return UnmarshalPremiumGiftCodePaymentOption(data) + case TypePremiumGiftPaymentOption: + return UnmarshalPremiumGiftPaymentOption(data) - case TypePremiumGiftCodePaymentOptions: - return UnmarshalPremiumGiftCodePaymentOptions(data) + case TypePremiumGiftPaymentOptions: + return UnmarshalPremiumGiftPaymentOptions(data) + + case TypePremiumGiveawayPaymentOption: + return UnmarshalPremiumGiveawayPaymentOption(data) + + case TypePremiumGiveawayPaymentOptions: + return UnmarshalPremiumGiveawayPaymentOptions(data) case TypePremiumGiftCodeInfo: return UnmarshalPremiumGiftCodeInfo(data) @@ -22746,6 +22905,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarTransactionTypeAffiliateProgramCommission: return UnmarshalStarTransactionTypeAffiliateProgramCommission(data) + case TypeStarTransactionTypePaidMessageSend: + return UnmarshalStarTransactionTypePaidMessageSend(data) + + case TypeStarTransactionTypePaidMessageReceive: + return UnmarshalStarTransactionTypePaidMessageReceive(data) + + case TypeStarTransactionTypePremiumPurchase: + return UnmarshalStarTransactionTypePremiumPurchase(data) + case TypeStarTransactionTypeUnsupported: return UnmarshalStarTransactionTypeUnsupported(data) @@ -23325,6 +23493,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePublicChatTypeIsLocationBased: return UnmarshalPublicChatTypeIsLocationBased(data) + case TypeAccountInfo: + return UnmarshalAccountInfo(data) + case TypeChatActionBarReportSpam: return UnmarshalChatActionBarReportSpam(data) @@ -25575,6 +25746,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStorePaymentPurposePremiumSubscription: return UnmarshalStorePaymentPurposePremiumSubscription(data) + case TypeStorePaymentPurposePremiumGift: + return UnmarshalStorePaymentPurposePremiumGift(data) + case TypeStorePaymentPurposePremiumGiftCodes: return UnmarshalStorePaymentPurposePremiumGiftCodes(data) @@ -25590,6 +25764,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStorePaymentPurposeGiftedStars: return UnmarshalStorePaymentPurposeGiftedStars(data) + case TypeTelegramPaymentPurposePremiumGift: + return UnmarshalTelegramPaymentPurposePremiumGift(data) + case TypeTelegramPaymentPurposePremiumGiftCodes: return UnmarshalTelegramPaymentPurposePremiumGiftCodes(data) @@ -25839,6 +26016,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePushMessageContentBasicGroupChatCreate: return UnmarshalPushMessageContentBasicGroupChatCreate(data) + case TypePushMessageContentVideoChatStarted: + return UnmarshalPushMessageContentVideoChatStarted(data) + + case TypePushMessageContentVideoChatEnded: + return UnmarshalPushMessageContentVideoChatEnded(data) + + case TypePushMessageContentInviteVideoChatParticipants: + return UnmarshalPushMessageContentInviteVideoChatParticipants(data) + case TypePushMessageContentChatAddMembers: return UnmarshalPushMessageContentChatAddMembers(data) @@ -25869,6 +26055,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePushMessageContentSuggestProfilePhoto: return UnmarshalPushMessageContentSuggestProfilePhoto(data) + case TypePushMessageContentProximityAlertTriggered: + return UnmarshalPushMessageContentProximityAlertTriggered(data) + case TypePushMessageContentMessageForwards: return UnmarshalPushMessageContentMessageForwards(data) @@ -26028,6 +26217,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUserPrivacySettingAutosaveGifts: return UnmarshalUserPrivacySettingAutosaveGifts(data) + case TypeUserPrivacySettingAllowUnpaidMessages: + return UnmarshalUserPrivacySettingAllowUnpaidMessages(data) + case TypeReadDatePrivacySettings: return UnmarshalReadDatePrivacySettings(data) @@ -26037,6 +26229,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeCanSendMessageToUserResultOk: return UnmarshalCanSendMessageToUserResultOk(data) + case TypeCanSendMessageToUserResultUserHasPaidMessages: + return UnmarshalCanSendMessageToUserResultUserHasPaidMessages(data) + case TypeCanSendMessageToUserResultUserIsDeleted: return UnmarshalCanSendMessageToUserResultUserIsDeleted(data) @@ -26580,6 +26775,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeFileDownloadedPrefixSize: return UnmarshalFileDownloadedPrefixSize(data) + case TypeStarCount: + return UnmarshalStarCount(data) + case TypeDeepLinkInfo: return UnmarshalDeepLinkInfo(data) diff --git a/data/td_api.tl b/data/td_api.tl index 28709bd..8872945 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -529,12 +529,13 @@ poll id:int64 question:formattedText options:vector total_voter_coun //@description Describes an alternative re-encoded quality of a video file +//@id Unique identifier of the alternative video, which is used in the HLS file //@width Video width //@height Video height //@codec Codec used for video file encoding, for example, "h264", "h265", or "av1" //@hls_file HLS file describing the video //@video File containing the video -alternativeVideo width:int32 height:int32 codec:string hls_file:file video:file = AlternativeVideo; +alternativeVideo id:int64 width:int32 height:int32 codec:string hls_file:file video:file = AlternativeVideo; //@description Describes a chat background @@ -972,19 +973,30 @@ premiumPaymentOption currency:string amount:int53 discount_percentage:int32 mont //@last_transaction_id Identifier of the last in-store transaction for the currently used option premiumStatePaymentOption payment_option:premiumPaymentOption is_current:Bool is_upgrade:Bool last_transaction_id:string = PremiumStatePaymentOption; -//@description Describes an option for creating Telegram Premium gift codes or Telegram Premium giveaway. Use telegramPaymentPurposePremiumGiftCodes or telegramPaymentPurposePremiumGiveaway for out-of-store payments +//@description Describes an option for gifting Telegram Premium to a user. Use telegramPaymentPurposePremiumGift for out-of-store payments or payments in Telegram Stars +//@currency ISO 4217 currency code for the payment +//@amount The amount to pay, in the smallest units of the currency +//@star_count The alternative amount of Telegram Stars to pay; 0 if payment in Telegram Stars is not possible +//@discount_percentage The discount associated with this option, as a percentage +//@month_count Number of months the Telegram Premium subscription will be active +//@store_product_id Identifier of the store product associated with the option +//@sticker A sticker to be shown along with the option; may be null if unknown +premiumGiftPaymentOption currency:string amount:int53 star_count:int53 discount_percentage:int32 month_count:int32 store_product_id:string sticker:sticker = PremiumGiftPaymentOption; + +//@description Contains a list of options for gifting Telegram Premium to a user @options The list of options sorted by Telegram Premium subscription duration +premiumGiftPaymentOptions options:vector = PremiumGiftPaymentOptions; + +//@description Describes an option for creating of Telegram Premium giveaway or manual distribution of Telegram Premium among chat members. Use telegramPaymentPurposePremiumGiftCodes or telegramPaymentPurposePremiumGiveaway for out-of-store payments //@currency ISO 4217 currency code for Telegram Premium gift code payment //@amount The amount to pay, in the smallest units of the currency -//@discount_percentage The discount associated with this option, as a percentage //@winner_count Number of users which will be able to activate the gift codes //@month_count Number of months the Telegram Premium subscription will be active //@store_product_id Identifier of the store product associated with the option; may be empty if none //@store_product_quantity Number of times the store product must be paid -//@sticker A sticker to be shown along with the gift code; may be null if unknown -premiumGiftCodePaymentOption currency:string amount:int53 discount_percentage:int32 winner_count:int32 month_count:int32 store_product_id:string store_product_quantity:int32 sticker:sticker = PremiumGiftCodePaymentOption; +premiumGiveawayPaymentOption currency:string amount:int53 winner_count:int32 month_count:int32 store_product_id:string store_product_quantity:int32 = PremiumGiveawayPaymentOption; -//@description Contains a list of options for creating Telegram Premium gift codes or Telegram Premium giveaway @options The list of options -premiumGiftCodePaymentOptions options:vector = PremiumGiftCodePaymentOptions; +//@description Contains a list of options for creating of Telegram Premium giveaway or manual distribution of Telegram Premium among chat members @options The list of options +premiumGiveawayPaymentOptions options:vector = PremiumGiveawayPaymentOptions; //@description Contains information about a Telegram Premium gift code //@creator_id Identifier of a chat or a user that created the gift code; may be null if unknown. If null and the code is from messagePremiumGiftCode message, then creator_id from the message can be used @@ -1013,7 +1025,7 @@ starPaymentOptions options:vector = StarPaymentOptions; //@is_default True, if the option must be chosen by default starGiveawayWinnerOption winner_count:int32 won_star_count:int53 is_default:Bool = StarGiveawayWinnerOption; -//@description Describes an option for creating Telegram Star giveaway. Use telegramPaymentPurposeStarGiveaway for out-of-store payments +//@description Describes an option for creating of Telegram Star giveaway. Use telegramPaymentPurposeStarGiveaway for out-of-store payments //@currency ISO 4217 currency code for the payment //@amount The amount to pay, in the smallest units of the currency //@star_count Number of Telegram Stars that will be distributed among winners @@ -1024,7 +1036,7 @@ starGiveawayWinnerOption winner_count:int32 won_star_count:int53 is_default:Bool //@is_additional True, if the option must be shown only in the full list of payment options starGiveawayPaymentOption currency:string amount:int53 star_count:int53 store_product_id:string yearly_boost_count:int32 winner_options:vector is_default:Bool is_additional:Bool = StarGiveawayPaymentOption; -//@description Contains a list of options for creating Telegram Star giveaway @options The list of options +//@description Contains a list of options for creating of Telegram Star giveaway @options The list of options starGiveawayPaymentOptions options:vector = StarGiveawayPaymentOptions; @@ -1118,6 +1130,7 @@ sentGiftUpgraded gift:upgradedGift = SentGift; //@text Message added to the gift //@is_private True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone are able to see them //@is_saved True, if the gift is displayed on the chat's profile page; only for the receiver of the gift +//@is_pinned True, if the gift is pinned to the top of the chat's profile page //@can_be_upgraded True, if the gift is a regular gift that can be upgraded to a unique gift; only for the receiver of the gift //@can_be_transferred True, if the gift is an upgraded gift that can be transferred to another owner; only for the receiver of the gift //@was_refunded True, if the gift was refunded and isn't available anymore @@ -1127,7 +1140,7 @@ sentGiftUpgraded gift:upgradedGift = SentGift; //@prepaid_upgrade_star_count Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift //@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift //@export_date Point in time (Unix timestamp) when the upgraded gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift -receivedGift received_gift_id:string sender_id:MessageSender text:formattedText is_private:Bool is_saved:Bool can_be_upgraded:Bool can_be_transferred:Bool was_refunded:Bool date:int32 gift:SentGift sell_star_count:int53 prepaid_upgrade_star_count:int53 transfer_star_count:int53 export_date:int32 = ReceivedGift; +receivedGift received_gift_id:string sender_id:MessageSender text:formattedText is_private:Bool is_saved:Bool is_pinned:Bool can_be_upgraded:Bool can_be_transferred:Bool was_refunded:Bool date:int32 gift:SentGift sell_star_count:int53 prepaid_upgrade_star_count:int53 transfer_star_count:int53 export_date:int32 = ReceivedGift; //@description Represents a list of gifts received by a user or a chat //@total_count The total number of received gifts @@ -1176,7 +1189,8 @@ starTransactionTypeUserDeposit user_id:int53 sticker:sticker = StarTransactionTy //@giveaway_message_id Identifier of the message with the giveaway; can be 0 or an identifier of a deleted message starTransactionTypeGiveawayDeposit chat_id:int53 giveaway_message_id:int53 = StarTransactionType; -//@description The transaction is a withdrawal of earned Telegram Stars to Fragment; for bots and channel chats only @withdrawal_state State of the withdrawal; may be null for refunds from Fragment +//@description The transaction is a withdrawal of earned Telegram Stars to Fragment; for regular users, bots, supergroup and channel chats only +//@withdrawal_state State of the withdrawal; may be null for refunds from Fragment starTransactionTypeFragmentWithdrawal withdrawal_state:RevenueWithdrawalState = StarTransactionType; //@description The transaction is a withdrawal of earned Telegram Stars to Telegram Ad platform; for bots and channel chats only @@ -1254,8 +1268,8 @@ starTransactionTypeGiftTransfer owner_id:MessageSender gift:upgradedGift = StarT //@description The transaction is a sale of a received gift; for regular users and channel chats only @user_id Identifier of the user that sent the gift @gift The gift starTransactionTypeGiftSale user_id:int53 gift:gift = StarTransactionType; -//@description The transaction is an upgrade of a gift; for regular users only @gift The upgraded gift -starTransactionTypeGiftUpgrade gift:upgradedGift = StarTransactionType; +//@description The transaction is an upgrade of a gift; for regular users only @user_id Identifier of the user that initially sent the gift @gift The upgraded gift +starTransactionTypeGiftUpgrade user_id:int53 gift:upgradedGift = StarTransactionType; //@description The transaction is a sending of a paid reaction to a message in a channel chat by the current user; for regular users only //@chat_id Identifier of the channel chat @@ -1272,6 +1286,22 @@ starTransactionTypeChannelPaidReactionReceive user_id:int53 message_id:int53 = S //@commission_per_mille The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the program owner starTransactionTypeAffiliateProgramCommission chat_id:int53 commission_per_mille:int32 = StarTransactionType; +//@description The transaction is a sending of a paid message; for regular users only @chat_id Identifier of the chat that received the payment @message_count Number of sent paid messages +starTransactionTypePaidMessageSend chat_id:int53 message_count:int32 = StarTransactionType; + +//@description The transaction is a receiving of a paid message; for regular users and supergroup chats only +//@sender_id Identifier of the sender of the message +//@message_count Number of received paid messages +//@commission_per_mille The number of Telegram Stars received by the Telegram for each 1000 Telegram Stars paid for message sending +//@commission_star_amount The amount of Telegram Stars that were received by Telegram; can be negative for refunds +starTransactionTypePaidMessageReceive sender_id:MessageSender message_count:int32 commission_per_mille:int32 commission_star_amount:starAmount = StarTransactionType; + +//@description The transaction is a purchase of Telegram Premium subscription; for regular users only +//@user_id Identifier of the user that received the Telegram Premium subscription +//@month_count Number of months the Telegram Premium subscription will be active +//@sticker A sticker to be shown in the transaction information; may be null if unknown +starTransactionTypePremiumPurchase user_id:int53 month_count:int32 sticker:sticker = StarTransactionType; + //@description The transaction is a transaction of an unsupported type starTransactionTypeUnsupported = StarTransactionType; @@ -1420,11 +1450,12 @@ usernames active_usernames:vector disabled_usernames:vector edit //@has_active_stories True, if the user has non-expired stories available to the current user //@has_unread_active_stories True, if the user has unread non-expired stories available to the current user //@restricts_new_chats True, if the user may restrict new chats with non-contacts. Use canSendMessageToUser to check whether the current user can message the user or try to create a chat with them +//@paid_message_star_count Number of Telegram Stars that must be paid by general user for each sent message to the user. If positive and userFullInfo is unknown, use canSendMessageToUser to check whether the current user must pay //@have_access If false, the user is inaccessible, and the only information known about the user is inside this class. Identifier of the user can't be passed to any method //@type Type of the user //@language_code IETF language tag of the user's language; only available to bots //@added_to_attachment_menu True, if the user added the current bot to attachment menu; only available to bots -user id:int53 access_hash:int64 first_name:string last_name:string usernames:usernames phone_number:string status:UserStatus profile_photo:profilePhoto accent_color_id:int32 background_custom_emoji_id:int64 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 emoji_status:emojiStatus is_contact:Bool is_mutual_contact:Bool is_close_friend:Bool verification_status:verificationStatus is_premium:Bool is_support:Bool restriction_reason:string has_active_stories:Bool has_unread_active_stories:Bool restricts_new_chats:Bool have_access:Bool type:UserType language_code:string added_to_attachment_menu:Bool = User; +user id:int53 access_hash:int64 first_name:string last_name:string usernames:usernames phone_number:string status:UserStatus profile_photo:profilePhoto accent_color_id:int32 background_custom_emoji_id:int64 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 emoji_status:emojiStatus is_contact:Bool is_mutual_contact:Bool is_close_friend:Bool verification_status:verificationStatus is_premium:Bool is_support:Bool restriction_reason:string has_active_stories:Bool has_unread_active_stories:Bool restricts_new_chats:Bool paid_message_star_count:int53 have_access:Bool type:UserType language_code:string added_to_attachment_menu:Bool = User; //@description Contains information about a bot @@ -1474,10 +1505,12 @@ botInfo short_description:string description:string photo:photo animation:animat //@personal_chat_id Identifier of the personal chat of the user; 0 if none //@gift_count Number of saved to profile gifts for other users or the total number of received gifts for the current user //@group_in_common_count Number of group chats where both the other user and the current user are a member; 0 for the current user +//@incoming_paid_message_star_count Number of Telegram Stars that must be paid by the user for each sent message to the current user +//@outgoing_paid_message_star_count Number of Telegram Stars that must be paid by the current user for each sent message to the user //@bot_verification Information about verification status of the user provided by a bot; may be null if none or unknown //@business_info Information about business settings for Telegram Business accounts; may be null if none //@bot_info For bots, information about the bot; may be null if the user isn't a bot -userFullInfo personal_photo:chatPhoto photo:chatPhoto public_photo:chatPhoto block_list:BlockList can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool has_private_forwards:Bool has_restricted_voice_and_video_note_messages:Bool has_posted_to_profile_stories:Bool has_sponsored_messages_enabled:Bool need_phone_number_privacy_exception:Bool set_chat_background:Bool bio:formattedText birthdate:birthdate personal_chat_id:int53 gift_count:int32 group_in_common_count:int32 bot_verification:botVerification business_info:businessInfo bot_info:botInfo = UserFullInfo; +userFullInfo personal_photo:chatPhoto photo:chatPhoto public_photo:chatPhoto block_list:BlockList can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool has_private_forwards:Bool has_restricted_voice_and_video_note_messages:Bool has_posted_to_profile_stories:Bool has_sponsored_messages_enabled:Bool need_phone_number_privacy_exception:Bool set_chat_background:Bool bio:formattedText birthdate:birthdate personal_chat_id:int53 gift_count:int32 group_in_common_count:int32 incoming_paid_message_star_count:int53 outgoing_paid_message_star_count:int53 bot_verification:botVerification business_info:businessInfo bot_info:botInfo = UserFullInfo; //@description Represents a list of users @total_count Approximate total number of users found @user_ids A list of user identifiers users total_count:int32 user_ids:vector = Users; @@ -1719,9 +1752,10 @@ basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int53 memb //@verification_status Information about verification status of the supergroup or channel; may be null if none //@has_sensitive_content True, if content of media messages in the supergroup or channel chat must be hidden with 18+ spoiler //@restriction_reason If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted +//@paid_message_star_count Number of Telegram Stars that must be paid by non-administrator users of the supergroup chat for each sent message //@has_active_stories True, if the supergroup or channel has non-expired stories available to the current user //@has_unread_active_stories True, if the supergroup or channel has unread non-expired stories available to the current user -supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 boost_level:int32 has_linked_chat:Bool has_location:Bool sign_messages:Bool show_message_sender:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool verification_status:verificationStatus has_sensitive_content:Bool restriction_reason:string has_active_stories:Bool has_unread_active_stories:Bool = Supergroup; +supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 boost_level:int32 has_linked_chat:Bool has_location:Bool sign_messages:Bool show_message_sender:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool verification_status:verificationStatus has_sensitive_content:Bool restriction_reason:string paid_message_star_count:int53 has_active_stories:Bool has_unread_active_stories:Bool = Supergroup; //@description Contains full information about a supergroup or channel //@photo Chat photo; may be null if empty or unknown. If non-null, then it is the same photo as in chat.photo @@ -1733,6 +1767,7 @@ supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:Chat //@linked_chat_id 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 //@slow_mode_delay Delay between consecutive sent messages for non-administrator supergroup members, in seconds //@slow_mode_delay_expires_in 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 +//@can_enable_paid_messages True, if paid messages can be enabled in the supergroup chat; for supergroup only //@can_enable_paid_reaction True, if paid reaction can be enabled in the channel chat; for channels only //@can_get_members True, if members of the chat can be retrieved via getSupergroupMembers or searchChatMembers //@has_hidden_members True, if non-administrators can receive only administrators and bots using getSupergroupMembers or searchChatMembers @@ -1761,7 +1796,7 @@ supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:Chat //@bot_verification Information about verification status of the supergroup or the channel provided by a bot; may be null if none or unknown //@upgraded_from_basic_group_id Identifier of the basic group from which supergroup was upgraded; 0 if none //@upgraded_from_max_message_id Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none -supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_enable_paid_reaction:Bool can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_get_revenue_statistics:Bool can_get_star_revenue_statistics:Bool can_send_gift:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool can_have_sponsored_messages:Bool has_aggressive_anti_spam_enabled:Bool has_paid_media_allowed:Bool has_pinned_stories:Bool gift_count:int32 my_boost_count:int32 unrestrict_boost_count:int32 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector bot_verification:botVerification upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; +supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_enable_paid_messages:Bool can_enable_paid_reaction:Bool can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_get_revenue_statistics:Bool can_get_star_revenue_statistics:Bool can_send_gift:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool can_have_sponsored_messages:Bool has_aggressive_anti_spam_enabled:Bool has_paid_media_allowed:Bool has_pinned_stories:Bool gift_count:int32 my_boost_count:int32 unrestrict_boost_count:int32 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector bot_verification:botVerification upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; //@class SecretChatState @description Describes the current secret chat state @@ -1973,8 +2008,9 @@ messageSendingStatePending sending_id:int32 = MessageSendingState; //@need_another_sender True, if the message can be re-sent only on behalf of a different sender //@need_another_reply_quote True, if the message can be re-sent only if another quote is chosen in the message that is replied by the given message //@need_drop_reply True, if the message can be re-sent only if the message to be replied is removed. This will be done automatically by resendMessages +//@required_paid_message_star_count The number of Telegram Stars that must be paid to send the message; 0 if the current amount is correct //@retry_after Time left before the message can be re-sent, in seconds. No update is sent when this field changes -messageSendingStateFailed error:error can_retry:Bool need_another_sender:Bool need_another_reply_quote:Bool need_drop_reply:Bool retry_after:double = MessageSendingState; +messageSendingStateFailed error:error can_retry:Bool need_another_sender:Bool need_another_reply_quote:Bool need_drop_reply:Bool required_paid_message_star_count:int53 retry_after:double = MessageSendingState; //@description Describes manually or automatically chosen quote from another message @@ -2062,6 +2098,7 @@ factCheck text:formattedText country_code:string = FactCheck; //@via_bot_user_id If non-zero, the user identifier of the inline bot through which this message was sent //@sender_business_bot_user_id If non-zero, the user identifier of the business bot that sent this message //@sender_boost_count Number of times the sender of the message boosted the supergroup at the time the message was sent; 0 if none or unknown. For messages sent by the current user, supergroupFullInfo.my_boost_count must be used instead +//@paid_message_star_count The number of Telegram Stars the sender paid to send the message //@author_signature For channel posts and anonymous group messages, optional author signature //@media_album_id Unique identifier of an album this message belongs to; 0 if none. Only audios, documents, photos and videos can be grouped together in albums //@effect_id Unique identifier of the effect added to the message; 0 if none @@ -2069,7 +2106,7 @@ factCheck text:formattedText country_code:string = FactCheck; //@restriction_reason If non-empty, contains a human-readable description of the reason why access to this message must be restricted //@content Content of the message //@reply_markup Reply markup for the message; may be null if none -message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool is_from_offline:Bool can_be_saved:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector fact_check:factCheck reply_to:MessageReplyTo message_thread_id:int53 saved_messages_topic_id:int53 self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 sender_business_bot_user_id:int53 sender_boost_count:int32 author_signature:string media_album_id:int64 effect_id:int64 has_sensitive_content:Bool restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; +message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool is_from_offline:Bool can_be_saved:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector fact_check:factCheck reply_to:MessageReplyTo message_thread_id:int53 saved_messages_topic_id:int53 self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 sender_business_bot_user_id:int53 sender_boost_count:int32 paid_message_star_count:int53 author_signature:string media_album_id:int64 effect_id:int64 has_sensitive_content:Bool restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; //@description Contains a list of messages @total_count Approximate total number of messages found @messages List of messages; messages may be null @@ -2489,6 +2526,15 @@ publicChatTypeHasUsername = PublicChatType; publicChatTypeIsLocationBased = PublicChatType; +//@description Contains basic information about another user that started a chat with the current user +//@registration_month Month when the user was registered in Telegram; 0-12; may be 0 if unknown +//@registration_year Year when the user was registered in Telegram; 0-9999; may be 0 if unknown +//@phone_number_country_code A two-letter ISO 3166-1 alpha-2 country code based on the phone number of the user; may be empty if unknown +//@last_name_change_date Point in time (Unix timestamp) when the user changed name last time; 0 if unknown +//@last_photo_change_date Point in time (Unix timestamp) when the user changed photo last time; 0 if unknown +accountInfo registration_month:int32 registration_year:int32 phone_number_country_code:string last_name_change_date:int32 last_photo_change_date:int32 = AccountInfo; + + //@class ChatActionBar @description Describes actions which must be possible to do through a chat action bar //@description The chat can be reported as spam using the method reportChat with an empty option_id and message_ids. If the chat is a private chat with a user with an emoji status, then a notice about emoji status usage must be shown @@ -2501,7 +2547,8 @@ chatActionBarInviteMembers = ChatActionBar; //@description The chat is a private or secret chat, which can be reported using the method reportChat, or the other user can be blocked using the method setMessageSenderBlockList, //-or the other user can be added to the contact list using the method addContact. If the chat is a private chat with a user with an emoji status, then a notice about emoji status usage must be shown //@can_unarchive If true, the chat was automatically archived and can be moved back to the main chat list using addChatToList simultaneously with setting chat notification settings to default using setChatNotificationSettings -chatActionBarReportAddBlock can_unarchive:Bool = ChatActionBar; +//@account_info Basic information about the other user in the chat; may be null if unknown +chatActionBarReportAddBlock can_unarchive:Bool account_info:accountInfo = ChatActionBar; //@description The chat is a private or secret chat and the other user can be added to the contact list using the method addContact chatActionBarAddContact = ChatActionBar; @@ -4248,12 +4295,13 @@ messageSelfDestructTypeImmediately = MessageSelfDestructType; //@from_background Pass true if the message is sent from the background //@protect_content Pass true if the content of the message must be protected from forwarding and saving; for bots only //@allow_paid_broadcast Pass true to allow the message to ignore regular broadcast limits for a small fee; for bots only +//@paid_message_star_count The number of Telegram Stars the user agreed to pay to send the messages //@update_order_of_installed_sticker_sets Pass true if the user explicitly chosen a sticker or a custom emoji from an installed sticker set; applicable only to sendMessage and sendMessageAlbum -//@scheduling_state Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, live location messages and self-destructing messages can't be scheduled +//@scheduling_state Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, to a chat with paid messages, live location messages and self-destructing messages can't be scheduled //@effect_id Identifier of the effect to apply to the message; pass 0 if none; applicable only to sendMessage and sendMessageAlbum in private chats //@sending_id Non-persistent identifier, which will be returned back in messageSendingStatePending object and can be used to match sent messages and corresponding updateNewMessage updates //@only_preview Pass true to get a fake message instead of actually sending them -messageSendOptions disable_notification:Bool from_background:Bool protect_content:Bool allow_paid_broadcast:Bool update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState effect_id:int64 sending_id:int32 only_preview:Bool = MessageSendOptions; +messageSendOptions disable_notification:Bool from_background:Bool protect_content:Bool allow_paid_broadcast:Bool paid_message_star_count:int53 update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState effect_id:int64 sending_id:int32 only_preview:Bool = MessageSendOptions; //@description Options to be used when a message content is copied without reference to the original sender. Service messages, messages with messageInvoice, messagePaidMedia, messageGiveaway, or messageGiveawayWinners content can't be copied //@send_copy True, if content of the message needs to be copied without reference to the original sender. Always true if the message is forwarded to a secret chat or is local. @@ -5221,6 +5269,7 @@ groupCallRecentSpeaker participant_id:MessageSender is_speaking:Bool = GroupCall //@description Describes a group call //@id Group call identifier +//@from_call_id Identifier of one-to-one call from which the group call was created; 0 if unknown //@title Group call title //@scheduled_start_date Point in time (Unix timestamp) when the group call is expected to be started by an administrator; 0 if it is already active or was ended //@enabled_start_notification True, if the group call is scheduled and the current user will receive a notification when the group call starts @@ -5241,7 +5290,7 @@ groupCallRecentSpeaker participant_id:MessageSender is_speaking:Bool = GroupCall //@record_duration Duration of the ongoing group call recording, in seconds; 0 if none. An updateGroupCall update is not triggered when value of this field changes, but the same recording goes on //@is_video_recorded True, if a video file is being recorded for the call //@duration Call duration, in seconds; for ended calls only -groupCall id:int32 title:string scheduled_start_date:int32 enabled_start_notification:Bool is_active:Bool is_rtmp_stream:Bool is_joined:Bool need_rejoin:Bool can_be_managed:Bool participant_count:int32 has_hidden_listeners:Bool loaded_all_participants:Bool recent_speakers:vector is_my_video_enabled:Bool is_my_video_paused:Bool can_enable_video:Bool mute_new_participants:Bool can_toggle_mute_new_participants:Bool record_duration:int32 is_video_recorded:Bool duration:int32 = GroupCall; +groupCall id:int32 from_call_id:int32 title:string scheduled_start_date:int32 enabled_start_notification:Bool is_active:Bool is_rtmp_stream:Bool is_joined:Bool need_rejoin:Bool can_be_managed:Bool participant_count:int32 has_hidden_listeners:Bool loaded_all_participants:Bool recent_speakers:vector is_my_video_enabled:Bool is_my_video_paused:Bool can_enable_video:Bool mute_new_participants:Bool can_toggle_mute_new_participants:Bool record_duration:int32 is_video_recorded:Bool duration:int32 = GroupCall; //@description Describes a group of video synchronization source identifiers @semantics The semantics of sources, one of "SIM" or "FID" @source_ids The list of synchronization source identifiers groupCallVideoSourceGroup semantics:string source_ids:vector = GroupCallVideoSourceGroup; @@ -6258,8 +6307,15 @@ premiumState state:formattedText payment_options:vector options:messageSendOptions send_copy:Bool remove_caption:Bool = Messages; -//@description Sends messages from a quick reply shortcut. Requires Telegram Business subscription +//@description Sends messages from a quick reply shortcut. Requires Telegram Business subscription. Can't be used to send paid messages //@chat_id Identifier of the chat to which to send messages. The chat must be a private chat with a regular user //@shortcut_id Unique identifier of the quick reply shortcut //@sending_id Non-persistent identifier, which will be returned back in messageSendingStatePending object and can be used to match sent messages and corresponding updateNewMessage updates @@ -9374,7 +9463,8 @@ sendQuickReplyShortcutMessages chat_id:int53 shortcut_id:int32 sending_id:int32 //@chat_id Identifier of the chat to send messages //@message_ids Identifiers of the messages to resend. Message identifiers must be in a strictly increasing order //@quote New manually chosen quote from the message to be replied; pass null if none. Ignored if more than one message is re-sent, or if messageSendingStateFailed.need_another_reply_quote == false -resendMessages chat_id:int53 message_ids:vector quote:inputTextQuote = Messages; +//@paid_message_star_count The number of Telegram Stars the user agreed to pay to send the messages. Ignored if messageSendingStateFailed.required_paid_message_star_count == 0 +resendMessages chat_id:int53 message_ids:vector quote:inputTextQuote paid_message_star_count:int53 = Messages; //@description Sends a notification about a screenshot taken in a chat. Supported only in private and secret chats @chat_id Chat identifier sendChatScreenshotTakenNotification chat_id:int53 = Ok; @@ -10888,7 +10978,7 @@ processChatJoinRequests chat_id:int53 invite_link:string approve:Bool = Ok; //@user_id Identifier of the user to be called //@protocol The call protocols supported by the application //@is_video Pass true to create a video call -//@group_call_id Identifier of the group call to which the user will be added after exchanging private key via the call; pass 0 if none; currently, ignored +//@group_call_id Identifier of the group call to which the user will be added after exchanging private key via the call; pass 0 if none createCall user_id:int53 protocol:callProtocol is_video:Bool group_call_id:int32 = CallId; //@description Accepts an incoming call @call_id Call identifier @protocol The call protocols supported by the application @@ -10960,7 +11050,8 @@ toggleGroupCallEnabledStartNotification group_call_id:int32 enabled_start_notifi //@is_muted Pass true to join the call with muted microphone //@is_my_video_enabled Pass true if the user's video is enabled //@invite_hash If non-empty, invite hash to be used to join the group call without being muted by administrators -joinGroupCall group_call_id:int32 participant_id:MessageSender audio_source_id:int32 payload:string is_muted:Bool is_my_video_enabled:Bool invite_hash:string = Text; +//@key_fingerprint Fingerprint of the encryption key for E2E group calls not bound to a chat; pass 0 for voice chats +joinGroupCall group_call_id:int32 participant_id:MessageSender audio_source_id:int32 payload:string is_muted:Bool is_my_video_enabled:Bool invite_hash:string key_fingerprint:int64 = Text; //@description Starts screen sharing in a joined group call. Returns join response payload for tgcalls //@group_call_id Group call identifier @@ -11117,7 +11208,9 @@ getCloseFriends = Users; //@description Changes a personal profile photo of a contact user @user_id User identifier @photo Profile photo to set; pass null to delete the photo; inputChatPhotoPrevious isn't supported in this function setUserPersonalProfilePhoto user_id:int53 photo:InputChatPhoto = Ok; -//@description Suggests a profile photo to another regular user with common messages @user_id User identifier @photo Profile photo to suggest; inputChatPhotoPrevious isn't supported in this function +//@description Suggests a profile photo to another regular user with common messages and allowing non-paid messages +//@user_id User identifier +//@photo Profile photo to suggest; inputChatPhotoPrevious isn't supported in this function suggestUserProfilePhoto user_id:int53 photo:InputChatPhoto = Ok; //@description Toggles whether the bot can manage emoji status of the current user @bot_user_id User identifier of the bot @can_manage_emoji_status Pass true if the bot is allowed to change emoji status of the user; pass false otherwise @@ -11313,8 +11406,10 @@ removeRecentHashtag hashtag:string = Ok; //@link_preview_options Options to be used for generation of the link preview; pass null to use default link preview options getLinkPreview text:formattedText link_preview_options:linkPreviewOptions = LinkPreview; -//@description Returns an instant view version of a web page if available. Returns a 404 error if the web page has no instant view page @url The web page URL @force_full Pass true to get full instant view for the web page -getWebPageInstantView url:string force_full:Bool = WebPageInstantView; +//@description Returns an instant view version of a web page if available. This is an offline request if only_local is true. Returns a 404 error if the web page has no instant view page +//@url The web page URL +//@only_local Pass true to get only locally available information without sending network requests +getWebPageInstantView url:string only_local:Bool = WebPageInstantView; //@description Changes a profile photo for the current user @@ -11764,7 +11859,8 @@ getAvailableGifts = Gifts; //@description Sends a gift to another user or channel chat. May return an error with a message "STARGIFT_USAGE_LIMITED" if the gift was sold out //@gift_id Identifier of the gift to send //@owner_id Identifier of the user or the channel chat that will receive the gift -//@text Text to show along with the gift; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed +//@text Text to show along with the gift; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed. +//-Must be empty if the receiver enabled paid messages //@is_private Pass true to show gift text and sender only to the gift receiver; otherwise, everyone will be able to see them //@pay_for_upgrade Pass true to additionally pay for the gift upgrade and allow the receiver to upgrade it for free sendGift gift_id:int64 owner_id:MessageSender text:formattedText is_private:Bool pay_for_upgrade:Bool = Ok; @@ -11772,11 +11868,16 @@ sendGift gift_id:int64 owner_id:MessageSender text:formattedText is_private:Bool //@description Sells a gift for Telegram Stars @received_gift_id Identifier of the gift sellGift received_gift_id:string = Ok; -//@description Toggles whether a gift is shown on the current user's or the channel's profile page; requires can_post_messages administrator right in the chat +//@description Toggles whether a gift is shown on the current user's or the channel's profile page; requires can_post_messages administrator right in the channel chat //@received_gift_id Identifier of the gift //@is_saved Pass true to display the gift on the user's or the channel's profile page; pass false to remove it from the profile page toggleGiftIsSaved received_gift_id:string is_saved:Bool = Ok; +//@description Changes the list of pinned gifts on the current user's or the channel's profile page; requires can_post_messages administrator right in the channel chat +//@owner_id Identifier of the user or the channel chat that received the gifts +//@received_gift_ids New list of pinned gifts. All gifts must be upgraded and saved on the profile page first. There can be up to getOption("pinned_gift_count_max") pinned gifts +setPinnedGifts owner_id:MessageSender received_gift_ids:vector = Ok; + //@description Toggles whether notifications for new gifts received by a channel chat are sent to the current user; requires can_post_messages administrator right in the chat //@chat_id Identifier of the channel chat //@are_enabled Pass true to enable notifications about new gifts owned by the channel chat; pass false to disable the notifications @@ -11930,6 +12031,20 @@ setNewChatPrivacySettings settings:newChatPrivacySettings = Ok; //@description Returns privacy settings for new chat creation getNewChatPrivacySettings = NewChatPrivacySettings; +//@description Returns the total number of Telegram Stars received by the current user for paid messages from the given user @user_id Identifier of the user +getPaidMessageRevenue user_id:int53 = StarCount; + +//@description Allows the specified user to send unpaid private messages to the current user by adding a rule to userPrivacySettingAllowUnpaidMessages +//@user_id Identifier of the user +//@refund_payments Pass true to refund the user previously paid messages +allowUnpaidMessagesFromUser user_id:int53 refund_payments:Bool = Ok; + +//@description Changes the amount of Telegram Stars that must be paid to send a message to a supergroup chat; requires can_restrict_members administrator right and supergroupFullInfo.can_enable_paid_messages +//@chat_id Identifier of the supergroup chat +//@paid_message_star_count The new number of Telegram Stars that must be paid for each message that is sent to the supergroup chat unless the sender is an administrator of the chat; 0-getOption("paid_message_star_count_max"). +//-The supergroup will receive getOption("paid_message_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for message sending +setChatPaidMessageStarCount chat_id:int53 paid_message_star_count:int53 = Ok; + //@description Check whether the current user can message another user or try to create a chat with them //@user_id Identifier of the other user @@ -12012,12 +12127,12 @@ getChatRevenueTransactions chat_id:int53 offset:int32 limit:int32 = ChatRevenueT //@description Returns detailed Telegram Star revenue statistics -//@owner_id Identifier of the owner of the Telegram Stars; can be identifier of an owned bot, or identifier of a channel chat with supergroupFullInfo.can_get_star_revenue_statistics == true +//@owner_id Identifier of the owner of the Telegram Stars; can be identifier of the current user, an owned bot, or a supergroup or a channel chat with supergroupFullInfo.can_get_star_revenue_statistics == true //@is_dark Pass true if a dark theme is used by the application getStarRevenueStatistics owner_id:MessageSender is_dark:Bool = StarRevenueStatistics; //@description Returns a URL for Telegram Star withdrawal -//@owner_id Identifier of the owner of the Telegram Stars; can be identifier of an owned bot, or identifier of an owned channel chat +//@owner_id Identifier of the owner of the Telegram Stars; can be identifier of the current user, an owned bot, or an owned supergroup or channel chat //@star_count The number of Telegram Stars to withdraw. Must be at least getOption("star_withdrawal_count_min") //@password The 2-step verification password of the current user getStarWithdrawalUrl owner_id:MessageSender star_count:int53 password:string = HttpUrl; @@ -12273,9 +12388,12 @@ clickPremiumSubscriptionButton = Ok; //@description Returns state of Telegram Premium subscription and promotion videos for Premium features getPremiumState = PremiumState; -//@description Returns available options for Telegram Premium gift code or Telegram Premium giveaway creation -//@boosted_chat_id Identifier of the supergroup or channel chat, which will be automatically boosted by receivers of the gift codes and which is administered by the user; 0 if none -getPremiumGiftCodePaymentOptions boosted_chat_id:int53 = PremiumGiftCodePaymentOptions; +//@description Returns available options for gifting Telegram Premium to a user +getPremiumGiftPaymentOptions = PremiumGiftPaymentOptions; + +//@description Returns available options for creating of Telegram Premium giveaway or manual distribution of Telegram Premium among chat members +//@boosted_chat_id Identifier of the supergroup or channel chat, which will be automatically boosted by receivers of the gift codes and which is administered by the user +getPremiumGiveawayPaymentOptions boosted_chat_id:int53 = PremiumGiveawayPaymentOptions; //@description Return information about a Telegram Premium gift code @code The code to check checkPremiumGiftCode code:string = PremiumGiftCodeInfo; @@ -12306,7 +12424,7 @@ getStarGiveawayPaymentOptions = StarGiveawayPaymentOptions; //@description Returns the list of Telegram Star transactions for the specified owner //@owner_id Identifier of the owner of the Telegram Stars; can be the identifier of the current user, identifier of an owned bot, -//-or identifier of a channel chat with supergroupFullInfo.can_get_star_revenue_statistics == true +//-or identifier of a supergroup or a channel chat with supergroupFullInfo.can_get_star_revenue_statistics == true //@subscription_id If non-empty, only transactions related to the Star Subscription will be returned //@direction Direction of the transactions to receive; pass null to get all transactions //@offset Offset of the first transaction to return as received from the previous request; use empty string to get the first chunk of results From 05b67218a96588edd23ee7158d3e2f7733e403c0 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Wed, 12 Mar 2025 00:35:34 +0800 Subject: [PATCH 37/54] Check space before @ --- client/extra.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/client/extra.go b/client/extra.go index 61dd7fc..0a6c60f 100644 --- a/client/extra.go +++ b/client/extra.go @@ -25,18 +25,18 @@ func IsCommand(text string) bool { func CheckCommand(text string, entities []*TextEntity) string { if IsCommand(text) { - // e.g.: ["/hello@world_bot", "/hello@", "/hello@123"] - // Result: "/hello" - if i := strings.Index(text, "@"); i != -1 { - return text[:i] - } - // e.g. ["/hello 123", "/hell o 123"] // Result: "/hello", "/hell" if i := strings.Index(text, " "); i != -1 { return text[:i] } + // e.g.: ["/hello@world_bot", "/hello@", "/hello@123"] + // Result: "/hello" + if i := strings.Index(text, "@"); i != -1 { + return text[:i] + } + return text } return "" From c695d13f46308de873f66d27c90db5a26aae4dcf Mon Sep 17 00:00:00 2001 From: c0re100 Date: Sun, 13 Apr 2025 20:30:45 +0800 Subject: [PATCH 38/54] Update to TDLib 1.8.47 --- client/function.go | 733 +++++++++++++++++++++++++++++++++++++----- client/type.go | 589 +++++++++++++++++++++++++++++---- client/unmarshaler.go | 277 ++++++++++++++-- data/td_api.tl | 314 ++++++++++++++---- 4 files changed, 1664 insertions(+), 249 deletions(-) diff --git a/client/function.go b/client/function.go index 51e31dc..f4c29cf 100755 --- a/client/function.go +++ b/client/function.go @@ -6,7 +6,7 @@ import ( "errors" ) -// Returns the current authorization state; this is an offline request. For informational purposes only. Use updateAuthorizationState instead to maintain the current authorization state. Can be called before initialization +// Returns the current authorization state. This is an offline method. For informational purposes only. Use updateAuthorizationState instead to maintain the current authorization state. Can be called before initialization func (client *Client) GetAuthorizationState() (AuthorizationState, error) { result, err := client.Send(Request{ meta: meta{ @@ -29,6 +29,9 @@ func (client *Client) GetAuthorizationState() (AuthorizationState, error) { case TypeAuthorizationStateWaitPhoneNumber: return UnmarshalAuthorizationStateWaitPhoneNumber(result.Data) + case TypeAuthorizationStateWaitPremiumPurchase: + return UnmarshalAuthorizationStateWaitPremiumPurchase(result.Data) + case TypeAuthorizationStateWaitEmailAddress: return UnmarshalAuthorizationStateWaitEmailAddress(result.Data) @@ -136,7 +139,7 @@ type SetAuthenticationPhoneNumberRequest struct { Settings *PhoneNumberAuthenticationSettings `json:"settings"` } -// Sets the phone number of the user and sends an authentication code to the user. Works only when the current authorization state is authorizationStateWaitPhoneNumber, or if there is no pending authentication query and the current authorization state is authorizationStateWaitEmailAddress, authorizationStateWaitEmailCode, authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword +// Sets the phone number of the user and sends an authentication code to the user. Works only when the current authorization state is authorizationStateWaitPhoneNumber, or if there is no pending authentication query and the current authorization state is authorizationStateWaitPremiumPurchase, authorizationStateWaitEmailAddress, authorizationStateWaitEmailCode, authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword func (client *Client) SetAuthenticationPhoneNumber(req *SetAuthenticationPhoneNumberRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -158,6 +161,70 @@ func (client *Client) SetAuthenticationPhoneNumber(req *SetAuthenticationPhoneNu return UnmarshalOk(result.Data) } +type CheckAuthenticationPremiumPurchaseRequest struct { + // ISO 4217 currency code of the payment currency + Currency string `json:"currency"` + // Paid amount, in the smallest units of the currency + Amount int64 `json:"amount"` +} + +// Checks whether an in-store purchase of Telegram Premium is possible before authorization. Works only when the current authorization state is authorizationStateWaitPremiumPurchase +func (client *Client) CheckAuthenticationPremiumPurchase(req *CheckAuthenticationPremiumPurchaseRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "checkAuthenticationPremiumPurchase", + }, + Data: map[string]interface{}{ + "currency": req.Currency, + "amount": req.Amount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetAuthenticationPremiumPurchaseTransactionRequest struct { + // Information about the transaction + Transaction StoreTransaction `json:"transaction"` + // Pass true if this is a restore of a Telegram Premium purchase; only for App Store + IsRestore bool `json:"is_restore"` + // ISO 4217 currency code of the payment currency + Currency string `json:"currency"` + // Paid amount, in the smallest units of the currency + Amount int64 `json:"amount"` +} + +// Informs server about an in-store purchase of Telegram Premium before authorization. Works only when the current authorization state is authorizationStateWaitPremiumPurchase +func (client *Client) SetAuthenticationPremiumPurchaseTransaction(req *SetAuthenticationPremiumPurchaseTransactionRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setAuthenticationPremiumPurchaseTransaction", + }, + Data: map[string]interface{}{ + "transaction": req.Transaction, + "is_restore": req.IsRestore, + "currency": req.Currency, + "amount": req.Amount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type SetAuthenticationEmailAddressRequest struct { // The email address of the user EmailAddress string `json:"email_address"` @@ -267,7 +334,7 @@ type RequestQrCodeAuthenticationRequest struct { OtherUserIds []int64 `json:"other_user_ids"` } -// Requests QR code authentication by scanning a QR code on another logged in device. Works only when the current authorization state is authorizationStateWaitPhoneNumber, or if there is no pending authentication query and the current authorization state is authorizationStateWaitEmailAddress, authorizationStateWaitEmailCode, authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword +// Requests QR code authentication by scanning a QR code on another logged in device. Works only when the current authorization state is authorizationStateWaitPhoneNumber, or if there is no pending authentication query and the current authorization state is authorizationStateWaitPremiumPurchase, authorizationStateWaitEmailAddress, authorizationStateWaitEmailCode, authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword func (client *Client) RequestQrCodeAuthentication(req *RequestQrCodeAuthenticationRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -1094,7 +1161,7 @@ type GetUserRequest struct { UserId int64 `json:"user_id"` } -// Returns information about a user by their identifier. This is an offline request if the current user is not a bot +// Returns information about a user by their identifier. This is an offline method if the current user is not a bot func (client *Client) GetUser(req *GetUserRequest) (*User, error) { result, err := client.Send(Request{ meta: meta{ @@ -1146,7 +1213,7 @@ type GetBasicGroupRequest struct { BasicGroupId int64 `json:"basic_group_id"` } -// Returns information about a basic group by its identifier. This is an offline request if the current user is not a bot +// Returns information about a basic group by its identifier. This is an offline method if the current user is not a bot func (client *Client) GetBasicGroup(req *GetBasicGroupRequest) (*BasicGroup, error) { result, err := client.Send(Request{ meta: meta{ @@ -1198,7 +1265,7 @@ type GetSupergroupRequest struct { SupergroupId int64 `json:"supergroup_id"` } -// Returns information about a supergroup or a channel by its identifier. This is an offline request if the current user is not a bot +// Returns information about a supergroup or a channel by its identifier. This is an offline method if the current user is not a bot func (client *Client) GetSupergroup(req *GetSupergroupRequest) (*Supergroup, error) { result, err := client.Send(Request{ meta: meta{ @@ -1250,7 +1317,7 @@ type GetSecretChatRequest struct { SecretChatId int32 `json:"secret_chat_id"` } -// Returns information about a secret chat by its identifier. This is an offline request +// Returns information about a secret chat by its identifier. This is an offline method func (client *Client) GetSecretChat(req *GetSecretChatRequest) (*SecretChat, error) { result, err := client.Send(Request{ meta: meta{ @@ -1276,7 +1343,7 @@ type GetChatRequest struct { ChatId int64 `json:"chat_id"` } -// Returns information about a chat by its identifier; this is an offline request if the current user is not a bot +// Returns information about a chat by its identifier. This is an offline method if the current user is not a bot func (client *Client) GetChat(req *GetChatRequest) (*Chat, error) { result, err := client.Send(Request{ meta: meta{ @@ -1333,7 +1400,7 @@ type GetMessageLocallyRequest struct { MessageId int64 `json:"message_id"` } -// Returns information about a message, if it is available without sending network request. Returns a 404 error if message isn't available locally. This is an offline request +// Returns information about a message, if it is available without sending network request. Returns a 404 error if message isn't available locally. This is an offline method func (client *Client) GetMessageLocally(req *GetMessageLocallyRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -1478,7 +1545,7 @@ type GetMessagePropertiesRequest struct { MessageId int64 `json:"message_id"` } -// Returns properties of a message; this is an offline request +// Returns properties of a message. This is an offline method func (client *Client) GetMessageProperties(req *GetMessagePropertiesRequest) (*MessageProperties, error) { result, err := client.Send(Request{ meta: meta{ @@ -1610,7 +1677,7 @@ type GetFileRequest struct { FileId int32 `json:"file_id"` } -// Returns information about a file; this is an offline request +// Returns information about a file. This is an offline method func (client *Client) GetFile(req *GetFileRequest) (*File, error) { result, err := client.Send(Request{ meta: meta{ @@ -1638,7 +1705,7 @@ type GetRemoteFileRequest struct { FileType FileType `json:"file_type"` } -// Returns information about a file by its remote identifier; this is an offline request. Can be used to register a URL as a file for further uploading, or sending as a message. Even the request succeeds, the file can be used only if it is still accessible to the user. For example, if the file is from a message, then the message must be not deleted and accessible to the user. If the file database is disabled, then the corresponding object with the file must be preloaded by the application +// Returns information about a file by its remote identifier. This is an offline method. Can be used to register a URL as a file for further uploading, or sending as a message. Even the request succeeds, the file can be used only if it is still accessible to the user. For example, if the file is from a message, then the message must be not deleted and accessible to the user. If the file database is disabled, then the corresponding object with the file must be preloaded by the application func (client *Client) GetRemoteFile(req *GetRemoteFileRequest) (*File, error) { result, err := client.Send(Request{ meta: meta{ @@ -1777,7 +1844,7 @@ type SearchChatsRequest struct { Limit int32 `json:"limit"` } -// Searches for the specified query in the title and username of already known chats; this is an offline request. Returns chats in the order seen in the main chat list +// Searches for the specified query in the title and username of already known chats. This is an offline method. Returns chats in the order seen in the main chat list func (client *Client) SearchChats(req *SearchChatsRequest) (*Chats, error) { result, err := client.Send(Request{ meta: meta{ @@ -2080,7 +2147,7 @@ type SearchRecentlyFoundChatsRequest struct { Limit int32 `json:"limit"` } -// Searches for the specified query in the title and username of up to 50 recently found chats; this is an offline request +// Searches for the specified query in the title and username of up to 50 recently found chats. This is an offline method func (client *Client) SearchRecentlyFoundChats(req *SearchRecentlyFoundChatsRequest) (*Chats, error) { result, err := client.Send(Request{ meta: meta{ @@ -2178,7 +2245,7 @@ type GetRecentlyOpenedChatsRequest struct { Limit int32 `json:"limit"` } -// Returns recently opened chats; this is an offline request. Returns chats in the order of last opening +// Returns recently opened chats. This is an offline method. Returns chats in the order of last opening func (client *Client) GetRecentlyOpenedChats(req *GetRecentlyOpenedChatsRequest) (*Chats, error) { result, err := client.Send(Request{ meta: meta{ @@ -2606,7 +2673,7 @@ type GetChatHistoryRequest struct { OnlyLocal bool `json:"only_local"` } -// Returns messages in a chat. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id). For optimal performance, the number of returned messages is chosen by TDLib. This is an offline request if only_local is true +// Returns messages in a chat. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id). For optimal performance, the number of returned messages is chosen by TDLib. This is an offline method if only_local is true func (client *Client) GetChatHistory(req *GetChatHistoryRequest) (*Messages, error) { result, err := client.Send(Request{ meta: meta{ @@ -3506,7 +3573,7 @@ type ReportChatSponsoredMessageRequest struct { } // Reports a sponsored message to Telegram moderators -func (client *Client) ReportChatSponsoredMessage(req *ReportChatSponsoredMessageRequest) (ReportChatSponsoredMessageResult, error) { +func (client *Client) ReportChatSponsoredMessage(req *ReportChatSponsoredMessageRequest) (ReportSponsoredResult, error) { result, err := client.Send(Request{ meta: meta{ Type: "reportChatSponsoredMessage", @@ -3526,20 +3593,145 @@ func (client *Client) ReportChatSponsoredMessage(req *ReportChatSponsoredMessage } switch result.Type { - case TypeReportChatSponsoredMessageResultOk: - return UnmarshalReportChatSponsoredMessageResultOk(result.Data) + case TypeReportSponsoredResultOk: + return UnmarshalReportSponsoredResultOk(result.Data) - case TypeReportChatSponsoredMessageResultFailed: - return UnmarshalReportChatSponsoredMessageResultFailed(result.Data) + case TypeReportSponsoredResultFailed: + return UnmarshalReportSponsoredResultFailed(result.Data) - case TypeReportChatSponsoredMessageResultOptionRequired: - return UnmarshalReportChatSponsoredMessageResultOptionRequired(result.Data) + case TypeReportSponsoredResultOptionRequired: + return UnmarshalReportSponsoredResultOptionRequired(result.Data) - case TypeReportChatSponsoredMessageResultAdsHidden: - return UnmarshalReportChatSponsoredMessageResultAdsHidden(result.Data) + case TypeReportSponsoredResultAdsHidden: + return UnmarshalReportSponsoredResultAdsHidden(result.Data) - case TypeReportChatSponsoredMessageResultPremiumRequired: - return UnmarshalReportChatSponsoredMessageResultPremiumRequired(result.Data) + case TypeReportSponsoredResultPremiumRequired: + return UnmarshalReportSponsoredResultPremiumRequired(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + +type GetSearchSponsoredChatsRequest struct { + // Query the user searches for + Query string `json:"query"` +} + +// Returns sponsored chats to be shown in the search results +func (client *Client) GetSearchSponsoredChats(req *GetSearchSponsoredChatsRequest) (*SponsoredChats, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getSearchSponsoredChats", + }, + Data: map[string]interface{}{ + "query": req.Query, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalSponsoredChats(result.Data) +} + +type ViewSponsoredChatRequest struct { + // Unique identifier of the sponsored chat + SponsoredChatUniqueId int64 `json:"sponsored_chat_unique_id"` +} + +// Informs TDLib that the user fully viewed a sponsored chat +func (client *Client) ViewSponsoredChat(req *ViewSponsoredChatRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "viewSponsoredChat", + }, + Data: map[string]interface{}{ + "sponsored_chat_unique_id": req.SponsoredChatUniqueId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type OpenSponsoredChatRequest struct { + // Unique identifier of the sponsored chat + SponsoredChatUniqueId int64 `json:"sponsored_chat_unique_id"` +} + +// Informs TDLib that the user opened a sponsored chat +func (client *Client) OpenSponsoredChat(req *OpenSponsoredChatRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "openSponsoredChat", + }, + Data: map[string]interface{}{ + "sponsored_chat_unique_id": req.SponsoredChatUniqueId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ReportSponsoredChatRequest struct { + // Unique identifier of the sponsored chat + SponsoredChatUniqueId int64 `json:"sponsored_chat_unique_id"` + // Option identifier chosen by the user; leave empty for the initial request + OptionId []byte `json:"option_id"` +} + +// Reports a sponsored chat to Telegram moderators +func (client *Client) ReportSponsoredChat(req *ReportSponsoredChatRequest) (ReportSponsoredResult, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reportSponsoredChat", + }, + Data: map[string]interface{}{ + "sponsored_chat_unique_id": req.SponsoredChatUniqueId, + "option_id": req.OptionId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypeReportSponsoredResultOk: + return UnmarshalReportSponsoredResultOk(result.Data) + + case TypeReportSponsoredResultFailed: + return UnmarshalReportSponsoredResultFailed(result.Data) + + case TypeReportSponsoredResultOptionRequired: + return UnmarshalReportSponsoredResultOptionRequired(result.Data) + + case TypeReportSponsoredResultAdsHidden: + return UnmarshalReportSponsoredResultAdsHidden(result.Data) + + case TypeReportSponsoredResultPremiumRequired: + return UnmarshalReportSponsoredResultPremiumRequired(result.Data) default: return nil, errors.New("invalid type") @@ -3617,7 +3809,7 @@ type GetMessageLinkRequest struct { InMessageThread bool `json:"in_message_thread"` } -// Returns an HTTPS link to a message in a chat. Available only if messageProperties.can_get_link, or if messageProperties.can_get_media_timestamp_links and a media timestamp link is generated. This is an offline request +// Returns an HTTPS link to a message in a chat. Available only if messageProperties.can_get_link, or if messageProperties.can_get_media_timestamp_links and a media timestamp link is generated. This is an offline method func (client *Client) GetMessageLink(req *GetMessageLinkRequest) (*MessageLink, error) { result, err := client.Send(Request{ meta: meta{ @@ -5080,6 +5272,343 @@ func (client *Client) SetBusinessMessageIsPinned(req *SetBusinessMessageIsPinned return UnmarshalOk(result.Data) } +type ReadBusinessMessageRequest struct { + // Unique identifier of business connection through which the message was received + BusinessConnectionId string `json:"business_connection_id"` + // The chat the message belongs to + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` +} + +// Reads a message on behalf of a business account; for bots only +func (client *Client) ReadBusinessMessage(req *ReadBusinessMessageRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "readBusinessMessage", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "chat_id": req.ChatId, + "message_id": req.MessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DeleteBusinessMessagesRequest struct { + // Unique identifier of business connection through which the messages were received + BusinessConnectionId string `json:"business_connection_id"` + // Identifier of the messages + MessageIds []int64 `json:"message_ids"` +} + +// Deletes messages on behalf of a business account; for bots only +func (client *Client) DeleteBusinessMessages(req *DeleteBusinessMessagesRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteBusinessMessages", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "message_ids": req.MessageIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type EditBusinessStoryRequest struct { + // Identifier of the chat that posted the story + StorySenderChatId int64 `json:"story_sender_chat_id"` + // Identifier of the story to edit + StoryId int32 `json:"story_id"` + // New content of the story + Content InputStoryContent `json:"content"` + // New clickable rectangle areas to be shown on the story media + Areas *InputStoryAreas `json:"areas"` + // New story caption + Caption *FormattedText `json:"caption"` + // The new privacy settings for the story + PrivacySettings StoryPrivacySettings `json:"privacy_settings"` +} + +// Changes a story sent by the bot on behalf of a business account; for bots only +func (client *Client) EditBusinessStory(req *EditBusinessStoryRequest) (*Story, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editBusinessStory", + }, + Data: map[string]interface{}{ + "story_sender_chat_id": req.StorySenderChatId, + "story_id": req.StoryId, + "content": req.Content, + "areas": req.Areas, + "caption": req.Caption, + "privacy_settings": req.PrivacySettings, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStory(result.Data) +} + +type DeleteBusinessStoryRequest struct { + // Unique identifier of business connection + BusinessConnectionId string `json:"business_connection_id"` + // Identifier of the story to delete + StoryId int32 `json:"story_id"` +} + +// Deletes a story sent by the bot on behalf of a business account; for bots only +func (client *Client) DeleteBusinessStory(req *DeleteBusinessStoryRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteBusinessStory", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "story_id": req.StoryId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetBusinessAccountNameRequest struct { + // Unique identifier of business connection + BusinessConnectionId string `json:"business_connection_id"` + // The new value of the first name for the business account; 1-64 characters + FirstName string `json:"first_name"` + // The new value of the optional last name for the business account; 0-64 characters + LastName string `json:"last_name"` +} + +// Changes the first and last name of a business account; for bots only +func (client *Client) SetBusinessAccountName(req *SetBusinessAccountNameRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBusinessAccountName", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "first_name": req.FirstName, + "last_name": req.LastName, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetBusinessAccountBioRequest struct { + // Unique identifier of business connection + BusinessConnectionId string `json:"business_connection_id"` + // The new value of the bio; 0-getOption("bio_length_max") characters without line feeds + Bio string `json:"bio"` +} + +// Changes the bio of a business account; for bots only +func (client *Client) SetBusinessAccountBio(req *SetBusinessAccountBioRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBusinessAccountBio", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "bio": req.Bio, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetBusinessAccountProfilePhotoRequest struct { + // Unique identifier of business connection + BusinessConnectionId string `json:"business_connection_id"` + // Profile photo to set; pass null to remove the photo + Photo InputChatPhoto `json:"photo"` + // Pass true to set the public photo, which will be visible even the main photo is hidden by privacy settings + IsPublic bool `json:"is_public"` +} + +// Changes a profile photo of a business account; for bots only +func (client *Client) SetBusinessAccountProfilePhoto(req *SetBusinessAccountProfilePhotoRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBusinessAccountProfilePhoto", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "photo": req.Photo, + "is_public": req.IsPublic, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetBusinessAccountUsernameRequest struct { + // Unique identifier of business connection + BusinessConnectionId string `json:"business_connection_id"` + // The new value of the username + Username string `json:"username"` +} + +// Changes the editable username of a business account; for bots only +func (client *Client) SetBusinessAccountUsername(req *SetBusinessAccountUsernameRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBusinessAccountUsername", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "username": req.Username, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetBusinessAccountGiftSettingsRequest struct { + // Unique identifier of business connection + BusinessConnectionId string `json:"business_connection_id"` + // The new settings + Settings *GiftSettings `json:"settings"` +} + +// Changes settings for gift receiving of a business account; for bots only +func (client *Client) SetBusinessAccountGiftSettings(req *SetBusinessAccountGiftSettingsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBusinessAccountGiftSettings", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "settings": req.Settings, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetBusinessAccountStarAmountRequest struct { + // Unique identifier of business connection + BusinessConnectionId string `json:"business_connection_id"` +} + +// Returns the amount of Telegram Stars owned by a business account; for bots only +func (client *Client) GetBusinessAccountStarAmount(req *GetBusinessAccountStarAmountRequest) (*StarAmount, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getBusinessAccountStarAmount", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStarAmount(result.Data) +} + +type TransferBusinessAccountStarsRequest struct { + // Unique identifier of business connection + BusinessConnectionId string `json:"business_connection_id"` + // Number of Telegram Stars to transfer + StarCount int64 `json:"star_count"` +} + +// Transfer Telegram Stars from the business account to the business bot; for bots only +func (client *Client) TransferBusinessAccountStars(req *TransferBusinessAccountStarsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "transferBusinessAccountStars", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "star_count": req.StarCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type CheckQuickReplyShortcutNameRequest struct { // The name of the shortcut; 1-32 characters Name string `json:"name"` @@ -5554,7 +6083,7 @@ type GetForumTopicLinkRequest struct { MessageThreadId int64 `json:"message_thread_id"` } -// Returns an HTTPS link to a topic in a forum chat. This is an offline request +// Returns an HTTPS link to a topic in a forum chat. This is an offline method func (client *Client) GetForumTopicLink(req *GetForumTopicLinkRequest) (*MessageLink, error) { result, err := client.Send(Request{ meta: meta{ @@ -7279,7 +7808,7 @@ type GetWebAppPlaceholderRequest struct { BotUserId int64 `json:"bot_user_id"` } -// Returns a default placeholder for Web Apps of a bot; this is an offline request. Returns a 404 error if the placeholder isn't known +// Returns a default placeholder for Web Apps of a bot. This is an offline method. Returns a 404 error if the placeholder isn't known func (client *Client) GetWebAppPlaceholder(req *GetWebAppPlaceholderRequest) (*Outline, error) { result, err := client.Send(Request{ meta: meta{ @@ -8667,7 +9196,7 @@ type GetChatListsToAddChatRequest struct { ChatId int64 `json:"chat_id"` } -// Returns chat lists to which the chat can be added. This is an offline request +// Returns chat lists to which the chat can be added. This is an offline method func (client *Client) GetChatListsToAddChat(req *GetChatListsToAddChatRequest) (*ChatLists, error) { result, err := client.Send(Request{ meta: meta{ @@ -11605,7 +12134,7 @@ type GetChatBoostLevelFeaturesRequest struct { Level int32 `json:"level"` } -// Returns the list of features available on the specific chat boost level; this is an offline request +// Returns the list of features available on the specific chat boost level. This is an offline method func (client *Client) GetChatBoostLevelFeatures(req *GetChatBoostLevelFeaturesRequest) (*ChatBoostLevelFeatures, error) { result, err := client.Send(Request{ meta: meta{ @@ -11632,7 +12161,7 @@ type GetChatBoostFeaturesRequest struct { IsChannel bool `json:"is_channel"` } -// Returns the list of features available for different chat boost levels; this is an offline request +// Returns the list of features available for different chat boost levels. This is an offline method func (client *Client) GetChatBoostFeatures(req *GetChatBoostFeaturesRequest) (*ChatBoostFeatures, error) { result, err := client.Send(Request{ meta: meta{ @@ -14932,7 +15461,7 @@ type GetStickerOutlineRequest struct { ForClickedAnimatedEmojiMessage bool `json:"for_clicked_animated_emoji_message"` } -// Returns outline of a sticker; this is an offline request. Returns a 404 error if the outline isn't known +// Returns outline of a sticker. This is an offline method. Returns a 404 error if the outline isn't known func (client *Client) GetStickerOutline(req *GetStickerOutlineRequest) (*Outline, error) { result, err := client.Send(Request{ meta: meta{ @@ -16082,7 +16611,7 @@ type GetWebPageInstantViewRequest struct { OnlyLocal bool `json:"only_local"` } -// Returns an instant view version of a web page if available. This is an offline request if only_local is true. Returns a 404 error if the web page has no instant view page +// Returns an instant view version of a web page if available. This is an offline method if only_local is true. Returns a 404 error if the web page has no instant view page func (client *Client) GetWebPageInstantView(req *GetWebPageInstantViewRequest) (*WebPageInstantView, error) { result, err := client.Send(Request{ meta: meta{ @@ -16107,7 +16636,7 @@ func (client *Client) GetWebPageInstantView(req *GetWebPageInstantViewRequest) ( type SetProfilePhotoRequest struct { // Profile photo to set Photo InputChatPhoto `json:"photo"` - // Pass true to set a public photo, which will be visible even the main photo is hidden by privacy settings + // Pass true to set the public photo, which will be visible even the main photo is hidden by privacy settings IsPublic bool `json:"is_public"` } @@ -18890,6 +19419,32 @@ func (client *Client) DeleteSavedCredentials() (*Ok, error) { return UnmarshalOk(result.Data) } +type SetGiftSettingsRequest struct { + // The new settings + Settings *GiftSettings `json:"settings"` +} + +// Changes settings for gift receiving for the current user +func (client *Client) SetGiftSettings(req *SetGiftSettingsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setGiftSettings", + }, + Data: map[string]interface{}{ + "settings": req.Settings, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + // Returns gifts that can be sent to other users and channel chats func (client *Client) GetAvailableGifts() (*Gifts, error) { result, err := client.Send(Request{ @@ -18948,6 +19503,8 @@ func (client *Client) SendGift(req *SendGiftRequest) (*Ok, error) { } type SellGiftRequest struct { + // Unique identifier of business connection on behalf of which to send the request; for bots only + BusinessConnectionId string `json:"business_connection_id"` // Identifier of the gift ReceivedGiftId string `json:"received_gift_id"` } @@ -18959,6 +19516,7 @@ func (client *Client) SellGift(req *SellGiftRequest) (*Ok, error) { Type: "sellGift", }, Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, "received_gift_id": req.ReceivedGiftId, }, }) @@ -19087,6 +19645,8 @@ func (client *Client) GetGiftUpgradePreview(req *GetGiftUpgradePreviewRequest) ( } type UpgradeGiftRequest struct { + // Unique identifier of business connection on behalf of which to send the request; for bots only + BusinessConnectionId string `json:"business_connection_id"` // Identifier of the gift ReceivedGiftId string `json:"received_gift_id"` // Pass true to keep the original gift text, sender and receiver in the upgraded gift @@ -19102,6 +19662,7 @@ func (client *Client) UpgradeGift(req *UpgradeGiftRequest) (*UpgradeGiftResult, Type: "upgradeGift", }, Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, "received_gift_id": req.ReceivedGiftId, "keep_original_details": req.KeepOriginalDetails, "star_count": req.StarCount, @@ -19119,6 +19680,8 @@ func (client *Client) UpgradeGift(req *UpgradeGiftRequest) (*UpgradeGiftResult, } type TransferGiftRequest struct { + // Unique identifier of business connection on behalf of which to send the request; for bots only + BusinessConnectionId string `json:"business_connection_id"` // Identifier of the gift ReceivedGiftId string `json:"received_gift_id"` // Identifier of the user or the channel chat that will receive the gift @@ -19134,6 +19697,7 @@ func (client *Client) TransferGift(req *TransferGiftRequest) (*Ok, error) { Type: "transferGift", }, Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, "received_gift_id": req.ReceivedGiftId, "new_owner_id": req.NewOwnerId, "star_count": req.StarCount, @@ -19151,6 +19715,8 @@ func (client *Client) TransferGift(req *TransferGiftRequest) (*Ok, error) { } type GetReceivedGiftsRequest struct { + // Unique identifier of business connection on behalf of which to send the request; for bots only + BusinessConnectionId string `json:"business_connection_id"` // Identifier of the gift receiver OwnerId MessageSender `json:"owner_id"` // Pass true to exclude gifts that aren't saved to the chat's profile page. Always true for gifts received by other users and channel chats without can_post_messages administrator right @@ -19178,6 +19744,7 @@ func (client *Client) GetReceivedGifts(req *GetReceivedGiftsRequest) (*ReceivedG Type: "getReceivedGifts", }, Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, "owner_id": req.OwnerId, "exclude_unsaved": req.ExcludeUnsaved, "exclude_saved": req.ExcludeSaved, @@ -19547,7 +20114,7 @@ type GetLocalizationTargetInfoRequest struct { OnlyLocal bool `json:"only_local"` } -// Returns information about the current localization target. This is an offline request if only_local is true. Can be called before authorization +// Returns information about the current localization target. This is an offline method if only_local is true. Can be called before authorization func (client *Client) GetLocalizationTargetInfo(req *GetLocalizationTargetInfoRequest) (*LocalizationTargetInfo, error) { result, err := client.Send(Request{ meta: meta{ @@ -22455,6 +23022,41 @@ func (client *Client) ApplyPremiumGiftCode(req *ApplyPremiumGiftCodeRequest) (*O return UnmarshalOk(result.Data) } +type GiftPremiumWithStarsRequest struct { + // Identifier of the user which will receive Telegram Premium + UserId int64 `json:"user_id"` + // The number of Telegram Stars to pay for subscription + StarCount int64 `json:"star_count"` + // Number of months the Telegram Premium subscription will be active for the user + MonthCount int32 `json:"month_count"` + // Text to show to the user receiving Telegram Premium; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed + Text *FormattedText `json:"text"` +} + +// Allows to buy a Telegram Premium subscription for another user with payment in Telegram Stars; for bots only +func (client *Client) GiftPremiumWithStars(req *GiftPremiumWithStarsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "giftPremiumWithStars", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "star_count": req.StarCount, + "month_count": req.MonthCount, + "text": req.Text, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type LaunchPrepaidGiveawayRequest struct { // Unique identifier of the prepaid giveaway GiveawayId JsonInt64 `json:"giveaway_id"` @@ -22664,7 +23266,7 @@ type CanPurchaseFromStoreRequest struct { Purpose StorePaymentPurpose `json:"purpose"` } -// Checks whether an in-store purchase is possible. Must be called before any in-store purchase +// Checks whether an in-store purchase is possible. Must be called before any in-store purchase. For official applications only func (client *Client) CanPurchaseFromStore(req *CanPurchaseFromStoreRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -22685,56 +23287,21 @@ func (client *Client) CanPurchaseFromStore(req *CanPurchaseFromStoreRequest) (*O return UnmarshalOk(result.Data) } -type AssignAppStoreTransactionRequest struct { - // App Store receipt - Receipt []byte `json:"receipt"` +type AssignStoreTransactionRequest struct { + // Information about the transaction + Transaction StoreTransaction `json:"transaction"` // Transaction purpose Purpose StorePaymentPurpose `json:"purpose"` } -// Informs server about a purchase through App Store. For official applications only -func (client *Client) AssignAppStoreTransaction(req *AssignAppStoreTransactionRequest) (*Ok, error) { +// Informs server about an in-store purchase. For official applications only +func (client *Client) AssignStoreTransaction(req *AssignStoreTransactionRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "assignAppStoreTransaction", + Type: "assignStoreTransaction", }, Data: map[string]interface{}{ - "receipt": req.Receipt, - "purpose": req.Purpose, - }, - }) - if err != nil { - return nil, err - } - - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } - - return UnmarshalOk(result.Data) -} - -type AssignGooglePlayTransactionRequest struct { - // Application package name - PackageName string `json:"package_name"` - // Identifier of the purchased store product - StoreProductId string `json:"store_product_id"` - // Google Play purchase token - PurchaseToken string `json:"purchase_token"` - // Transaction purpose - Purpose StorePaymentPurpose `json:"purpose"` -} - -// Informs server about a purchase through Google Play. For official applications only -func (client *Client) AssignGooglePlayTransaction(req *AssignGooglePlayTransactionRequest) (*Ok, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "assignGooglePlayTransaction", - }, - Data: map[string]interface{}{ - "package_name": req.PackageName, - "store_product_id": req.StoreProductId, - "purchase_token": req.PurchaseToken, + "transaction": req.Transaction, "purpose": req.Purpose, }, }) @@ -24464,6 +25031,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateForumTopicInfo: return UnmarshalUpdateForumTopicInfo(result.Data) + case TypeUpdateForumTopic: + return UnmarshalUpdateForumTopic(result.Data) + case TypeUpdateScopeNotificationSettings: return UnmarshalUpdateScopeNotificationSettings(result.Data) @@ -24626,6 +25196,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateConnectionState: return UnmarshalUpdateConnectionState(result.Data) + case TypeUpdateFreezeState: + return UnmarshalUpdateFreezeState(result.Data) + case TypeUpdateTermsOfService: return UnmarshalUpdateTermsOfService(result.Data) diff --git a/client/type.go b/client/type.go index c4f4597..22df51f 100755 --- a/client/type.go +++ b/client/type.go @@ -48,7 +48,7 @@ const ( ClassMessageReplyTo = "MessageReplyTo" ClassInputMessageReplyTo = "InputMessageReplyTo" ClassMessageSource = "MessageSource" - ClassReportChatSponsoredMessageResult = "ReportChatSponsoredMessageResult" + ClassReportSponsoredResult = "ReportSponsoredResult" ClassNotificationSettingsScope = "NotificationSettingsScope" ClassReactionNotificationSource = "ReactionNotificationSource" ClassChatType = "ChatType" @@ -126,6 +126,7 @@ const ( ClassPremiumStoryFeature = "PremiumStoryFeature" ClassPremiumSource = "PremiumSource" ClassStorePaymentPurpose = "StorePaymentPurpose" + ClassStoreTransaction = "StoreTransaction" ClassTelegramPaymentPurpose = "TelegramPaymentPurpose" ClassDeviceToken = "DeviceToken" ClassBackgroundFill = "BackgroundFill" @@ -227,6 +228,7 @@ const ( ClassBusinessRecipients = "BusinessRecipients" ClassBusinessAwayMessageSettings = "BusinessAwayMessageSettings" ClassBusinessGreetingMessageSettings = "BusinessGreetingMessageSettings" + ClassBusinessBotRights = "BusinessBotRights" ClassBusinessConnectedBot = "BusinessConnectedBot" ClassBusinessStartPage = "BusinessStartPage" ClassInputBusinessStartPage = "InputBusinessStartPage" @@ -267,6 +269,8 @@ const ( ClassStarGiveawayWinnerOption = "StarGiveawayWinnerOption" ClassStarGiveawayPaymentOption = "StarGiveawayPaymentOption" ClassStarGiveawayPaymentOptions = "StarGiveawayPaymentOptions" + ClassAcceptedGiftTypes = "AcceptedGiftTypes" + ClassGiftSettings = "GiftSettings" ClassUpgradedGiftModel = "UpgradedGiftModel" ClassUpgradedGiftSymbol = "UpgradedGiftSymbol" ClassUpgradedGiftBackdropColors = "UpgradedGiftBackdropColors" @@ -344,6 +348,8 @@ const ( ClassMessageSponsor = "MessageSponsor" ClassSponsoredMessage = "SponsoredMessage" ClassSponsoredMessages = "SponsoredMessages" + ClassSponsoredChat = "SponsoredChat" + ClassSponsoredChats = "SponsoredChats" ClassReportOption = "ReportOption" ClassFileDownload = "FileDownload" ClassDownloadedFileCounts = "DownloadedFileCounts" @@ -630,6 +636,7 @@ const ( TypeTermsOfService = "termsOfService" TypeAuthorizationStateWaitTdlibParameters = "authorizationStateWaitTdlibParameters" TypeAuthorizationStateWaitPhoneNumber = "authorizationStateWaitPhoneNumber" + TypeAuthorizationStateWaitPremiumPurchase = "authorizationStateWaitPremiumPurchase" TypeAuthorizationStateWaitEmailAddress = "authorizationStateWaitEmailAddress" TypeAuthorizationStateWaitEmailCode = "authorizationStateWaitEmailCode" TypeAuthorizationStateWaitCode = "authorizationStateWaitCode" @@ -722,6 +729,7 @@ const ( TypeBusinessRecipients = "businessRecipients" TypeBusinessAwayMessageSettings = "businessAwayMessageSettings" TypeBusinessGreetingMessageSettings = "businessGreetingMessageSettings" + TypeBusinessBotRights = "businessBotRights" TypeBusinessConnectedBot = "businessConnectedBot" TypeBusinessStartPage = "businessStartPage" TypeInputBusinessStartPage = "inputBusinessStartPage" @@ -776,6 +784,8 @@ const ( TypeStarGiveawayWinnerOption = "starGiveawayWinnerOption" TypeStarGiveawayPaymentOption = "starGiveawayPaymentOption" TypeStarGiveawayPaymentOptions = "starGiveawayPaymentOptions" + TypeAcceptedGiftTypes = "acceptedGiftTypes" + TypeGiftSettings = "giftSettings" TypeUpgradedGiftModel = "upgradedGiftModel" TypeUpgradedGiftSymbol = "upgradedGiftSymbol" TypeUpgradedGiftBackdropColors = "upgradedGiftBackdropColors" @@ -821,6 +831,8 @@ const ( TypeStarTransactionTypePaidMessageSend = "starTransactionTypePaidMessageSend" TypeStarTransactionTypePaidMessageReceive = "starTransactionTypePaidMessageReceive" TypeStarTransactionTypePremiumPurchase = "starTransactionTypePremiumPurchase" + TypeStarTransactionTypeBusinessBotTransferSend = "starTransactionTypeBusinessBotTransferSend" + TypeStarTransactionTypeBusinessBotTransferReceive = "starTransactionTypeBusinessBotTransferReceive" TypeStarTransactionTypeUnsupported = "starTransactionTypeUnsupported" TypeStarTransaction = "starTransaction" TypeStarTransactions = "starTransactions" @@ -961,12 +973,14 @@ const ( TypeMessageSponsor = "messageSponsor" TypeSponsoredMessage = "sponsoredMessage" TypeSponsoredMessages = "sponsoredMessages" + TypeSponsoredChat = "sponsoredChat" + TypeSponsoredChats = "sponsoredChats" TypeReportOption = "reportOption" - TypeReportChatSponsoredMessageResultOk = "reportChatSponsoredMessageResultOk" - TypeReportChatSponsoredMessageResultFailed = "reportChatSponsoredMessageResultFailed" - TypeReportChatSponsoredMessageResultOptionRequired = "reportChatSponsoredMessageResultOptionRequired" - TypeReportChatSponsoredMessageResultAdsHidden = "reportChatSponsoredMessageResultAdsHidden" - TypeReportChatSponsoredMessageResultPremiumRequired = "reportChatSponsoredMessageResultPremiumRequired" + TypeReportSponsoredResultOk = "reportSponsoredResultOk" + TypeReportSponsoredResultFailed = "reportSponsoredResultFailed" + TypeReportSponsoredResultOptionRequired = "reportSponsoredResultOptionRequired" + TypeReportSponsoredResultAdsHidden = "reportSponsoredResultAdsHidden" + TypeReportSponsoredResultPremiumRequired = "reportSponsoredResultPremiumRequired" TypeFileDownload = "fileDownload" TypeDownloadedFileCounts = "downloadedFileCounts" TypeFoundFileDownloads = "foundFileDownloads" @@ -1338,6 +1352,8 @@ const ( TypeMessageGift = "messageGift" TypeMessageUpgradedGift = "messageUpgradedGift" TypeMessageRefundedUpgradedGift = "messageRefundedUpgradedGift" + TypeMessagePaidMessagesRefunded = "messagePaidMessagesRefunded" + TypeMessagePaidMessagePriceChanged = "messagePaidMessagePriceChanged" TypeMessageContactRegistered = "messageContactRegistered" TypeMessageUsersShared = "messageUsersShared" TypeMessageChatShared = "messageChatShared" @@ -1771,6 +1787,8 @@ const ( TypeStorePaymentPurposeStarGiveaway = "storePaymentPurposeStarGiveaway" TypeStorePaymentPurposeStars = "storePaymentPurposeStars" TypeStorePaymentPurposeGiftedStars = "storePaymentPurposeGiftedStars" + TypeStoreTransactionAppStore = "storeTransactionAppStore" + TypeStoreTransactionGooglePlay = "storeTransactionGooglePlay" TypeTelegramPaymentPurposePremiumGift = "telegramPaymentPurposePremiumGift" TypeTelegramPaymentPurposePremiumGiftCodes = "telegramPaymentPurposePremiumGiftCodes" TypeTelegramPaymentPurposePremiumGiveaway = "telegramPaymentPurposePremiumGiveaway" @@ -2215,6 +2233,7 @@ const ( TypeUpdateQuickReplyShortcuts = "updateQuickReplyShortcuts" TypeUpdateQuickReplyShortcutMessages = "updateQuickReplyShortcutMessages" TypeUpdateForumTopicInfo = "updateForumTopicInfo" + TypeUpdateForumTopic = "updateForumTopic" TypeUpdateScopeNotificationSettings = "updateScopeNotificationSettings" TypeUpdateReactionNotificationSettings = "updateReactionNotificationSettings" TypeUpdateNotification = "updateNotification" @@ -2269,6 +2288,7 @@ const ( TypeUpdateProfileAccentColors = "updateProfileAccentColors" TypeUpdateLanguagePackStrings = "updateLanguagePackStrings" TypeUpdateConnectionState = "updateConnectionState" + TypeUpdateFreezeState = "updateFreezeState" TypeUpdateTermsOfService = "updateTermsOfService" TypeUpdateUnconfirmedSession = "updateUnconfirmedSession" TypeUpdateAttachmentMenuBots = "updateAttachmentMenuBots" @@ -2532,9 +2552,9 @@ type MessageSource interface { MessageSourceType() string } -// Describes result of sponsored message report -type ReportChatSponsoredMessageResult interface { - ReportChatSponsoredMessageResultType() string +// Describes result of sponsored message or chat report +type ReportSponsoredResult interface { + ReportSponsoredResultType() string } // Describes the types of chats to which notification settings are relevant @@ -2922,6 +2942,11 @@ type StorePaymentPurpose interface { StorePaymentPurposeType() string } +// Describes an in-store transaction +type StoreTransaction interface { + StoreTransactionType() string +} + // Describes a purpose of a payment toward Telegram type TelegramPaymentPurpose interface { TelegramPaymentPurposeType() string @@ -3884,6 +3909,33 @@ func (*AuthorizationStateWaitPhoneNumber) AuthorizationStateType() string { return TypeAuthorizationStateWaitPhoneNumber } +// The user must buy Telegram Premium as an in-store purchase to log in. Call checkAuthenticationPremiumPurchase and then setAuthenticationPremiumPurchaseTransaction +type AuthorizationStateWaitPremiumPurchase struct { + meta + // Identifier of the store product that must be bought + StoreProductId string `json:"store_product_id"` +} + +func (entity *AuthorizationStateWaitPremiumPurchase) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AuthorizationStateWaitPremiumPurchase + + return json.Marshal((*stub)(entity)) +} + +func (*AuthorizationStateWaitPremiumPurchase) GetClass() string { + return ClassAuthorizationState +} + +func (*AuthorizationStateWaitPremiumPurchase) GetType() string { + return TypeAuthorizationStateWaitPremiumPurchase +} + +func (*AuthorizationStateWaitPremiumPurchase) AuthorizationStateType() string { + return TypeAuthorizationStateWaitPremiumPurchase +} + // TDLib needs the user's email address to authorize. Call setAuthenticationEmailAddress to provide the email address, or directly call checkAuthenticationEmailCode with Apple ID/Google ID token if allowed type AuthorizationStateWaitEmailAddress struct { meta @@ -6771,6 +6823,55 @@ func (*BusinessGreetingMessageSettings) GetType() string { return TypeBusinessGreetingMessageSettings } +// Describes rights of a business bot +type BusinessBotRights struct { + meta + // True, if the bot can send and edit messages in the private chats that had incoming messages in the last 24 hours + CanReply bool `json:"can_reply"` + // True, if the bot can mark incoming private messages as read + CanReadMessages bool `json:"can_read_messages"` + // True, if the bot can delete sent messages + CanDeleteSentMessages bool `json:"can_delete_sent_messages"` + // True, if the bot can delete any message + CanDeleteAllMessages bool `json:"can_delete_all_messages"` + // True, if the bot can edit name of the business account + CanEditName bool `json:"can_edit_name"` + // True, if the bot can edit bio of the business account + CanEditBio bool `json:"can_edit_bio"` + // True, if the bot can edit profile photo of the business account + CanEditProfilePhoto bool `json:"can_edit_profile_photo"` + // True, if the bot can edit username of the business account + CanEditUsername bool `json:"can_edit_username"` + // True, if the bot can view gifts and amount of Telegram Stars owned by the business account + CanViewGiftsAndStars bool `json:"can_view_gifts_and_stars"` + // True, if the bot can sell regular gifts received by the business account + CanSellGifts bool `json:"can_sell_gifts"` + // True, if the bot can change gift receiving settings of the business account + CanChangeGiftSettings bool `json:"can_change_gift_settings"` + // True, if the bot can transfer and upgrade gifts received by the business account + CanTransferAndUpgradeGifts bool `json:"can_transfer_and_upgrade_gifts"` + // True, if the bot can transfer Telegram Stars received by the business account to account of the bot, or use them to upgrade and transfer gifts + CanTransferStars bool `json:"can_transfer_stars"` + // True, if the bot can send, edit and delete stories + CanManageStories bool `json:"can_manage_stories"` +} + +func (entity *BusinessBotRights) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessBotRights + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessBotRights) GetClass() string { + return ClassBusinessBotRights +} + +func (*BusinessBotRights) GetType() string { + return TypeBusinessBotRights +} + // Describes a bot connected to a business account type BusinessConnectedBot struct { meta @@ -6778,8 +6879,8 @@ type BusinessConnectedBot struct { BotUserId int64 `json:"bot_user_id"` // Private chats that will be accessible to the bot Recipients *BusinessRecipients `json:"recipients"` - // True, if the bot can send messages to the private chats; false otherwise - CanReply bool `json:"can_reply"` + // Rights of the bot + Rights *BusinessBotRights `json:"rights"` } func (entity *BusinessConnectedBot) MarshalJSON() ([]byte, error) { @@ -8488,6 +8589,60 @@ func (*StarGiveawayPaymentOptions) GetType() string { return TypeStarGiveawayPaymentOptions } +// Describes gift types that are accepted by a user +type AcceptedGiftTypes struct { + meta + // True, if unlimited regular gifts are accepted + UnlimitedGifts bool `json:"unlimited_gifts"` + // True, if limited regular gifts are accepted + LimitedGifts bool `json:"limited_gifts"` + // True, if upgraded gifts and regular gifts that can be upgraded for free are accepted + UpgradedGifts bool `json:"upgraded_gifts"` + // True, if Telegram Premium subscription is accepted + PremiumSubscription bool `json:"premium_subscription"` +} + +func (entity *AcceptedGiftTypes) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AcceptedGiftTypes + + return json.Marshal((*stub)(entity)) +} + +func (*AcceptedGiftTypes) GetClass() string { + return ClassAcceptedGiftTypes +} + +func (*AcceptedGiftTypes) GetType() string { + return TypeAcceptedGiftTypes +} + +// Contains settings for gift receiving for a user +type GiftSettings struct { + meta + // True, if a button for sending a gift to the user or by the user must always be shown in the input field + ShowGiftButton bool `json:"show_gift_button"` + // Types of gifts accepted by the user; for Telegram Premium users only + AcceptedGiftTypes *AcceptedGiftTypes `json:"accepted_gift_types"` +} + +func (entity *GiftSettings) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftSettings + + return json.Marshal((*stub)(entity)) +} + +func (*GiftSettings) GetClass() string { + return ClassGiftSettings +} + +func (*GiftSettings) GetType() string { + return TypeGiftSettings +} + // Describes a model of an upgraded gift type UpgradedGiftModel struct { meta @@ -8495,7 +8650,7 @@ type UpgradedGiftModel struct { Name string `json:"name"` // The sticker representing the upgraded gift Sticker *Sticker `json:"sticker"` - // The number of upgraded gift that receive this model for each 1000 gifts upgraded + // The number of upgraded gifts that receive this model for each 1000 gifts upgraded RarityPerMille int32 `json:"rarity_per_mille"` } @@ -8520,9 +8675,9 @@ type UpgradedGiftSymbol struct { meta // Name of the symbol Name string `json:"name"` - // The sticker representing the upgraded gift + // The sticker representing the symbol Sticker *Sticker `json:"sticker"` - // The number of upgraded gift that receive this symbol for each 1000 gifts upgraded + // The number of upgraded gifts that receive this symbol for each 1000 gifts upgraded RarityPerMille int32 `json:"rarity_per_mille"` } @@ -8578,7 +8733,7 @@ type UpgradedGiftBackdrop struct { Name string `json:"name"` // Colors of the backdrop Colors *UpgradedGiftBackdropColors `json:"colors"` - // The number of upgraded gift that receive this backdrop for each 1000 gifts upgraded + // The number of upgraded gifts that receive this backdrop for each 1000 gifts upgraded RarityPerMille int32 `json:"rarity_per_mille"` } @@ -8733,11 +8888,11 @@ type UpgradedGift struct { MaxUpgradedCount int32 `json:"max_upgraded_count"` // Identifier of the user or the chat that owns the upgraded gift; may be null if none or unknown OwnerId MessageSender `json:"owner_id"` - // Address of the gift NFT owner in TON blockchain; may be empty if none + // Address of the gift NFT owner in TON blockchain; may be empty if none. Append the address to getOption("ton_blockchain_explorer_url") to get a link with information about the address OwnerAddress string `json:"owner_address"` // Name of the owner for the case when owner identifier and address aren't known OwnerName string `json:"owner_name"` - // Address of the gift NFT in TON blockchain; may be empty if none + // Address of the gift NFT in TON blockchain; may be empty if none. Append the address to getOption("ton_blockchain_explorer_url") to get a link with information about the address GiftAddress string `json:"gift_address"` // Model of the upgraded gift Model *UpgradedGiftModel `json:"model"` @@ -10072,7 +10227,7 @@ func (starTransactionTypePaidMessageReceive *StarTransactionTypePaidMessageRecei return nil } -// The transaction is a purchase of Telegram Premium subscription; for regular users only +// The transaction is a purchase of Telegram Premium subscription; for regular users and bots only type StarTransactionTypePremiumPurchase struct { meta // Identifier of the user that received the Telegram Premium subscription @@ -10103,6 +10258,60 @@ func (*StarTransactionTypePremiumPurchase) StarTransactionTypeType() string { return TypeStarTransactionTypePremiumPurchase } +// The transaction is a transfer of Telegram Stars to a business bot; for regular users only +type StarTransactionTypeBusinessBotTransferSend struct { + meta + // Identifier of the bot that received Telegram Stars + UserId int64 `json:"user_id"` +} + +func (entity *StarTransactionTypeBusinessBotTransferSend) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeBusinessBotTransferSend + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeBusinessBotTransferSend) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeBusinessBotTransferSend) GetType() string { + return TypeStarTransactionTypeBusinessBotTransferSend +} + +func (*StarTransactionTypeBusinessBotTransferSend) StarTransactionTypeType() string { + return TypeStarTransactionTypeBusinessBotTransferSend +} + +// The transaction is a transfer of Telegram Stars from a business account; for bots only +type StarTransactionTypeBusinessBotTransferReceive struct { + meta + // Identifier of the user that sent Telegram Stars + UserId int64 `json:"user_id"` +} + +func (entity *StarTransactionTypeBusinessBotTransferReceive) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeBusinessBotTransferReceive + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeBusinessBotTransferReceive) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeBusinessBotTransferReceive) GetType() string { + return TypeStarTransactionTypeBusinessBotTransferReceive +} + +func (*StarTransactionTypeBusinessBotTransferReceive) StarTransactionTypeType() string { + return TypeStarTransactionTypeBusinessBotTransferReceive +} + // The transaction is a transaction of an unsupported type type StarTransactionTypeUnsupported struct{ meta @@ -11082,6 +11291,8 @@ type UserFullInfo struct { IncomingPaidMessageStarCount int64 `json:"incoming_paid_message_star_count"` // Number of Telegram Stars that must be paid by the current user for each sent message to the user OutgoingPaidMessageStarCount int64 `json:"outgoing_paid_message_star_count"` + // Settings for gift receiving for the user + GiftSettings *GiftSettings `json:"gift_settings"` // Information about verification status of the user provided by a bot; may be null if none or unknown BotVerification *BotVerification `json:"bot_verification"` // Information about business settings for Telegram Business accounts; may be null if none @@ -11128,6 +11339,7 @@ func (userFullInfo *UserFullInfo) UnmarshalJSON(data []byte) error { GroupInCommonCount int32 `json:"group_in_common_count"` IncomingPaidMessageStarCount int64 `json:"incoming_paid_message_star_count"` OutgoingPaidMessageStarCount int64 `json:"outgoing_paid_message_star_count"` + GiftSettings *GiftSettings `json:"gift_settings"` BotVerification *BotVerification `json:"bot_verification"` BusinessInfo *BusinessInfo `json:"business_info"` BotInfo *BotInfo `json:"bot_info"` @@ -11157,6 +11369,7 @@ func (userFullInfo *UserFullInfo) UnmarshalJSON(data []byte) error { userFullInfo.GroupInCommonCount = tmp.GroupInCommonCount userFullInfo.IncomingPaidMessageStarCount = tmp.IncomingPaidMessageStarCount userFullInfo.OutgoingPaidMessageStarCount = tmp.OutgoingPaidMessageStarCount + userFullInfo.GiftSettings = tmp.GiftSettings userFullInfo.BotVerification = tmp.BotVerification userFullInfo.BusinessInfo = tmp.BusinessInfo userFullInfo.BotInfo = tmp.BotInfo @@ -15072,6 +15285,58 @@ func (*SponsoredMessages) GetType() string { return TypeSponsoredMessages } +// Describes a sponsored chat +type SponsoredChat struct { + meta + // Unique identifier of this result + UniqueId int64 `json:"unique_id"` + // Chat identifier + ChatId int64 `json:"chat_id"` + // Additional optional information about the sponsor to be shown along with the chat + SponsorInfo string `json:"sponsor_info"` + // If non-empty, additional information about the sponsored chat to be shown along with the chat + AdditionalInfo string `json:"additional_info"` +} + +func (entity *SponsoredChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SponsoredChat + + return json.Marshal((*stub)(entity)) +} + +func (*SponsoredChat) GetClass() string { + return ClassSponsoredChat +} + +func (*SponsoredChat) GetType() string { + return TypeSponsoredChat +} + +// Contains a list of sponsored chats +type SponsoredChats struct { + meta + // List of sponsored chats + Chats []*SponsoredChat `json:"chats"` +} + +func (entity *SponsoredChats) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SponsoredChats + + return json.Marshal((*stub)(entity)) +} + +func (*SponsoredChats) GetClass() string { + return ClassSponsoredChats +} + +func (*SponsoredChats) GetType() string { + return TypeSponsoredChats +} + // Describes an option to report an entity to Telegram type ReportOption struct { meta @@ -15098,57 +15363,57 @@ func (*ReportOption) GetType() string { } // The message was reported successfully -type ReportChatSponsoredMessageResultOk struct{ +type ReportSponsoredResultOk struct{ meta } -func (entity *ReportChatSponsoredMessageResultOk) MarshalJSON() ([]byte, error) { +func (entity *ReportSponsoredResultOk) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ReportChatSponsoredMessageResultOk + type stub ReportSponsoredResultOk return json.Marshal((*stub)(entity)) } -func (*ReportChatSponsoredMessageResultOk) GetClass() string { - return ClassReportChatSponsoredMessageResult +func (*ReportSponsoredResultOk) GetClass() string { + return ClassReportSponsoredResult } -func (*ReportChatSponsoredMessageResultOk) GetType() string { - return TypeReportChatSponsoredMessageResultOk +func (*ReportSponsoredResultOk) GetType() string { + return TypeReportSponsoredResultOk } -func (*ReportChatSponsoredMessageResultOk) ReportChatSponsoredMessageResultType() string { - return TypeReportChatSponsoredMessageResultOk +func (*ReportSponsoredResultOk) ReportSponsoredResultType() string { + return TypeReportSponsoredResultOk } // The sponsored message is too old or not found -type ReportChatSponsoredMessageResultFailed struct{ +type ReportSponsoredResultFailed struct{ meta } -func (entity *ReportChatSponsoredMessageResultFailed) MarshalJSON() ([]byte, error) { +func (entity *ReportSponsoredResultFailed) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ReportChatSponsoredMessageResultFailed + type stub ReportSponsoredResultFailed return json.Marshal((*stub)(entity)) } -func (*ReportChatSponsoredMessageResultFailed) GetClass() string { - return ClassReportChatSponsoredMessageResult +func (*ReportSponsoredResultFailed) GetClass() string { + return ClassReportSponsoredResult } -func (*ReportChatSponsoredMessageResultFailed) GetType() string { - return TypeReportChatSponsoredMessageResultFailed +func (*ReportSponsoredResultFailed) GetType() string { + return TypeReportSponsoredResultFailed } -func (*ReportChatSponsoredMessageResultFailed) ReportChatSponsoredMessageResultType() string { - return TypeReportChatSponsoredMessageResultFailed +func (*ReportSponsoredResultFailed) ReportSponsoredResultType() string { + return TypeReportSponsoredResultFailed } // The user must choose an option to report the message and repeat request with the chosen option -type ReportChatSponsoredMessageResultOptionRequired struct { +type ReportSponsoredResultOptionRequired struct { meta // Title for the option choice Title string `json:"title"` @@ -15156,74 +15421,74 @@ type ReportChatSponsoredMessageResultOptionRequired struct { Options []*ReportOption `json:"options"` } -func (entity *ReportChatSponsoredMessageResultOptionRequired) MarshalJSON() ([]byte, error) { +func (entity *ReportSponsoredResultOptionRequired) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ReportChatSponsoredMessageResultOptionRequired + type stub ReportSponsoredResultOptionRequired return json.Marshal((*stub)(entity)) } -func (*ReportChatSponsoredMessageResultOptionRequired) GetClass() string { - return ClassReportChatSponsoredMessageResult +func (*ReportSponsoredResultOptionRequired) GetClass() string { + return ClassReportSponsoredResult } -func (*ReportChatSponsoredMessageResultOptionRequired) GetType() string { - return TypeReportChatSponsoredMessageResultOptionRequired +func (*ReportSponsoredResultOptionRequired) GetType() string { + return TypeReportSponsoredResultOptionRequired } -func (*ReportChatSponsoredMessageResultOptionRequired) ReportChatSponsoredMessageResultType() string { - return TypeReportChatSponsoredMessageResultOptionRequired +func (*ReportSponsoredResultOptionRequired) ReportSponsoredResultType() string { + return TypeReportSponsoredResultOptionRequired } // Sponsored messages were hidden for the user in all chats -type ReportChatSponsoredMessageResultAdsHidden struct{ +type ReportSponsoredResultAdsHidden struct{ meta } -func (entity *ReportChatSponsoredMessageResultAdsHidden) MarshalJSON() ([]byte, error) { +func (entity *ReportSponsoredResultAdsHidden) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ReportChatSponsoredMessageResultAdsHidden + type stub ReportSponsoredResultAdsHidden return json.Marshal((*stub)(entity)) } -func (*ReportChatSponsoredMessageResultAdsHidden) GetClass() string { - return ClassReportChatSponsoredMessageResult +func (*ReportSponsoredResultAdsHidden) GetClass() string { + return ClassReportSponsoredResult } -func (*ReportChatSponsoredMessageResultAdsHidden) GetType() string { - return TypeReportChatSponsoredMessageResultAdsHidden +func (*ReportSponsoredResultAdsHidden) GetType() string { + return TypeReportSponsoredResultAdsHidden } -func (*ReportChatSponsoredMessageResultAdsHidden) ReportChatSponsoredMessageResultType() string { - return TypeReportChatSponsoredMessageResultAdsHidden +func (*ReportSponsoredResultAdsHidden) ReportSponsoredResultType() string { + return TypeReportSponsoredResultAdsHidden } // The user asked to hide sponsored messages, but Telegram Premium is required for this -type ReportChatSponsoredMessageResultPremiumRequired struct{ +type ReportSponsoredResultPremiumRequired struct{ meta } -func (entity *ReportChatSponsoredMessageResultPremiumRequired) MarshalJSON() ([]byte, error) { +func (entity *ReportSponsoredResultPremiumRequired) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ReportChatSponsoredMessageResultPremiumRequired + type stub ReportSponsoredResultPremiumRequired return json.Marshal((*stub)(entity)) } -func (*ReportChatSponsoredMessageResultPremiumRequired) GetClass() string { - return ClassReportChatSponsoredMessageResult +func (*ReportSponsoredResultPremiumRequired) GetClass() string { + return ClassReportSponsoredResult } -func (*ReportChatSponsoredMessageResultPremiumRequired) GetType() string { - return TypeReportChatSponsoredMessageResultPremiumRequired +func (*ReportSponsoredResultPremiumRequired) GetType() string { + return TypeReportSponsoredResultPremiumRequired } -func (*ReportChatSponsoredMessageResultPremiumRequired) ReportChatSponsoredMessageResultType() string { - return TypeReportChatSponsoredMessageResultPremiumRequired +func (*ReportSponsoredResultPremiumRequired) ReportSponsoredResultType() string { + return TypeReportSponsoredResultPremiumRequired } // Describes a file added to file download list @@ -18311,6 +18576,8 @@ func (*ForumTopicIcon) GetType() string { // Contains basic information about a forum topic type ForumTopicInfo struct { meta + // Identifier of the forum chat to which the topic belongs + ChatId int64 `json:"chat_id"` // Message thread identifier of the topic MessageThreadId int64 `json:"message_thread_id"` // Name of the topic @@ -18349,6 +18616,7 @@ func (*ForumTopicInfo) GetType() string { func (forumTopicInfo *ForumTopicInfo) UnmarshalJSON(data []byte) error { var tmp struct { + ChatId int64 `json:"chat_id"` MessageThreadId int64 `json:"message_thread_id"` Name string `json:"name"` Icon *ForumTopicIcon `json:"icon"` @@ -18365,6 +18633,7 @@ func (forumTopicInfo *ForumTopicInfo) UnmarshalJSON(data []byte) error { return err } + forumTopicInfo.ChatId = tmp.ChatId forumTopicInfo.MessageThreadId = tmp.MessageThreadId forumTopicInfo.Name = tmp.Name forumTopicInfo.Icon = tmp.Icon @@ -18387,6 +18656,8 @@ type ForumTopic struct { Info *ForumTopicInfo `json:"info"` // Last message in the topic; may be null if unknown LastMessage *Message `json:"last_message"` + // A parameter used to determine order of the topic in the topic list. Topics must be sorted by the order in descending order + Order JsonInt64 `json:"order"` // True, if the topic is pinned in the topic list IsPinned bool `json:"is_pinned"` // Number of unread messages in the topic @@ -27826,6 +28097,62 @@ func (messageRefundedUpgradedGift *MessageRefundedUpgradedGift) UnmarshalJSON(da return nil } +// Paid messages were refunded +type MessagePaidMessagesRefunded struct { + meta + // The number of refunded messages + MessageCount int32 `json:"message_count"` + // The number of refunded Telegram Stars + StarCount int64 `json:"star_count"` +} + +func (entity *MessagePaidMessagesRefunded) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessagePaidMessagesRefunded + + return json.Marshal((*stub)(entity)) +} + +func (*MessagePaidMessagesRefunded) GetClass() string { + return ClassMessageContent +} + +func (*MessagePaidMessagesRefunded) GetType() string { + return TypeMessagePaidMessagesRefunded +} + +func (*MessagePaidMessagesRefunded) MessageContentType() string { + return TypeMessagePaidMessagesRefunded +} + +// A price for paid messages was changed in the supergroup chat +type MessagePaidMessagePriceChanged struct { + meta + // The new number of Telegram Stars that must be paid by non-administrator users of the supergroup chat for each sent message + PaidMessageStarCount int64 `json:"paid_message_star_count"` +} + +func (entity *MessagePaidMessagePriceChanged) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessagePaidMessagePriceChanged + + return json.Marshal((*stub)(entity)) +} + +func (*MessagePaidMessagePriceChanged) GetClass() string { + return ClassMessageContent +} + +func (*MessagePaidMessagePriceChanged) GetType() string { + return TypeMessagePaidMessagePriceChanged +} + +func (*MessagePaidMessagePriceChanged) MessageContentType() string { + return TypeMessagePaidMessagePriceChanged +} + // A contact has registered with Telegram type MessageContactRegistered struct{ meta @@ -35953,8 +36280,8 @@ type BusinessConnection struct { UserChatId int64 `json:"user_chat_id"` // Point in time (Unix timestamp) when the connection was established Date int32 `json:"date"` - // True, if the bot can send messages to the connected user; false otherwise - CanReply bool `json:"can_reply"` + // Rights of the bot; may be null if the connection was disabled + Rights *BusinessBotRights `json:"rights"` // True, if the connection is enabled; false otherwise IsEnabled bool `json:"is_enabled"` } @@ -42212,10 +42539,68 @@ func (*StorePaymentPurposeGiftedStars) StorePaymentPurposeType() string { return TypeStorePaymentPurposeGiftedStars } +// A purchase through App Store +type StoreTransactionAppStore struct { + meta + // App Store receipt + Receipt []byte `json:"receipt"` +} + +func (entity *StoreTransactionAppStore) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoreTransactionAppStore + + return json.Marshal((*stub)(entity)) +} + +func (*StoreTransactionAppStore) GetClass() string { + return ClassStoreTransaction +} + +func (*StoreTransactionAppStore) GetType() string { + return TypeStoreTransactionAppStore +} + +func (*StoreTransactionAppStore) StoreTransactionType() string { + return TypeStoreTransactionAppStore +} + +// A purchase through Google Play +type StoreTransactionGooglePlay struct { + meta + // Application package name + PackageName string `json:"package_name"` + // Identifier of the purchased store product + StoreProductId string `json:"store_product_id"` + // Google Play purchase token + PurchaseToken string `json:"purchase_token"` +} + +func (entity *StoreTransactionGooglePlay) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoreTransactionGooglePlay + + return json.Marshal((*stub)(entity)) +} + +func (*StoreTransactionGooglePlay) GetClass() string { + return ClassStoreTransaction +} + +func (*StoreTransactionGooglePlay) GetType() string { + return TypeStoreTransactionGooglePlay +} + +func (*StoreTransactionGooglePlay) StoreTransactionType() string { + return TypeStoreTransactionGooglePlay +} + // The user gifting Telegram Premium to another user type TelegramPaymentPurposePremiumGift struct { meta - // ISO 4217 currency code of the payment currency + // ISO 4217 currency code of the payment currency, or "XTR" for payments in Telegram Stars Currency string `json:"currency"` // Paid amount, in the smallest units of the currency Amount int64 `json:"amount"` @@ -46578,7 +46963,7 @@ type NewChatPrivacySettings struct { meta // True, if non-contacts users are able to write first to the current user. Telegram Premium subscribers are able to write first regardless of this setting AllowNewChatsFromUnknownUsers bool `json:"allow_new_chats_from_unknown_users"` - // Number of Telegram Stars that must be paid for every incoming private message by non-contacts; 0-getOption("paid_message_star_count_max"). If positive, then allow_new_chats_from_unknown_users must be true. The current user will receive getOption("paid_message_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for message sending + // Number of Telegram Stars that must be paid for every incoming private message by non-contacts; 0-getOption("paid_message_star_count_max"). If positive, then allow_new_chats_from_unknown_users must be true. The current user will receive getOption("paid_message_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for message sending. Can be positive, only if getOption("can_enable_paid_messages") is true IncomingPaidMessageStarCount int64 `json:"incoming_paid_message_star_count"` } @@ -55269,8 +55654,6 @@ func (*UpdateQuickReplyShortcutMessages) UpdateType() string { // Basic information about a topic in a forum chat was changed type UpdateForumTopicInfo struct { meta - // Chat identifier - ChatId int64 `json:"chat_id"` // New information about the topic Info *ForumTopicInfo `json:"info"` } @@ -55295,6 +55678,41 @@ func (*UpdateForumTopicInfo) UpdateType() string { return TypeUpdateForumTopicInfo } +// Information about a topic in a forum chat was changed +type UpdateForumTopic struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // Message thread identifier of the topic + MessageThreadId int64 `json:"message_thread_id"` + // True, if the topic is pinned in the topic list + IsPinned bool `json:"is_pinned"` + // Identifier of the last read outgoing message + LastReadOutboxMessageId int64 `json:"last_read_outbox_message_id"` + // Notification settings for the topic + NotificationSettings *ChatNotificationSettings `json:"notification_settings"` +} + +func (entity *UpdateForumTopic) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateForumTopic + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateForumTopic) GetClass() string { + return ClassUpdate +} + +func (*UpdateForumTopic) GetType() string { + return TypeUpdateForumTopic +} + +func (*UpdateForumTopic) UpdateType() string { + return TypeUpdateForumTopic +} + // Notification settings for some type of chats were updated type UpdateScopeNotificationSettings struct { meta @@ -57166,6 +57584,39 @@ func (updateConnectionState *UpdateConnectionState) UnmarshalJSON(data []byte) e return nil } +// The freeze state of the current user's account has changed +type UpdateFreezeState struct { + meta + // True, if the account is frozen + IsFrozen bool `json:"is_frozen"` + // Point in time (Unix timestamp) when the account was frozen; 0 if the account isn't frozen + FreezingDate int32 `json:"freezing_date"` + // Point in time (Unix timestamp) when the account will be deleted and can't be unfrozen; 0 if the account isn't frozen + DeletionDate int32 `json:"deletion_date"` + // The link to open to send an appeal to unfreeze the account + AppealLink string `json:"appeal_link"` +} + +func (entity *UpdateFreezeState) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateFreezeState + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateFreezeState) GetClass() string { + return ClassUpdate +} + +func (*UpdateFreezeState) GetType() string { + return TypeUpdateFreezeState +} + +func (*UpdateFreezeState) UpdateType() string { + return TypeUpdateFreezeState +} + // New terms of service must be accepted by the user. If the terms of service are declined, then the deleteAccount method must be called with the reason "Decline ToS update" type UpdateTermsOfService struct { meta diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 62cd54e..31bc0c7 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -151,6 +151,9 @@ func UnmarshalAuthorizationState(data json.RawMessage) (AuthorizationState, erro case TypeAuthorizationStateWaitPhoneNumber: return UnmarshalAuthorizationStateWaitPhoneNumber(data) + case TypeAuthorizationStateWaitPremiumPurchase: + return UnmarshalAuthorizationStateWaitPremiumPurchase(data) + case TypeAuthorizationStateWaitEmailAddress: return UnmarshalAuthorizationStateWaitEmailAddress(data) @@ -931,6 +934,12 @@ func UnmarshalStarTransactionType(data json.RawMessage) (StarTransactionType, er case TypeStarTransactionTypePremiumPurchase: return UnmarshalStarTransactionTypePremiumPurchase(data) + case TypeStarTransactionTypeBusinessBotTransferSend: + return UnmarshalStarTransactionTypeBusinessBotTransferSend(data) + + case TypeStarTransactionTypeBusinessBotTransferReceive: + return UnmarshalStarTransactionTypeBusinessBotTransferReceive(data) + case TypeStarTransactionTypeUnsupported: return UnmarshalStarTransactionTypeUnsupported(data) @@ -1707,7 +1716,7 @@ func UnmarshalListOfMessageSource(dataList []json.RawMessage) ([]MessageSource, return list, nil } -func UnmarshalReportChatSponsoredMessageResult(data json.RawMessage) (ReportChatSponsoredMessageResult, error) { +func UnmarshalReportSponsoredResult(data json.RawMessage) (ReportSponsoredResult, error) { var meta meta err := json.Unmarshal(data, &meta) @@ -1716,31 +1725,31 @@ func UnmarshalReportChatSponsoredMessageResult(data json.RawMessage) (ReportChat } switch meta.Type { - case TypeReportChatSponsoredMessageResultOk: - return UnmarshalReportChatSponsoredMessageResultOk(data) + case TypeReportSponsoredResultOk: + return UnmarshalReportSponsoredResultOk(data) - case TypeReportChatSponsoredMessageResultFailed: - return UnmarshalReportChatSponsoredMessageResultFailed(data) + case TypeReportSponsoredResultFailed: + return UnmarshalReportSponsoredResultFailed(data) - case TypeReportChatSponsoredMessageResultOptionRequired: - return UnmarshalReportChatSponsoredMessageResultOptionRequired(data) + case TypeReportSponsoredResultOptionRequired: + return UnmarshalReportSponsoredResultOptionRequired(data) - case TypeReportChatSponsoredMessageResultAdsHidden: - return UnmarshalReportChatSponsoredMessageResultAdsHidden(data) + case TypeReportSponsoredResultAdsHidden: + return UnmarshalReportSponsoredResultAdsHidden(data) - case TypeReportChatSponsoredMessageResultPremiumRequired: - return UnmarshalReportChatSponsoredMessageResultPremiumRequired(data) + case TypeReportSponsoredResultPremiumRequired: + return UnmarshalReportSponsoredResultPremiumRequired(data) default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } } -func UnmarshalListOfReportChatSponsoredMessageResult(dataList []json.RawMessage) ([]ReportChatSponsoredMessageResult, error) { - list := []ReportChatSponsoredMessageResult{} +func UnmarshalListOfReportSponsoredResult(dataList []json.RawMessage) ([]ReportSponsoredResult, error) { + list := []ReportSponsoredResult{} for _, data := range dataList { - entity, err := UnmarshalReportChatSponsoredMessageResult(data) + entity, err := UnmarshalReportSponsoredResult(data) if err != nil { return nil, err } @@ -3507,6 +3516,12 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessageRefundedUpgradedGift: return UnmarshalMessageRefundedUpgradedGift(data) + case TypeMessagePaidMessagesRefunded: + return UnmarshalMessagePaidMessagesRefunded(data) + + case TypeMessagePaidMessagePriceChanged: + return UnmarshalMessagePaidMessagePriceChanged(data) + case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) @@ -5772,6 +5787,40 @@ func UnmarshalListOfStorePaymentPurpose(dataList []json.RawMessage) ([]StorePaym return list, nil } +func UnmarshalStoreTransaction(data json.RawMessage) (StoreTransaction, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeStoreTransactionAppStore: + return UnmarshalStoreTransactionAppStore(data) + + case TypeStoreTransactionGooglePlay: + return UnmarshalStoreTransactionGooglePlay(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfStoreTransaction(dataList []json.RawMessage) ([]StoreTransaction, error) { + list := []StoreTransaction{} + + for _, data := range dataList { + entity, err := UnmarshalStoreTransaction(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalTelegramPaymentPurpose(data json.RawMessage) (TelegramPaymentPurpose, error) { var meta meta @@ -8153,6 +8202,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateForumTopicInfo: return UnmarshalUpdateForumTopicInfo(data) + case TypeUpdateForumTopic: + return UnmarshalUpdateForumTopic(data) + case TypeUpdateScopeNotificationSettings: return UnmarshalUpdateScopeNotificationSettings(data) @@ -8315,6 +8367,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateConnectionState: return UnmarshalUpdateConnectionState(data) + case TypeUpdateFreezeState: + return UnmarshalUpdateFreezeState(data) + case TypeUpdateTermsOfService: return UnmarshalUpdateTermsOfService(data) @@ -8697,6 +8752,14 @@ func UnmarshalAuthorizationStateWaitPhoneNumber(data json.RawMessage) (*Authoriz return &resp, err } +func UnmarshalAuthorizationStateWaitPremiumPurchase(data json.RawMessage) (*AuthorizationStateWaitPremiumPurchase, error) { + var resp AuthorizationStateWaitPremiumPurchase + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalAuthorizationStateWaitEmailAddress(data json.RawMessage) (*AuthorizationStateWaitEmailAddress, error) { var resp AuthorizationStateWaitEmailAddress @@ -9433,6 +9496,14 @@ func UnmarshalBusinessGreetingMessageSettings(data json.RawMessage) (*BusinessGr return &resp, err } +func UnmarshalBusinessBotRights(data json.RawMessage) (*BusinessBotRights, error) { + var resp BusinessBotRights + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalBusinessConnectedBot(data json.RawMessage) (*BusinessConnectedBot, error) { var resp BusinessConnectedBot @@ -9865,6 +9936,22 @@ func UnmarshalStarGiveawayPaymentOptions(data json.RawMessage) (*StarGiveawayPay return &resp, err } +func UnmarshalAcceptedGiftTypes(data json.RawMessage) (*AcceptedGiftTypes, error) { + var resp AcceptedGiftTypes + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftSettings(data json.RawMessage) (*GiftSettings, error) { + var resp GiftSettings + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpgradedGiftModel(data json.RawMessage) (*UpgradedGiftModel, error) { var resp UpgradedGiftModel @@ -10225,6 +10312,22 @@ func UnmarshalStarTransactionTypePremiumPurchase(data json.RawMessage) (*StarTra return &resp, err } +func UnmarshalStarTransactionTypeBusinessBotTransferSend(data json.RawMessage) (*StarTransactionTypeBusinessBotTransferSend, error) { + var resp StarTransactionTypeBusinessBotTransferSend + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeBusinessBotTransferReceive(data json.RawMessage) (*StarTransactionTypeBusinessBotTransferReceive, error) { + var resp StarTransactionTypeBusinessBotTransferReceive + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarTransactionTypeUnsupported(data json.RawMessage) (*StarTransactionTypeUnsupported, error) { var resp StarTransactionTypeUnsupported @@ -11345,6 +11448,22 @@ func UnmarshalSponsoredMessages(data json.RawMessage) (*SponsoredMessages, error return &resp, err } +func UnmarshalSponsoredChat(data json.RawMessage) (*SponsoredChat, error) { + var resp SponsoredChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSponsoredChats(data json.RawMessage) (*SponsoredChats, error) { + var resp SponsoredChats + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalReportOption(data json.RawMessage) (*ReportOption, error) { var resp ReportOption @@ -11353,40 +11472,40 @@ func UnmarshalReportOption(data json.RawMessage) (*ReportOption, error) { return &resp, err } -func UnmarshalReportChatSponsoredMessageResultOk(data json.RawMessage) (*ReportChatSponsoredMessageResultOk, error) { - var resp ReportChatSponsoredMessageResultOk +func UnmarshalReportSponsoredResultOk(data json.RawMessage) (*ReportSponsoredResultOk, error) { + var resp ReportSponsoredResultOk err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalReportChatSponsoredMessageResultFailed(data json.RawMessage) (*ReportChatSponsoredMessageResultFailed, error) { - var resp ReportChatSponsoredMessageResultFailed +func UnmarshalReportSponsoredResultFailed(data json.RawMessage) (*ReportSponsoredResultFailed, error) { + var resp ReportSponsoredResultFailed err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalReportChatSponsoredMessageResultOptionRequired(data json.RawMessage) (*ReportChatSponsoredMessageResultOptionRequired, error) { - var resp ReportChatSponsoredMessageResultOptionRequired +func UnmarshalReportSponsoredResultOptionRequired(data json.RawMessage) (*ReportSponsoredResultOptionRequired, error) { + var resp ReportSponsoredResultOptionRequired err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalReportChatSponsoredMessageResultAdsHidden(data json.RawMessage) (*ReportChatSponsoredMessageResultAdsHidden, error) { - var resp ReportChatSponsoredMessageResultAdsHidden +func UnmarshalReportSponsoredResultAdsHidden(data json.RawMessage) (*ReportSponsoredResultAdsHidden, error) { + var resp ReportSponsoredResultAdsHidden err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalReportChatSponsoredMessageResultPremiumRequired(data json.RawMessage) (*ReportChatSponsoredMessageResultPremiumRequired, error) { - var resp ReportChatSponsoredMessageResultPremiumRequired +func UnmarshalReportSponsoredResultPremiumRequired(data json.RawMessage) (*ReportSponsoredResultPremiumRequired, error) { + var resp ReportSponsoredResultPremiumRequired err := json.Unmarshal(data, &resp) @@ -14361,6 +14480,22 @@ func UnmarshalMessageRefundedUpgradedGift(data json.RawMessage) (*MessageRefunde return &resp, err } +func UnmarshalMessagePaidMessagesRefunded(data json.RawMessage) (*MessagePaidMessagesRefunded, error) { + var resp MessagePaidMessagesRefunded + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessagePaidMessagePriceChanged(data json.RawMessage) (*MessagePaidMessagePriceChanged, error) { + var resp MessagePaidMessagePriceChanged + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageContactRegistered(data json.RawMessage) (*MessageContactRegistered, error) { var resp MessageContactRegistered @@ -17825,6 +17960,22 @@ func UnmarshalStorePaymentPurposeGiftedStars(data json.RawMessage) (*StorePaymen return &resp, err } +func UnmarshalStoreTransactionAppStore(data json.RawMessage) (*StoreTransactionAppStore, error) { + var resp StoreTransactionAppStore + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoreTransactionGooglePlay(data json.RawMessage) (*StoreTransactionGooglePlay, error) { + var resp StoreTransactionGooglePlay + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalTelegramPaymentPurposePremiumGift(data json.RawMessage) (*TelegramPaymentPurposePremiumGift, error) { var resp TelegramPaymentPurposePremiumGift @@ -21377,6 +21528,14 @@ func UnmarshalUpdateForumTopicInfo(data json.RawMessage) (*UpdateForumTopicInfo, return &resp, err } +func UnmarshalUpdateForumTopic(data json.RawMessage) (*UpdateForumTopic, error) { + var resp UpdateForumTopic + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateScopeNotificationSettings(data json.RawMessage) (*UpdateScopeNotificationSettings, error) { var resp UpdateScopeNotificationSettings @@ -21809,6 +21968,14 @@ func UnmarshalUpdateConnectionState(data json.RawMessage) (*UpdateConnectionStat return &resp, err } +func UnmarshalUpdateFreezeState(data json.RawMessage) (*UpdateFreezeState, error) { + var resp UpdateFreezeState + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateTermsOfService(data json.RawMessage) (*UpdateTermsOfService, error) { var resp UpdateTermsOfService @@ -22341,6 +22508,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeAuthorizationStateWaitPhoneNumber: return UnmarshalAuthorizationStateWaitPhoneNumber(data) + case TypeAuthorizationStateWaitPremiumPurchase: + return UnmarshalAuthorizationStateWaitPremiumPurchase(data) + case TypeAuthorizationStateWaitEmailAddress: return UnmarshalAuthorizationStateWaitEmailAddress(data) @@ -22617,6 +22787,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeBusinessGreetingMessageSettings: return UnmarshalBusinessGreetingMessageSettings(data) + case TypeBusinessBotRights: + return UnmarshalBusinessBotRights(data) + case TypeBusinessConnectedBot: return UnmarshalBusinessConnectedBot(data) @@ -22779,6 +22952,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarGiveawayPaymentOptions: return UnmarshalStarGiveawayPaymentOptions(data) + case TypeAcceptedGiftTypes: + return UnmarshalAcceptedGiftTypes(data) + + case TypeGiftSettings: + return UnmarshalGiftSettings(data) + case TypeUpgradedGiftModel: return UnmarshalUpgradedGiftModel(data) @@ -22914,6 +23093,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarTransactionTypePremiumPurchase: return UnmarshalStarTransactionTypePremiumPurchase(data) + case TypeStarTransactionTypeBusinessBotTransferSend: + return UnmarshalStarTransactionTypeBusinessBotTransferSend(data) + + case TypeStarTransactionTypeBusinessBotTransferReceive: + return UnmarshalStarTransactionTypeBusinessBotTransferReceive(data) + case TypeStarTransactionTypeUnsupported: return UnmarshalStarTransactionTypeUnsupported(data) @@ -23334,23 +23519,29 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSponsoredMessages: return UnmarshalSponsoredMessages(data) + case TypeSponsoredChat: + return UnmarshalSponsoredChat(data) + + case TypeSponsoredChats: + return UnmarshalSponsoredChats(data) + case TypeReportOption: return UnmarshalReportOption(data) - case TypeReportChatSponsoredMessageResultOk: - return UnmarshalReportChatSponsoredMessageResultOk(data) + case TypeReportSponsoredResultOk: + return UnmarshalReportSponsoredResultOk(data) - case TypeReportChatSponsoredMessageResultFailed: - return UnmarshalReportChatSponsoredMessageResultFailed(data) + case TypeReportSponsoredResultFailed: + return UnmarshalReportSponsoredResultFailed(data) - case TypeReportChatSponsoredMessageResultOptionRequired: - return UnmarshalReportChatSponsoredMessageResultOptionRequired(data) + case TypeReportSponsoredResultOptionRequired: + return UnmarshalReportSponsoredResultOptionRequired(data) - case TypeReportChatSponsoredMessageResultAdsHidden: - return UnmarshalReportChatSponsoredMessageResultAdsHidden(data) + case TypeReportSponsoredResultAdsHidden: + return UnmarshalReportSponsoredResultAdsHidden(data) - case TypeReportChatSponsoredMessageResultPremiumRequired: - return UnmarshalReportChatSponsoredMessageResultPremiumRequired(data) + case TypeReportSponsoredResultPremiumRequired: + return UnmarshalReportSponsoredResultPremiumRequired(data) case TypeFileDownload: return UnmarshalFileDownload(data) @@ -24465,6 +24656,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageRefundedUpgradedGift: return UnmarshalMessageRefundedUpgradedGift(data) + case TypeMessagePaidMessagesRefunded: + return UnmarshalMessagePaidMessagesRefunded(data) + + case TypeMessagePaidMessagePriceChanged: + return UnmarshalMessagePaidMessagePriceChanged(data) + case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) @@ -25764,6 +25961,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStorePaymentPurposeGiftedStars: return UnmarshalStorePaymentPurposeGiftedStars(data) + case TypeStoreTransactionAppStore: + return UnmarshalStoreTransactionAppStore(data) + + case TypeStoreTransactionGooglePlay: + return UnmarshalStoreTransactionGooglePlay(data) + case TypeTelegramPaymentPurposePremiumGift: return UnmarshalTelegramPaymentPurposePremiumGift(data) @@ -27096,6 +27299,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateForumTopicInfo: return UnmarshalUpdateForumTopicInfo(data) + case TypeUpdateForumTopic: + return UnmarshalUpdateForumTopic(data) + case TypeUpdateScopeNotificationSettings: return UnmarshalUpdateScopeNotificationSettings(data) @@ -27258,6 +27464,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateConnectionState: return UnmarshalUpdateConnectionState(data) + case TypeUpdateFreezeState: + return UnmarshalUpdateFreezeState(data) + case TypeUpdateTermsOfService: return UnmarshalUpdateTermsOfService(data) diff --git a/data/td_api.tl b/data/td_api.tl index 8872945..9247a4e 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -129,6 +129,10 @@ authorizationStateWaitTdlibParameters = AuthorizationState; //@description TDLib needs the user's phone number to authorize. Call setAuthenticationPhoneNumber to provide the phone number, or use requestQrCodeAuthentication or checkAuthenticationBotToken for other authentication options authorizationStateWaitPhoneNumber = AuthorizationState; +//@description The user must buy Telegram Premium as an in-store purchase to log in. Call checkAuthenticationPremiumPurchase and then setAuthenticationPremiumPurchaseTransaction +//@store_product_id Identifier of the store product that must be bought +authorizationStateWaitPremiumPurchase store_product_id:string = AuthorizationState; + //@description TDLib needs the user's email address to authorize. Call setAuthenticationEmailAddress to provide the email address, or directly call checkAuthenticationEmailCode with Apple ID/Google ID token if allowed //@allow_apple_id True, if authorization through Apple ID is allowed //@allow_google_id True, if authorization through Google ID is allowed @@ -681,11 +685,28 @@ businessAwayMessageSettings shortcut_id:int32 recipients:businessRecipients sche //@inactivity_days The number of days after which a chat will be considered as inactive; currently, must be on of 7, 14, 21, or 28 businessGreetingMessageSettings shortcut_id:int32 recipients:businessRecipients inactivity_days:int32 = BusinessGreetingMessageSettings; +//@description Describes rights of a business bot +//@can_reply True, if the bot can send and edit messages in the private chats that had incoming messages in the last 24 hours +//@can_read_messages True, if the bot can mark incoming private messages as read +//@can_delete_sent_messages True, if the bot can delete sent messages +//@can_delete_all_messages True, if the bot can delete any message +//@can_edit_name True, if the bot can edit name of the business account +//@can_edit_bio True, if the bot can edit bio of the business account +//@can_edit_profile_photo True, if the bot can edit profile photo of the business account +//@can_edit_username True, if the bot can edit username of the business account +//@can_view_gifts_and_stars True, if the bot can view gifts and amount of Telegram Stars owned by the business account +//@can_sell_gifts True, if the bot can sell regular gifts received by the business account +//@can_change_gift_settings True, if the bot can change gift receiving settings of the business account +//@can_transfer_and_upgrade_gifts True, if the bot can transfer and upgrade gifts received by the business account +//@can_transfer_stars True, if the bot can transfer Telegram Stars received by the business account to account of the bot, or use them to upgrade and transfer gifts +//@can_manage_stories True, if the bot can send, edit and delete stories +businessBotRights can_reply:Bool can_read_messages:Bool can_delete_sent_messages:Bool can_delete_all_messages:Bool can_edit_name:Bool can_edit_bio:Bool can_edit_profile_photo:Bool can_edit_username:Bool can_view_gifts_and_stars:Bool can_sell_gifts:Bool can_change_gift_settings:Bool can_transfer_and_upgrade_gifts:Bool can_transfer_stars:Bool can_manage_stories:Bool = BusinessBotRights; + //@description Describes a bot connected to a business account //@bot_user_id User identifier of the bot //@recipients Private chats that will be accessible to the bot -//@can_reply True, if the bot can send messages to the private chats; false otherwise -businessConnectedBot bot_user_id:int53 recipients:businessRecipients can_reply:Bool = BusinessConnectedBot; +//@rights Rights of the bot +businessConnectedBot bot_user_id:int53 recipients:businessRecipients rights:businessBotRights = BusinessConnectedBot; //@description Describes settings for a business account start page //@title Title text of the start page @@ -1040,16 +1061,28 @@ starGiveawayPaymentOption currency:string amount:int53 star_count:int53 store_pr starGiveawayPaymentOptions options:vector = StarGiveawayPaymentOptions; +//@description Describes gift types that are accepted by a user +//@unlimited_gifts True, if unlimited regular gifts are accepted +//@limited_gifts True, if limited regular gifts are accepted +//@upgraded_gifts True, if upgraded gifts and regular gifts that can be upgraded for free are accepted +//@premium_subscription True, if Telegram Premium subscription is accepted +acceptedGiftTypes unlimited_gifts:Bool limited_gifts:Bool upgraded_gifts:Bool premium_subscription:Bool = AcceptedGiftTypes; + +//@description Contains settings for gift receiving for a user +//@show_gift_button True, if a button for sending a gift to the user or by the user must always be shown in the input field +//@accepted_gift_types Types of gifts accepted by the user; for Telegram Premium users only +giftSettings show_gift_button:Bool accepted_gift_types:acceptedGiftTypes = GiftSettings; + //@description Describes a model of an upgraded gift //@name Name of the model //@sticker The sticker representing the upgraded gift -//@rarity_per_mille The number of upgraded gift that receive this model for each 1000 gifts upgraded +//@rarity_per_mille The number of upgraded gifts that receive this model for each 1000 gifts upgraded upgradedGiftModel name:string sticker:sticker rarity_per_mille:int32 = UpgradedGiftModel; //@description Describes a symbol shown on the pattern of an upgraded gift //@name Name of the symbol -//@sticker The sticker representing the upgraded gift -//@rarity_per_mille The number of upgraded gift that receive this symbol for each 1000 gifts upgraded +//@sticker The sticker representing the symbol +//@rarity_per_mille The number of upgraded gifts that receive this symbol for each 1000 gifts upgraded upgradedGiftSymbol name:string sticker:sticker rarity_per_mille:int32 = UpgradedGiftSymbol; //@description Describes colors of a backdrop of an upgraded gift @@ -1062,7 +1095,7 @@ upgradedGiftBackdropColors center_color:int32 edge_color:int32 symbol_color:int3 //@description Describes a backdrop of an upgraded gift //@name Name of the backdrop //@colors Colors of the backdrop -//@rarity_per_mille The number of upgraded gift that receive this backdrop for each 1000 gifts upgraded +//@rarity_per_mille The number of upgraded gifts that receive this backdrop for each 1000 gifts upgraded upgradedGiftBackdrop name:string colors:upgradedGiftBackdropColors rarity_per_mille:int32 = UpgradedGiftBackdrop; //@description Describes the original details about the gift @@ -1096,9 +1129,9 @@ gifts gifts:vector = Gifts; //@total_upgraded_count Total number of gifts that were upgraded from the same gift //@max_upgraded_count The maximum number of gifts that can be upgraded from the same gift //@owner_id Identifier of the user or the chat that owns the upgraded gift; may be null if none or unknown -//@owner_address Address of the gift NFT owner in TON blockchain; may be empty if none +//@owner_address Address of the gift NFT owner in TON blockchain; may be empty if none. Append the address to getOption("ton_blockchain_explorer_url") to get a link with information about the address //@owner_name Name of the owner for the case when owner identifier and address aren't known -//@gift_address Address of the gift NFT in TON blockchain; may be empty if none +//@gift_address Address of the gift NFT in TON blockchain; may be empty if none. Append the address to getOption("ton_blockchain_explorer_url") to get a link with information about the address //@model Model of the upgraded gift //@symbol Symbol of the upgraded gift //@backdrop Backdrop of the upgraded gift @@ -1296,12 +1329,18 @@ starTransactionTypePaidMessageSend chat_id:int53 message_count:int32 = StarTrans //@commission_star_amount The amount of Telegram Stars that were received by Telegram; can be negative for refunds starTransactionTypePaidMessageReceive sender_id:MessageSender message_count:int32 commission_per_mille:int32 commission_star_amount:starAmount = StarTransactionType; -//@description The transaction is a purchase of Telegram Premium subscription; for regular users only +//@description The transaction is a purchase of Telegram Premium subscription; for regular users and bots only //@user_id Identifier of the user that received the Telegram Premium subscription //@month_count Number of months the Telegram Premium subscription will be active //@sticker A sticker to be shown in the transaction information; may be null if unknown starTransactionTypePremiumPurchase user_id:int53 month_count:int32 sticker:sticker = StarTransactionType; +//@description The transaction is a transfer of Telegram Stars to a business bot; for regular users only @user_id Identifier of the bot that received Telegram Stars +starTransactionTypeBusinessBotTransferSend user_id:int53 = StarTransactionType; + +//@description The transaction is a transfer of Telegram Stars from a business account; for bots only @user_id Identifier of the user that sent Telegram Stars +starTransactionTypeBusinessBotTransferReceive user_id:int53 = StarTransactionType; + //@description The transaction is a transaction of an unsupported type starTransactionTypeUnsupported = StarTransactionType; @@ -1507,10 +1546,11 @@ botInfo short_description:string description:string photo:photo animation:animat //@group_in_common_count Number of group chats where both the other user and the current user are a member; 0 for the current user //@incoming_paid_message_star_count Number of Telegram Stars that must be paid by the user for each sent message to the current user //@outgoing_paid_message_star_count Number of Telegram Stars that must be paid by the current user for each sent message to the user +//@gift_settings Settings for gift receiving for the user //@bot_verification Information about verification status of the user provided by a bot; may be null if none or unknown //@business_info Information about business settings for Telegram Business accounts; may be null if none //@bot_info For bots, information about the bot; may be null if the user isn't a bot -userFullInfo personal_photo:chatPhoto photo:chatPhoto public_photo:chatPhoto block_list:BlockList can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool has_private_forwards:Bool has_restricted_voice_and_video_note_messages:Bool has_posted_to_profile_stories:Bool has_sponsored_messages_enabled:Bool need_phone_number_privacy_exception:Bool set_chat_background:Bool bio:formattedText birthdate:birthdate personal_chat_id:int53 gift_count:int32 group_in_common_count:int32 incoming_paid_message_star_count:int53 outgoing_paid_message_star_count:int53 bot_verification:botVerification business_info:businessInfo bot_info:botInfo = UserFullInfo; +userFullInfo personal_photo:chatPhoto photo:chatPhoto public_photo:chatPhoto block_list:BlockList can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool has_private_forwards:Bool has_restricted_voice_and_video_note_messages:Bool has_posted_to_profile_stories:Bool has_sponsored_messages_enabled:Bool need_phone_number_privacy_exception:Bool set_chat_background:Bool bio:formattedText birthdate:birthdate personal_chat_id:int53 gift_count:int32 group_in_common_count:int32 incoming_paid_message_star_count:int53 outgoing_paid_message_star_count:int53 gift_settings:giftSettings bot_verification:botVerification business_info:businessInfo bot_info:botInfo = UserFullInfo; //@description Represents a list of users @total_count Approximate total number of users found @user_ids A list of user identifiers users total_count:int32 user_ids:vector = Users; @@ -2193,27 +2233,37 @@ sponsoredMessage message_id:int53 is_recommended:Bool can_be_reported:Bool conte //@description Contains a list of sponsored messages @messages List of sponsored messages @messages_between The minimum number of messages between shown sponsored messages, or 0 if only one sponsored message must be shown after all ordinary messages sponsoredMessages messages:vector messages_between:int32 = SponsoredMessages; +//@description Describes a sponsored chat +//@unique_id Unique identifier of this result +//@chat_id Chat identifier +//@sponsor_info Additional optional information about the sponsor to be shown along with the chat +//@additional_info If non-empty, additional information about the sponsored chat to be shown along with the chat +sponsoredChat unique_id:int53 chat_id:int53 sponsor_info:string additional_info:string = SponsoredChat; + +//@description Contains a list of sponsored chats @chats List of sponsored chats +sponsoredChats chats:vector = SponsoredChats; + //@description Describes an option to report an entity to Telegram @id Unique identifier of the option @text Text of the option reportOption id:bytes text:string = ReportOption; -//@class ReportChatSponsoredMessageResult @description Describes result of sponsored message report +//@class ReportSponsoredResult @description Describes result of sponsored message or chat report //@description The message was reported successfully -reportChatSponsoredMessageResultOk = ReportChatSponsoredMessageResult; +reportSponsoredResultOk = ReportSponsoredResult; //@description The sponsored message is too old or not found -reportChatSponsoredMessageResultFailed = ReportChatSponsoredMessageResult; +reportSponsoredResultFailed = ReportSponsoredResult; //@description The user must choose an option to report the message and repeat request with the chosen option @title Title for the option choice @options List of available options -reportChatSponsoredMessageResultOptionRequired title:string options:vector = ReportChatSponsoredMessageResult; +reportSponsoredResultOptionRequired title:string options:vector = ReportSponsoredResult; //@description Sponsored messages were hidden for the user in all chats -reportChatSponsoredMessageResultAdsHidden = ReportChatSponsoredMessageResult; +reportSponsoredResultAdsHidden = ReportSponsoredResult; //@description The user asked to hide sponsored messages, but Telegram Premium is required for this -reportChatSponsoredMessageResultPremiumRequired = ReportChatSponsoredMessageResult; +reportSponsoredResultPremiumRequired = ReportSponsoredResult; //@description Describes a file added to file download list @@ -2774,6 +2824,7 @@ savedMessagesTopic id:int53 type:SavedMessagesTopicType is_pinned:Bool order:int forumTopicIcon color:int32 custom_emoji_id:int64 = ForumTopicIcon; //@description Contains basic information about a forum topic +//@chat_id Identifier of the forum chat to which the topic belongs //@message_thread_id Message thread identifier of the topic //@name Name of the topic //@icon Icon of the topic @@ -2783,11 +2834,12 @@ forumTopicIcon color:int32 custom_emoji_id:int64 = ForumTopicIcon; //@is_outgoing True, if the topic was created by the current user //@is_closed True, if the topic is closed //@is_hidden True, if the topic is hidden above the topic list and closed; for General topic only -forumTopicInfo message_thread_id:int53 name:string icon:forumTopicIcon creation_date:int32 creator_id:MessageSender is_general:Bool is_outgoing:Bool is_closed:Bool is_hidden:Bool = ForumTopicInfo; +forumTopicInfo chat_id:int53 message_thread_id:int53 name:string icon:forumTopicIcon creation_date:int32 creator_id:MessageSender is_general:Bool is_outgoing:Bool is_closed:Bool is_hidden:Bool = ForumTopicInfo; //@description Describes a forum topic //@info Basic information about the topic //@last_message Last message in the topic; may be null if unknown +//@order A parameter used to determine order of the topic in the topic list. Topics must be sorted by the order in descending order //@is_pinned True, if the topic is pinned in the topic list //@unread_count Number of unread messages in the topic //@last_read_inbox_message_id Identifier of the last read incoming message @@ -2796,7 +2848,7 @@ forumTopicInfo message_thread_id:int53 name:string icon:forumTopicIcon creation_ //@unread_reaction_count Number of messages with unread reactions in the topic //@notification_settings Notification settings for the topic //@draft_message A draft of a message in the topic; may be null if none -forumTopic info:forumTopicInfo last_message:message is_pinned:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 unread_reaction_count:int32 notification_settings:chatNotificationSettings draft_message:draftMessage = ForumTopic; +forumTopic info:forumTopicInfo last_message:message order:int64 is_pinned:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 unread_reaction_count:int32 notification_settings:chatNotificationSettings draft_message:draftMessage = ForumTopic; //@description Describes a list of forum topics //@total_count Approximate total number of forum topics found @@ -4138,6 +4190,12 @@ messageUpgradedGift gift:upgradedGift sender_id:MessageSender received_gift_id:s //@is_upgrade True, if the gift was obtained by upgrading of a previously received gift messageRefundedUpgradedGift gift:gift sender_id:MessageSender is_upgrade:Bool = MessageContent; +//@description Paid messages were refunded @message_count The number of refunded messages @star_count The number of refunded Telegram Stars +messagePaidMessagesRefunded message_count:int32 star_count:int53 = MessageContent; + +//@description A price for paid messages was changed in the supergroup chat @paid_message_star_count The new number of Telegram Stars that must be paid by non-administrator users of the supergroup chat for each sent message +messagePaidMessagePriceChanged paid_message_star_count:int53 = MessageContent; + //@description A contact has registered with Telegram messageContactRegistered = MessageContent; @@ -5469,9 +5527,9 @@ speechRecognitionResultError error:error = SpeechRecognitionResult; //@user_id Identifier of the business user that created the connection //@user_chat_id Chat identifier of the private chat with the user //@date Point in time (Unix timestamp) when the connection was established -//@can_reply True, if the bot can send messages to the connected user; false otherwise +//@rights Rights of the bot; may be null if the connection was disabled //@is_enabled True, if the connection is enabled; false otherwise -businessConnection id:string user_id:int53 user_chat_id:int53 date:int32 can_reply:Bool is_enabled:Bool = BusinessConnection; +businessConnection id:string user_id:int53 user_chat_id:int53 date:int32 rights:businessBotRights is_enabled:Bool = BusinessConnection; //@description Describes a color to highlight a bot added to attachment menu @light_color Color in the RGB format for light themes @dark_color Color in the RGB format for dark themes @@ -6350,10 +6408,22 @@ storePaymentPurposeStars currency:string amount:int53 star_count:int53 = StorePa storePaymentPurposeGiftedStars user_id:int53 currency:string amount:int53 star_count:int53 = StorePaymentPurpose; +//@class StoreTransaction @description Describes an in-store transaction + +//@description A purchase through App Store @receipt App Store receipt +storeTransactionAppStore receipt:bytes = StoreTransaction; + +//@description A purchase through Google Play +//@package_name Application package name +//@store_product_id Identifier of the purchased store product +//@purchase_token Google Play purchase token +storeTransactionGooglePlay package_name:string store_product_id:string purchase_token:string = StoreTransaction; + + //@class TelegramPaymentPurpose @description Describes a purpose of a payment toward Telegram //@description The user gifting Telegram Premium to another user -//@currency ISO 4217 currency code of the payment currency +//@currency ISO 4217 currency code of the payment currency, or "XTR" for payments in Telegram Stars //@amount Paid amount, in the smallest units of the currency //@user_id Identifier of the user which will receive Telegram Premium //@month_count Number of months the Telegram Premium subscription will be active for the user @@ -6975,7 +7045,8 @@ readDatePrivacySettings show_read_date:Bool = ReadDatePrivacySettings; //@description Contains privacy settings for chats with non-contacts //@allow_new_chats_from_unknown_users True, if non-contacts users are able to write first to the current user. Telegram Premium subscribers are able to write first regardless of this setting //@incoming_paid_message_star_count Number of Telegram Stars that must be paid for every incoming private message by non-contacts; 0-getOption("paid_message_star_count_max"). -//-If positive, then allow_new_chats_from_unknown_users must be true. The current user will receive getOption("paid_message_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for message sending +//-If positive, then allow_new_chats_from_unknown_users must be true. The current user will receive getOption("paid_message_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for message sending. +//-Can be positive, only if getOption("can_enable_paid_messages") is true newChatPrivacySettings allow_new_chats_from_unknown_users:Bool incoming_paid_message_star_count:int53 = NewChatPrivacySettings; @@ -8281,8 +8352,16 @@ updateQuickReplyShortcuts shortcut_ids:vector = Update; //@messages The new list of quick reply messages for the shortcut in order from the first to the last sent updateQuickReplyShortcutMessages shortcut_id:int32 messages:vector = Update; -//@description Basic information about a topic in a forum chat was changed @chat_id Chat identifier @info New information about the topic -updateForumTopicInfo chat_id:int53 info:forumTopicInfo = Update; +//@description Basic information about a topic in a forum chat was changed @info New information about the topic +updateForumTopicInfo info:forumTopicInfo = Update; + +//@description Information about a topic in a forum chat was changed +//@chat_id Chat identifier +//@message_thread_id Message thread identifier of the topic +//@is_pinned True, if the topic is pinned in the topic list +//@last_read_outbox_message_id Identifier of the last read outgoing message +//@notification_settings Notification settings for the topic +updateForumTopic chat_id:int53 message_thread_id:int53 is_pinned:Bool last_read_outbox_message_id:int53 notification_settings:chatNotificationSettings = Update; //@description Notification settings for some type of chats were updated @scope Types of chats for which notification settings were updated @notification_settings The new notification settings updateScopeNotificationSettings scope:NotificationSettingsScope notification_settings:scopeNotificationSettings = Update; @@ -8510,6 +8589,13 @@ updateLanguagePackStrings localization_target:string language_pack_id:string str //@description The connection state has changed. This update must be used only to show a human-readable description of the connection state @state The new connection state updateConnectionState state:ConnectionState = Update; +//@description The freeze state of the current user's account has changed +//@is_frozen True, if the account is frozen +//@freezing_date Point in time (Unix timestamp) when the account was frozen; 0 if the account isn't frozen +//@deletion_date Point in time (Unix timestamp) when the account will be deleted and can't be unfrozen; 0 if the account isn't frozen +//@appeal_link The link to open to send an appeal to unfreeze the account +updateFreezeState is_frozen:Bool freezing_date:int32 deletion_date:int32 appeal_link:string = Update; + //@description New terms of service must be accepted by the user. If the terms of service are declined, then the deleteAccount method must be called with the reason "Decline ToS update" @terms_of_service_id Identifier of the terms of service @terms_of_service The new terms of service updateTermsOfService terms_of_service_id:string terms_of_service:termsOfService = Update; @@ -8773,7 +8859,7 @@ testVectorStringObject value:vector = TestVectorStringObject; ---functions--- -//@description Returns the current authorization state; this is an offline request. For informational purposes only. Use updateAuthorizationState instead to maintain the current authorization state. Can be called before initialization +//@description Returns the current authorization state. This is an offline method. For informational purposes only. Use updateAuthorizationState instead to maintain the current authorization state. Can be called before initialization getAuthorizationState = AuthorizationState; @@ -8795,11 +8881,24 @@ getAuthorizationState = AuthorizationState; setTdlibParameters use_test_dc:Bool database_directory:string files_directory:string database_encryption_key:bytes use_file_database:Bool use_chat_info_database:Bool use_message_database:Bool use_secret_chats:Bool api_id:int32 api_hash:string system_language_code:string device_model:string system_version:string application_version:string = Ok; //@description Sets the phone number of the user and sends an authentication code to the user. Works only when the current authorization state is authorizationStateWaitPhoneNumber, -//-or if there is no pending authentication query and the current authorization state is authorizationStateWaitEmailAddress, authorizationStateWaitEmailCode, authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword +//-or if there is no pending authentication query and the current authorization state is authorizationStateWaitPremiumPurchase, authorizationStateWaitEmailAddress, +//-authorizationStateWaitEmailCode, authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword //@phone_number The phone number of the user, in international format //@settings Settings for the authentication of the user's phone number; pass null to use default settings setAuthenticationPhoneNumber phone_number:string settings:phoneNumberAuthenticationSettings = Ok; +//@description Checks whether an in-store purchase of Telegram Premium is possible before authorization. Works only when the current authorization state is authorizationStateWaitPremiumPurchase +//@currency ISO 4217 currency code of the payment currency +//@amount Paid amount, in the smallest units of the currency +checkAuthenticationPremiumPurchase currency:string amount:int53 = Ok; + +//@description Informs server about an in-store purchase of Telegram Premium before authorization. Works only when the current authorization state is authorizationStateWaitPremiumPurchase +//@transaction Information about the transaction +//@is_restore Pass true if this is a restore of a Telegram Premium purchase; only for App Store +//@currency ISO 4217 currency code of the payment currency +//@amount Paid amount, in the smallest units of the currency +setAuthenticationPremiumPurchaseTransaction transaction:StoreTransaction is_restore:Bool currency:string amount:int53 = Ok; + //@description Sets the email address of the user and sends an authentication code to the email address. Works only when the current authorization state is authorizationStateWaitEmailAddress @email_address The email address of the user setAuthenticationEmailAddress email_address:string = Ok; @@ -8815,7 +8914,8 @@ checkAuthenticationEmailCode code:EmailAddressAuthentication = Ok; checkAuthenticationCode code:string = Ok; //@description Requests QR code authentication by scanning a QR code on another logged in device. Works only when the current authorization state is authorizationStateWaitPhoneNumber, -//-or if there is no pending authentication query and the current authorization state is authorizationStateWaitEmailAddress, authorizationStateWaitEmailCode, authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword +//-or if there is no pending authentication query and the current authorization state is authorizationStateWaitPremiumPurchase, authorizationStateWaitEmailAddress, +//-authorizationStateWaitEmailCode, authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword //@other_user_ids List of user identifiers of other users currently using the application requestQrCodeAuthentication other_user_ids:vector = Ok; @@ -8945,28 +9045,28 @@ getTemporaryPasswordState = TemporaryPasswordState; //@description Returns the current user getMe = User; -//@description Returns information about a user by their identifier. This is an offline request if the current user is not a bot @user_id User identifier +//@description Returns information about a user by their identifier. This is an offline method if the current user is not a bot @user_id User identifier getUser user_id:int53 = User; //@description Returns full information about a user by their identifier @user_id User identifier getUserFullInfo user_id:int53 = UserFullInfo; -//@description Returns information about a basic group by its identifier. This is an offline request if the current user is not a bot @basic_group_id Basic group identifier +//@description Returns information about a basic group by its identifier. This is an offline method if the current user is not a bot @basic_group_id Basic group identifier getBasicGroup basic_group_id:int53 = BasicGroup; //@description Returns full information about a basic group by its identifier @basic_group_id Basic group identifier getBasicGroupFullInfo basic_group_id:int53 = BasicGroupFullInfo; -//@description Returns information about a supergroup or a channel by its identifier. This is an offline request if the current user is not a bot @supergroup_id Supergroup or channel identifier +//@description Returns information about a supergroup or a channel by its identifier. This is an offline method if the current user is not a bot @supergroup_id Supergroup or channel identifier getSupergroup supergroup_id:int53 = Supergroup; //@description Returns full information about a supergroup or a channel by its identifier, cached for up to 1 minute @supergroup_id Supergroup or channel identifier getSupergroupFullInfo supergroup_id:int53 = SupergroupFullInfo; -//@description Returns information about a secret chat by its identifier. This is an offline request @secret_chat_id Secret chat identifier +//@description Returns information about a secret chat by its identifier. This is an offline method @secret_chat_id Secret chat identifier getSecretChat secret_chat_id:int32 = SecretChat; -//@description Returns information about a chat by its identifier; this is an offline request if the current user is not a bot @chat_id Chat identifier +//@description Returns information about a chat by its identifier. This is an offline method if the current user is not a bot @chat_id Chat identifier getChat chat_id:int53 = Chat; //@description Returns information about a message. Returns a 404 error if the message doesn't exist @@ -8974,7 +9074,7 @@ getChat chat_id:int53 = Chat; //@message_id Identifier of the message to get getMessage chat_id:int53 message_id:int53 = Message; -//@description Returns information about a message, if it is available without sending network request. Returns a 404 error if message isn't available locally. This is an offline request +//@description Returns information about a message, if it is available without sending network request. Returns a 404 error if message isn't available locally. This is an offline method //@chat_id Identifier of the chat the message belongs to //@message_id Identifier of the message to get getMessageLocally chat_id:int53 message_id:int53 = Message; @@ -8996,7 +9096,7 @@ getCallbackQueryMessage chat_id:int53 message_id:int53 callback_query_id:int64 = //@description Returns information about messages. If a message is not found, returns null on the corresponding position of the result @chat_id Identifier of the chat the messages belong to @message_ids Identifiers of the messages to get getMessages chat_id:int53 message_ids:vector = Messages; -//@description Returns properties of a message; this is an offline request @chat_id Chat identifier @message_id Identifier of the message +//@description Returns properties of a message. This is an offline method @chat_id Chat identifier @message_id Identifier of the message getMessageProperties chat_id:int53 message_id:int53 = MessageProperties; //@description Returns information about a message thread. Can be used only if messageProperties.can_get_message_thread == true @chat_id Chat identifier @message_id Identifier of the message @@ -9012,10 +9112,10 @@ getMessageReadDate chat_id:int53 message_id:int53 = MessageReadDate; //@message_id Identifier of the message getMessageViewers chat_id:int53 message_id:int53 = MessageViewers; -//@description Returns information about a file; this is an offline request @file_id Identifier of the file to get +//@description Returns information about a file. This is an offline method @file_id Identifier of the file to get getFile file_id:int32 = File; -//@description Returns information about a file by its remote identifier; this is an offline request. Can be used to register a URL as a file for further uploading, or sending as a message. Even the request succeeds, the file can be used only if it is still accessible to the user. +//@description Returns information about a file by its remote identifier. This is an offline method. Can be used to register a URL as a file for further uploading, or sending as a message. Even the request succeeds, the file can be used only if it is still accessible to the user. //-For example, if the file is from a message, then the message must be not deleted and accessible to the user. If the file database is disabled, then the corresponding object with the file must be preloaded by the application //@remote_file_id Remote identifier of the file to get //@file_type File type; pass null if unknown @@ -9039,7 +9139,7 @@ searchPublicChat username:string = Chat; //@query Query to search for searchPublicChats query:string = Chats; -//@description Searches for the specified query in the title and username of already known chats; this is an offline request. Returns chats in the order seen in the main chat list +//@description Searches for the specified query in the title and username of already known chats. This is an offline method. Returns chats in the order seen in the main chat list //@query Query to search for. If the query is empty, returns up to 50 recently found chats //@limit The maximum number of chats to be returned searchChats query:string limit:int32 = Chats; @@ -9082,7 +9182,7 @@ getTopChats category:TopChatCategory limit:int32 = Chats; //@description Removes a chat from the list of frequently used chats. Supported only if the chat info database is enabled @category Category of frequently used chats @chat_id Chat identifier removeTopChat category:TopChatCategory chat_id:int53 = Ok; -//@description Searches for the specified query in the title and username of up to 50 recently found chats; this is an offline request +//@description Searches for the specified query in the title and username of up to 50 recently found chats. This is an offline method //@query Query to search for //@limit The maximum number of chats to be returned searchRecentlyFoundChats query:string limit:int32 = Chats; @@ -9096,7 +9196,7 @@ removeRecentlyFoundChat chat_id:int53 = Ok; //@description Clears the list of recently found chats clearRecentlyFoundChats = Ok; -//@description Returns recently opened chats; this is an offline request. Returns chats in the order of last opening @limit The maximum number of chats to be returned +//@description Returns recently opened chats. This is an offline method. Returns chats in the order of last opening @limit The maximum number of chats to be returned getRecentlyOpenedChats limit:int32 = Chats; //@description Checks whether a username can be set for a chat @chat_id Chat identifier; must be identifier of a supergroup chat, or a channel chat, or a private chat with self, or 0 if the chat is being created @username Username to be checked @@ -9162,7 +9262,7 @@ getGroupsInCommon user_id:int53 offset_chat_id:int53 limit:int32 = Chats; //@description Returns messages in a chat. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id). -//-For optimal performance, the number of returned messages is chosen by TDLib. This is an offline request if only_local is true +//-For optimal performance, the number of returned messages is chosen by TDLib. This is an offline method if only_local is true //@chat_id Chat identifier //@from_message_id Identifier of the message starting from which history must be fetched; use 0 to get results from the last message //@offset Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages @@ -9344,7 +9444,21 @@ clickChatSponsoredMessage chat_id:int53 message_id:int53 is_media_click:Bool fro //@chat_id Chat identifier of the sponsored message //@message_id Identifier of the sponsored message //@option_id Option identifier chosen by the user; leave empty for the initial request -reportChatSponsoredMessage chat_id:int53 message_id:int53 option_id:bytes = ReportChatSponsoredMessageResult; +reportChatSponsoredMessage chat_id:int53 message_id:int53 option_id:bytes = ReportSponsoredResult; + +//@description Returns sponsored chats to be shown in the search results @query Query the user searches for +getSearchSponsoredChats query:string = SponsoredChats; + +//@description Informs TDLib that the user fully viewed a sponsored chat @sponsored_chat_unique_id Unique identifier of the sponsored chat +viewSponsoredChat sponsored_chat_unique_id:int53 = Ok; + +//@description Informs TDLib that the user opened a sponsored chat @sponsored_chat_unique_id Unique identifier of the sponsored chat +openSponsoredChat sponsored_chat_unique_id:int53 = Ok; + +//@description Reports a sponsored chat to Telegram moderators +//@sponsored_chat_unique_id Unique identifier of the sponsored chat +//@option_id Option identifier chosen by the user; leave empty for the initial request +reportSponsoredChat sponsored_chat_unique_id:int53 option_id:bytes = ReportSponsoredResult; //@description Removes an active notification from notification list. Needs to be called only if the notification is removed by the current user @notification_group_id Identifier of notification group to which the notification belongs @notification_id Identifier of removed notification @@ -9354,7 +9468,7 @@ removeNotification notification_group_id:int32 notification_id:int32 = Ok; removeNotificationGroup notification_group_id:int32 max_notification_id:int32 = Ok; -//@description Returns an HTTPS link to a message in a chat. Available only if messageProperties.can_get_link, or if messageProperties.can_get_media_timestamp_links and a media timestamp link is generated. This is an offline request +//@description Returns an HTTPS link to a message in a chat. Available only if messageProperties.can_get_link, or if messageProperties.can_get_media_timestamp_links and a media timestamp link is generated. This is an offline method //@chat_id Identifier of the chat to which the message belongs //@message_id Identifier of the message //@media_timestamp If not 0, timestamp from which the video/audio/video note/voice note/story playing must start, in seconds. The media can be in the message content or in its link preview @@ -9663,6 +9777,66 @@ stopBusinessPoll business_connection_id:string chat_id:int53 message_id:int53 re //@is_pinned Pass true to pin the message, pass false to unpin it setBusinessMessageIsPinned business_connection_id:string chat_id:int53 message_id:int53 is_pinned:Bool = Ok; +//@description Reads a message on behalf of a business account; for bots only +//@business_connection_id Unique identifier of business connection through which the message was received +//@chat_id The chat the message belongs to +//@message_id Identifier of the message +readBusinessMessage business_connection_id:string chat_id:int53 message_id:int53 = Ok; + +//@description Deletes messages on behalf of a business account; for bots only +//@business_connection_id Unique identifier of business connection through which the messages were received +//@message_ids Identifier of the messages +deleteBusinessMessages business_connection_id:string message_ids:vector = Ok; + +//@description Changes a story sent by the bot on behalf of a business account; for bots only +//@story_sender_chat_id Identifier of the chat that posted the story +//@story_id Identifier of the story to edit +//@content New content of the story +//@areas New clickable rectangle areas to be shown on the story media +//@caption New story caption +//@privacy_settings The new privacy settings for the story +editBusinessStory story_sender_chat_id:int53 story_id:int32 content:InputStoryContent areas:inputStoryAreas caption:formattedText privacy_settings:StoryPrivacySettings = Story; + +//@description Deletes a story sent by the bot on behalf of a business account; for bots only +//@business_connection_id Unique identifier of business connection +//@story_id Identifier of the story to delete +deleteBusinessStory business_connection_id:string story_id:int32 = Ok; + +//@description Changes the first and last name of a business account; for bots only +//@business_connection_id Unique identifier of business connection +//@first_name The new value of the first name for the business account; 1-64 characters +//@last_name The new value of the optional last name for the business account; 0-64 characters +setBusinessAccountName business_connection_id:string first_name:string last_name:string = Ok; + +//@description Changes the bio of a business account; for bots only +//@business_connection_id Unique identifier of business connection +//@bio The new value of the bio; 0-getOption("bio_length_max") characters without line feeds +setBusinessAccountBio business_connection_id:string bio:string = Ok; + +//@description Changes a profile photo of a business account; for bots only +//@business_connection_id Unique identifier of business connection +//@photo Profile photo to set; pass null to remove the photo +//@is_public Pass true to set the public photo, which will be visible even the main photo is hidden by privacy settings +setBusinessAccountProfilePhoto business_connection_id:string photo:InputChatPhoto is_public:Bool = Ok; + +//@description Changes the editable username of a business account; for bots only +//@business_connection_id Unique identifier of business connection +//@username The new value of the username +setBusinessAccountUsername business_connection_id:string username:string = Ok; + +//@description Changes settings for gift receiving of a business account; for bots only +//@business_connection_id Unique identifier of business connection +//@settings The new settings +setBusinessAccountGiftSettings business_connection_id:string settings:giftSettings = Ok; + +//@description Returns the amount of Telegram Stars owned by a business account; for bots only @business_connection_id Unique identifier of business connection +getBusinessAccountStarAmount business_connection_id:string = StarAmount; + +//@description Transfer Telegram Stars from the business account to the business bot; for bots only +//@business_connection_id Unique identifier of business connection +//@star_count Number of Telegram Stars to transfer +transferBusinessAccountStars business_connection_id:string star_count:int53 = Ok; + //@description Checks validness of a name for a quick reply shortcut. Can be called synchronously @name The name of the shortcut; 1-32 characters checkQuickReplyShortcutName name:string = Ok; @@ -9745,7 +9919,7 @@ editForumTopic chat_id:int53 message_thread_id:int53 name:string edit_icon_custo //@description Returns information about a forum topic @chat_id Identifier of the chat @message_thread_id Message thread identifier of the forum topic getForumTopic chat_id:int53 message_thread_id:int53 = ForumTopic; -//@description Returns an HTTPS link to a topic in a forum chat. This is an offline request @chat_id Identifier of the chat @message_thread_id Message thread identifier of the forum topic +//@description Returns an HTTPS link to a topic in a forum chat. This is an offline method @chat_id Identifier of the chat @message_thread_id Message thread identifier of the forum topic getForumTopicLink chat_id:int53 message_thread_id:int53 = MessageLink; //@description Returns found forum topics in a forum chat. This is a temporary method for getting information about topic list from the server @@ -10025,7 +10199,7 @@ getGrossingWebAppBots offset:string limit:int32 = FoundUsers; //@web_app_short_name Short name of the Web App searchWebApp bot_user_id:int53 web_app_short_name:string = FoundWebApp; -//@description Returns a default placeholder for Web Apps of a bot; this is an offline request. Returns a 404 error if the placeholder isn't known @bot_user_id Identifier of the target bot +//@description Returns a default placeholder for Web Apps of a bot. This is an offline method. Returns a 404 error if the placeholder isn't known @bot_user_id Identifier of the target bot getWebAppPlaceholder bot_user_id:int53 = Outline; //@description Returns an HTTPS URL of a Web App to open after a link of the type internalLinkTypeWebApp is clicked @@ -10227,7 +10401,7 @@ createNewSecretChat user_id:int53 = Chat; upgradeBasicGroupChatToSupergroupChat chat_id:int53 = Chat; -//@description Returns chat lists to which the chat can be added. This is an offline request @chat_id Chat identifier +//@description Returns chat lists to which the chat can be added. This is an offline method @chat_id Chat identifier getChatListsToAddChat chat_id:int53 = ChatLists; //@description Adds a chat to a chat list. A chat can't be simultaneously in Main and Archive chat lists, so it is automatically removed from another one if needed @@ -10692,12 +10866,12 @@ activateStoryStealthMode = Ok; getStoryPublicForwards story_sender_chat_id:int53 story_id:int32 offset:string limit:int32 = PublicForwards; -//@description Returns the list of features available on the specific chat boost level; this is an offline request +//@description Returns the list of features available on the specific chat boost level. This is an offline method //@is_channel Pass true to get the list of features for channels; pass false to get the list of features for supergroups //@level Chat boost level getChatBoostLevelFeatures is_channel:Bool level:int32 = ChatBoostLevelFeatures; -//@description Returns the list of features available for different chat boost levels; this is an offline request +//@description Returns the list of features available for different chat boost levels. This is an offline method //@is_channel Pass true to get the list of features for channels; pass false to get the list of features for supergroups getChatBoostFeatures is_channel:Bool = ChatBoostFeatures; @@ -11233,7 +11407,7 @@ sharePhoneNumber user_id:int53 = Ok; getUserProfilePhotos user_id:int53 offset:int32 limit:int32 = ChatPhotos; -//@description Returns outline of a sticker; this is an offline request. Returns a 404 error if the outline isn't known +//@description Returns outline of a sticker. This is an offline method. Returns a 404 error if the outline isn't known //@sticker_file_id File identifier of the sticker //@for_animated_emoji Pass true to get the outline scaled for animated emoji //@for_clicked_animated_emoji_message Pass true to get the outline scaled for clicked animated emoji message @@ -11406,7 +11580,7 @@ removeRecentHashtag hashtag:string = Ok; //@link_preview_options Options to be used for generation of the link preview; pass null to use default link preview options getLinkPreview text:formattedText link_preview_options:linkPreviewOptions = LinkPreview; -//@description Returns an instant view version of a web page if available. This is an offline request if only_local is true. Returns a 404 error if the web page has no instant view page +//@description Returns an instant view version of a web page if available. This is an offline method if only_local is true. Returns a 404 error if the web page has no instant view page //@url The web page URL //@only_local Pass true to get only locally available information without sending network requests getWebPageInstantView url:string only_local:Bool = WebPageInstantView; @@ -11414,7 +11588,7 @@ getWebPageInstantView url:string only_local:Bool = WebPageInstantView; //@description Changes a profile photo for the current user //@photo Profile photo to set -//@is_public Pass true to set a public photo, which will be visible even the main photo is hidden by privacy settings +//@is_public Pass true to set the public photo, which will be visible even the main photo is hidden by privacy settings setProfilePhoto photo:InputChatPhoto is_public:Bool = Ok; //@description Deletes a profile photo @profile_photo_id Identifier of the profile photo to delete @@ -11853,6 +12027,9 @@ deleteSavedOrderInfo = Ok; deleteSavedCredentials = Ok; +//@description Changes settings for gift receiving for the current user @settings The new settings +setGiftSettings settings:giftSettings = Ok; + //@description Returns gifts that can be sent to other users and channel chats getAvailableGifts = Gifts; @@ -11865,8 +12042,10 @@ getAvailableGifts = Gifts; //@pay_for_upgrade Pass true to additionally pay for the gift upgrade and allow the receiver to upgrade it for free sendGift gift_id:int64 owner_id:MessageSender text:formattedText is_private:Bool pay_for_upgrade:Bool = Ok; -//@description Sells a gift for Telegram Stars @received_gift_id Identifier of the gift -sellGift received_gift_id:string = Ok; +//@description Sells a gift for Telegram Stars +//@business_connection_id Unique identifier of business connection on behalf of which to send the request; for bots only +//@received_gift_id Identifier of the gift +sellGift business_connection_id:string received_gift_id:string = Ok; //@description Toggles whether a gift is shown on the current user's or the channel's profile page; requires can_post_messages administrator right in the channel chat //@received_gift_id Identifier of the gift @@ -11887,18 +12066,21 @@ toggleChatGiftNotifications chat_id:int53 are_enabled:Bool = Ok; getGiftUpgradePreview gift_id:int64 = GiftUpgradePreview; //@description Upgrades a regular gift +//@business_connection_id Unique identifier of business connection on behalf of which to send the request; for bots only //@received_gift_id Identifier of the gift //@keep_original_details Pass true to keep the original gift text, sender and receiver in the upgraded gift //@star_count The amount of Telegram Stars required to pay for the upgrade. It the gift has prepaid_upgrade_star_count > 0, then pass 0, otherwise, pass gift.upgrade_star_count -upgradeGift received_gift_id:string keep_original_details:Bool star_count:int53 = UpgradeGiftResult; +upgradeGift business_connection_id:string received_gift_id:string keep_original_details:Bool star_count:int53 = UpgradeGiftResult; //@description Sends an upgraded gift to another user or a channel chat +//@business_connection_id Unique identifier of business connection on behalf of which to send the request; for bots only //@received_gift_id Identifier of the gift //@new_owner_id Identifier of the user or the channel chat that will receive the gift //@star_count The amount of Telegram Stars required to pay for the transfer -transferGift received_gift_id:string new_owner_id:MessageSender star_count:int53 = Ok; +transferGift business_connection_id:string received_gift_id:string new_owner_id:MessageSender star_count:int53 = Ok; //@description Returns gifts received by the given user or chat +//@business_connection_id Unique identifier of business connection on behalf of which to send the request; for bots only //@owner_id Identifier of the gift receiver //@exclude_unsaved Pass true to exclude gifts that aren't saved to the chat's profile page. Always true for gifts received by other users and channel chats without can_post_messages administrator right //@exclude_saved Pass true to exclude gifts that are saved to the chat's profile page. Always false for gifts received by other users and channel chats without can_post_messages administrator right @@ -11908,7 +12090,7 @@ transferGift received_gift_id:string new_owner_id:MessageSender star_count:int53 //@sort_by_price Pass true to sort results by gift price instead of send date //@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results //@limit The maximum number of gifts to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned objects is chosen by TDLib and can be smaller than the specified limit -getReceivedGifts owner_id:MessageSender exclude_unsaved:Bool exclude_saved:Bool exclude_unlimited:Bool exclude_limited:Bool exclude_upgraded:Bool sort_by_price:Bool offset:string limit:int32 = ReceivedGifts; +getReceivedGifts business_connection_id:string owner_id:MessageSender exclude_unsaved:Bool exclude_saved:Bool exclude_unlimited:Bool exclude_limited:Bool exclude_upgraded:Bool sort_by_price:Bool offset:string limit:int32 = ReceivedGifts; //@description Returns information about a received gift @received_gift_id Identifier of the gift getReceivedGift received_gift_id:string = ReceivedGift; @@ -11962,7 +12144,7 @@ removeInstalledBackground background_id:int64 = Ok; resetInstalledBackgrounds = Ok; -//@description Returns information about the current localization target. This is an offline request if only_local is true. Can be called before authorization @only_local Pass true to get only locally available information without sending network requests +//@description Returns information about the current localization target. This is an offline method if only_local is true. Can be called before authorization @only_local Pass true to get only locally available information without sending network requests getLocalizationTargetInfo only_local:Bool = LocalizationTargetInfo; //@description Returns information about a language pack. Returned language pack identifier may be different from a provided one. Can be called before authorization @language_pack_id Language pack identifier @@ -12401,6 +12583,13 @@ checkPremiumGiftCode code:string = PremiumGiftCodeInfo; //@description Applies a Telegram Premium gift code @code The code to apply applyPremiumGiftCode code:string = Ok; +//@description Allows to buy a Telegram Premium subscription for another user with payment in Telegram Stars; for bots only +//@user_id Identifier of the user which will receive Telegram Premium +//@star_count The number of Telegram Stars to pay for subscription +//@month_count Number of months the Telegram Premium subscription will be active for the user +//@text Text to show to the user receiving Telegram Premium; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed +giftPremiumWithStars user_id:int53 star_count:int53 month_count:int32 text:formattedText = Ok; + //@description Launches a prepaid giveaway //@giveaway_id Unique identifier of the prepaid giveaway //@parameters Giveaway parameters @@ -12436,18 +12625,11 @@ getStarTransactions owner_id:MessageSender subscription_id:string direction:Star //@offset Offset of the first subscription to return as received from the previous request; use empty string to get the first chunk of results getStarSubscriptions only_expiring:Bool offset:string = StarSubscriptions; -//@description Checks whether an in-store purchase is possible. Must be called before any in-store purchase @purpose Transaction purpose +//@description Checks whether an in-store purchase is possible. Must be called before any in-store purchase. For official applications only @purpose Transaction purpose canPurchaseFromStore purpose:StorePaymentPurpose = Ok; -//@description Informs server about a purchase through App Store. For official applications only @receipt App Store receipt @purpose Transaction purpose -assignAppStoreTransaction receipt:bytes purpose:StorePaymentPurpose = Ok; - -//@description Informs server about a purchase through Google Play. For official applications only -//@package_name Application package name -//@store_product_id Identifier of the purchased store product -//@purchase_token Google Play purchase token -//@purpose Transaction purpose -assignGooglePlayTransaction package_name:string store_product_id:string purchase_token:string purpose:StorePaymentPurpose = Ok; +//@description Informs server about an in-store purchase. For official applications only @transaction Information about the transaction @purpose Transaction purpose +assignStoreTransaction transaction:StoreTransaction purpose:StorePaymentPurpose = Ok; //@description Cancels or re-enables Telegram Star subscription //@subscription_id Identifier of the subscription to change From dc9ae3ed546e976f6360c5ba050dde64c91c077f Mon Sep 17 00:00:00 2001 From: c0re100 Date: Thu, 1 May 2025 18:12:43 +0800 Subject: [PATCH 39/54] Fallback --- client/extra.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/extra.go b/client/extra.go index 0a6c60f..827c857 100644 --- a/client/extra.go +++ b/client/extra.go @@ -28,6 +28,10 @@ func CheckCommand(text string, entities []*TextEntity) string { // e.g. ["/hello 123", "/hell o 123"] // Result: "/hello", "/hell" if i := strings.Index(text, " "); i != -1 { + // Fallback: remove @bot + if i2 := strings.Index(text, "@"); i2 != -1 { + return text[:i2] + } return text[:i] } From b943b2fe5e7b209d4d1dfcb9f99d3ef42f502a20 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Thu, 1 May 2025 18:13:00 +0800 Subject: [PATCH 40/54] Update to TDLib 1.8.48 --- client/function.go | 522 +++++++++++++++------ client/type.go | 1015 +++++++++++++++++++++++++++++++---------- client/unmarshaler.go | 477 +++++++++++++++---- data/td_api.tl | 468 ++++++++++++------- 4 files changed, 1824 insertions(+), 658 deletions(-) diff --git a/client/function.go b/client/function.go index f4c29cf..ed53166 100755 --- a/client/function.go +++ b/client/function.go @@ -2979,7 +2979,7 @@ type SearchCallMessagesRequest struct { OnlyMissed bool `json:"only_missed"` } -// Searches for call messages. Returns the results in reverse chronological order (i.e., in order of decreasing message_id). For optimal performance, the number of returned messages is chosen by TDLib +// Searches for call and group call messages. Returns the results in reverse chronological order (i.e., in order of decreasing message_id). For optimal performance, the number of returned messages is chosen by TDLib func (client *Client) SearchCallMessages(req *SearchCallMessagesRequest) (*FoundMessages, error) { result, err := client.Send(Request{ meta: meta{ @@ -3065,7 +3065,7 @@ func (client *Client) SearchPublicMessagesByTag(req *SearchPublicMessagesByTagRe type SearchPublicStoriesByTagRequest struct { // Identifier of the chat that posted the stories to search for; pass 0 to search stories in all chats - StorySenderChatId int64 `json:"story_sender_chat_id"` + StoryPosterChatId int64 `json:"story_poster_chat_id"` // Hashtag or cashtag to search for Tag string `json:"tag"` // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results @@ -3081,7 +3081,7 @@ func (client *Client) SearchPublicStoriesByTag(req *SearchPublicStoriesByTagRequ Type: "searchPublicStoriesByTag", }, Data: map[string]interface{}{ - "story_sender_chat_id": req.StorySenderChatId, + "story_poster_chat_id": req.StoryPosterChatId, "tag": req.Tag, "offset": req.Offset, "limit": req.Limit, @@ -5335,7 +5335,7 @@ func (client *Client) DeleteBusinessMessages(req *DeleteBusinessMessagesRequest) type EditBusinessStoryRequest struct { // Identifier of the chat that posted the story - StorySenderChatId int64 `json:"story_sender_chat_id"` + StoryPosterChatId int64 `json:"story_poster_chat_id"` // Identifier of the story to edit StoryId int32 `json:"story_id"` // New content of the story @@ -5348,14 +5348,14 @@ type EditBusinessStoryRequest struct { PrivacySettings StoryPrivacySettings `json:"privacy_settings"` } -// Changes a story sent by the bot on behalf of a business account; for bots only +// Changes a story posted by the bot on behalf of a business account; for bots only func (client *Client) EditBusinessStory(req *EditBusinessStoryRequest) (*Story, error) { result, err := client.Send(Request{ meta: meta{ Type: "editBusinessStory", }, Data: map[string]interface{}{ - "story_sender_chat_id": req.StorySenderChatId, + "story_poster_chat_id": req.StoryPosterChatId, "story_id": req.StoryId, "content": req.Content, "areas": req.Areas, @@ -5381,7 +5381,7 @@ type DeleteBusinessStoryRequest struct { StoryId int32 `json:"story_id"` } -// Deletes a story sent by the bot on behalf of a business account; for bots only +// Deletes a story posted by the bot on behalf of a business account; for bots only func (client *Client) DeleteBusinessStory(req *DeleteBusinessStoryRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -8684,6 +8684,9 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeGame: return UnmarshalInternalLinkTypeGame(result.Data) + case TypeInternalLinkTypeGroupCall: + return UnmarshalInternalLinkTypeGroupCall(result.Data) + case TypeInternalLinkTypeInstantView: return UnmarshalInternalLinkTypeInstantView(result.Data) @@ -11323,7 +11326,7 @@ func (client *Client) GetCurrentWeather(req *GetCurrentWeatherRequest) (*Current type GetStoryRequest struct { // Identifier of the chat that posted the story - StorySenderChatId int64 `json:"story_sender_chat_id"` + StoryPosterChatId int64 `json:"story_poster_chat_id"` // Story identifier StoryId int32 `json:"story_id"` // Pass true to get only locally available information without sending network requests @@ -11337,7 +11340,7 @@ func (client *Client) GetStory(req *GetStoryRequest) (*Story, error) { Type: "getStory", }, Data: map[string]interface{}{ - "story_sender_chat_id": req.StorySenderChatId, + "story_poster_chat_id": req.StoryPosterChatId, "story_id": req.StoryId, "only_local": req.OnlyLocal, }, @@ -11353,11 +11356,11 @@ func (client *Client) GetStory(req *GetStoryRequest) (*Story, error) { return UnmarshalStory(result.Data) } -// Returns supergroup and channel chats in which the current user has the right to post stories. The chats must be rechecked with canSendStory before actually trying to post a story there -func (client *Client) GetChatsToSendStories() (*Chats, error) { +// Returns supergroup and channel chats in which the current user has the right to post stories. The chats must be rechecked with canPostStory before actually trying to post a story there +func (client *Client) GetChatsToPostStories() (*Chats, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getChatsToSendStories", + Type: "getChatsToPostStories", }, Data: map[string]interface{}{}, }) @@ -11372,16 +11375,16 @@ func (client *Client) GetChatsToSendStories() (*Chats, error) { return UnmarshalChats(result.Data) } -type CanSendStoryRequest struct { +type CanPostStoryRequest struct { // Chat identifier. Pass Saved Messages chat identifier when posting a story on behalf of the current user ChatId int64 `json:"chat_id"` } -// Checks whether the current user can send a story on behalf of a chat; requires can_post_stories right for supergroup and channel chats -func (client *Client) CanSendStory(req *CanSendStoryRequest) (CanSendStoryResult, error) { +// Checks whether the current user can post a story on behalf of a chat; requires can_post_stories right for supergroup and channel chats +func (client *Client) CanPostStory(req *CanPostStoryRequest) (CanPostStoryResult, error) { result, err := client.Send(Request{ meta: meta{ - Type: "canSendStory", + Type: "canPostStory", }, Data: map[string]interface{}{ "chat_id": req.ChatId, @@ -11396,30 +11399,30 @@ func (client *Client) CanSendStory(req *CanSendStoryRequest) (CanSendStoryResult } switch result.Type { - case TypeCanSendStoryResultOk: - return UnmarshalCanSendStoryResultOk(result.Data) + case TypeCanPostStoryResultOk: + return UnmarshalCanPostStoryResultOk(result.Data) - case TypeCanSendStoryResultPremiumNeeded: - return UnmarshalCanSendStoryResultPremiumNeeded(result.Data) + case TypeCanPostStoryResultPremiumNeeded: + return UnmarshalCanPostStoryResultPremiumNeeded(result.Data) - case TypeCanSendStoryResultBoostNeeded: - return UnmarshalCanSendStoryResultBoostNeeded(result.Data) + case TypeCanPostStoryResultBoostNeeded: + return UnmarshalCanPostStoryResultBoostNeeded(result.Data) - case TypeCanSendStoryResultActiveStoryLimitExceeded: - return UnmarshalCanSendStoryResultActiveStoryLimitExceeded(result.Data) + case TypeCanPostStoryResultActiveStoryLimitExceeded: + return UnmarshalCanPostStoryResultActiveStoryLimitExceeded(result.Data) - case TypeCanSendStoryResultWeeklyLimitExceeded: - return UnmarshalCanSendStoryResultWeeklyLimitExceeded(result.Data) + case TypeCanPostStoryResultWeeklyLimitExceeded: + return UnmarshalCanPostStoryResultWeeklyLimitExceeded(result.Data) - case TypeCanSendStoryResultMonthlyLimitExceeded: - return UnmarshalCanSendStoryResultMonthlyLimitExceeded(result.Data) + case TypeCanPostStoryResultMonthlyLimitExceeded: + return UnmarshalCanPostStoryResultMonthlyLimitExceeded(result.Data) default: return nil, errors.New("invalid type") } } -type SendStoryRequest struct { +type PostStoryRequest struct { // Identifier of the chat that will post the story. Pass Saved Messages chat identifier when posting a story on behalf of the current user ChatId int64 `json:"chat_id"` // Content of the story @@ -11428,7 +11431,7 @@ type SendStoryRequest struct { Areas *InputStoryAreas `json:"areas"` // Story caption; pass null to use an empty caption; 0-getOption("story_caption_length_max") characters; can have entities only if getOption("can_use_text_entities_in_story_caption") Caption *FormattedText `json:"caption"` - // The privacy settings for the story; ignored for stories sent to supergroup and channel chats + // The privacy settings for the story; ignored for stories posted on behalf of supergroup and channel chats PrivacySettings StoryPrivacySettings `json:"privacy_settings"` // Period after which the story is moved to archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400 for Telegram Premium users, and 86400 otherwise ActivePeriod int32 `json:"active_period"` @@ -11440,11 +11443,11 @@ type SendStoryRequest struct { ProtectContent bool `json:"protect_content"` } -// Sends a new story to a chat; requires can_post_stories right for supergroup and channel chats. Returns a temporary story -func (client *Client) SendStory(req *SendStoryRequest) (*Story, error) { +// Posts a new story on behalf of a chat; requires can_post_stories right for supergroup and channel chats. Returns a temporary story +func (client *Client) PostStory(req *PostStoryRequest) (*Story, error) { result, err := client.Send(Request{ meta: meta{ - Type: "sendStory", + Type: "postStory", }, Data: map[string]interface{}{ "chat_id": req.ChatId, @@ -11471,7 +11474,7 @@ func (client *Client) SendStory(req *SendStoryRequest) (*Story, error) { type EditStoryRequest struct { // Identifier of the chat that posted the story - StorySenderChatId int64 `json:"story_sender_chat_id"` + StoryPosterChatId int64 `json:"story_poster_chat_id"` // Identifier of the story to edit StoryId int32 `json:"story_id"` // New content of the story; pass null to keep the current content @@ -11489,7 +11492,7 @@ func (client *Client) EditStory(req *EditStoryRequest) (*Ok, error) { Type: "editStory", }, Data: map[string]interface{}{ - "story_sender_chat_id": req.StorySenderChatId, + "story_poster_chat_id": req.StoryPosterChatId, "story_id": req.StoryId, "content": req.Content, "areas": req.Areas, @@ -11509,7 +11512,7 @@ func (client *Client) EditStory(req *EditStoryRequest) (*Ok, error) { type EditStoryCoverRequest struct { // Identifier of the chat that posted the story - StorySenderChatId int64 `json:"story_sender_chat_id"` + StoryPosterChatId int64 `json:"story_poster_chat_id"` // Identifier of the story to edit StoryId int32 `json:"story_id"` // New timestamp of the frame, which will be used as video thumbnail @@ -11523,7 +11526,7 @@ func (client *Client) EditStoryCover(req *EditStoryCoverRequest) (*Ok, error) { Type: "editStoryCover", }, Data: map[string]interface{}{ - "story_sender_chat_id": req.StorySenderChatId, + "story_poster_chat_id": req.StoryPosterChatId, "story_id": req.StoryId, "cover_frame_timestamp": req.CoverFrameTimestamp, }, @@ -11570,7 +11573,7 @@ func (client *Client) SetStoryPrivacySettings(req *SetStoryPrivacySettingsReques type ToggleStoryIsPostedToChatPageRequest struct { // Identifier of the chat that posted the story - StorySenderChatId int64 `json:"story_sender_chat_id"` + StoryPosterChatId int64 `json:"story_poster_chat_id"` // Identifier of the story StoryId int32 `json:"story_id"` // Pass true to make the story accessible after expiration; pass false to make it private @@ -11584,7 +11587,7 @@ func (client *Client) ToggleStoryIsPostedToChatPage(req *ToggleStoryIsPostedToCh Type: "toggleStoryIsPostedToChatPage", }, Data: map[string]interface{}{ - "story_sender_chat_id": req.StorySenderChatId, + "story_poster_chat_id": req.StoryPosterChatId, "story_id": req.StoryId, "is_posted_to_chat_page": req.IsPostedToChatPage, }, @@ -11602,19 +11605,19 @@ func (client *Client) ToggleStoryIsPostedToChatPage(req *ToggleStoryIsPostedToCh type DeleteStoryRequest struct { // Identifier of the chat that posted the story - StorySenderChatId int64 `json:"story_sender_chat_id"` + StoryPosterChatId int64 `json:"story_poster_chat_id"` // Identifier of the story to delete StoryId int32 `json:"story_id"` } -// Deletes a previously sent story. Can be called only if story.can_be_deleted == true +// Deletes a previously posted story. Can be called only if story.can_be_deleted == true func (client *Client) DeleteStory(req *DeleteStoryRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ Type: "deleteStory", }, Data: map[string]interface{}{ - "story_sender_chat_id": req.StorySenderChatId, + "story_poster_chat_id": req.StoryPosterChatId, "story_id": req.StoryId, }, }) @@ -11653,7 +11656,7 @@ type LoadActiveStoriesRequest struct { StoryList StoryList `json:"story_list"` } -// Loads more active stories from a story list. The loaded stories will be sent through updates. Active stories are sorted by the pair (active_stories.order, active_stories.story_sender_chat_id) in descending order. Returns a 404 error if all active stories have been loaded +// Loads more active stories from a story list. The loaded stories will be sent through updates. Active stories are sorted by the pair (active_stories.order, active_stories.story_poster_chat_id) in descending order. Returns a 404 error if all active stories have been loaded func (client *Client) LoadActiveStories(req *LoadActiveStoriesRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -11823,8 +11826,8 @@ func (client *Client) SetChatPinnedStories(req *SetChatPinnedStoriesRequest) (*O } type OpenStoryRequest struct { - // The identifier of the sender of the opened story - StorySenderChatId int64 `json:"story_sender_chat_id"` + // The identifier of the chat that posted the opened story + StoryPosterChatId int64 `json:"story_poster_chat_id"` // The identifier of the story StoryId int32 `json:"story_id"` } @@ -11836,7 +11839,7 @@ func (client *Client) OpenStory(req *OpenStoryRequest) (*Ok, error) { Type: "openStory", }, Data: map[string]interface{}{ - "story_sender_chat_id": req.StorySenderChatId, + "story_poster_chat_id": req.StoryPosterChatId, "story_id": req.StoryId, }, }) @@ -11852,8 +11855,8 @@ func (client *Client) OpenStory(req *OpenStoryRequest) (*Ok, error) { } type CloseStoryRequest struct { - // The identifier of the sender of the story to close - StorySenderChatId int64 `json:"story_sender_chat_id"` + // The identifier of the poster of the story to close + StoryPosterChatId int64 `json:"story_poster_chat_id"` // The identifier of the story StoryId int32 `json:"story_id"` } @@ -11865,7 +11868,7 @@ func (client *Client) CloseStory(req *CloseStoryRequest) (*Ok, error) { Type: "closeStory", }, Data: map[string]interface{}{ - "story_sender_chat_id": req.StorySenderChatId, + "story_poster_chat_id": req.StoryPosterChatId, "story_id": req.StoryId, }, }) @@ -11907,8 +11910,8 @@ func (client *Client) GetStoryAvailableReactions(req *GetStoryAvailableReactions } type SetStoryReactionRequest struct { - // The identifier of the sender of the story - StorySenderChatId int64 `json:"story_sender_chat_id"` + // The identifier of the poster of the story + StoryPosterChatId int64 `json:"story_poster_chat_id"` // The identifier of the story StoryId int32 `json:"story_id"` // Type of the reaction to set; pass null to remove the reaction. Custom emoji reactions can be used only by Telegram Premium users. Paid reactions can't be set @@ -11924,7 +11927,7 @@ func (client *Client) SetStoryReaction(req *SetStoryReactionRequest) (*Ok, error Type: "setStoryReaction", }, Data: map[string]interface{}{ - "story_sender_chat_id": req.StorySenderChatId, + "story_poster_chat_id": req.StoryPosterChatId, "story_id": req.StoryId, "reaction_type": req.ReactionType, "update_recent_reactions": req.UpdateRecentReactions, @@ -11986,8 +11989,8 @@ func (client *Client) GetStoryInteractions(req *GetStoryInteractionsRequest) (*S } type GetChatStoryInteractionsRequest struct { - // The identifier of the sender of the story - StorySenderChatId int64 `json:"story_sender_chat_id"` + // The identifier of the poster of the story + StoryPosterChatId int64 `json:"story_poster_chat_id"` // Story identifier StoryId int32 `json:"story_id"` // Pass the default heart reaction or a suggested reaction type to receive only interactions with the specified reaction type; pass null to receive all interactions; reactionTypePaid isn't supported @@ -12007,7 +12010,7 @@ func (client *Client) GetChatStoryInteractions(req *GetChatStoryInteractionsRequ Type: "getChatStoryInteractions", }, Data: map[string]interface{}{ - "story_sender_chat_id": req.StorySenderChatId, + "story_poster_chat_id": req.StoryPosterChatId, "story_id": req.StoryId, "reaction_type": req.ReactionType, "prefer_forwards": req.PreferForwards, @@ -12027,8 +12030,8 @@ func (client *Client) GetChatStoryInteractions(req *GetChatStoryInteractionsRequ } type ReportStoryRequest struct { - // The identifier of the sender of the story to report - StorySenderChatId int64 `json:"story_sender_chat_id"` + // The identifier of the poster of the story to report + StoryPosterChatId int64 `json:"story_poster_chat_id"` // The identifier of the story to report StoryId int32 `json:"story_id"` // Option identifier chosen by the user; leave empty for the initial request @@ -12044,7 +12047,7 @@ func (client *Client) ReportStory(req *ReportStoryRequest) (ReportStoryResult, e Type: "reportStory", }, Data: map[string]interface{}{ - "story_sender_chat_id": req.StorySenderChatId, + "story_poster_chat_id": req.StoryPosterChatId, "story_id": req.StoryId, "option_id": req.OptionId, "text": req.Text, @@ -12093,8 +12096,8 @@ func (client *Client) ActivateStoryStealthMode() (*Ok, error) { } type GetStoryPublicForwardsRequest struct { - // The identifier of the sender of the story - StorySenderChatId int64 `json:"story_sender_chat_id"` + // The identifier of the poster of the story + StoryPosterChatId int64 `json:"story_poster_chat_id"` // The identifier of the story StoryId int32 `json:"story_id"` // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results @@ -12110,7 +12113,7 @@ func (client *Client) GetStoryPublicForwards(req *GetStoryPublicForwardsRequest) Type: "getStoryPublicForwards", }, Data: map[string]interface{}{ - "story_sender_chat_id": req.StorySenderChatId, + "story_poster_chat_id": req.StoryPosterChatId, "story_id": req.StoryId, "offset": req.Offset, "limit": req.Limit, @@ -12868,7 +12871,7 @@ type ReadFilePartRequest struct { } // Reads a part of a file from the TDLib file cache and returns read bytes. This method is intended to be used only if the application has no direct access to TDLib's file system, because it is usually slower than a direct read from the file -func (client *Client) ReadFilePart(req *ReadFilePartRequest) (*FilePart, error) { +func (client *Client) ReadFilePart(req *ReadFilePartRequest) (*Data, error) { result, err := client.Send(Request{ meta: meta{ Type: "readFilePart", @@ -12887,7 +12890,7 @@ func (client *Client) ReadFilePart(req *ReadFilePartRequest) (*FilePart, error) return nil, buildResponseError(result.Data) } - return UnmarshalFilePart(result.Data) + return UnmarshalData(result.Data) } type DeleteFileRequest struct { @@ -13781,8 +13784,6 @@ type CreateCallRequest struct { Protocol *CallProtocol `json:"protocol"` // Pass true to create a video call IsVideo bool `json:"is_video"` - // Identifier of the group call to which the user will be added after exchanging private key via the call; pass 0 if none - GroupCallId int32 `json:"group_call_id"` } // Creates a new call @@ -13795,7 +13796,6 @@ func (client *Client) CreateCall(req *CreateCallRequest) (*CallId, error) { "user_id": req.UserId, "protocol": req.Protocol, "is_video": req.IsVideo, - "group_call_id": req.GroupCallId, }, }) if err != nil { @@ -13872,6 +13872,8 @@ type DiscardCallRequest struct { CallId int32 `json:"call_id"` // Pass true if the user was disconnected IsDisconnected bool `json:"is_disconnected"` + // If the call was upgraded to a group call, pass invite link to the group call + InviteLink string `json:"invite_link"` // The call duration, in seconds Duration int32 `json:"duration"` // Pass true if the call was a video call @@ -13889,6 +13891,7 @@ func (client *Client) DiscardCall(req *DiscardCallRequest) (*Ok, error) { Data: map[string]interface{}{ "call_id": req.CallId, "is_disconnected": req.IsDisconnected, + "invite_link": req.InviteLink, "duration": req.Duration, "is_video": req.IsVideo, "connection_id": req.ConnectionId, @@ -14089,18 +14092,18 @@ func (client *Client) CreateVideoChat(req *CreateVideoChatRequest) (*GroupCallId } type CreateGroupCallRequest struct { - // Call identifier - CallId int32 `json:"call_id"` + // Parameters to join the call; pass null to only create call link without joining the call + JoinParameters *GroupCallJoinParameters `json:"join_parameters"` } -// Creates a group call from a one-to-one call -func (client *Client) CreateGroupCall(req *CreateGroupCallRequest) (*Ok, error) { +// Creates a new group call that isn't bound to a chat +func (client *Client) CreateGroupCall(req *CreateGroupCallRequest) (*GroupCallInfo, error) { result, err := client.Send(Request{ meta: meta{ Type: "createGroupCall", }, Data: map[string]interface{}{ - "call_id": req.CallId, + "join_parameters": req.JoinParameters, }, }) if err != nil { @@ -14111,7 +14114,7 @@ func (client *Client) CreateGroupCall(req *CreateGroupCallRequest) (*Ok, error) return nil, buildResponseError(result.Data) } - return UnmarshalOk(result.Data) + return UnmarshalGroupCallInfo(result.Data) } type GetVideoChatRtmpUrlRequest struct { @@ -14119,7 +14122,7 @@ type GetVideoChatRtmpUrlRequest struct { ChatId int64 `json:"chat_id"` } -// Returns RTMP URL for streaming to the chat; requires can_manage_video_chats administrator right +// Returns RTMP URL for streaming to the video chat of a chat; requires can_manage_video_chats administrator right func (client *Client) GetVideoChatRtmpUrl(req *GetVideoChatRtmpUrlRequest) (*RtmpUrl, error) { result, err := client.Send(Request{ meta: meta{ @@ -14145,7 +14148,7 @@ type ReplaceVideoChatRtmpUrlRequest struct { ChatId int64 `json:"chat_id"` } -// Replaces the current RTMP URL for streaming to the chat; requires owner privileges +// Replaces the current RTMP URL for streaming to the video chat of a chat; requires owner privileges in the chat func (client *Client) ReplaceVideoChatRtmpUrl(req *ReplaceVideoChatRtmpUrlRequest) (*RtmpUrl, error) { result, err := client.Send(Request{ meta: meta{ @@ -14192,16 +14195,16 @@ func (client *Client) GetGroupCall(req *GetGroupCallRequest) (*GroupCall, error) return UnmarshalGroupCall(result.Data) } -type StartScheduledGroupCallRequest struct { - // Group call identifier +type StartScheduledVideoChatRequest struct { + // Group call identifier of the video chat GroupCallId int32 `json:"group_call_id"` } -// Starts a scheduled group call -func (client *Client) StartScheduledGroupCall(req *StartScheduledGroupCallRequest) (*Ok, error) { +// Starts a scheduled video chat +func (client *Client) StartScheduledVideoChat(req *StartScheduledVideoChatRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "startScheduledGroupCall", + Type: "startScheduledVideoChat", }, Data: map[string]interface{}{ "group_call_id": req.GroupCallId, @@ -14218,18 +14221,18 @@ func (client *Client) StartScheduledGroupCall(req *StartScheduledGroupCallReques return UnmarshalOk(result.Data) } -type ToggleGroupCallEnabledStartNotificationRequest struct { +type ToggleVideoChatEnabledStartNotificationRequest struct { // Group call identifier GroupCallId int32 `json:"group_call_id"` // New value of the enabled_start_notification setting EnabledStartNotification bool `json:"enabled_start_notification"` } -// Toggles whether the current user will receive a notification when the group call starts; scheduled group calls only -func (client *Client) ToggleGroupCallEnabledStartNotification(req *ToggleGroupCallEnabledStartNotificationRequest) (*Ok, error) { +// Toggles whether the current user will receive a notification when the video chat starts; for scheduled video chats only +func (client *Client) ToggleVideoChatEnabledStartNotification(req *ToggleVideoChatEnabledStartNotificationRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "toggleGroupCallEnabledStartNotification", + Type: "toggleVideoChatEnabledStartNotification", }, Data: map[string]interface{}{ "group_call_id": req.GroupCallId, @@ -14248,39 +14251,56 @@ func (client *Client) ToggleGroupCallEnabledStartNotification(req *ToggleGroupCa } type JoinGroupCallRequest struct { - // Group call identifier - GroupCallId int32 `json:"group_call_id"` - // Identifier of a group call participant, which will be used to join the call; pass null to join as self; video chats only - ParticipantId MessageSender `json:"participant_id"` - // Caller audio channel synchronization source identifier; received from tgcalls - AudioSourceId int32 `json:"audio_source_id"` - // Group call join payload; received from tgcalls - Payload string `json:"payload"` - // Pass true to join the call with muted microphone - IsMuted bool `json:"is_muted"` - // Pass true if the user's video is enabled - IsMyVideoEnabled bool `json:"is_my_video_enabled"` - // If non-empty, invite hash to be used to join the group call without being muted by administrators - InviteHash string `json:"invite_hash"` - // Fingerprint of the encryption key for E2E group calls not bound to a chat; pass 0 for voice chats - KeyFingerprint JsonInt64 `json:"key_fingerprint"` + // The group call to join + InputGroupCall InputGroupCall `json:"input_group_call"` + // Parameters to join the call + JoinParameters *GroupCallJoinParameters `json:"join_parameters"` } -// Joins an active group call. Returns join response payload for tgcalls -func (client *Client) JoinGroupCall(req *JoinGroupCallRequest) (*Text, error) { +// Joins a group call that is not bound to a chat +func (client *Client) JoinGroupCall(req *JoinGroupCallRequest) (*GroupCallInfo, error) { result, err := client.Send(Request{ meta: meta{ Type: "joinGroupCall", }, + Data: map[string]interface{}{ + "input_group_call": req.InputGroupCall, + "join_parameters": req.JoinParameters, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGroupCallInfo(result.Data) +} + +type JoinVideoChatRequest struct { + // Group call identifier + GroupCallId int32 `json:"group_call_id"` + // Identifier of a group call participant, which will be used to join the call; pass null to join as self; video chats only + ParticipantId MessageSender `json:"participant_id"` + // Parameters to join the call + JoinParameters *GroupCallJoinParameters `json:"join_parameters"` + // Invite hash as received from internalLinkTypeVideoChat + InviteHash string `json:"invite_hash"` +} + +// Joins an active video chat. Returns join response payload for tgcalls +func (client *Client) JoinVideoChat(req *JoinVideoChatRequest) (*Text, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "joinVideoChat", + }, Data: map[string]interface{}{ "group_call_id": req.GroupCallId, "participant_id": req.ParticipantId, - "audio_source_id": req.AudioSourceId, - "payload": req.Payload, - "is_muted": req.IsMuted, - "is_my_video_enabled": req.IsMyVideoEnabled, + "join_parameters": req.JoinParameters, "invite_hash": req.InviteHash, - "key_fingerprint": req.KeyFingerprint, }, }) if err != nil { @@ -14381,18 +14401,18 @@ func (client *Client) EndGroupCallScreenSharing(req *EndGroupCallScreenSharingRe return UnmarshalOk(result.Data) } -type SetGroupCallTitleRequest struct { +type SetVideoChatTitleRequest struct { // Group call identifier GroupCallId int32 `json:"group_call_id"` // New group call title; 1-64 characters Title string `json:"title"` } -// Sets group call title. Requires groupCall.can_be_managed group call flag -func (client *Client) SetGroupCallTitle(req *SetGroupCallTitleRequest) (*Ok, error) { +// Sets title of a video chat; requires groupCall.can_be_managed right +func (client *Client) SetVideoChatTitle(req *SetVideoChatTitleRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "setGroupCallTitle", + Type: "setVideoChatTitle", }, Data: map[string]interface{}{ "group_call_id": req.GroupCallId, @@ -14410,18 +14430,18 @@ func (client *Client) SetGroupCallTitle(req *SetGroupCallTitleRequest) (*Ok, err return UnmarshalOk(result.Data) } -type ToggleGroupCallMuteNewParticipantsRequest struct { +type ToggleVideoChatMuteNewParticipantsRequest struct { // Group call identifier GroupCallId int32 `json:"group_call_id"` // New value of the mute_new_participants setting MuteNewParticipants bool `json:"mute_new_participants"` } -// Toggles whether new participants of a group call can be unmuted only by administrators of the group call. Requires groupCall.can_toggle_mute_new_participants group call flag -func (client *Client) ToggleGroupCallMuteNewParticipants(req *ToggleGroupCallMuteNewParticipantsRequest) (*Ok, error) { +// Toggles whether new participants of a video chat can be unmuted only by administrators of the video chat. Requires groupCall.can_toggle_mute_new_participants right +func (client *Client) ToggleVideoChatMuteNewParticipants(req *ToggleVideoChatMuteNewParticipantsRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "toggleGroupCallMuteNewParticipants", + Type: "toggleVideoChatMuteNewParticipants", }, Data: map[string]interface{}{ "group_call_id": req.GroupCallId, @@ -14439,18 +14459,94 @@ func (client *Client) ToggleGroupCallMuteNewParticipants(req *ToggleGroupCallMut return UnmarshalOk(result.Data) } -type InviteGroupCallParticipantsRequest struct { +type InviteGroupCallParticipantRequest struct { // Group call identifier GroupCallId int32 `json:"group_call_id"` - // User identifiers. At most 10 users can be invited simultaneously - UserIds []int64 `json:"user_ids"` + // User identifier + UserId int64 `json:"user_id"` + // Pass true if the group call is a video call + IsVideo bool `json:"is_video"` } -// Invites users to an active group call. Sends a service message of type messageInviteVideoChatParticipants for video chats -func (client *Client) InviteGroupCallParticipants(req *InviteGroupCallParticipantsRequest) (*Ok, error) { +// Invites a user to an active group call; for group calls not bound to a chat only. Sends a service message of the type messageGroupCall. The group call can have at most getOption("group_call_participant_count_max") participants +func (client *Client) InviteGroupCallParticipant(req *InviteGroupCallParticipantRequest) (InviteGroupCallParticipantResult, error) { result, err := client.Send(Request{ meta: meta{ - Type: "inviteGroupCallParticipants", + Type: "inviteGroupCallParticipant", + }, + Data: map[string]interface{}{ + "group_call_id": req.GroupCallId, + "user_id": req.UserId, + "is_video": req.IsVideo, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypeInviteGroupCallParticipantResultUserPrivacyRestricted: + return UnmarshalInviteGroupCallParticipantResultUserPrivacyRestricted(result.Data) + + case TypeInviteGroupCallParticipantResultUserAlreadyParticipant: + return UnmarshalInviteGroupCallParticipantResultUserAlreadyParticipant(result.Data) + + case TypeInviteGroupCallParticipantResultUserWasBanned: + return UnmarshalInviteGroupCallParticipantResultUserWasBanned(result.Data) + + case TypeInviteGroupCallParticipantResultSuccess: + return UnmarshalInviteGroupCallParticipantResultSuccess(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + +type DeclineGroupCallInvitationRequest struct { + // Identifier of the chat with the message + ChatId int64 `json:"chat_id"` + // Identifier of the message of the type messageGroupCall + MessageId int64 `json:"message_id"` +} + +// Declines an invitation to an active group call via messageGroupCall. Can be called both by the sender and the receiver of the invitation +func (client *Client) DeclineGroupCallInvitation(req *DeclineGroupCallInvitationRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "declineGroupCallInvitation", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type BanGroupCallParticipantsRequest struct { + // Group call identifier + GroupCallId int32 `json:"group_call_id"` + // Identifiers of group call participants to ban; identifiers of unknown users from the update updateGroupCallParticipants can be also passed to the method + UserIds []JsonInt64 `json:"user_ids"` +} + +// Bans users from a group call not bound to a chat; requires groupCall.is_owned. Only the owner of the group call can invite the banned users back +func (client *Client) BanGroupCallParticipants(req *BanGroupCallParticipantsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "banGroupCallParticipants", }, Data: map[string]interface{}{ "group_call_id": req.GroupCallId, @@ -14468,18 +14564,47 @@ func (client *Client) InviteGroupCallParticipants(req *InviteGroupCallParticipan return UnmarshalOk(result.Data) } -type GetGroupCallInviteLinkRequest struct { +type InviteVideoChatParticipantsRequest struct { // Group call identifier GroupCallId int32 `json:"group_call_id"` - // Pass true if the invite link needs to contain an invite hash, passing which to joinGroupCall would allow the invited user to unmute themselves. Requires groupCall.can_be_managed group call flag + // User identifiers. At most 10 users can be invited simultaneously + UserIds []int64 `json:"user_ids"` +} + +// Invites users to an active video chat. Sends a service message of the type messageInviteVideoChatParticipants to the chat bound to the group call +func (client *Client) InviteVideoChatParticipants(req *InviteVideoChatParticipantsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "inviteVideoChatParticipants", + }, + Data: map[string]interface{}{ + "group_call_id": req.GroupCallId, + "user_ids": req.UserIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetVideoChatInviteLinkRequest struct { + // Group call identifier + GroupCallId int32 `json:"group_call_id"` + // Pass true if the invite link needs to contain an invite hash, passing which to joinVideoChat would allow the invited user to unmute themselves. Requires groupCall.can_be_managed right CanSelfUnmute bool `json:"can_self_unmute"` } // Returns invite link to a video chat in a public chat -func (client *Client) GetGroupCallInviteLink(req *GetGroupCallInviteLinkRequest) (*HttpUrl, error) { +func (client *Client) GetVideoChatInviteLink(req *GetVideoChatInviteLinkRequest) (*HttpUrl, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getGroupCallInviteLink", + Type: "getVideoChatInviteLink", }, Data: map[string]interface{}{ "group_call_id": req.GroupCallId, @@ -14502,7 +14627,7 @@ type RevokeGroupCallInviteLinkRequest struct { GroupCallId int32 `json:"group_call_id"` } -// Revokes invite link for a group call. Requires groupCall.can_be_managed group call flag +// Revokes invite link for a group call. Requires groupCall.can_be_managed right for video chats or groupCall.is_owned otherwise func (client *Client) RevokeGroupCallInviteLink(req *RevokeGroupCallInviteLinkRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -14534,7 +14659,7 @@ type StartGroupCallRecordingRequest struct { UsePortraitOrientation bool `json:"use_portrait_orientation"` } -// Starts recording of an active group call. Requires groupCall.can_be_managed group call flag +// Starts recording of an active group call; for video chats only. Requires groupCall.can_be_managed right func (client *Client) StartGroupCallRecording(req *StartGroupCallRecordingRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -14563,7 +14688,7 @@ type EndGroupCallRecordingRequest struct { GroupCallId int32 `json:"group_call_id"` } -// Ends recording of an active group call. Requires groupCall.can_be_managed group call flag +// Ends recording of an active group call; for video chats only. Requires groupCall.can_be_managed right func (client *Client) EndGroupCallRecording(req *EndGroupCallRecordingRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -14651,7 +14776,7 @@ type SetGroupCallParticipantIsSpeakingRequest struct { IsSpeaking bool `json:"is_speaking"` } -// Informs TDLib that speaking state of a participant of an active group has changed +// Informs TDLib that speaking state of a participant of an active group call has changed func (client *Client) SetGroupCallParticipantIsSpeaking(req *SetGroupCallParticipantIsSpeakingRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -14715,7 +14840,7 @@ type SetGroupCallParticipantVolumeLevelRequest struct { VolumeLevel int32 `json:"volume_level"` } -// Changes volume level of a participant of an active group call. If the current user can manage the group call, then the participant's volume level will be changed for all users with the default volume level +// Changes volume level of a participant of an active group call. If the current user can manage the group call or is the owner of the group call, then the participant's volume level will be changed for all users with the default volume level func (client *Client) SetGroupCallParticipantVolumeLevel(req *SetGroupCallParticipantVolumeLevelRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -14743,11 +14868,11 @@ type ToggleGroupCallParticipantIsHandRaisedRequest struct { GroupCallId int32 `json:"group_call_id"` // Participant identifier ParticipantId MessageSender `json:"participant_id"` - // Pass true if the user's hand needs to be raised. Only self hand can be raised. Requires groupCall.can_be_managed group call flag to lower other's hand + // Pass true if the user's hand needs to be raised. Only self hand can be raised. Requires groupCall.can_be_managed right to lower other's hand IsHandRaised bool `json:"is_hand_raised"` } -// Toggles whether a group call participant hand is rased +// Toggles whether a group call participant hand is rased; for video chats only func (client *Client) ToggleGroupCallParticipantIsHandRaised(req *ToggleGroupCallParticipantIsHandRaisedRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -14770,6 +14895,35 @@ func (client *Client) ToggleGroupCallParticipantIsHandRaised(req *ToggleGroupCal return UnmarshalOk(result.Data) } +type GetGroupCallParticipantsRequest struct { + // The group call which participants will be returned + InputGroupCall InputGroupCall `json:"input_group_call"` + // The maximum number of participants to return; must be positive + Limit int32 `json:"limit"` +} + +// Returns information about participants of a non-joined group call that is not bound to a chat +func (client *Client) GetGroupCallParticipants(req *GetGroupCallParticipantsRequest) (*GroupCallParticipants, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getGroupCallParticipants", + }, + Data: map[string]interface{}{ + "input_group_call": req.InputGroupCall, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGroupCallParticipants(result.Data) +} + type LoadGroupCallParticipantsRequest struct { // Group call identifier. The group call must be previously received through getGroupCall and must be joined or being joined GroupCallId int32 `json:"group_call_id"` @@ -14830,7 +14984,7 @@ type EndGroupCallRequest struct { GroupCallId int32 `json:"group_call_id"` } -// Ends a group call. Requires groupCall.can_be_managed +// Ends a group call. Requires groupCall.can_be_managed right for video chats or groupCall.is_owned otherwise func (client *Client) EndGroupCall(req *EndGroupCallRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -14851,16 +15005,16 @@ func (client *Client) EndGroupCall(req *EndGroupCallRequest) (*Ok, error) { return UnmarshalOk(result.Data) } -type GetGroupCallStreamsRequest struct { +type GetVideoChatStreamsRequest struct { // Group call identifier GroupCallId int32 `json:"group_call_id"` } -// Returns information about available group call streams -func (client *Client) GetGroupCallStreams(req *GetGroupCallStreamsRequest) (*GroupCallStreams, error) { +// Returns information about available video chat streams +func (client *Client) GetVideoChatStreams(req *GetVideoChatStreamsRequest) (*VideoChatStreams, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getGroupCallStreams", + Type: "getVideoChatStreams", }, Data: map[string]interface{}{ "group_call_id": req.GroupCallId, @@ -14874,10 +15028,10 @@ func (client *Client) GetGroupCallStreams(req *GetGroupCallStreamsRequest) (*Gro return nil, buildResponseError(result.Data) } - return UnmarshalGroupCallStreams(result.Data) + return UnmarshalVideoChatStreams(result.Data) } -type GetGroupCallStreamSegmentRequest struct { +type GetVideoChatStreamSegmentRequest struct { // Group call identifier GroupCallId int32 `json:"group_call_id"` // Point in time when the stream segment begins; Unix timestamp in milliseconds @@ -14890,11 +15044,11 @@ type GetGroupCallStreamSegmentRequest struct { VideoQuality GroupCallVideoQuality `json:"video_quality"` } -// Returns a file with a segment of a group call stream in a modified OGG format for audio or MPEG-4 format for video -func (client *Client) GetGroupCallStreamSegment(req *GetGroupCallStreamSegmentRequest) (*FilePart, error) { +// Returns a file with a segment of a video chat stream in a modified OGG format for audio or MPEG-4 format for video +func (client *Client) GetVideoChatStreamSegment(req *GetVideoChatStreamSegmentRequest) (*Data, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getGroupCallStreamSegment", + Type: "getVideoChatStreamSegment", }, Data: map[string]interface{}{ "group_call_id": req.GroupCallId, @@ -14912,7 +15066,77 @@ func (client *Client) GetGroupCallStreamSegment(req *GetGroupCallStreamSegmentRe return nil, buildResponseError(result.Data) } - return UnmarshalFilePart(result.Data) + return UnmarshalData(result.Data) +} + +type EncryptGroupCallDataRequest struct { + // Group call identifier. The call must not be a video chat + GroupCallId int32 `json:"group_call_id"` + // Data channel for which data is encrypted + DataChannel GroupCallDataChannel `json:"data_channel"` + // Data to encrypt + Data []byte `json:"data"` + // Size of data prefix that must be kept unencrypted + UnencryptedPrefixSize int32 `json:"unencrypted_prefix_size"` +} + +// Encrypts group call data before sending them over network using tgcalls +func (client *Client) EncryptGroupCallData(req *EncryptGroupCallDataRequest) (*Data, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "encryptGroupCallData", + }, + Data: map[string]interface{}{ + "group_call_id": req.GroupCallId, + "data_channel": req.DataChannel, + "data": req.Data, + "unencrypted_prefix_size": req.UnencryptedPrefixSize, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalData(result.Data) +} + +type DecryptGroupCallDataRequest struct { + // Group call identifier. The call must not be a video chat + GroupCallId int32 `json:"group_call_id"` + // Identifier of the group call participant, which sent the data + ParticipantId MessageSender `json:"participant_id"` + // Data channel for which data was encrypted; pass null if unknown + DataChannel GroupCallDataChannel `json:"data_channel"` + // Data to decrypt + Data []byte `json:"data"` +} + +// Decrypts group call data received by tgcalls +func (client *Client) DecryptGroupCallData(req *DecryptGroupCallDataRequest) (*Data, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "decryptGroupCallData", + }, + Data: map[string]interface{}{ + "group_call_id": req.GroupCallId, + "participant_id": req.ParticipantId, + "data_channel": req.DataChannel, + "data": req.Data, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalData(result.Data) } type SetMessageSenderBlockListRequest struct { @@ -25121,6 +25345,12 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateGroupCallParticipant: return UnmarshalUpdateGroupCallParticipant(result.Data) + case TypeUpdateGroupCallParticipants: + return UnmarshalUpdateGroupCallParticipants(result.Data) + + case TypeUpdateGroupCallVerificationState: + return UnmarshalUpdateGroupCallVerificationState(result.Data) + case TypeUpdateNewCallSignalingData: return UnmarshalUpdateNewCallSignalingData(result.Data) @@ -25139,11 +25369,11 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateStoryDeleted: return UnmarshalUpdateStoryDeleted(result.Data) - case TypeUpdateStorySendSucceeded: - return UnmarshalUpdateStorySendSucceeded(result.Data) + case TypeUpdateStoryPostSucceeded: + return UnmarshalUpdateStoryPostSucceeded(result.Data) - case TypeUpdateStorySendFailed: - return UnmarshalUpdateStorySendFailed(result.Data) + case TypeUpdateStoryPostFailed: + return UnmarshalUpdateStoryPostFailed(result.Data) case TypeUpdateChatActiveStories: return UnmarshalUpdateChatActiveStories(result.Data) diff --git a/client/type.go b/client/type.go index 22df51f..1848a98 100755 --- a/client/type.go +++ b/client/type.go @@ -107,6 +107,9 @@ const ( ClassCallServerType = "CallServerType" ClassCallState = "CallState" ClassGroupCallVideoQuality = "GroupCallVideoQuality" + ClassInviteGroupCallParticipantResult = "InviteGroupCallParticipantResult" + ClassGroupCallDataChannel = "GroupCallDataChannel" + ClassInputGroupCall = "InputGroupCall" ClassCallProblem = "CallProblem" ClassFirebaseAuthenticationSettings = "FirebaseAuthenticationSettings" ClassReactionUnavailabilityReason = "ReactionUnavailabilityReason" @@ -132,7 +135,7 @@ const ( ClassBackgroundFill = "BackgroundFill" ClassBackgroundType = "BackgroundType" ClassInputBackground = "InputBackground" - ClassCanSendStoryResult = "CanSendStoryResult" + ClassCanPostStoryResult = "CanPostStoryResult" ClassCanTransferOwnershipResult = "CanTransferOwnershipResult" ClassCheckChatUsernameResult = "CheckChatUsernameResult" ClassCheckStickerSetNameResult = "CheckStickerSetNameResult" @@ -488,14 +491,17 @@ const ( ClassCallServer = "CallServer" ClassCallId = "CallId" ClassGroupCallId = "GroupCallId" - ClassGroupCallStream = "GroupCallStream" - ClassGroupCallStreams = "GroupCallStreams" + ClassGroupCallJoinParameters = "GroupCallJoinParameters" + ClassVideoChatStream = "VideoChatStream" + ClassVideoChatStreams = "VideoChatStreams" ClassRtmpUrl = "RtmpUrl" ClassGroupCallRecentSpeaker = "GroupCallRecentSpeaker" ClassGroupCall = "GroupCall" ClassGroupCallVideoSourceGroup = "GroupCallVideoSourceGroup" ClassGroupCallParticipantVideoInfo = "GroupCallParticipantVideoInfo" ClassGroupCallParticipant = "GroupCallParticipant" + ClassGroupCallParticipants = "GroupCallParticipants" + ClassGroupCallInfo = "GroupCallInfo" ClassCall = "Call" ClassPhoneNumberAuthenticationSettings = "PhoneNumberAuthenticationSettings" ClassAddedReaction = "AddedReaction" @@ -557,7 +563,6 @@ const ( ClassMessageLinkInfo = "MessageLinkInfo" ClassChatBoostLink = "ChatBoostLink" ClassChatBoostLinkInfo = "ChatBoostLinkInfo" - ClassFilePart = "FilePart" ClassStorageStatisticsByFileType = "StorageStatisticsByFileType" ClassStorageStatisticsByChat = "StorageStatisticsByChat" ClassStorageStatistics = "StorageStatistics" @@ -575,6 +580,7 @@ const ( ClassTMeUrls = "TMeUrls" ClassCount = "Count" ClassText = "Text" + ClassData = "Data" ClassSeconds = "Seconds" ClassFileDownloadedPrefixSize = "FileDownloadedPrefixSize" ClassStarCount = "StarCount" @@ -1154,6 +1160,7 @@ const ( TypeLinkPreviewTypeEmbeddedVideoPlayer = "linkPreviewTypeEmbeddedVideoPlayer" TypeLinkPreviewTypeExternalAudio = "linkPreviewTypeExternalAudio" TypeLinkPreviewTypeExternalVideo = "linkPreviewTypeExternalVideo" + TypeLinkPreviewTypeGroupCall = "linkPreviewTypeGroupCall" TypeLinkPreviewTypeInvoice = "linkPreviewTypeInvoice" TypeLinkPreviewTypeMessage = "linkPreviewTypeMessage" TypeLinkPreviewTypePhoto = "linkPreviewTypePhoto" @@ -1310,6 +1317,7 @@ const ( TypeMessageStory = "messageStory" TypeMessageInvoice = "messageInvoice" TypeMessageCall = "messageCall" + TypeMessageGroupCall = "messageGroupCall" TypeMessageVideoChatScheduled = "messageVideoChatScheduled" TypeMessageVideoChatStarted = "messageVideoChatStarted" TypeMessageVideoChatEnded = "messageVideoChatEnded" @@ -1544,7 +1552,7 @@ const ( TypeCallDiscardReasonDeclined = "callDiscardReasonDeclined" TypeCallDiscardReasonDisconnected = "callDiscardReasonDisconnected" TypeCallDiscardReasonHungUp = "callDiscardReasonHungUp" - TypeCallDiscardReasonAllowGroupCall = "callDiscardReasonAllowGroupCall" + TypeCallDiscardReasonUpgradeToGroupCall = "callDiscardReasonUpgradeToGroupCall" TypeCallProtocol = "callProtocol" TypeCallServerTypeTelegramReflector = "callServerTypeTelegramReflector" TypeCallServerTypeWebrtc = "callServerTypeWebrtc" @@ -1557,17 +1565,28 @@ const ( TypeCallStateHangingUp = "callStateHangingUp" TypeCallStateDiscarded = "callStateDiscarded" TypeCallStateError = "callStateError" + TypeGroupCallJoinParameters = "groupCallJoinParameters" TypeGroupCallVideoQualityThumbnail = "groupCallVideoQualityThumbnail" TypeGroupCallVideoQualityMedium = "groupCallVideoQualityMedium" TypeGroupCallVideoQualityFull = "groupCallVideoQualityFull" - TypeGroupCallStream = "groupCallStream" - TypeGroupCallStreams = "groupCallStreams" + TypeVideoChatStream = "videoChatStream" + TypeVideoChatStreams = "videoChatStreams" TypeRtmpUrl = "rtmpUrl" TypeGroupCallRecentSpeaker = "groupCallRecentSpeaker" TypeGroupCall = "groupCall" TypeGroupCallVideoSourceGroup = "groupCallVideoSourceGroup" TypeGroupCallParticipantVideoInfo = "groupCallParticipantVideoInfo" TypeGroupCallParticipant = "groupCallParticipant" + TypeGroupCallParticipants = "groupCallParticipants" + TypeGroupCallInfo = "groupCallInfo" + TypeInviteGroupCallParticipantResultUserPrivacyRestricted = "inviteGroupCallParticipantResultUserPrivacyRestricted" + TypeInviteGroupCallParticipantResultUserAlreadyParticipant = "inviteGroupCallParticipantResultUserAlreadyParticipant" + TypeInviteGroupCallParticipantResultUserWasBanned = "inviteGroupCallParticipantResultUserWasBanned" + TypeInviteGroupCallParticipantResultSuccess = "inviteGroupCallParticipantResultSuccess" + TypeGroupCallDataChannelMain = "groupCallDataChannelMain" + TypeGroupCallDataChannelScreenSharing = "groupCallDataChannelScreenSharing" + TypeInputGroupCallLink = "inputGroupCallLink" + TypeInputGroupCallMessage = "inputGroupCallMessage" TypeCallProblemEcho = "callProblemEcho" TypeCallProblemNoise = "callProblemNoise" TypeCallProblemInterruptions = "callProblemInterruptions" @@ -1721,8 +1740,8 @@ const ( TypePremiumLimitTypeChatFolderInviteLinkCount = "premiumLimitTypeChatFolderInviteLinkCount" TypePremiumLimitTypeShareableChatFolderCount = "premiumLimitTypeShareableChatFolderCount" TypePremiumLimitTypeActiveStoryCount = "premiumLimitTypeActiveStoryCount" - TypePremiumLimitTypeWeeklySentStoryCount = "premiumLimitTypeWeeklySentStoryCount" - TypePremiumLimitTypeMonthlySentStoryCount = "premiumLimitTypeMonthlySentStoryCount" + TypePremiumLimitTypeWeeklyPostedStoryCount = "premiumLimitTypeWeeklyPostedStoryCount" + TypePremiumLimitTypeMonthlyPostedStoryCount = "premiumLimitTypeMonthlyPostedStoryCount" TypePremiumLimitTypeStoryCaptionLength = "premiumLimitTypeStoryCaptionLength" TypePremiumLimitTypeStorySuggestedReactionAreaCount = "premiumLimitTypeStorySuggestedReactionAreaCount" TypePremiumLimitTypeSimilarChatCount = "premiumLimitTypeSimilarChatCount" @@ -1823,12 +1842,12 @@ const ( TypeTimeZone = "timeZone" TypeTimeZones = "timeZones" TypeHashtags = "hashtags" - TypeCanSendStoryResultOk = "canSendStoryResultOk" - TypeCanSendStoryResultPremiumNeeded = "canSendStoryResultPremiumNeeded" - TypeCanSendStoryResultBoostNeeded = "canSendStoryResultBoostNeeded" - TypeCanSendStoryResultActiveStoryLimitExceeded = "canSendStoryResultActiveStoryLimitExceeded" - TypeCanSendStoryResultWeeklyLimitExceeded = "canSendStoryResultWeeklyLimitExceeded" - TypeCanSendStoryResultMonthlyLimitExceeded = "canSendStoryResultMonthlyLimitExceeded" + TypeCanPostStoryResultOk = "canPostStoryResultOk" + TypeCanPostStoryResultPremiumNeeded = "canPostStoryResultPremiumNeeded" + TypeCanPostStoryResultBoostNeeded = "canPostStoryResultBoostNeeded" + TypeCanPostStoryResultActiveStoryLimitExceeded = "canPostStoryResultActiveStoryLimitExceeded" + TypeCanPostStoryResultWeeklyLimitExceeded = "canPostStoryResultWeeklyLimitExceeded" + TypeCanPostStoryResultMonthlyLimitExceeded = "canPostStoryResultMonthlyLimitExceeded" TypeCanTransferOwnershipResultOk = "canTransferOwnershipResultOk" TypeCanTransferOwnershipResultPasswordNeeded = "canTransferOwnershipResultPasswordNeeded" TypeCanTransferOwnershipResultPasswordTooFresh = "canTransferOwnershipResultPasswordTooFresh" @@ -2006,6 +2025,7 @@ const ( TypeInternalLinkTypeDefaultMessageAutoDeleteTimerSettings = "internalLinkTypeDefaultMessageAutoDeleteTimerSettings" TypeInternalLinkTypeEditProfileSettings = "internalLinkTypeEditProfileSettings" TypeInternalLinkTypeGame = "internalLinkTypeGame" + TypeInternalLinkTypeGroupCall = "internalLinkTypeGroupCall" TypeInternalLinkTypeInstantView = "internalLinkTypeInstantView" TypeInternalLinkTypeInvoice = "internalLinkTypeInvoice" TypeInternalLinkTypeLanguagePack = "internalLinkTypeLanguagePack" @@ -2041,7 +2061,6 @@ const ( TypeChatBoostLinkInfo = "chatBoostLinkInfo" TypeBlockListMain = "blockListMain" TypeBlockListStories = "blockListStories" - TypeFilePart = "filePart" TypeFileTypeNone = "fileTypeNone" TypeFileTypeAnimation = "fileTypeAnimation" TypeFileTypeAudio = "fileTypeAudio" @@ -2124,6 +2143,7 @@ const ( TypeSuggestedActionExtendStarSubscriptions = "suggestedActionExtendStarSubscriptions" TypeCount = "count" TypeText = "text" + TypeData = "data" TypeSeconds = "seconds" TypeFileDownloadedPrefixSize = "fileDownloadedPrefixSize" TypeStarCount = "starCount" @@ -2263,14 +2283,16 @@ const ( TypeUpdateCall = "updateCall" TypeUpdateGroupCall = "updateGroupCall" TypeUpdateGroupCallParticipant = "updateGroupCallParticipant" + TypeUpdateGroupCallParticipants = "updateGroupCallParticipants" + TypeUpdateGroupCallVerificationState = "updateGroupCallVerificationState" TypeUpdateNewCallSignalingData = "updateNewCallSignalingData" TypeUpdateUserPrivacySettingRules = "updateUserPrivacySettingRules" TypeUpdateUnreadMessageCount = "updateUnreadMessageCount" TypeUpdateUnreadChatCount = "updateUnreadChatCount" TypeUpdateStory = "updateStory" TypeUpdateStoryDeleted = "updateStoryDeleted" - TypeUpdateStorySendSucceeded = "updateStorySendSucceeded" - TypeUpdateStorySendFailed = "updateStorySendFailed" + TypeUpdateStoryPostSucceeded = "updateStoryPostSucceeded" + TypeUpdateStoryPostFailed = "updateStoryPostFailed" TypeUpdateChatActiveStories = "updateChatActiveStories" TypeUpdateStoryListChatCount = "updateStoryListChatCount" TypeUpdateStoryStealthMode = "updateStoryStealthMode" @@ -2792,7 +2814,7 @@ type StoryContent interface { StoryContentType() string } -// The content of a story to send +// The content of a story to post type InputStoryContent interface { InputStoryContentType() string } @@ -2847,6 +2869,21 @@ type GroupCallVideoQuality interface { GroupCallVideoQualityType() string } +// Describes result of group call participant invitation +type InviteGroupCallParticipantResult interface { + InviteGroupCallParticipantResultType() string +} + +// Describes data channel for a group call +type GroupCallDataChannel interface { + GroupCallDataChannelType() string +} + +// Describes a non-joined group call that isn't bound to a chat +type InputGroupCall interface { + InputGroupCallType() string +} + // Describes the exact type of problem with a call type CallProblem interface { CallProblemType() string @@ -2972,9 +3009,9 @@ type InputBackground interface { InputBackgroundType() string } -// Represents result of checking whether the current user can send a story in the specific chat -type CanSendStoryResult interface { - CanSendStoryResultType() string +// Represents result of checking whether the current user can post a story on behalf of the specific chat +type CanPostStoryResult interface { + CanPostStoryResultType() string } // Represents result of checking whether the current session can be used to transfer a chat ownership to another user @@ -6852,7 +6889,7 @@ type BusinessBotRights struct { CanTransferAndUpgradeGifts bool `json:"can_transfer_and_upgrade_gifts"` // True, if the bot can transfer Telegram Stars received by the business account to account of the bot, or use them to upgrade and transfer gifts CanTransferStars bool `json:"can_transfer_stars"` - // True, if the bot can send, edit and delete stories + // True, if the bot can post, edit and delete stories CanManageStories bool `json:"can_manage_stories"` } @@ -12671,7 +12708,7 @@ type Supergroup struct { Date int32 `json:"date"` // Status of the current user in the supergroup or channel; custom title will always be empty Status ChatMemberStatus `json:"status"` - // Number of members in the supergroup or channel; 0 if unknown. Currently, it is guaranteed to be known only if the supergroup or channel was received through getChatSimilarChats, getChatsToSendStories, getCreatedPublicChats, getGroupsInCommon, getInactiveSupergroupChats, getRecommendedChats, getSuitableDiscussionChats, getUserPrivacySettingRules, getVideoChatAvailableParticipants, searchPublicChats, or in chatFolderInviteLinkInfo.missing_chat_ids, or in userFullInfo.personal_chat_id, or for chats with messages or stories from publicForwards and foundStories + // Number of members in the supergroup or channel; 0 if unknown. Currently, it is guaranteed to be known only if the supergroup or channel was received through getChatSimilarChats, getChatsToPostStories, getCreatedPublicChats, getGroupsInCommon, getInactiveSupergroupChats, getRecommendedChats, getSuitableDiscussionChats, getUserPrivacySettingRules, getVideoChatAvailableParticipants, searchPublicChats, or in chatFolderInviteLinkInfo.missing_chat_ids, or in userFullInfo.personal_chat_id, or for chats with messages or stories from publicForwards and foundStories MemberCount int32 `json:"member_count"` // Approximate boost level for the chat BoostLevel int32 `json:"boost_level"` @@ -14342,8 +14379,8 @@ func (messageReplyToMessage *MessageReplyToMessage) UnmarshalJSON(data []byte) e // Describes a story replied by a given message type MessageReplyToStory struct { meta - // The identifier of the sender of the story - StorySenderChatId int64 `json:"story_sender_chat_id"` + // The identifier of the poster of the story + StoryPosterChatId int64 `json:"story_poster_chat_id"` // The identifier of the story StoryId int32 `json:"story_id"` } @@ -14431,8 +14468,8 @@ func (*InputMessageReplyToExternalMessage) InputMessageReplyToType() string { // Describes a story to be replied type InputMessageReplyToStory struct { meta - // The identifier of the sender of the story. Currently, stories can be replied only in the sender's chat and channel stories can't be replied - StorySenderChatId int64 `json:"story_sender_chat_id"` + // The identifier of the poster of the story. Currently, stories can be replied only in the chat that posted the story; channel stories can't be replied + StoryPosterChatId int64 `json:"story_poster_chat_id"` // The identifier of the story StoryId int32 `json:"story_id"` } @@ -15674,10 +15711,10 @@ type ChatNotificationSettings struct { UseDefaultStorySound bool `json:"use_default_story_sound"` // Identifier of the notification sound to be played for stories; 0 if sound is disabled StorySoundId JsonInt64 `json:"story_sound_id"` - // If true, the value for the relevant type of chat is used instead of show_story_sender - UseDefaultShowStorySender bool `json:"use_default_show_story_sender"` - // True, if the sender of stories must be displayed in notifications - ShowStorySender bool `json:"show_story_sender"` + // If true, the value for the relevant type of chat is used instead of show_story_poster + UseDefaultShowStoryPoster bool `json:"use_default_show_story_poster"` + // True, if the chat that posted a story must be displayed in notifications + ShowStoryPoster bool `json:"show_story_poster"` // If true, the value for the relevant type of chat or the forum chat is used instead of disable_pinned_message_notifications UseDefaultDisablePinnedMessageNotifications bool `json:"use_default_disable_pinned_message_notifications"` // If true, notifications for incoming pinned messages will be created as for an ordinary unread message @@ -15719,8 +15756,8 @@ type ScopeNotificationSettings struct { MuteStories bool `json:"mute_stories"` // Identifier of the notification sound to be played for stories; 0 if sound is disabled StorySoundId JsonInt64 `json:"story_sound_id"` - // True, if the sender of stories must be displayed in notifications - ShowStorySender bool `json:"show_story_sender"` + // True, if the chat that posted a story must be displayed in notifications + ShowStoryPoster bool `json:"show_story_poster"` // True, if notifications for incoming pinned messages will be created as for an ordinary unread message DisablePinnedMessageNotifications bool `json:"disable_pinned_message_notifications"` // True, if notifications for messages with mentions will be created as for an ordinary unread message @@ -16721,7 +16758,7 @@ func (*BusinessBotManageBar) GetType() string { return TypeBusinessBotManageBar } -// Describes a video chat +// Describes a video chat, i.e. a group call bound to a chat type VideoChat struct { meta // Group call identifier of an active video chat; 0 if none. Full information about the video chat can be received through the method getGroupCall @@ -21724,6 +21761,31 @@ func (*LinkPreviewTypeExternalVideo) LinkPreviewTypeType() string { return TypeLinkPreviewTypeExternalVideo } +// The link is a link to a group call that isn't bound to a chat +type LinkPreviewTypeGroupCall struct{ + meta +} + +func (entity *LinkPreviewTypeGroupCall) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeGroupCall + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeGroupCall) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeGroupCall) GetType() string { + return TypeLinkPreviewTypeGroupCall +} + +func (*LinkPreviewTypeGroupCall) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeGroupCall +} + // The link is a link to an invoice type LinkPreviewTypeInvoice struct{ meta @@ -21909,7 +21971,7 @@ func (*LinkPreviewTypeStickerSet) LinkPreviewTypeType() string { type LinkPreviewTypeStory struct { meta // The identifier of the chat that posted the story - StorySenderChatId int64 `json:"story_sender_chat_id"` + StoryPosterChatId int64 `json:"story_poster_chat_id"` // Story identifier StoryId int32 `json:"story_id"` } @@ -26393,7 +26455,7 @@ func (*MessagePoll) MessageContentType() string { type MessageStory struct { meta // Identifier of the chat that posted the story - StorySenderChatId int64 `json:"story_sender_chat_id"` + StoryPosterChatId int64 `json:"story_poster_chat_id"` // Story identifier StoryId int32 `json:"story_id"` // True, if the story was automatically forwarded because of a mention of the user @@ -26548,6 +26610,66 @@ func (messageCall *MessageCall) UnmarshalJSON(data []byte) error { return nil } +// A message with information about a group call not bound to a chat. If the message is incoming, the call isn't active, isn't missed, and has no duration, and getOption("can_accept_calls") is true, then incoming call screen must be shown to the user. Use joinGroupCall to accept the call or declineGroupCallInvitation to decline it. If the call become active or missed, then the call screen must be hidden +type MessageGroupCall struct { + meta + // True, if the call is active, i.e. the called user joined the call + IsActive bool `json:"is_active"` + // True, if the called user missed or declined the call + WasMissed bool `json:"was_missed"` + // True, if the call is a video call + IsVideo bool `json:"is_video"` + // Call duration, in seconds; for left calls only + Duration int32 `json:"duration"` + // Identifiers of some other call participants + OtherParticipantIds []MessageSender `json:"other_participant_ids"` +} + +func (entity *MessageGroupCall) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageGroupCall + + return json.Marshal((*stub)(entity)) +} + +func (*MessageGroupCall) GetClass() string { + return ClassMessageContent +} + +func (*MessageGroupCall) GetType() string { + return TypeMessageGroupCall +} + +func (*MessageGroupCall) MessageContentType() string { + return TypeMessageGroupCall +} + +func (messageGroupCall *MessageGroupCall) UnmarshalJSON(data []byte) error { + var tmp struct { + IsActive bool `json:"is_active"` + WasMissed bool `json:"was_missed"` + IsVideo bool `json:"is_video"` + Duration int32 `json:"duration"` + OtherParticipantIds []json.RawMessage `json:"other_participant_ids"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageGroupCall.IsActive = tmp.IsActive + messageGroupCall.WasMissed = tmp.WasMissed + messageGroupCall.IsVideo = tmp.IsVideo + messageGroupCall.Duration = tmp.Duration + + fieldOtherParticipantIds, _ := UnmarshalListOfMessageSender(tmp.OtherParticipantIds) + messageGroupCall.OtherParticipantIds = fieldOtherParticipantIds + + return nil +} + // A new video chat was scheduled type MessageVideoChatScheduled struct { meta @@ -30357,11 +30479,11 @@ func (inputMessagePoll *InputMessagePoll) UnmarshalJSON(data []byte) error { return nil } -// A message with a forwarded story. Stories can't be sent to secret chats. A story can be forwarded only if story.can_be_forwarded +// A message with a forwarded story. Stories can't be forwarded to secret chats. A story can be forwarded only if story.can_be_forwarded type InputMessageStory struct { meta // Identifier of the chat that posted the story - StorySenderChatId int64 `json:"story_sender_chat_id"` + StoryPosterChatId int64 `json:"story_poster_chat_id"` // Story identifier StoryId int32 `json:"story_id"` } @@ -32756,7 +32878,7 @@ func (*InputStoryAreas) GetType() string { return TypeInputStoryAreas } -// Describes a video file sent in a story +// Describes a video file posted as a story type StoryVideo struct { meta // Duration of the video, in seconds @@ -33036,7 +33158,7 @@ func (*StoryListArchive) StoryListType() string { return TypeStoryListArchive } -// The original story was a public story with known sender +// The original story was a public story that was posted by a known chat type StoryOriginPublicStory struct { meta // Identifier of the chat that posted original story @@ -33065,11 +33187,11 @@ func (*StoryOriginPublicStory) StoryOriginType() string { return TypeStoryOriginPublicStory } -// The original story was sent by an unknown user +// The original story was posted by an unknown user type StoryOriginHiddenUser struct { meta - // Name of the story sender - SenderName string `json:"sender_name"` + // Name of the user or the chat that posted the story + PosterName string `json:"poster_name"` } func (entity *StoryOriginHiddenUser) MarshalJSON() ([]byte, error) { @@ -33168,21 +33290,21 @@ func (*StoryInteractionInfo) GetType() string { // Represents a story type Story struct { meta - // Unique story identifier among stories of the given sender + // Unique story identifier among stories posted by the given chat Id int32 `json:"id"` // Identifier of the chat that posted the story - SenderChatId int64 `json:"sender_chat_id"` - // Identifier of the sender of the story; may be null if the story is posted on behalf of the sender_chat_id - SenderId MessageSender `json:"sender_id"` + PosterChatId int64 `json:"poster_chat_id"` + // Identifier of the user or chat that posted the story; may be null if the story is posted on behalf of the poster_chat_id + PosterId MessageSender `json:"poster_id"` // Point in time (Unix timestamp) when the story was published Date int32 `json:"date"` - // True, if the story is being sent by the current user - IsBeingSent bool `json:"is_being_sent"` + // True, if the story is being posted by the current user + IsBeingPosted bool `json:"is_being_posted"` // True, if the story is being edited by the current user IsBeingEdited bool `json:"is_being_edited"` // True, if the story was edited IsEdited bool `json:"is_edited"` - // True, if the story is saved in the sender's profile and will be available there after expiration + // True, if the story is saved in the profile of the chat that posted it and will be available there after expiration IsPostedToChatPage bool `json:"is_posted_to_chat_page"` // True, if the story is visible only for the current user IsVisibleOnlyForSelf bool `json:"is_visible_only_for_self"` @@ -33192,7 +33314,7 @@ type Story struct { CanBeEdited bool `json:"can_be_edited"` // True, if the story can be forwarded as a message. Otherwise, screenshots and saving of the story content must be also forbidden CanBeForwarded bool `json:"can_be_forwarded"` - // True, if the story can be replied in the chat with the story sender + // True, if the story can be replied in the chat with the user that posted the story CanBeReplied bool `json:"can_be_replied"` // True, if the story's is_posted_to_chat_page value can be changed CanToggleIsPostedToChatPage bool `json:"can_toggle_is_posted_to_chat_page"` @@ -33237,10 +33359,10 @@ func (*Story) GetType() string { func (story *Story) UnmarshalJSON(data []byte) error { var tmp struct { Id int32 `json:"id"` - SenderChatId int64 `json:"sender_chat_id"` - SenderId json.RawMessage `json:"sender_id"` + PosterChatId int64 `json:"poster_chat_id"` + PosterId json.RawMessage `json:"poster_id"` Date int32 `json:"date"` - IsBeingSent bool `json:"is_being_sent"` + IsBeingPosted bool `json:"is_being_posted"` IsBeingEdited bool `json:"is_being_edited"` IsEdited bool `json:"is_edited"` IsPostedToChatPage bool `json:"is_posted_to_chat_page"` @@ -33268,9 +33390,9 @@ func (story *Story) UnmarshalJSON(data []byte) error { } story.Id = tmp.Id - story.SenderChatId = tmp.SenderChatId + story.PosterChatId = tmp.PosterChatId story.Date = tmp.Date - story.IsBeingSent = tmp.IsBeingSent + story.IsBeingPosted = tmp.IsBeingPosted story.IsBeingEdited = tmp.IsBeingEdited story.IsEdited = tmp.IsEdited story.IsPostedToChatPage = tmp.IsPostedToChatPage @@ -33288,8 +33410,8 @@ func (story *Story) UnmarshalJSON(data []byte) error { story.Areas = tmp.Areas story.Caption = tmp.Caption - fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) - story.SenderId = fieldSenderId + fieldPosterId, _ := UnmarshalMessageSender(tmp.PosterId) + story.PosterId = fieldPosterId fieldChosenReactionType, _ := UnmarshalReactionType(tmp.ChosenReactionType) story.ChosenReactionType = fieldChosenReactionType @@ -33357,12 +33479,12 @@ func (*FoundStories) GetType() string { return TypeFoundStories } -// Contains identifier of a story along with identifier of its sender +// Contains identifier of a story along with identifier of the chat that posted it type StoryFullId struct { meta // Identifier of the chat that posted the story - SenderChatId int64 `json:"sender_chat_id"` - // Unique story identifier among stories of the given sender + PosterChatId int64 `json:"poster_chat_id"` + // Unique story identifier among stories of the chat StoryId int32 `json:"story_id"` } @@ -33385,7 +33507,7 @@ func (*StoryFullId) GetType() string { // Contains basic information about a story type StoryInfo struct { meta - // Unique story identifier among stories of the given sender + // Unique story identifier among stories of the chat StoryId int32 `json:"story_id"` // Point in time (Unix timestamp) when the story was published Date int32 `json:"date"` @@ -33416,7 +33538,7 @@ type ChatActiveStories struct { ChatId int64 `json:"chat_id"` // Identifier of the story list in which the stories are shown; may be null if the stories aren't shown in a story list List StoryList `json:"list"` - // A parameter used to determine order of the stories in the story list; 0 if the stories doesn't need to be shown in the story list. Stories must be sorted by the pair (order, story_sender_chat_id) in descending order + // A parameter used to determine order of the stories in the story list; 0 if the stories doesn't need to be shown in the story list. Stories must be sorted by the pair (order, story_poster_chat_id) in descending order Order int64 `json:"order"` // Identifier of the last read active story MaxReadStoryId int32 `json:"max_read_story_id"` @@ -34557,31 +34679,31 @@ func (*CallDiscardReasonHungUp) CallDiscardReasonType() string { return TypeCallDiscardReasonHungUp } -// The call was ended because it has been used successfully to transfer private encryption key for the associated group call -type CallDiscardReasonAllowGroupCall struct { +// The call was ended because it has been upgraded to a group call +type CallDiscardReasonUpgradeToGroupCall struct { meta - // Encrypted using the call private key encryption key for the associated group call - EncryptedGroupCallKey []byte `json:"encrypted_group_call_key"` + // Invite link for the group call + InviteLink string `json:"invite_link"` } -func (entity *CallDiscardReasonAllowGroupCall) MarshalJSON() ([]byte, error) { +func (entity *CallDiscardReasonUpgradeToGroupCall) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub CallDiscardReasonAllowGroupCall + type stub CallDiscardReasonUpgradeToGroupCall return json.Marshal((*stub)(entity)) } -func (*CallDiscardReasonAllowGroupCall) GetClass() string { +func (*CallDiscardReasonUpgradeToGroupCall) GetClass() string { return ClassCallDiscardReason } -func (*CallDiscardReasonAllowGroupCall) GetType() string { - return TypeCallDiscardReasonAllowGroupCall +func (*CallDiscardReasonUpgradeToGroupCall) GetType() string { + return TypeCallDiscardReasonUpgradeToGroupCall } -func (*CallDiscardReasonAllowGroupCall) CallDiscardReasonType() string { - return TypeCallDiscardReasonAllowGroupCall +func (*CallDiscardReasonUpgradeToGroupCall) CallDiscardReasonType() string { + return TypeCallDiscardReasonUpgradeToGroupCall } // Specifies the supported call protocols @@ -34848,6 +34970,8 @@ type CallStateReady struct { Emojis []string `json:"emojis"` // True, if peer-to-peer connection is allowed by users privacy settings AllowP2p bool `json:"allow_p2p"` + // True, if the other party supports upgrading of the call to a group call + IsGroupCallSupported bool `json:"is_group_call_supported"` // Custom JSON-encoded call parameters to be passed to tgcalls CustomParameters string `json:"custom_parameters"` } @@ -34980,6 +35104,35 @@ func (*CallStateError) CallStateType() string { return TypeCallStateError } +// Describes parameters used to join a group call +type GroupCallJoinParameters struct { + meta + // Audio channel synchronization source identifier; received from tgcalls + AudioSourceId int32 `json:"audio_source_id"` + // Group call join payload; received from tgcalls + Payload string `json:"payload"` + // Pass true to join the call with muted microphone + IsMuted bool `json:"is_muted"` + // Pass true if the user's video is enabled + IsMyVideoEnabled bool `json:"is_my_video_enabled"` +} + +func (entity *GroupCallJoinParameters) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GroupCallJoinParameters + + return json.Marshal((*stub)(entity)) +} + +func (*GroupCallJoinParameters) GetClass() string { + return ClassGroupCallJoinParameters +} + +func (*GroupCallJoinParameters) GetType() string { + return TypeGroupCallJoinParameters +} + // The worst available video quality type GroupCallVideoQualityThumbnail struct{ meta @@ -35055,8 +35208,8 @@ func (*GroupCallVideoQualityFull) GroupCallVideoQualityType() string { return TypeGroupCallVideoQualityFull } -// Describes an available stream in a group call -type GroupCallStream struct { +// Describes an available stream in a video chat +type VideoChatStream struct { meta // Identifier of an audio/video channel ChannelId int32 `json:"channel_id"` @@ -35066,43 +35219,43 @@ type GroupCallStream struct { TimeOffset int64 `json:"time_offset"` } -func (entity *GroupCallStream) MarshalJSON() ([]byte, error) { +func (entity *VideoChatStream) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub GroupCallStream + type stub VideoChatStream return json.Marshal((*stub)(entity)) } -func (*GroupCallStream) GetClass() string { - return ClassGroupCallStream +func (*VideoChatStream) GetClass() string { + return ClassVideoChatStream } -func (*GroupCallStream) GetType() string { - return TypeGroupCallStream +func (*VideoChatStream) GetType() string { + return TypeVideoChatStream } -// Represents a list of group call streams -type GroupCallStreams struct { +// Represents a list of video chat streams +type VideoChatStreams struct { meta - // A list of group call streams - Streams []*GroupCallStream `json:"streams"` + // A list of video chat streams + Streams []*VideoChatStream `json:"streams"` } -func (entity *GroupCallStreams) MarshalJSON() ([]byte, error) { +func (entity *VideoChatStreams) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub GroupCallStreams + type stub VideoChatStreams return json.Marshal((*stub)(entity)) } -func (*GroupCallStreams) GetClass() string { - return ClassGroupCallStreams +func (*VideoChatStreams) GetClass() string { + return ClassVideoChatStreams } -func (*GroupCallStreams) GetType() string { - return TypeGroupCallStreams +func (*VideoChatStreams) GetType() string { + return TypeVideoChatStreams } // Represents an RTMP URL @@ -35179,27 +35332,31 @@ type GroupCall struct { meta // Group call identifier Id int32 `json:"id"` - // Identifier of one-to-one call from which the group call was created; 0 if unknown - FromCallId int32 `json:"from_call_id"` - // Group call title + // Group call title; for video chats only Title string `json:"title"` - // Point in time (Unix timestamp) when the group call is expected to be started by an administrator; 0 if it is already active or was ended + // Invite link for the group call; for group calls that aren't bound to a chat. For video chats call getVideoChatInviteLink to get the link + InviteLink string `json:"invite_link"` + // Point in time (Unix timestamp) when the group call is expected to be started by an administrator; 0 if it is already active or was ended; for video chats only ScheduledStartDate int32 `json:"scheduled_start_date"` - // True, if the group call is scheduled and the current user will receive a notification when the group call starts + // True, if the group call is scheduled and the current user will receive a notification when the group call starts; for video chats only EnabledStartNotification bool `json:"enabled_start_notification"` // True, if the call is active IsActive bool `json:"is_active"` - // True, if the chat is an RTMP stream instead of an ordinary video chat + // True, if the call is bound to a chat + IsVideoChat bool `json:"is_video_chat"` + // True, if the call is an RTMP stream instead of an ordinary video chat; for video chats only IsRtmpStream bool `json:"is_rtmp_stream"` // True, if the call is joined IsJoined bool `json:"is_joined"` // True, if user was kicked from the call because of network loss and the call needs to be rejoined NeedRejoin bool `json:"need_rejoin"` - // True, if the current user can manage the group call + // True, if the user is the owner of the call and can end the call, change volume level of other users, or ban users there; for group calls that aren't bound to a chat + IsOwned bool `json:"is_owned"` + // True, if the current user can manage the group call; for video chats only CanBeManaged bool `json:"can_be_managed"` // Number of participants in the group call ParticipantCount int32 `json:"participant_count"` - // True, if group call participants, which are muted, aren't returned in participant list + // True, if group call participants, which are muted, aren't returned in participant list; for video chats only HasHiddenListeners bool `json:"has_hidden_listeners"` // True, if all group call participants are loaded LoadedAllParticipants bool `json:"loaded_all_participants"` @@ -35211,9 +35368,9 @@ type GroupCall struct { IsMyVideoPaused bool `json:"is_my_video_paused"` // True, if the current user can broadcast video or share screen CanEnableVideo bool `json:"can_enable_video"` - // True, if only group call administrators can unmute new participants + // True, if only group call administrators can unmute new participants; for video chats only MuteNewParticipants bool `json:"mute_new_participants"` - // True, if the current user can enable or disable mute_new_participants setting + // True, if the current user can enable or disable mute_new_participants setting; for video chats only CanToggleMuteNewParticipants bool `json:"can_toggle_mute_new_participants"` // Duration of the ongoing group call recording, in seconds; 0 if none. An updateGroupCall update is not triggered when value of this field changes, but the same recording goes on RecordDuration int32 `json:"record_duration"` @@ -35399,6 +35556,285 @@ func (groupCallParticipant *GroupCallParticipant) UnmarshalJSON(data []byte) err return nil } +// Contains identifiers of group call participants +type GroupCallParticipants struct { + meta + // Total number of group call participants + TotalCount int32 `json:"total_count"` + // Identifiers of the participants + ParticipantIds []MessageSender `json:"participant_ids"` +} + +func (entity *GroupCallParticipants) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GroupCallParticipants + + return json.Marshal((*stub)(entity)) +} + +func (*GroupCallParticipants) GetClass() string { + return ClassGroupCallParticipants +} + +func (*GroupCallParticipants) GetType() string { + return TypeGroupCallParticipants +} + +func (groupCallParticipants *GroupCallParticipants) UnmarshalJSON(data []byte) error { + var tmp struct { + TotalCount int32 `json:"total_count"` + ParticipantIds []json.RawMessage `json:"participant_ids"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + groupCallParticipants.TotalCount = tmp.TotalCount + + fieldParticipantIds, _ := UnmarshalListOfMessageSender(tmp.ParticipantIds) + groupCallParticipants.ParticipantIds = fieldParticipantIds + + return nil +} + +// Contains information about a just created or just joined group call +type GroupCallInfo struct { + meta + // Identifier of the group call + GroupCallId int32 `json:"group_call_id"` + // Join response payload for tgcalls; empty if the call isn't joined + JoinPayload string `json:"join_payload"` +} + +func (entity *GroupCallInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GroupCallInfo + + return json.Marshal((*stub)(entity)) +} + +func (*GroupCallInfo) GetClass() string { + return ClassGroupCallInfo +} + +func (*GroupCallInfo) GetType() string { + return TypeGroupCallInfo +} + +// The user can't be invited due to their privacy settings +type InviteGroupCallParticipantResultUserPrivacyRestricted struct{ + meta +} + +func (entity *InviteGroupCallParticipantResultUserPrivacyRestricted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InviteGroupCallParticipantResultUserPrivacyRestricted + + return json.Marshal((*stub)(entity)) +} + +func (*InviteGroupCallParticipantResultUserPrivacyRestricted) GetClass() string { + return ClassInviteGroupCallParticipantResult +} + +func (*InviteGroupCallParticipantResultUserPrivacyRestricted) GetType() string { + return TypeInviteGroupCallParticipantResultUserPrivacyRestricted +} + +func (*InviteGroupCallParticipantResultUserPrivacyRestricted) InviteGroupCallParticipantResultType() string { + return TypeInviteGroupCallParticipantResultUserPrivacyRestricted +} + +// The user can't be invited because they are already a participant of the call +type InviteGroupCallParticipantResultUserAlreadyParticipant struct{ + meta +} + +func (entity *InviteGroupCallParticipantResultUserAlreadyParticipant) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InviteGroupCallParticipantResultUserAlreadyParticipant + + return json.Marshal((*stub)(entity)) +} + +func (*InviteGroupCallParticipantResultUserAlreadyParticipant) GetClass() string { + return ClassInviteGroupCallParticipantResult +} + +func (*InviteGroupCallParticipantResultUserAlreadyParticipant) GetType() string { + return TypeInviteGroupCallParticipantResultUserAlreadyParticipant +} + +func (*InviteGroupCallParticipantResultUserAlreadyParticipant) InviteGroupCallParticipantResultType() string { + return TypeInviteGroupCallParticipantResultUserAlreadyParticipant +} + +// The user can't be invited because they were banned by the owner of the call and can be invited back only by the owner of the group call +type InviteGroupCallParticipantResultUserWasBanned struct{ + meta +} + +func (entity *InviteGroupCallParticipantResultUserWasBanned) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InviteGroupCallParticipantResultUserWasBanned + + return json.Marshal((*stub)(entity)) +} + +func (*InviteGroupCallParticipantResultUserWasBanned) GetClass() string { + return ClassInviteGroupCallParticipantResult +} + +func (*InviteGroupCallParticipantResultUserWasBanned) GetType() string { + return TypeInviteGroupCallParticipantResultUserWasBanned +} + +func (*InviteGroupCallParticipantResultUserWasBanned) InviteGroupCallParticipantResultType() string { + return TypeInviteGroupCallParticipantResultUserWasBanned +} + +// The user was invited and a service message of the type messageGroupCall was sent which can be used in declineGroupCallInvitation to cancel the invitation +type InviteGroupCallParticipantResultSuccess struct { + meta + // Identifier of the chat with the invitation message + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` +} + +func (entity *InviteGroupCallParticipantResultSuccess) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InviteGroupCallParticipantResultSuccess + + return json.Marshal((*stub)(entity)) +} + +func (*InviteGroupCallParticipantResultSuccess) GetClass() string { + return ClassInviteGroupCallParticipantResult +} + +func (*InviteGroupCallParticipantResultSuccess) GetType() string { + return TypeInviteGroupCallParticipantResultSuccess +} + +func (*InviteGroupCallParticipantResultSuccess) InviteGroupCallParticipantResultType() string { + return TypeInviteGroupCallParticipantResultSuccess +} + +// The main data channel for audio and video data +type GroupCallDataChannelMain struct{ + meta +} + +func (entity *GroupCallDataChannelMain) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GroupCallDataChannelMain + + return json.Marshal((*stub)(entity)) +} + +func (*GroupCallDataChannelMain) GetClass() string { + return ClassGroupCallDataChannel +} + +func (*GroupCallDataChannelMain) GetType() string { + return TypeGroupCallDataChannelMain +} + +func (*GroupCallDataChannelMain) GroupCallDataChannelType() string { + return TypeGroupCallDataChannelMain +} + +// The data channel for screen sharing +type GroupCallDataChannelScreenSharing struct{ + meta +} + +func (entity *GroupCallDataChannelScreenSharing) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GroupCallDataChannelScreenSharing + + return json.Marshal((*stub)(entity)) +} + +func (*GroupCallDataChannelScreenSharing) GetClass() string { + return ClassGroupCallDataChannel +} + +func (*GroupCallDataChannelScreenSharing) GetType() string { + return TypeGroupCallDataChannelScreenSharing +} + +func (*GroupCallDataChannelScreenSharing) GroupCallDataChannelType() string { + return TypeGroupCallDataChannelScreenSharing +} + +// The group call is accessible through a link +type InputGroupCallLink struct { + meta + // The link for the group call + Link string `json:"link"` +} + +func (entity *InputGroupCallLink) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputGroupCallLink + + return json.Marshal((*stub)(entity)) +} + +func (*InputGroupCallLink) GetClass() string { + return ClassInputGroupCall +} + +func (*InputGroupCallLink) GetType() string { + return TypeInputGroupCallLink +} + +func (*InputGroupCallLink) InputGroupCallType() string { + return TypeInputGroupCallLink +} + +// The group call is accessible through a message of the type messageGroupCall +type InputGroupCallMessage struct { + meta + // Identifier of the chat with the message + ChatId int64 `json:"chat_id"` + // Identifier of the message of the type messageGroupCall + MessageId int64 `json:"message_id"` +} + +func (entity *InputGroupCallMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputGroupCallMessage + + return json.Marshal((*stub)(entity)) +} + +func (*InputGroupCallMessage) GetClass() string { + return ClassInputGroupCall +} + +func (*InputGroupCallMessage) GetType() string { + return TypeInputGroupCallMessage +} + +func (*InputGroupCallMessage) InputGroupCallType() string { + return TypeInputGroupCallMessage +} + // The user heard their own voice type CallProblemEcho struct{ meta @@ -35637,8 +36073,6 @@ type Call struct { IsVideo bool `json:"is_video"` // Call state State CallState `json:"state"` - // Identifier of the group call associated with the call; 0 if the group call isn't created yet. The group call can be received through the method getGroupCall - GroupCallId int32 `json:"group_call_id"` } func (entity *Call) MarshalJSON() ([]byte, error) { @@ -35664,7 +36098,6 @@ func (call *Call) UnmarshalJSON(data []byte) error { IsOutgoing bool `json:"is_outgoing"` IsVideo bool `json:"is_video"` State json.RawMessage `json:"state"` - GroupCallId int32 `json:"group_call_id"` } err := json.Unmarshal(data, &tmp) @@ -35676,7 +36109,6 @@ func (call *Call) UnmarshalJSON(data []byte) error { call.UserId = tmp.UserId call.IsOutgoing = tmp.IsOutgoing call.IsVideo = tmp.IsVideo - call.GroupCallId = tmp.GroupCallId fieldState, _ := UnmarshalCallState(tmp.State) call.State = fieldState @@ -35753,7 +36185,7 @@ type PhoneNumberAuthenticationSettings struct { AllowSmsRetrieverApi bool `json:"allow_sms_retriever_api"` // For official Android and iOS applications only; pass null otherwise. Settings for Firebase Authentication FirebaseAuthenticationSettings FirebaseAuthenticationSettings `json:"firebase_authentication_settings"` - // List of up to 20 authentication tokens, recently received in updateOption("authentication_token") in previously logged out sessions + // List of up to 20 authentication tokens, recently received in updateOption("authentication_token") in previously logged out sessions; for setAuthenticationPhoneNumber only AuthenticationTokens []string `json:"authentication_tokens"` } @@ -40659,57 +41091,57 @@ func (*PremiumLimitTypeActiveStoryCount) PremiumLimitTypeType() string { return TypePremiumLimitTypeActiveStoryCount } -// The maximum number of stories sent per week -type PremiumLimitTypeWeeklySentStoryCount struct{ +// The maximum number of stories posted per week +type PremiumLimitTypeWeeklyPostedStoryCount struct{ meta } -func (entity *PremiumLimitTypeWeeklySentStoryCount) MarshalJSON() ([]byte, error) { +func (entity *PremiumLimitTypeWeeklyPostedStoryCount) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub PremiumLimitTypeWeeklySentStoryCount + type stub PremiumLimitTypeWeeklyPostedStoryCount return json.Marshal((*stub)(entity)) } -func (*PremiumLimitTypeWeeklySentStoryCount) GetClass() string { +func (*PremiumLimitTypeWeeklyPostedStoryCount) GetClass() string { return ClassPremiumLimitType } -func (*PremiumLimitTypeWeeklySentStoryCount) GetType() string { - return TypePremiumLimitTypeWeeklySentStoryCount +func (*PremiumLimitTypeWeeklyPostedStoryCount) GetType() string { + return TypePremiumLimitTypeWeeklyPostedStoryCount } -func (*PremiumLimitTypeWeeklySentStoryCount) PremiumLimitTypeType() string { - return TypePremiumLimitTypeWeeklySentStoryCount +func (*PremiumLimitTypeWeeklyPostedStoryCount) PremiumLimitTypeType() string { + return TypePremiumLimitTypeWeeklyPostedStoryCount } -// The maximum number of stories sent per month -type PremiumLimitTypeMonthlySentStoryCount struct{ +// The maximum number of stories posted per month +type PremiumLimitTypeMonthlyPostedStoryCount struct{ meta } -func (entity *PremiumLimitTypeMonthlySentStoryCount) MarshalJSON() ([]byte, error) { +func (entity *PremiumLimitTypeMonthlyPostedStoryCount) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub PremiumLimitTypeMonthlySentStoryCount + type stub PremiumLimitTypeMonthlyPostedStoryCount return json.Marshal((*stub)(entity)) } -func (*PremiumLimitTypeMonthlySentStoryCount) GetClass() string { +func (*PremiumLimitTypeMonthlyPostedStoryCount) GetClass() string { return ClassPremiumLimitType } -func (*PremiumLimitTypeMonthlySentStoryCount) GetType() string { - return TypePremiumLimitTypeMonthlySentStoryCount +func (*PremiumLimitTypeMonthlyPostedStoryCount) GetType() string { + return TypePremiumLimitTypeMonthlyPostedStoryCount } -func (*PremiumLimitTypeMonthlySentStoryCount) PremiumLimitTypeType() string { - return TypePremiumLimitTypeMonthlySentStoryCount +func (*PremiumLimitTypeMonthlyPostedStoryCount) PremiumLimitTypeType() string { + return TypePremiumLimitTypeMonthlyPostedStoryCount } -// The maximum length of captions of sent stories +// The maximum length of captions of posted stories type PremiumLimitTypeStoryCaptionLength struct{ meta } @@ -43629,157 +44061,157 @@ func (*Hashtags) GetType() string { } // A story can be sent -type CanSendStoryResultOk struct{ +type CanPostStoryResultOk struct{ meta } -func (entity *CanSendStoryResultOk) MarshalJSON() ([]byte, error) { +func (entity *CanPostStoryResultOk) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub CanSendStoryResultOk + type stub CanPostStoryResultOk return json.Marshal((*stub)(entity)) } -func (*CanSendStoryResultOk) GetClass() string { - return ClassCanSendStoryResult +func (*CanPostStoryResultOk) GetClass() string { + return ClassCanPostStoryResult } -func (*CanSendStoryResultOk) GetType() string { - return TypeCanSendStoryResultOk +func (*CanPostStoryResultOk) GetType() string { + return TypeCanPostStoryResultOk } -func (*CanSendStoryResultOk) CanSendStoryResultType() string { - return TypeCanSendStoryResultOk +func (*CanPostStoryResultOk) CanPostStoryResultType() string { + return TypeCanPostStoryResultOk } // The user must subscribe to Telegram Premium to be able to post stories -type CanSendStoryResultPremiumNeeded struct{ +type CanPostStoryResultPremiumNeeded struct{ meta } -func (entity *CanSendStoryResultPremiumNeeded) MarshalJSON() ([]byte, error) { +func (entity *CanPostStoryResultPremiumNeeded) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub CanSendStoryResultPremiumNeeded + type stub CanPostStoryResultPremiumNeeded return json.Marshal((*stub)(entity)) } -func (*CanSendStoryResultPremiumNeeded) GetClass() string { - return ClassCanSendStoryResult +func (*CanPostStoryResultPremiumNeeded) GetClass() string { + return ClassCanPostStoryResult } -func (*CanSendStoryResultPremiumNeeded) GetType() string { - return TypeCanSendStoryResultPremiumNeeded +func (*CanPostStoryResultPremiumNeeded) GetType() string { + return TypeCanPostStoryResultPremiumNeeded } -func (*CanSendStoryResultPremiumNeeded) CanSendStoryResultType() string { - return TypeCanSendStoryResultPremiumNeeded +func (*CanPostStoryResultPremiumNeeded) CanPostStoryResultType() string { + return TypeCanPostStoryResultPremiumNeeded } // The chat must be boosted first by Telegram Premium subscribers to post more stories. Call getChatBoostStatus to get current boost status of the chat -type CanSendStoryResultBoostNeeded struct{ +type CanPostStoryResultBoostNeeded struct{ meta } -func (entity *CanSendStoryResultBoostNeeded) MarshalJSON() ([]byte, error) { +func (entity *CanPostStoryResultBoostNeeded) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub CanSendStoryResultBoostNeeded + type stub CanPostStoryResultBoostNeeded return json.Marshal((*stub)(entity)) } -func (*CanSendStoryResultBoostNeeded) GetClass() string { - return ClassCanSendStoryResult +func (*CanPostStoryResultBoostNeeded) GetClass() string { + return ClassCanPostStoryResult } -func (*CanSendStoryResultBoostNeeded) GetType() string { - return TypeCanSendStoryResultBoostNeeded +func (*CanPostStoryResultBoostNeeded) GetType() string { + return TypeCanPostStoryResultBoostNeeded } -func (*CanSendStoryResultBoostNeeded) CanSendStoryResultType() string { - return TypeCanSendStoryResultBoostNeeded +func (*CanPostStoryResultBoostNeeded) CanPostStoryResultType() string { + return TypeCanPostStoryResultBoostNeeded } // The limit for the number of active stories exceeded. The user can buy Telegram Premium, delete an active story, or wait for the oldest story to expire -type CanSendStoryResultActiveStoryLimitExceeded struct{ +type CanPostStoryResultActiveStoryLimitExceeded struct{ meta } -func (entity *CanSendStoryResultActiveStoryLimitExceeded) MarshalJSON() ([]byte, error) { +func (entity *CanPostStoryResultActiveStoryLimitExceeded) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub CanSendStoryResultActiveStoryLimitExceeded + type stub CanPostStoryResultActiveStoryLimitExceeded return json.Marshal((*stub)(entity)) } -func (*CanSendStoryResultActiveStoryLimitExceeded) GetClass() string { - return ClassCanSendStoryResult +func (*CanPostStoryResultActiveStoryLimitExceeded) GetClass() string { + return ClassCanPostStoryResult } -func (*CanSendStoryResultActiveStoryLimitExceeded) GetType() string { - return TypeCanSendStoryResultActiveStoryLimitExceeded +func (*CanPostStoryResultActiveStoryLimitExceeded) GetType() string { + return TypeCanPostStoryResultActiveStoryLimitExceeded } -func (*CanSendStoryResultActiveStoryLimitExceeded) CanSendStoryResultType() string { - return TypeCanSendStoryResultActiveStoryLimitExceeded +func (*CanPostStoryResultActiveStoryLimitExceeded) CanPostStoryResultType() string { + return TypeCanPostStoryResultActiveStoryLimitExceeded } // The weekly limit for the number of posted stories exceeded. The user needs to buy Telegram Premium or wait specified time -type CanSendStoryResultWeeklyLimitExceeded struct { +type CanPostStoryResultWeeklyLimitExceeded struct { meta - // Time left before the user can send the next story + // Time left before the user can post the next story RetryAfter int32 `json:"retry_after"` } -func (entity *CanSendStoryResultWeeklyLimitExceeded) MarshalJSON() ([]byte, error) { +func (entity *CanPostStoryResultWeeklyLimitExceeded) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub CanSendStoryResultWeeklyLimitExceeded + type stub CanPostStoryResultWeeklyLimitExceeded return json.Marshal((*stub)(entity)) } -func (*CanSendStoryResultWeeklyLimitExceeded) GetClass() string { - return ClassCanSendStoryResult +func (*CanPostStoryResultWeeklyLimitExceeded) GetClass() string { + return ClassCanPostStoryResult } -func (*CanSendStoryResultWeeklyLimitExceeded) GetType() string { - return TypeCanSendStoryResultWeeklyLimitExceeded +func (*CanPostStoryResultWeeklyLimitExceeded) GetType() string { + return TypeCanPostStoryResultWeeklyLimitExceeded } -func (*CanSendStoryResultWeeklyLimitExceeded) CanSendStoryResultType() string { - return TypeCanSendStoryResultWeeklyLimitExceeded +func (*CanPostStoryResultWeeklyLimitExceeded) CanPostStoryResultType() string { + return TypeCanPostStoryResultWeeklyLimitExceeded } // The monthly limit for the number of posted stories exceeded. The user needs to buy Telegram Premium or wait specified time -type CanSendStoryResultMonthlyLimitExceeded struct { +type CanPostStoryResultMonthlyLimitExceeded struct { meta - // Time left before the user can send the next story + // Time left before the user can post the next story RetryAfter int32 `json:"retry_after"` } -func (entity *CanSendStoryResultMonthlyLimitExceeded) MarshalJSON() ([]byte, error) { +func (entity *CanPostStoryResultMonthlyLimitExceeded) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub CanSendStoryResultMonthlyLimitExceeded + type stub CanPostStoryResultMonthlyLimitExceeded return json.Marshal((*stub)(entity)) } -func (*CanSendStoryResultMonthlyLimitExceeded) GetClass() string { - return ClassCanSendStoryResult +func (*CanPostStoryResultMonthlyLimitExceeded) GetClass() string { + return ClassCanPostStoryResult } -func (*CanSendStoryResultMonthlyLimitExceeded) GetType() string { - return TypeCanSendStoryResultMonthlyLimitExceeded +func (*CanPostStoryResultMonthlyLimitExceeded) GetType() string { + return TypeCanPostStoryResultMonthlyLimitExceeded } -func (*CanSendStoryResultMonthlyLimitExceeded) CanSendStoryResultType() string { - return TypeCanSendStoryResultMonthlyLimitExceeded +func (*CanPostStoryResultMonthlyLimitExceeded) CanPostStoryResultType() string { + return TypeCanPostStoryResultMonthlyLimitExceeded } // The session can be used @@ -48738,6 +49170,33 @@ func (*InternalLinkTypeGame) InternalLinkTypeType() string { return TypeInternalLinkTypeGame } +// The link is a link to a group call that isn't bound to a chat. Call joinGroupCall with the given invite_link +type InternalLinkTypeGroupCall struct { + meta + // Internal representation of the invite link + InviteLink string `json:"invite_link"` +} + +func (entity *InternalLinkTypeGroupCall) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeGroupCall + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeGroupCall) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeGroupCall) GetType() string { + return TypeInternalLinkTypeGroupCall +} + +func (*InternalLinkTypeGroupCall) InternalLinkTypeType() string { + return TypeInternalLinkTypeGroupCall +} + // The link must be opened in an Instant View. Call getWebPageInstantView with the given URL to process the link. If Instant View is found, then show it, otherwise, open the fallback URL in an external browser type InternalLinkTypeInstantView struct { meta @@ -49311,11 +49770,11 @@ func (*InternalLinkTypeStickerSet) InternalLinkTypeType() string { return TypeInternalLinkTypeStickerSet } -// The link is a link to a story. Call searchPublicChat with the given sender username, then call getStory with the received chat identifier and the given story identifier, then show the story if received +// The link is a link to a story. Call searchPublicChat with the given poster username, then call getStory with the received chat identifier and the given story identifier, then show the story if received type InternalLinkTypeStory struct { meta - // Username of the sender of the story - StorySenderUsername string `json:"story_sender_username"` + // Username of the poster of the story + StoryPosterUsername string `json:"story_poster_username"` // Story identifier StoryId int32 `json:"story_id"` } @@ -49529,7 +49988,7 @@ func (*InternalLinkTypeUserToken) InternalLinkTypeType() string { return TypeInternalLinkTypeUserToken } -// The link is a link to a video chat. Call searchPublicChat with the given chat username, and then joinGroupCall with the given invite hash to process the link +// The link is a link to a video chat. Call searchPublicChat with the given chat username, and then joinVideoChat with the given invite hash to process the link type InternalLinkTypeVideoChat struct { meta // Username of the chat with the video chat @@ -49774,29 +50233,6 @@ func (*BlockListStories) BlockListType() string { return TypeBlockListStories } -// Contains a part of a file -type FilePart struct { - meta - // File bytes - Data []byte `json:"data"` -} - -func (entity *FilePart) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub FilePart - - return json.Marshal((*stub)(entity)) -} - -func (*FilePart) GetClass() string { - return ClassFilePart -} - -func (*FilePart) GetType() string { - return TypeFilePart -} - // The data is not a file type FileTypeNone struct{ meta @@ -52012,6 +52448,29 @@ func (*Text) GetType() string { return TypeText } +// Contains some binary data +type Data struct { + meta + // Data + Data []byte `json:"data"` +} + +func (entity *Data) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Data + + return json.Marshal((*stub)(entity)) +} + +func (*Data) GetClass() string { + return ClassData +} + +func (*Data) GetType() string { + return TypeData +} + // Contains a value representing a number of seconds type Seconds struct { meta @@ -52548,7 +53007,7 @@ func (*ChatStatisticsObjectTypeMessage) ChatStatisticsObjectTypeType() string { return TypeChatStatisticsObjectTypeMessage } -// Describes a story sent by the chat +// Describes a story posted on behalf of the chat type ChatStatisticsObjectTypeStory struct { meta // Story identifier @@ -52575,7 +53034,7 @@ func (*ChatStatisticsObjectTypeStory) ChatStatisticsObjectTypeType() string { return TypeChatStatisticsObjectTypeStory } -// Contains statistics about interactions with a message sent in the chat or a story sent by the chat +// Contains statistics about interactions with a message sent in the chat or a story posted on behalf of the chat type ChatStatisticsInteractionInfo struct { meta // Type of the object @@ -52839,11 +53298,11 @@ type ChatStatisticsChannel struct { MeanMessageShareCount *StatisticalValue `json:"mean_message_share_count"` // Mean number of times reactions were added to the recently sent messages MeanMessageReactionCount *StatisticalValue `json:"mean_message_reaction_count"` - // Mean number of times the recently sent stories were viewed + // Mean number of times the recently posted stories were viewed MeanStoryViewCount *StatisticalValue `json:"mean_story_view_count"` - // Mean number of times the recently sent stories were shared + // Mean number of times the recently posted stories were shared MeanStoryShareCount *StatisticalValue `json:"mean_story_share_count"` - // Mean number of times reactions were added to the recently sent stories + // Mean number of times reactions were added to the recently posted stories MeanStoryReactionCount *StatisticalValue `json:"mean_story_reaction_count"` // A percentage of users with enabled notifications for the chat; 0-100 EnabledNotificationsPercentage float64 `json:"enabled_notifications_percentage"` @@ -52871,7 +53330,7 @@ type ChatStatisticsChannel struct { StoryReactionGraph StatisticalGraph `json:"story_reaction_graph"` // A graph containing number of views of associated with the chat instant views InstantViewInteractionGraph StatisticalGraph `json:"instant_view_interaction_graph"` - // Detailed statistics about number of views and shares of recently sent messages and stories + // Detailed statistics about number of views and shares of recently sent messages and posted stories RecentInteractions []*ChatStatisticsInteractionInfo `json:"recent_interactions"` } @@ -55687,6 +56146,8 @@ type UpdateForumTopic struct { MessageThreadId int64 `json:"message_thread_id"` // True, if the topic is pinned in the topic list IsPinned bool `json:"is_pinned"` + // Identifier of the last read incoming message + LastReadInboxMessageId int64 `json:"last_read_inbox_message_id"` // Identifier of the last read outgoing message LastReadOutboxMessageId int64 `json:"last_read_outbox_message_id"` // Notification settings for the topic @@ -56628,7 +57089,7 @@ func (*UpdateCall) UpdateType() string { // Information about a group call was updated type UpdateGroupCall struct { meta - // New data about a group call + // New data about the group call GroupCall *GroupCall `json:"group_call"` } @@ -56655,9 +57116,9 @@ func (*UpdateGroupCall) UpdateType() string { // Information about a group call participant was changed. The updates are sent only after the group call is received through getGroupCall and only if the call is joined or being joined type UpdateGroupCallParticipant struct { meta - // Identifier of group call + // Identifier of the group call GroupCallId int32 `json:"group_call_id"` - // New data about a participant + // New data about the participant Participant *GroupCallParticipant `json:"participant"` } @@ -56681,6 +57142,66 @@ func (*UpdateGroupCallParticipant) UpdateType() string { return TypeUpdateGroupCallParticipant } +// The list of group call participants that can send and receive encrypted call data has changed; for group calls not bound to a chat only +type UpdateGroupCallParticipants struct { + meta + // Identifier of the group call + GroupCallId int32 `json:"group_call_id"` + // New list of group call participant user identifiers. The identifiers may be invalid or the corresponding users may be unknown. The participants must be shown in the list of group call participants even there is no information about them + ParticipantUserIds []JsonInt64 `json:"participant_user_ids"` +} + +func (entity *UpdateGroupCallParticipants) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateGroupCallParticipants + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateGroupCallParticipants) GetClass() string { + return ClassUpdate +} + +func (*UpdateGroupCallParticipants) GetType() string { + return TypeUpdateGroupCallParticipants +} + +func (*UpdateGroupCallParticipants) UpdateType() string { + return TypeUpdateGroupCallParticipants +} + +// The verification state of an encrypted group call has changed; for group calls not bound to a chat only +type UpdateGroupCallVerificationState struct { + meta + // Identifier of the group call + GroupCallId int32 `json:"group_call_id"` + // The call state generation to which the emoji corresponds. If generation is different for two users, then their emoji may be also different + Generation int32 `json:"generation"` + // Group call state fingerprint represented as 4 emoji; may be empty if the state isn't verified yet + Emojis []string `json:"emojis"` +} + +func (entity *UpdateGroupCallVerificationState) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateGroupCallVerificationState + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateGroupCallVerificationState) GetClass() string { + return ClassUpdate +} + +func (*UpdateGroupCallVerificationState) GetType() string { + return TypeUpdateGroupCallVerificationState +} + +func (*UpdateGroupCallVerificationState) UpdateType() string { + return TypeUpdateGroupCallVerificationState +} + // New call signaling data arrived type UpdateNewCallSignalingData struct { meta @@ -56905,7 +57426,7 @@ func (*UpdateStory) UpdateType() string { type UpdateStoryDeleted struct { meta // Identifier of the chat that posted the story - StorySenderChatId int64 `json:"story_sender_chat_id"` + StoryPosterChatId int64 `json:"story_poster_chat_id"` // Story identifier StoryId int32 `json:"story_id"` } @@ -56930,67 +57451,67 @@ func (*UpdateStoryDeleted) UpdateType() string { return TypeUpdateStoryDeleted } -// A story has been successfully sent -type UpdateStorySendSucceeded struct { +// A story has been successfully posted +type UpdateStoryPostSucceeded struct { meta - // The sent story + // The posted story Story *Story `json:"story"` // The previous temporary story identifier OldStoryId int32 `json:"old_story_id"` } -func (entity *UpdateStorySendSucceeded) MarshalJSON() ([]byte, error) { +func (entity *UpdateStoryPostSucceeded) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub UpdateStorySendSucceeded + type stub UpdateStoryPostSucceeded return json.Marshal((*stub)(entity)) } -func (*UpdateStorySendSucceeded) GetClass() string { +func (*UpdateStoryPostSucceeded) GetClass() string { return ClassUpdate } -func (*UpdateStorySendSucceeded) GetType() string { - return TypeUpdateStorySendSucceeded +func (*UpdateStoryPostSucceeded) GetType() string { + return TypeUpdateStoryPostSucceeded } -func (*UpdateStorySendSucceeded) UpdateType() string { - return TypeUpdateStorySendSucceeded +func (*UpdateStoryPostSucceeded) UpdateType() string { + return TypeUpdateStoryPostSucceeded } -// A story failed to send. If the story sending is canceled, then updateStoryDeleted will be received instead of this update -type UpdateStorySendFailed struct { +// A story failed to post. If the story posting is canceled, then updateStoryDeleted will be received instead of this update +type UpdateStoryPostFailed struct { meta - // The failed to send story + // The failed to post story Story *Story `json:"story"` - // The cause of the story sending failure + // The cause of the story posting failure Error *Error `json:"error"` // Type of the error; may be null if unknown - ErrorType CanSendStoryResult `json:"error_type"` + ErrorType CanPostStoryResult `json:"error_type"` } -func (entity *UpdateStorySendFailed) MarshalJSON() ([]byte, error) { +func (entity *UpdateStoryPostFailed) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub UpdateStorySendFailed + type stub UpdateStoryPostFailed return json.Marshal((*stub)(entity)) } -func (*UpdateStorySendFailed) GetClass() string { +func (*UpdateStoryPostFailed) GetClass() string { return ClassUpdate } -func (*UpdateStorySendFailed) GetType() string { - return TypeUpdateStorySendFailed +func (*UpdateStoryPostFailed) GetType() string { + return TypeUpdateStoryPostFailed } -func (*UpdateStorySendFailed) UpdateType() string { - return TypeUpdateStorySendFailed +func (*UpdateStoryPostFailed) UpdateType() string { + return TypeUpdateStoryPostFailed } -func (updateStorySendFailed *UpdateStorySendFailed) UnmarshalJSON(data []byte) error { +func (updateStoryPostFailed *UpdateStoryPostFailed) UnmarshalJSON(data []byte) error { var tmp struct { Story *Story `json:"story"` Error *Error `json:"error"` @@ -57002,11 +57523,11 @@ func (updateStorySendFailed *UpdateStorySendFailed) UnmarshalJSON(data []byte) e return err } - updateStorySendFailed.Story = tmp.Story - updateStorySendFailed.Error = tmp.Error + updateStoryPostFailed.Story = tmp.Story + updateStoryPostFailed.Error = tmp.Error - fieldErrorType, _ := UnmarshalCanSendStoryResult(tmp.ErrorType) - updateStorySendFailed.ErrorType = fieldErrorType + fieldErrorType, _ := UnmarshalCanPostStoryResult(tmp.ErrorType) + updateStoryPostFailed.ErrorType = fieldErrorType return nil } diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 31bc0c7..dd0a41a 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -2666,6 +2666,9 @@ func UnmarshalLinkPreviewType(data json.RawMessage) (LinkPreviewType, error) { case TypeLinkPreviewTypeExternalVideo: return UnmarshalLinkPreviewTypeExternalVideo(data) + case TypeLinkPreviewTypeGroupCall: + return UnmarshalLinkPreviewTypeGroupCall(data) + case TypeLinkPreviewTypeInvoice: return UnmarshalLinkPreviewTypeInvoice(data) @@ -3390,6 +3393,9 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessageCall: return UnmarshalMessageCall(data) + case TypeMessageGroupCall: + return UnmarshalMessageGroupCall(data) + case TypeMessageVideoChatScheduled: return UnmarshalMessageVideoChatScheduled(data) @@ -4570,8 +4576,8 @@ func UnmarshalCallDiscardReason(data json.RawMessage) (CallDiscardReason, error) case TypeCallDiscardReasonHungUp: return UnmarshalCallDiscardReasonHungUp(data) - case TypeCallDiscardReasonAllowGroupCall: - return UnmarshalCallDiscardReasonAllowGroupCall(data) + case TypeCallDiscardReasonUpgradeToGroupCall: + return UnmarshalCallDiscardReasonUpgradeToGroupCall(data) default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) @@ -4709,6 +4715,114 @@ func UnmarshalListOfGroupCallVideoQuality(dataList []json.RawMessage) ([]GroupCa return list, nil } +func UnmarshalInviteGroupCallParticipantResult(data json.RawMessage) (InviteGroupCallParticipantResult, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeInviteGroupCallParticipantResultUserPrivacyRestricted: + return UnmarshalInviteGroupCallParticipantResultUserPrivacyRestricted(data) + + case TypeInviteGroupCallParticipantResultUserAlreadyParticipant: + return UnmarshalInviteGroupCallParticipantResultUserAlreadyParticipant(data) + + case TypeInviteGroupCallParticipantResultUserWasBanned: + return UnmarshalInviteGroupCallParticipantResultUserWasBanned(data) + + case TypeInviteGroupCallParticipantResultSuccess: + return UnmarshalInviteGroupCallParticipantResultSuccess(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfInviteGroupCallParticipantResult(dataList []json.RawMessage) ([]InviteGroupCallParticipantResult, error) { + list := []InviteGroupCallParticipantResult{} + + for _, data := range dataList { + entity, err := UnmarshalInviteGroupCallParticipantResult(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalGroupCallDataChannel(data json.RawMessage) (GroupCallDataChannel, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeGroupCallDataChannelMain: + return UnmarshalGroupCallDataChannelMain(data) + + case TypeGroupCallDataChannelScreenSharing: + return UnmarshalGroupCallDataChannelScreenSharing(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfGroupCallDataChannel(dataList []json.RawMessage) ([]GroupCallDataChannel, error) { + list := []GroupCallDataChannel{} + + for _, data := range dataList { + entity, err := UnmarshalGroupCallDataChannel(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalInputGroupCall(data json.RawMessage) (InputGroupCall, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeInputGroupCallLink: + return UnmarshalInputGroupCallLink(data) + + case TypeInputGroupCallMessage: + return UnmarshalInputGroupCallMessage(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfInputGroupCall(dataList []json.RawMessage) ([]InputGroupCall, error) { + list := []InputGroupCall{} + + for _, data := range dataList { + entity, err := UnmarshalInputGroupCall(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalCallProblem(data json.RawMessage) (CallProblem, error) { var meta meta @@ -5448,11 +5562,11 @@ func UnmarshalPremiumLimitType(data json.RawMessage) (PremiumLimitType, error) { case TypePremiumLimitTypeActiveStoryCount: return UnmarshalPremiumLimitTypeActiveStoryCount(data) - case TypePremiumLimitTypeWeeklySentStoryCount: - return UnmarshalPremiumLimitTypeWeeklySentStoryCount(data) + case TypePremiumLimitTypeWeeklyPostedStoryCount: + return UnmarshalPremiumLimitTypeWeeklyPostedStoryCount(data) - case TypePremiumLimitTypeMonthlySentStoryCount: - return UnmarshalPremiumLimitTypeMonthlySentStoryCount(data) + case TypePremiumLimitTypeMonthlyPostedStoryCount: + return UnmarshalPremiumLimitTypeMonthlyPostedStoryCount(data) case TypePremiumLimitTypeStoryCaptionLength: return UnmarshalPremiumLimitTypeStoryCaptionLength(data) @@ -6048,7 +6162,7 @@ func UnmarshalListOfInputBackground(dataList []json.RawMessage) ([]InputBackgrou return list, nil } -func UnmarshalCanSendStoryResult(data json.RawMessage) (CanSendStoryResult, error) { +func UnmarshalCanPostStoryResult(data json.RawMessage) (CanPostStoryResult, error) { var meta meta err := json.Unmarshal(data, &meta) @@ -6057,34 +6171,34 @@ func UnmarshalCanSendStoryResult(data json.RawMessage) (CanSendStoryResult, erro } switch meta.Type { - case TypeCanSendStoryResultOk: - return UnmarshalCanSendStoryResultOk(data) + case TypeCanPostStoryResultOk: + return UnmarshalCanPostStoryResultOk(data) - case TypeCanSendStoryResultPremiumNeeded: - return UnmarshalCanSendStoryResultPremiumNeeded(data) + case TypeCanPostStoryResultPremiumNeeded: + return UnmarshalCanPostStoryResultPremiumNeeded(data) - case TypeCanSendStoryResultBoostNeeded: - return UnmarshalCanSendStoryResultBoostNeeded(data) + case TypeCanPostStoryResultBoostNeeded: + return UnmarshalCanPostStoryResultBoostNeeded(data) - case TypeCanSendStoryResultActiveStoryLimitExceeded: - return UnmarshalCanSendStoryResultActiveStoryLimitExceeded(data) + case TypeCanPostStoryResultActiveStoryLimitExceeded: + return UnmarshalCanPostStoryResultActiveStoryLimitExceeded(data) - case TypeCanSendStoryResultWeeklyLimitExceeded: - return UnmarshalCanSendStoryResultWeeklyLimitExceeded(data) + case TypeCanPostStoryResultWeeklyLimitExceeded: + return UnmarshalCanPostStoryResultWeeklyLimitExceeded(data) - case TypeCanSendStoryResultMonthlyLimitExceeded: - return UnmarshalCanSendStoryResultMonthlyLimitExceeded(data) + case TypeCanPostStoryResultMonthlyLimitExceeded: + return UnmarshalCanPostStoryResultMonthlyLimitExceeded(data) default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } } -func UnmarshalListOfCanSendStoryResult(dataList []json.RawMessage) ([]CanSendStoryResult, error) { - list := []CanSendStoryResult{} +func UnmarshalListOfCanPostStoryResult(dataList []json.RawMessage) ([]CanPostStoryResult, error) { + list := []CanPostStoryResult{} for _, data := range dataList { - entity, err := UnmarshalCanSendStoryResult(data) + entity, err := UnmarshalCanPostStoryResult(data) if err != nil { return nil, err } @@ -7093,6 +7207,9 @@ func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { case TypeInternalLinkTypeGame: return UnmarshalInternalLinkTypeGame(data) + case TypeInternalLinkTypeGroupCall: + return UnmarshalInternalLinkTypeGroupCall(data) + case TypeInternalLinkTypeInstantView: return UnmarshalInternalLinkTypeInstantView(data) @@ -8292,6 +8409,12 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateGroupCallParticipant: return UnmarshalUpdateGroupCallParticipant(data) + case TypeUpdateGroupCallParticipants: + return UnmarshalUpdateGroupCallParticipants(data) + + case TypeUpdateGroupCallVerificationState: + return UnmarshalUpdateGroupCallVerificationState(data) + case TypeUpdateNewCallSignalingData: return UnmarshalUpdateNewCallSignalingData(data) @@ -8310,11 +8433,11 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateStoryDeleted: return UnmarshalUpdateStoryDeleted(data) - case TypeUpdateStorySendSucceeded: - return UnmarshalUpdateStorySendSucceeded(data) + case TypeUpdateStoryPostSucceeded: + return UnmarshalUpdateStoryPostSucceeded(data) - case TypeUpdateStorySendFailed: - return UnmarshalUpdateStorySendFailed(data) + case TypeUpdateStoryPostFailed: + return UnmarshalUpdateStoryPostFailed(data) case TypeUpdateChatActiveStories: return UnmarshalUpdateChatActiveStories(data) @@ -12896,6 +13019,14 @@ func UnmarshalLinkPreviewTypeExternalVideo(data json.RawMessage) (*LinkPreviewTy return &resp, err } +func UnmarshalLinkPreviewTypeGroupCall(data json.RawMessage) (*LinkPreviewTypeGroupCall, error) { + var resp LinkPreviewTypeGroupCall + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalLinkPreviewTypeInvoice(data json.RawMessage) (*LinkPreviewTypeInvoice, error) { var resp LinkPreviewTypeInvoice @@ -14144,6 +14275,14 @@ func UnmarshalMessageCall(data json.RawMessage) (*MessageCall, error) { return &resp, err } +func UnmarshalMessageGroupCall(data json.RawMessage) (*MessageGroupCall, error) { + var resp MessageGroupCall + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageVideoChatScheduled(data json.RawMessage) (*MessageVideoChatScheduled, error) { var resp MessageVideoChatScheduled @@ -16016,8 +16155,8 @@ func UnmarshalCallDiscardReasonHungUp(data json.RawMessage) (*CallDiscardReasonH return &resp, err } -func UnmarshalCallDiscardReasonAllowGroupCall(data json.RawMessage) (*CallDiscardReasonAllowGroupCall, error) { - var resp CallDiscardReasonAllowGroupCall +func UnmarshalCallDiscardReasonUpgradeToGroupCall(data json.RawMessage) (*CallDiscardReasonUpgradeToGroupCall, error) { + var resp CallDiscardReasonUpgradeToGroupCall err := json.Unmarshal(data, &resp) @@ -16120,6 +16259,14 @@ func UnmarshalCallStateError(data json.RawMessage) (*CallStateError, error) { return &resp, err } +func UnmarshalGroupCallJoinParameters(data json.RawMessage) (*GroupCallJoinParameters, error) { + var resp GroupCallJoinParameters + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalGroupCallVideoQualityThumbnail(data json.RawMessage) (*GroupCallVideoQualityThumbnail, error) { var resp GroupCallVideoQualityThumbnail @@ -16144,16 +16291,16 @@ func UnmarshalGroupCallVideoQualityFull(data json.RawMessage) (*GroupCallVideoQu return &resp, err } -func UnmarshalGroupCallStream(data json.RawMessage) (*GroupCallStream, error) { - var resp GroupCallStream +func UnmarshalVideoChatStream(data json.RawMessage) (*VideoChatStream, error) { + var resp VideoChatStream err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalGroupCallStreams(data json.RawMessage) (*GroupCallStreams, error) { - var resp GroupCallStreams +func UnmarshalVideoChatStreams(data json.RawMessage) (*VideoChatStreams, error) { + var resp VideoChatStreams err := json.Unmarshal(data, &resp) @@ -16208,6 +16355,86 @@ func UnmarshalGroupCallParticipant(data json.RawMessage) (*GroupCallParticipant, return &resp, err } +func UnmarshalGroupCallParticipants(data json.RawMessage) (*GroupCallParticipants, error) { + var resp GroupCallParticipants + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGroupCallInfo(data json.RawMessage) (*GroupCallInfo, error) { + var resp GroupCallInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInviteGroupCallParticipantResultUserPrivacyRestricted(data json.RawMessage) (*InviteGroupCallParticipantResultUserPrivacyRestricted, error) { + var resp InviteGroupCallParticipantResultUserPrivacyRestricted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInviteGroupCallParticipantResultUserAlreadyParticipant(data json.RawMessage) (*InviteGroupCallParticipantResultUserAlreadyParticipant, error) { + var resp InviteGroupCallParticipantResultUserAlreadyParticipant + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInviteGroupCallParticipantResultUserWasBanned(data json.RawMessage) (*InviteGroupCallParticipantResultUserWasBanned, error) { + var resp InviteGroupCallParticipantResultUserWasBanned + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInviteGroupCallParticipantResultSuccess(data json.RawMessage) (*InviteGroupCallParticipantResultSuccess, error) { + var resp InviteGroupCallParticipantResultSuccess + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGroupCallDataChannelMain(data json.RawMessage) (*GroupCallDataChannelMain, error) { + var resp GroupCallDataChannelMain + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGroupCallDataChannelScreenSharing(data json.RawMessage) (*GroupCallDataChannelScreenSharing, error) { + var resp GroupCallDataChannelScreenSharing + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputGroupCallLink(data json.RawMessage) (*InputGroupCallLink, error) { + var resp InputGroupCallLink + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputGroupCallMessage(data json.RawMessage) (*InputGroupCallMessage, error) { + var resp InputGroupCallMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalCallProblemEcho(data json.RawMessage) (*CallProblemEcho, error) { var resp CallProblemEcho @@ -17432,16 +17659,16 @@ func UnmarshalPremiumLimitTypeActiveStoryCount(data json.RawMessage) (*PremiumLi return &resp, err } -func UnmarshalPremiumLimitTypeWeeklySentStoryCount(data json.RawMessage) (*PremiumLimitTypeWeeklySentStoryCount, error) { - var resp PremiumLimitTypeWeeklySentStoryCount +func UnmarshalPremiumLimitTypeWeeklyPostedStoryCount(data json.RawMessage) (*PremiumLimitTypeWeeklyPostedStoryCount, error) { + var resp PremiumLimitTypeWeeklyPostedStoryCount err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalPremiumLimitTypeMonthlySentStoryCount(data json.RawMessage) (*PremiumLimitTypeMonthlySentStoryCount, error) { - var resp PremiumLimitTypeMonthlySentStoryCount +func UnmarshalPremiumLimitTypeMonthlyPostedStoryCount(data json.RawMessage) (*PremiumLimitTypeMonthlyPostedStoryCount, error) { + var resp PremiumLimitTypeMonthlyPostedStoryCount err := json.Unmarshal(data, &resp) @@ -18248,48 +18475,48 @@ func UnmarshalHashtags(data json.RawMessage) (*Hashtags, error) { return &resp, err } -func UnmarshalCanSendStoryResultOk(data json.RawMessage) (*CanSendStoryResultOk, error) { - var resp CanSendStoryResultOk +func UnmarshalCanPostStoryResultOk(data json.RawMessage) (*CanPostStoryResultOk, error) { + var resp CanPostStoryResultOk err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalCanSendStoryResultPremiumNeeded(data json.RawMessage) (*CanSendStoryResultPremiumNeeded, error) { - var resp CanSendStoryResultPremiumNeeded +func UnmarshalCanPostStoryResultPremiumNeeded(data json.RawMessage) (*CanPostStoryResultPremiumNeeded, error) { + var resp CanPostStoryResultPremiumNeeded err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalCanSendStoryResultBoostNeeded(data json.RawMessage) (*CanSendStoryResultBoostNeeded, error) { - var resp CanSendStoryResultBoostNeeded +func UnmarshalCanPostStoryResultBoostNeeded(data json.RawMessage) (*CanPostStoryResultBoostNeeded, error) { + var resp CanPostStoryResultBoostNeeded err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalCanSendStoryResultActiveStoryLimitExceeded(data json.RawMessage) (*CanSendStoryResultActiveStoryLimitExceeded, error) { - var resp CanSendStoryResultActiveStoryLimitExceeded +func UnmarshalCanPostStoryResultActiveStoryLimitExceeded(data json.RawMessage) (*CanPostStoryResultActiveStoryLimitExceeded, error) { + var resp CanPostStoryResultActiveStoryLimitExceeded err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalCanSendStoryResultWeeklyLimitExceeded(data json.RawMessage) (*CanSendStoryResultWeeklyLimitExceeded, error) { - var resp CanSendStoryResultWeeklyLimitExceeded +func UnmarshalCanPostStoryResultWeeklyLimitExceeded(data json.RawMessage) (*CanPostStoryResultWeeklyLimitExceeded, error) { + var resp CanPostStoryResultWeeklyLimitExceeded err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalCanSendStoryResultMonthlyLimitExceeded(data json.RawMessage) (*CanSendStoryResultMonthlyLimitExceeded, error) { - var resp CanSendStoryResultMonthlyLimitExceeded +func UnmarshalCanPostStoryResultMonthlyLimitExceeded(data json.RawMessage) (*CanPostStoryResultMonthlyLimitExceeded, error) { + var resp CanPostStoryResultMonthlyLimitExceeded err := json.Unmarshal(data, &resp) @@ -19712,6 +19939,14 @@ func UnmarshalInternalLinkTypeGame(data json.RawMessage) (*InternalLinkTypeGame, return &resp, err } +func UnmarshalInternalLinkTypeGroupCall(data json.RawMessage) (*InternalLinkTypeGroupCall, error) { + var resp InternalLinkTypeGroupCall + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInternalLinkTypeInstantView(data json.RawMessage) (*InternalLinkTypeInstantView, error) { var resp InternalLinkTypeInstantView @@ -19992,14 +20227,6 @@ func UnmarshalBlockListStories(data json.RawMessage) (*BlockListStories, error) return &resp, err } -func UnmarshalFilePart(data json.RawMessage) (*FilePart, error) { - var resp FilePart - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - func UnmarshalFileTypeNone(data json.RawMessage) (*FileTypeNone, error) { var resp FileTypeNone @@ -20656,6 +20883,14 @@ func UnmarshalText(data json.RawMessage) (*Text, error) { return &resp, err } +func UnmarshalData(data json.RawMessage) (*Data, error) { + var resp Data + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalSeconds(data json.RawMessage) (*Seconds, error) { var resp Seconds @@ -21768,6 +22003,22 @@ func UnmarshalUpdateGroupCallParticipant(data json.RawMessage) (*UpdateGroupCall return &resp, err } +func UnmarshalUpdateGroupCallParticipants(data json.RawMessage) (*UpdateGroupCallParticipants, error) { + var resp UpdateGroupCallParticipants + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateGroupCallVerificationState(data json.RawMessage) (*UpdateGroupCallVerificationState, error) { + var resp UpdateGroupCallVerificationState + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateNewCallSignalingData(data json.RawMessage) (*UpdateNewCallSignalingData, error) { var resp UpdateNewCallSignalingData @@ -21816,16 +22067,16 @@ func UnmarshalUpdateStoryDeleted(data json.RawMessage) (*UpdateStoryDeleted, err return &resp, err } -func UnmarshalUpdateStorySendSucceeded(data json.RawMessage) (*UpdateStorySendSucceeded, error) { - var resp UpdateStorySendSucceeded +func UnmarshalUpdateStoryPostSucceeded(data json.RawMessage) (*UpdateStoryPostSucceeded, error) { + var resp UpdateStoryPostSucceeded err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalUpdateStorySendFailed(data json.RawMessage) (*UpdateStorySendFailed, error) { - var resp UpdateStorySendFailed +func UnmarshalUpdateStoryPostFailed(data json.RawMessage) (*UpdateStoryPostFailed, error) { + var resp UpdateStoryPostFailed err := json.Unmarshal(data, &resp) @@ -24062,6 +24313,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeLinkPreviewTypeExternalVideo: return UnmarshalLinkPreviewTypeExternalVideo(data) + case TypeLinkPreviewTypeGroupCall: + return UnmarshalLinkPreviewTypeGroupCall(data) + case TypeLinkPreviewTypeInvoice: return UnmarshalLinkPreviewTypeInvoice(data) @@ -24530,6 +24784,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageCall: return UnmarshalMessageCall(data) + case TypeMessageGroupCall: + return UnmarshalMessageGroupCall(data) + case TypeMessageVideoChatScheduled: return UnmarshalMessageVideoChatScheduled(data) @@ -25232,8 +25489,8 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeCallDiscardReasonHungUp: return UnmarshalCallDiscardReasonHungUp(data) - case TypeCallDiscardReasonAllowGroupCall: - return UnmarshalCallDiscardReasonAllowGroupCall(data) + case TypeCallDiscardReasonUpgradeToGroupCall: + return UnmarshalCallDiscardReasonUpgradeToGroupCall(data) case TypeCallProtocol: return UnmarshalCallProtocol(data) @@ -25271,6 +25528,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeCallStateError: return UnmarshalCallStateError(data) + case TypeGroupCallJoinParameters: + return UnmarshalGroupCallJoinParameters(data) + case TypeGroupCallVideoQualityThumbnail: return UnmarshalGroupCallVideoQualityThumbnail(data) @@ -25280,11 +25540,11 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeGroupCallVideoQualityFull: return UnmarshalGroupCallVideoQualityFull(data) - case TypeGroupCallStream: - return UnmarshalGroupCallStream(data) + case TypeVideoChatStream: + return UnmarshalVideoChatStream(data) - case TypeGroupCallStreams: - return UnmarshalGroupCallStreams(data) + case TypeVideoChatStreams: + return UnmarshalVideoChatStreams(data) case TypeRtmpUrl: return UnmarshalRtmpUrl(data) @@ -25304,6 +25564,36 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeGroupCallParticipant: return UnmarshalGroupCallParticipant(data) + case TypeGroupCallParticipants: + return UnmarshalGroupCallParticipants(data) + + case TypeGroupCallInfo: + return UnmarshalGroupCallInfo(data) + + case TypeInviteGroupCallParticipantResultUserPrivacyRestricted: + return UnmarshalInviteGroupCallParticipantResultUserPrivacyRestricted(data) + + case TypeInviteGroupCallParticipantResultUserAlreadyParticipant: + return UnmarshalInviteGroupCallParticipantResultUserAlreadyParticipant(data) + + case TypeInviteGroupCallParticipantResultUserWasBanned: + return UnmarshalInviteGroupCallParticipantResultUserWasBanned(data) + + case TypeInviteGroupCallParticipantResultSuccess: + return UnmarshalInviteGroupCallParticipantResultSuccess(data) + + case TypeGroupCallDataChannelMain: + return UnmarshalGroupCallDataChannelMain(data) + + case TypeGroupCallDataChannelScreenSharing: + return UnmarshalGroupCallDataChannelScreenSharing(data) + + case TypeInputGroupCallLink: + return UnmarshalInputGroupCallLink(data) + + case TypeInputGroupCallMessage: + return UnmarshalInputGroupCallMessage(data) + case TypeCallProblemEcho: return UnmarshalCallProblemEcho(data) @@ -25763,11 +26053,11 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePremiumLimitTypeActiveStoryCount: return UnmarshalPremiumLimitTypeActiveStoryCount(data) - case TypePremiumLimitTypeWeeklySentStoryCount: - return UnmarshalPremiumLimitTypeWeeklySentStoryCount(data) + case TypePremiumLimitTypeWeeklyPostedStoryCount: + return UnmarshalPremiumLimitTypeWeeklyPostedStoryCount(data) - case TypePremiumLimitTypeMonthlySentStoryCount: - return UnmarshalPremiumLimitTypeMonthlySentStoryCount(data) + case TypePremiumLimitTypeMonthlyPostedStoryCount: + return UnmarshalPremiumLimitTypeMonthlyPostedStoryCount(data) case TypePremiumLimitTypeStoryCaptionLength: return UnmarshalPremiumLimitTypeStoryCaptionLength(data) @@ -26069,23 +26359,23 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeHashtags: return UnmarshalHashtags(data) - case TypeCanSendStoryResultOk: - return UnmarshalCanSendStoryResultOk(data) + case TypeCanPostStoryResultOk: + return UnmarshalCanPostStoryResultOk(data) - case TypeCanSendStoryResultPremiumNeeded: - return UnmarshalCanSendStoryResultPremiumNeeded(data) + case TypeCanPostStoryResultPremiumNeeded: + return UnmarshalCanPostStoryResultPremiumNeeded(data) - case TypeCanSendStoryResultBoostNeeded: - return UnmarshalCanSendStoryResultBoostNeeded(data) + case TypeCanPostStoryResultBoostNeeded: + return UnmarshalCanPostStoryResultBoostNeeded(data) - case TypeCanSendStoryResultActiveStoryLimitExceeded: - return UnmarshalCanSendStoryResultActiveStoryLimitExceeded(data) + case TypeCanPostStoryResultActiveStoryLimitExceeded: + return UnmarshalCanPostStoryResultActiveStoryLimitExceeded(data) - case TypeCanSendStoryResultWeeklyLimitExceeded: - return UnmarshalCanSendStoryResultWeeklyLimitExceeded(data) + case TypeCanPostStoryResultWeeklyLimitExceeded: + return UnmarshalCanPostStoryResultWeeklyLimitExceeded(data) - case TypeCanSendStoryResultMonthlyLimitExceeded: - return UnmarshalCanSendStoryResultMonthlyLimitExceeded(data) + case TypeCanPostStoryResultMonthlyLimitExceeded: + return UnmarshalCanPostStoryResultMonthlyLimitExceeded(data) case TypeCanTransferOwnershipResultOk: return UnmarshalCanTransferOwnershipResultOk(data) @@ -26618,6 +26908,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInternalLinkTypeGame: return UnmarshalInternalLinkTypeGame(data) + case TypeInternalLinkTypeGroupCall: + return UnmarshalInternalLinkTypeGroupCall(data) + case TypeInternalLinkTypeInstantView: return UnmarshalInternalLinkTypeInstantView(data) @@ -26723,9 +27016,6 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeBlockListStories: return UnmarshalBlockListStories(data) - case TypeFilePart: - return UnmarshalFilePart(data) - case TypeFileTypeNone: return UnmarshalFileTypeNone(data) @@ -26972,6 +27262,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeText: return UnmarshalText(data) + case TypeData: + return UnmarshalData(data) + case TypeSeconds: return UnmarshalSeconds(data) @@ -27389,6 +27682,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateGroupCallParticipant: return UnmarshalUpdateGroupCallParticipant(data) + case TypeUpdateGroupCallParticipants: + return UnmarshalUpdateGroupCallParticipants(data) + + case TypeUpdateGroupCallVerificationState: + return UnmarshalUpdateGroupCallVerificationState(data) + case TypeUpdateNewCallSignalingData: return UnmarshalUpdateNewCallSignalingData(data) @@ -27407,11 +27706,11 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateStoryDeleted: return UnmarshalUpdateStoryDeleted(data) - case TypeUpdateStorySendSucceeded: - return UnmarshalUpdateStorySendSucceeded(data) + case TypeUpdateStoryPostSucceeded: + return UnmarshalUpdateStoryPostSucceeded(data) - case TypeUpdateStorySendFailed: - return UnmarshalUpdateStorySendFailed(data) + case TypeUpdateStoryPostFailed: + return UnmarshalUpdateStoryPostFailed(data) case TypeUpdateChatActiveStories: return UnmarshalUpdateChatActiveStories(data) diff --git a/data/td_api.tl b/data/td_api.tl index 9247a4e..eb49cac 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -699,7 +699,7 @@ businessGreetingMessageSettings shortcut_id:int32 recipients:businessRecipients //@can_change_gift_settings True, if the bot can change gift receiving settings of the business account //@can_transfer_and_upgrade_gifts True, if the bot can transfer and upgrade gifts received by the business account //@can_transfer_stars True, if the bot can transfer Telegram Stars received by the business account to account of the bot, or use them to upgrade and transfer gifts -//@can_manage_stories True, if the bot can send, edit and delete stories +//@can_manage_stories True, if the bot can post, edit and delete stories businessBotRights can_reply:Bool can_read_messages:Bool can_delete_sent_messages:Bool can_delete_all_messages:Bool can_edit_name:Bool can_edit_bio:Bool can_edit_profile_photo:Bool can_edit_username:Bool can_view_gifts_and_stars:Bool can_sell_gifts:Bool can_change_gift_settings:Bool can_transfer_and_upgrade_gifts:Bool can_transfer_stars:Bool can_manage_stories:Bool = BusinessBotRights; //@description Describes a bot connected to a business account @@ -1775,7 +1775,7 @@ basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int53 memb //@date Point in time (Unix timestamp) when the current user joined, or the point in time when the supergroup or channel was created, in case the user is not a member //@status Status of the current user in the supergroup or channel; custom title will always be empty //@member_count Number of members in the supergroup or channel; 0 if unknown. Currently, it is guaranteed to be known only if the supergroup or channel was received through -//-getChatSimilarChats, getChatsToSendStories, getCreatedPublicChats, getGroupsInCommon, getInactiveSupergroupChats, getRecommendedChats, getSuitableDiscussionChats, +//-getChatSimilarChats, getChatsToPostStories, getCreatedPublicChats, getGroupsInCommon, getInactiveSupergroupChats, getRecommendedChats, getSuitableDiscussionChats, //-getUserPrivacySettingRules, getVideoChatAvailableParticipants, searchPublicChats, or in chatFolderInviteLinkInfo.missing_chat_ids, or in userFullInfo.personal_chat_id, //-or for chats with messages or stories from publicForwards and foundStories //@boost_level Approximate boost level for the chat @@ -2079,8 +2079,8 @@ inputTextQuote text:formattedText position:int32 = InputTextQuote; //-messageVideoNote, or messageVoiceNote messageReplyToMessage chat_id:int53 message_id:int53 quote:textQuote origin:MessageOrigin origin_send_date:int32 content:MessageContent = MessageReplyTo; -//@description Describes a story replied by a given message @story_sender_chat_id The identifier of the sender of the story @story_id The identifier of the story -messageReplyToStory story_sender_chat_id:int53 story_id:int32 = MessageReplyTo; +//@description Describes a story replied by a given message @story_poster_chat_id The identifier of the poster of the story @story_id The identifier of the story +messageReplyToStory story_poster_chat_id:int53 story_id:int32 = MessageReplyTo; //@class InputMessageReplyTo @description Contains information about the message or the story to be replied @@ -2097,9 +2097,9 @@ inputMessageReplyToMessage message_id:int53 quote:inputTextQuote = InputMessageR inputMessageReplyToExternalMessage chat_id:int53 message_id:int53 quote:inputTextQuote = InputMessageReplyTo; //@description Describes a story to be replied -//@story_sender_chat_id The identifier of the sender of the story. Currently, stories can be replied only in the sender's chat and channel stories can't be replied +//@story_poster_chat_id The identifier of the poster of the story. Currently, stories can be replied only in the chat that posted the story; channel stories can't be replied //@story_id The identifier of the story -inputMessageReplyToStory story_sender_chat_id:int53 story_id:int32 = InputMessageReplyTo; +inputMessageReplyToStory story_poster_chat_id:int53 story_id:int32 = InputMessageReplyTo; //@description Describes a fact-check added to the message by an independent checker @@ -2310,13 +2310,13 @@ notificationSettingsScopeChannelChats = NotificationSettingsScope; //@mute_stories True, if story notifications are disabled for the chat //@use_default_story_sound If true, the value for the relevant type of chat is used instead of story_sound_id //@story_sound_id Identifier of the notification sound to be played for stories; 0 if sound is disabled -//@use_default_show_story_sender If true, the value for the relevant type of chat is used instead of show_story_sender -//@show_story_sender True, if the sender of stories must be displayed in notifications +//@use_default_show_story_poster If true, the value for the relevant type of chat is used instead of show_story_poster +//@show_story_poster True, if the chat that posted a story must be displayed in notifications //@use_default_disable_pinned_message_notifications If true, the value for the relevant type of chat or the forum chat is used instead of disable_pinned_message_notifications //@disable_pinned_message_notifications If true, notifications for incoming pinned messages will be created as for an ordinary unread message //@use_default_disable_mention_notifications If true, the value for the relevant type of chat or the forum chat is used instead of disable_mention_notifications //@disable_mention_notifications If true, notifications for messages with mentions will be created as for an ordinary unread message -chatNotificationSettings use_default_mute_for:Bool mute_for:int32 use_default_sound:Bool sound_id:int64 use_default_show_preview:Bool show_preview:Bool use_default_mute_stories:Bool mute_stories:Bool use_default_story_sound:Bool story_sound_id:int64 use_default_show_story_sender:Bool show_story_sender:Bool use_default_disable_pinned_message_notifications:Bool disable_pinned_message_notifications:Bool use_default_disable_mention_notifications:Bool disable_mention_notifications:Bool = ChatNotificationSettings; +chatNotificationSettings use_default_mute_for:Bool mute_for:int32 use_default_sound:Bool sound_id:int64 use_default_show_preview:Bool show_preview:Bool use_default_mute_stories:Bool mute_stories:Bool use_default_story_sound:Bool story_sound_id:int64 use_default_show_story_poster:Bool show_story_poster:Bool use_default_disable_pinned_message_notifications:Bool disable_pinned_message_notifications:Bool use_default_disable_mention_notifications:Bool disable_mention_notifications:Bool = ChatNotificationSettings; //@description Contains information about notification settings for several chats //@mute_for Time left before notifications will be unmuted, in seconds @@ -2325,10 +2325,10 @@ chatNotificationSettings use_default_mute_for:Bool mute_for:int32 use_default_so //@use_default_mute_stories If true, story notifications are received only for the first 5 chats from topChatCategoryUsers regardless of the value of mute_stories //@mute_stories True, if story notifications are disabled //@story_sound_id Identifier of the notification sound to be played for stories; 0 if sound is disabled -//@show_story_sender True, if the sender of stories must be displayed in notifications +//@show_story_poster True, if the chat that posted a story must be displayed in notifications //@disable_pinned_message_notifications True, if notifications for incoming pinned messages will be created as for an ordinary unread message //@disable_mention_notifications True, if notifications for messages with mentions will be created as for an ordinary unread message -scopeNotificationSettings mute_for:int32 sound_id:int64 show_preview:Bool use_default_mute_stories:Bool mute_stories:Bool story_sound_id:int64 show_story_sender:Bool disable_pinned_message_notifications:Bool disable_mention_notifications:Bool = ScopeNotificationSettings; +scopeNotificationSettings mute_for:int32 sound_id:int64 show_preview:Bool use_default_mute_stories:Bool mute_stories:Bool story_sound_id:int64 show_story_poster:Bool disable_pinned_message_notifications:Bool disable_mention_notifications:Bool = ScopeNotificationSettings; //@class ReactionNotificationSource @description Describes sources of reactions for which notifications will be shown @@ -2498,7 +2498,7 @@ savedMessagesTags tags:vector = SavedMessagesTags; businessBotManageBar bot_user_id:int53 manage_url:string is_bot_paused:Bool can_bot_reply:Bool = BusinessBotManageBar; -//@description Describes a video chat +//@description Describes a video chat, i.e. a group call bound to a chat //@group_call_id Group call identifier of an active video chat; 0 if none. Full information about the video chat can be received through the method getGroupCall //@has_participants True, if the video chat has participants //@default_participant_id Default group call participant identifier to join the video chat; may be null @@ -3233,6 +3233,9 @@ linkPreviewTypeExternalAudio url:string mime_type:string duration:int32 = LinkPr //@duration Duration of the video, in seconds; 0 if unknown linkPreviewTypeExternalVideo url:string mime_type:string width:int32 height:int32 duration:int32 = LinkPreviewType; +//@description The link is a link to a group call that isn't bound to a chat +linkPreviewTypeGroupCall = LinkPreviewType; + //@description The link is a link to an invoice linkPreviewTypeInvoice = LinkPreviewType; @@ -3254,8 +3257,8 @@ linkPreviewTypeSticker sticker:sticker = LinkPreviewType; //@description The link is a link to a sticker set @stickers Up to 4 stickers from the sticker set linkPreviewTypeStickerSet stickers:vector = LinkPreviewType; -//@description The link is a link to a story. Link preview description is unavailable @story_sender_chat_id The identifier of the chat that posted the story @story_id Story identifier -linkPreviewTypeStory story_sender_chat_id:int53 story_id:int32 = LinkPreviewType; +//@description The link is a link to a story. Link preview description is unavailable @story_poster_chat_id The identifier of the chat that posted the story @story_id Story identifier +linkPreviewTypeStory story_poster_chat_id:int53 story_id:int32 = LinkPreviewType; //@description The link is a link to boost a supergroup chat @photo Photo of the chat; may be null linkPreviewTypeSupergroupBoost photo:chatPhoto = LinkPreviewType; @@ -3934,10 +3937,10 @@ messageGame game:game = MessageContent; messagePoll poll:poll = MessageContent; //@description A message with a forwarded story -//@story_sender_chat_id Identifier of the chat that posted the story +//@story_poster_chat_id Identifier of the chat that posted the story //@story_id Story identifier //@via_mention True, if the story was automatically forwarded because of a mention of the user -messageStory story_sender_chat_id:int53 story_id:int32 via_mention:Bool = MessageContent; +messageStory story_poster_chat_id:int53 story_id:int32 via_mention:Bool = MessageContent; //@description A message with an invoice from a bot. Use getInternalLink with internalLinkTypeBotStart to share the invoice //@product_info Information about the product @@ -3954,6 +3957,16 @@ messageInvoice product_info:productInfo currency:string total_amount:int53 start //@description A message with information about an ended call @is_video True, if the call was a video call @discard_reason Reason why the call was discarded @duration Call duration, in seconds messageCall is_video:Bool discard_reason:CallDiscardReason duration:int32 = MessageContent; +//@description A message with information about a group call not bound to a chat. If the message is incoming, the call isn't active, isn't missed, and has no duration, +//-and getOption("can_accept_calls") is true, then incoming call screen must be shown to the user. Use joinGroupCall to accept the call or declineGroupCallInvitation to decline it. +//-If the call become active or missed, then the call screen must be hidden +//@is_active True, if the call is active, i.e. the called user joined the call +//@was_missed True, if the called user missed or declined the call +//@is_video True, if the call is a video call +//@duration Call duration, in seconds; for left calls only +//@other_participant_ids Identifiers of some other call participants +messageGroupCall is_active:Bool was_missed:Bool is_video:Bool duration:int32 other_participant_ids:vector = MessageContent; + //@description A new video chat was scheduled @group_call_id Identifier of the video chat. The video chat can be received through the method getGroupCall @start_date Point in time (Unix timestamp) when the group call is expected to be started by an administrator messageVideoChatScheduled group_call_id:int32 start_date:int32 = MessageContent; @@ -4512,10 +4525,10 @@ inputMessageInvoice invoice:invoice title:string description:string photo_url:st //@is_closed True, if the poll needs to be sent already closed; for bots only inputMessagePoll question:formattedText options:vector is_anonymous:Bool type:PollType open_period:int32 close_date:int32 is_closed:Bool = InputMessageContent; -//@description A message with a forwarded story. Stories can't be sent to secret chats. A story can be forwarded only if story.can_be_forwarded -//@story_sender_chat_id Identifier of the chat that posted the story +//@description A message with a forwarded story. Stories can't be forwarded to secret chats. A story can be forwarded only if story.can_be_forwarded +//@story_poster_chat_id Identifier of the chat that posted the story //@story_id Story identifier -inputMessageStory story_sender_chat_id:int53 story_id:int32 = InputMessageContent; +inputMessageStory story_poster_chat_id:int53 story_id:int32 = InputMessageContent; //@description A forwarded message //@from_chat_id Identifier for the chat this forwarded message came from @@ -4890,7 +4903,7 @@ inputStoryArea position:storyAreaPosition type:InputStoryAreaType = InputStoryAr inputStoryAreas areas:vector = InputStoryAreas; -//@description Describes a video file sent in a story +//@description Describes a video file posted as a story //@duration Duration of the video, in seconds //@width Video width //@height Video height @@ -4916,7 +4929,7 @@ storyContentVideo video:storyVideo alternative_video:storyVideo = StoryContent; storyContentUnsupported = StoryContent; -//@class InputStoryContent @description The content of a story to send +//@class InputStoryContent @description The content of a story to post //@description A photo story //@photo Photo to send. The photo must be at most 10 MB in size. The photo size must be 1080x1920 @@ -4943,11 +4956,11 @@ storyListArchive = StoryList; //@class StoryOrigin @description Contains information about the origin of a story that was reposted -//@description The original story was a public story with known sender @chat_id Identifier of the chat that posted original story @story_id Story identifier of the original story +//@description The original story was a public story that was posted by a known chat @chat_id Identifier of the chat that posted original story @story_id Story identifier of the original story storyOriginPublicStory chat_id:int53 story_id:int32 = StoryOrigin; -//@description The original story was sent by an unknown user @sender_name Name of the story sender -storyOriginHiddenUser sender_name:string = StoryOrigin; +//@description The original story was posted by an unknown user @poster_name Name of the user or the chat that posted the story +storyOriginHiddenUser poster_name:string = StoryOrigin; //@description Contains information about original story that was reposted @@ -4963,19 +4976,19 @@ storyRepostInfo origin:StoryOrigin is_content_modified:Bool = StoryRepostInfo; storyInteractionInfo view_count:int32 forward_count:int32 reaction_count:int32 recent_viewer_user_ids:vector = StoryInteractionInfo; //@description Represents a story -//@id Unique story identifier among stories of the given sender -//@sender_chat_id Identifier of the chat that posted the story -//@sender_id Identifier of the sender of the story; may be null if the story is posted on behalf of the sender_chat_id +//@id Unique story identifier among stories posted by the given chat +//@poster_chat_id Identifier of the chat that posted the story +//@poster_id Identifier of the user or chat that posted the story; may be null if the story is posted on behalf of the poster_chat_id //@date Point in time (Unix timestamp) when the story was published -//@is_being_sent True, if the story is being sent by the current user +//@is_being_posted True, if the story is being posted by the current user //@is_being_edited True, if the story is being edited by the current user //@is_edited True, if the story was edited -//@is_posted_to_chat_page True, if the story is saved in the sender's profile and will be available there after expiration +//@is_posted_to_chat_page True, if the story is saved in the profile of the chat that posted it and will be available there after expiration //@is_visible_only_for_self True, if the story is visible only for the current user //@can_be_deleted True, if the story can be deleted //@can_be_edited True, if the story can be edited //@can_be_forwarded True, if the story can be forwarded as a message. Otherwise, screenshots and saving of the story content must be also forbidden -//@can_be_replied True, if the story can be replied in the chat with the story sender +//@can_be_replied True, if the story can be replied in the chat with the user that posted the story //@can_toggle_is_posted_to_chat_page True, if the story's is_posted_to_chat_page value can be changed //@can_get_statistics True, if the story statistics are available through getStoryStatistics //@can_get_interactions True, if interactions with the story can be received through getStoryInteractions @@ -4987,7 +5000,7 @@ storyInteractionInfo view_count:int32 forward_count:int32 reaction_count:int32 r //@content Content of the story //@areas Clickable areas to be shown on the story content //@caption Caption of the story -story id:int32 sender_chat_id:int53 sender_id:MessageSender date:int32 is_being_sent:Bool is_being_edited:Bool is_edited:Bool is_posted_to_chat_page:Bool is_visible_only_for_self:Bool can_be_deleted:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied:Bool can_toggle_is_posted_to_chat_page:Bool can_get_statistics:Bool can_get_interactions:Bool has_expired_viewers:Bool repost_info:storyRepostInfo interaction_info:storyInteractionInfo chosen_reaction_type:ReactionType privacy_settings:StoryPrivacySettings content:StoryContent areas:vector caption:formattedText = Story; +story id:int32 poster_chat_id:int53 poster_id:MessageSender date:int32 is_being_posted:Bool is_being_edited:Bool is_edited:Bool is_posted_to_chat_page:Bool is_visible_only_for_self:Bool can_be_deleted:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied:Bool can_toggle_is_posted_to_chat_page:Bool can_get_statistics:Bool can_get_interactions:Bool has_expired_viewers:Bool repost_info:storyRepostInfo interaction_info:storyInteractionInfo chosen_reaction_type:ReactionType privacy_settings:StoryPrivacySettings content:StoryContent areas:vector caption:formattedText = Story; //@description Represents a list of stories //@total_count Approximate total number of stories found @@ -4998,13 +5011,13 @@ stories total_count:int32 stories:vector pinned_story_ids:vector = //@description Contains a list of stories found by a search @total_count Approximate total number of stories found @stories List of stories @next_offset The offset for the next request. If empty, then there are no more results foundStories total_count:int32 stories:vector next_offset:string = FoundStories; -//@description Contains identifier of a story along with identifier of its sender -//@sender_chat_id Identifier of the chat that posted the story -//@story_id Unique story identifier among stories of the given sender -storyFullId sender_chat_id:int53 story_id:int32 = StoryFullId; +//@description Contains identifier of a story along with identifier of the chat that posted it +//@poster_chat_id Identifier of the chat that posted the story +//@story_id Unique story identifier among stories of the chat +storyFullId poster_chat_id:int53 story_id:int32 = StoryFullId; //@description Contains basic information about a story -//@story_id Unique story identifier among stories of the given sender +//@story_id Unique story identifier among stories of the chat //@date Point in time (Unix timestamp) when the story was published //@is_for_close_friends True, if the story is available only to close friends storyInfo story_id:int32 date:int32 is_for_close_friends:Bool = StoryInfo; @@ -5012,7 +5025,7 @@ storyInfo story_id:int32 date:int32 is_for_close_friends:Bool = StoryInfo; //@description Describes active stories posted by a chat //@chat_id Identifier of the chat that posted the stories //@list Identifier of the story list in which the stories are shown; may be null if the stories aren't shown in a story list -//@order A parameter used to determine order of the stories in the story list; 0 if the stories doesn't need to be shown in the story list. Stories must be sorted by the pair (order, story_sender_chat_id) in descending order +//@order A parameter used to determine order of the stories in the story list; 0 if the stories doesn't need to be shown in the story list. Stories must be sorted by the pair (order, story_poster_chat_id) in descending order //@max_read_story_id Identifier of the last read active story //@stories Basic information about the stories; use getStory to get full information about the stories. The stories are in chronological order (i.e., in order of increasing story identifiers) chatActiveStories chat_id:int53 list:StoryList order:int53 max_read_story_id:int32 stories:vector = ChatActiveStories; @@ -5222,9 +5235,8 @@ callDiscardReasonDisconnected = CallDiscardReason; //@description The call was ended because one of the parties hung up callDiscardReasonHungUp = CallDiscardReason; -//@description The call was ended because it has been used successfully to transfer private encryption key for the associated group call -//@encrypted_group_call_key Encrypted using the call private key encryption key for the associated group call -callDiscardReasonAllowGroupCall encrypted_group_call_key:bytes = CallDiscardReason; +//@description The call was ended because it has been upgraded to a group call @invite_link Invite link for the group call +callDiscardReasonUpgradeToGroupCall invite_link:string = CallDiscardReason; //@description Specifies the supported call protocols @@ -5280,8 +5292,9 @@ callStateExchangingKeys = CallState; //@encryption_key Call encryption key //@emojis Encryption key fingerprint represented as 4 emoji //@allow_p2p True, if peer-to-peer connection is allowed by users privacy settings +//@is_group_call_supported True, if the other party supports upgrading of the call to a group call //@custom_parameters Custom JSON-encoded call parameters to be passed to tgcalls -callStateReady protocol:callProtocol servers:vector config:string encryption_key:bytes emojis:vector allow_p2p:Bool custom_parameters:string = CallState; +callStateReady protocol:callProtocol servers:vector config:string encryption_key:bytes emojis:vector allow_p2p:Bool is_group_call_supported:Bool custom_parameters:string = CallState; //@description The call is hanging up after discardCall has been called callStateHangingUp = CallState; @@ -5297,6 +5310,14 @@ callStateDiscarded reason:CallDiscardReason need_rating:Bool need_debug_informat callStateError error:error = CallState; +//@description Describes parameters used to join a group call +//@audio_source_id Audio channel synchronization source identifier; received from tgcalls +//@payload Group call join payload; received from tgcalls +//@is_muted Pass true to join the call with muted microphone +//@is_my_video_enabled Pass true if the user's video is enabled +groupCallJoinParameters audio_source_id:int32 payload:string is_muted:Bool is_my_video_enabled:Bool = GroupCallJoinParameters; + + //@class GroupCallVideoQuality @description Describes the quality of a group call video //@description The worst available video quality @@ -5309,14 +5330,14 @@ groupCallVideoQualityMedium = GroupCallVideoQuality; groupCallVideoQualityFull = GroupCallVideoQuality; -//@description Describes an available stream in a group call +//@description Describes an available stream in a video chat //@channel_id Identifier of an audio/video channel //@scale Scale of segment durations in the stream. The duration is 1000/(2**scale) milliseconds //@time_offset Point in time when the stream currently ends; Unix timestamp in milliseconds -groupCallStream channel_id:int32 scale:int32 time_offset:int53 = GroupCallStream; +videoChatStream channel_id:int32 scale:int32 time_offset:int53 = VideoChatStream; -//@description Represents a list of group call streams @streams A list of group call streams -groupCallStreams streams:vector = GroupCallStreams; +//@description Represents a list of video chat streams @streams A list of video chat streams +videoChatStreams streams:vector = VideoChatStreams; //@description Represents an RTMP URL @url The URL @stream_key Stream key rtmpUrl url:string stream_key:string = RtmpUrl; @@ -5327,28 +5348,30 @@ groupCallRecentSpeaker participant_id:MessageSender is_speaking:Bool = GroupCall //@description Describes a group call //@id Group call identifier -//@from_call_id Identifier of one-to-one call from which the group call was created; 0 if unknown -//@title Group call title -//@scheduled_start_date Point in time (Unix timestamp) when the group call is expected to be started by an administrator; 0 if it is already active or was ended -//@enabled_start_notification True, if the group call is scheduled and the current user will receive a notification when the group call starts +//@title Group call title; for video chats only +//@invite_link Invite link for the group call; for group calls that aren't bound to a chat. For video chats call getVideoChatInviteLink to get the link +//@scheduled_start_date Point in time (Unix timestamp) when the group call is expected to be started by an administrator; 0 if it is already active or was ended; for video chats only +//@enabled_start_notification True, if the group call is scheduled and the current user will receive a notification when the group call starts; for video chats only //@is_active True, if the call is active -//@is_rtmp_stream True, if the chat is an RTMP stream instead of an ordinary video chat +//@is_video_chat True, if the call is bound to a chat +//@is_rtmp_stream True, if the call is an RTMP stream instead of an ordinary video chat; for video chats only //@is_joined True, if the call is joined //@need_rejoin True, if user was kicked from the call because of network loss and the call needs to be rejoined -//@can_be_managed True, if the current user can manage the group call +//@is_owned True, if the user is the owner of the call and can end the call, change volume level of other users, or ban users there; for group calls that aren't bound to a chat +//@can_be_managed True, if the current user can manage the group call; for video chats only //@participant_count Number of participants in the group call -//@has_hidden_listeners True, if group call participants, which are muted, aren't returned in participant list +//@has_hidden_listeners True, if group call participants, which are muted, aren't returned in participant list; for video chats only //@loaded_all_participants True, if all group call participants are loaded //@recent_speakers At most 3 recently speaking users in the group call //@is_my_video_enabled True, if the current user's video is enabled //@is_my_video_paused True, if the current user's video is paused //@can_enable_video True, if the current user can broadcast video or share screen -//@mute_new_participants True, if only group call administrators can unmute new participants -//@can_toggle_mute_new_participants True, if the current user can enable or disable mute_new_participants setting +//@mute_new_participants True, if only group call administrators can unmute new participants; for video chats only +//@can_toggle_mute_new_participants True, if the current user can enable or disable mute_new_participants setting; for video chats only //@record_duration Duration of the ongoing group call recording, in seconds; 0 if none. An updateGroupCall update is not triggered when value of this field changes, but the same recording goes on //@is_video_recorded True, if a video file is being recorded for the call //@duration Call duration, in seconds; for ended calls only -groupCall id:int32 from_call_id:int32 title:string scheduled_start_date:int32 enabled_start_notification:Bool is_active:Bool is_rtmp_stream:Bool is_joined:Bool need_rejoin:Bool can_be_managed:Bool participant_count:int32 has_hidden_listeners:Bool loaded_all_participants:Bool recent_speakers:vector is_my_video_enabled:Bool is_my_video_paused:Bool can_enable_video:Bool mute_new_participants:Bool can_toggle_mute_new_participants:Bool record_duration:int32 is_video_recorded:Bool duration:int32 = GroupCall; +groupCall id:int32 title:string invite_link:string scheduled_start_date:int32 enabled_start_notification:Bool is_active:Bool is_video_chat:Bool is_rtmp_stream:Bool is_joined:Bool need_rejoin:Bool is_owned:Bool can_be_managed:Bool participant_count:int32 has_hidden_listeners:Bool loaded_all_participants:Bool recent_speakers:vector is_my_video_enabled:Bool is_my_video_paused:Bool can_enable_video:Bool mute_new_participants:Bool can_toggle_mute_new_participants:Bool record_duration:int32 is_video_recorded:Bool duration:int32 = GroupCall; //@description Describes a group of video synchronization source identifiers @semantics The semantics of sources, one of "SIM" or "FID" @source_ids The list of synchronization source identifiers groupCallVideoSourceGroup semantics:string source_ids:vector = GroupCallVideoSourceGroup; @@ -5380,6 +5403,49 @@ groupCallParticipantVideoInfo source_groups:vector en //@order User's order in the group call participant list. Orders must be compared lexicographically. The bigger is order, the higher is user in the list. If order is empty, the user must be removed from the participant list groupCallParticipant participant_id:MessageSender audio_source_id:int32 screen_sharing_audio_source_id:int32 video_info:groupCallParticipantVideoInfo screen_sharing_video_info:groupCallParticipantVideoInfo bio:string is_current_user:Bool is_speaking:Bool is_hand_raised:Bool can_be_muted_for_all_users:Bool can_be_unmuted_for_all_users:Bool can_be_muted_for_current_user:Bool can_be_unmuted_for_current_user:Bool is_muted_for_all_users:Bool is_muted_for_current_user:Bool can_unmute_self:Bool volume_level:int32 order:string = GroupCallParticipant; +//@description Contains identifiers of group call participants @total_count Total number of group call participants @participant_ids Identifiers of the participants +groupCallParticipants total_count:int32 participant_ids:vector = GroupCallParticipants; + +//@description Contains information about a just created or just joined group call @group_call_id Identifier of the group call @join_payload Join response payload for tgcalls; empty if the call isn't joined +groupCallInfo group_call_id:int32 join_payload:string = GroupCallInfo; + + +//@class InviteGroupCallParticipantResult @description Describes result of group call participant invitation + +//@description The user can't be invited due to their privacy settings +inviteGroupCallParticipantResultUserPrivacyRestricted = InviteGroupCallParticipantResult; + +//@description The user can't be invited because they are already a participant of the call +inviteGroupCallParticipantResultUserAlreadyParticipant = InviteGroupCallParticipantResult; + +//@description The user can't be invited because they were banned by the owner of the call and can be invited back only by the owner of the group call +inviteGroupCallParticipantResultUserWasBanned = InviteGroupCallParticipantResult; + +//@description The user was invited and a service message of the type messageGroupCall was sent which can be used in declineGroupCallInvitation to cancel the invitation +//@chat_id Identifier of the chat with the invitation message +//@message_id Identifier of the message +inviteGroupCallParticipantResultSuccess chat_id:int53 message_id:int53 = InviteGroupCallParticipantResult; + + +//@class GroupCallDataChannel @description Describes data channel for a group call + +//@description The main data channel for audio and video data +groupCallDataChannelMain = GroupCallDataChannel; + +//@description The data channel for screen sharing +groupCallDataChannelScreenSharing = GroupCallDataChannel; + + +//@class InputGroupCall @description Describes a non-joined group call that isn't bound to a chat + +//@description The group call is accessible through a link @link The link for the group call +inputGroupCallLink link:string = InputGroupCall; + +//@description The group call is accessible through a message of the type messageGroupCall +//@chat_id Identifier of the chat with the message +//@message_id Identifier of the message of the type messageGroupCall +inputGroupCallMessage chat_id:int53 message_id:int53 = InputGroupCall; + //@class CallProblem @description Describes the exact type of problem with a call @@ -5417,8 +5483,7 @@ callProblemPixelatedVideo = CallProblem; //@is_outgoing True, if the call is outgoing //@is_video True, if the call is a video call //@state Call state -//@group_call_id Identifier of the group call associated with the call; 0 if the group call isn't created yet. The group call can be received through the method getGroupCall -call id:int32 user_id:int53 is_outgoing:Bool is_video:Bool state:CallState group_call_id:int32 = Call; +call id:int32 user_id:int53 is_outgoing:Bool is_video:Bool state:CallState = Call; //@class FirebaseAuthenticationSettings @description Contains settings for Firebase Authentication in the official applications @@ -5437,7 +5502,7 @@ firebaseAuthenticationSettingsIos device_token:string is_app_sandbox:Bool = Fire //@has_unknown_phone_number Pass true if there is a SIM card in the current device, but it is not possible to check whether phone number matches //@allow_sms_retriever_api For official applications only. True, if the application can use Android SMS Retriever API (requires Google Play Services >= 10.2) to automatically receive the authentication code from the SMS. See https://developers.google.com/identity/sms-retriever/ for more details //@firebase_authentication_settings For official Android and iOS applications only; pass null otherwise. Settings for Firebase Authentication -//@authentication_tokens List of up to 20 authentication tokens, recently received in updateOption("authentication_token") in previously logged out sessions +//@authentication_tokens List of up to 20 authentication tokens, recently received in updateOption("authentication_token") in previously logged out sessions; for setAuthenticationPhoneNumber only phoneNumberAuthenticationSettings allow_flash_call:Bool allow_missed_call:Bool is_current_phone_number:Bool has_unknown_phone_number:Bool allow_sms_retriever_api:Bool firebase_authentication_settings:FirebaseAuthenticationSettings authentication_tokens:vector = PhoneNumberAuthenticationSettings; @@ -6160,13 +6225,13 @@ premiumLimitTypeShareableChatFolderCount = PremiumLimitType; //@description The maximum number of active stories premiumLimitTypeActiveStoryCount = PremiumLimitType; -//@description The maximum number of stories sent per week -premiumLimitTypeWeeklySentStoryCount = PremiumLimitType; +//@description The maximum number of stories posted per week +premiumLimitTypeWeeklyPostedStoryCount = PremiumLimitType; -//@description The maximum number of stories sent per month -premiumLimitTypeMonthlySentStoryCount = PremiumLimitType; +//@description The maximum number of stories posted per month +premiumLimitTypeMonthlyPostedStoryCount = PremiumLimitType; -//@description The maximum length of captions of sent stories +//@description The maximum length of captions of posted stories premiumLimitTypeStoryCaptionLength = PremiumLimitType; //@description The maximum number of suggested reaction areas on a story @@ -6588,25 +6653,25 @@ timeZones time_zones:vector = TimeZones; hashtags hashtags:vector = Hashtags; -//@class CanSendStoryResult @description Represents result of checking whether the current user can send a story in the specific chat +//@class CanPostStoryResult @description Represents result of checking whether the current user can post a story on behalf of the specific chat //@description A story can be sent -canSendStoryResultOk = CanSendStoryResult; +canPostStoryResultOk = CanPostStoryResult; //@description The user must subscribe to Telegram Premium to be able to post stories -canSendStoryResultPremiumNeeded = CanSendStoryResult; +canPostStoryResultPremiumNeeded = CanPostStoryResult; //@description The chat must be boosted first by Telegram Premium subscribers to post more stories. Call getChatBoostStatus to get current boost status of the chat -canSendStoryResultBoostNeeded = CanSendStoryResult; +canPostStoryResultBoostNeeded = CanPostStoryResult; //@description The limit for the number of active stories exceeded. The user can buy Telegram Premium, delete an active story, or wait for the oldest story to expire -canSendStoryResultActiveStoryLimitExceeded = CanSendStoryResult; +canPostStoryResultActiveStoryLimitExceeded = CanPostStoryResult; -//@description The weekly limit for the number of posted stories exceeded. The user needs to buy Telegram Premium or wait specified time @retry_after Time left before the user can send the next story -canSendStoryResultWeeklyLimitExceeded retry_after:int32 = CanSendStoryResult; +//@description The weekly limit for the number of posted stories exceeded. The user needs to buy Telegram Premium or wait specified time @retry_after Time left before the user can post the next story +canPostStoryResultWeeklyLimitExceeded retry_after:int32 = CanPostStoryResult; -//@description The monthly limit for the number of posted stories exceeded. The user needs to buy Telegram Premium or wait specified time @retry_after Time left before the user can send the next story -canSendStoryResultMonthlyLimitExceeded retry_after:int32 = CanSendStoryResult; +//@description The monthly limit for the number of posted stories exceeded. The user needs to buy Telegram Premium or wait specified time @retry_after Time left before the user can post the next story +canPostStoryResultMonthlyLimitExceeded retry_after:int32 = CanPostStoryResult; //@class CanTransferOwnershipResult @description Represents result of checking whether the current session can be used to transfer a chat ownership to another user @@ -7333,6 +7398,9 @@ internalLinkTypeEditProfileSettings = InternalLinkType; //@game_short_name Short name of the game internalLinkTypeGame bot_username:string game_short_name:string = InternalLinkType; +//@description The link is a link to a group call that isn't bound to a chat. Call joinGroupCall with the given invite_link @invite_link Internal representation of the invite link +internalLinkTypeGroupCall invite_link:string = InternalLinkType; + //@description The link must be opened in an Instant View. Call getWebPageInstantView with the given URL to process the link. //-If Instant View is found, then show it, otherwise, open the fallback URL in an external browser //@url URL to be passed to getWebPageInstantView @@ -7431,10 +7499,10 @@ internalLinkTypeSettings = InternalLinkType; //@expect_custom_emoji True, if the sticker set is expected to contain custom emoji internalLinkTypeStickerSet sticker_set_name:string expect_custom_emoji:Bool = InternalLinkType; -//@description The link is a link to a story. Call searchPublicChat with the given sender username, then call getStory with the received chat identifier and the given story identifier, then show the story if received -//@story_sender_username Username of the sender of the story +//@description The link is a link to a story. Call searchPublicChat with the given poster username, then call getStory with the received chat identifier and the given story identifier, then show the story if received +//@story_poster_username Username of the poster of the story //@story_id Story identifier -internalLinkTypeStory story_sender_username:string story_id:int32 = InternalLinkType; +internalLinkTypeStory story_poster_username:string story_id:int32 = InternalLinkType; //@description The link is a link to a cloud theme. TDLib has no theme support yet @theme_name Name of the theme internalLinkTypeTheme theme_name:string = InternalLinkType; @@ -7463,7 +7531,7 @@ internalLinkTypeUserPhoneNumber phone_number:string draft_text:string open_profi //@token The token internalLinkTypeUserToken token:string = InternalLinkType; -//@description The link is a link to a video chat. Call searchPublicChat with the given chat username, and then joinGroupCall with the given invite hash to process the link +//@description The link is a link to a video chat. Call searchPublicChat with the given chat username, and then joinVideoChat with the given invite hash to process the link //@chat_username Username of the chat with the video chat //@invite_hash If non-empty, invite hash to be used to join the video chat without being muted by administrators //@is_live_stream True, if the video chat is expected to be a live stream in a channel or a broadcast group @@ -7512,10 +7580,6 @@ blockListMain = BlockList; blockListStories = BlockList; -//@description Contains a part of a file @data File bytes -filePart data:bytes = FilePart; - - //@class FileType @description Represents the type of file //@description The data is not a file @@ -7837,6 +7901,9 @@ count count:int32 = Count; //@description Contains some text @text Text text text:string = Text; +//@description Contains some binary data @data Data +data data:bytes = Data; + //@description Contains a value representing a number of seconds @seconds Number of seconds seconds seconds:double = Seconds; @@ -7921,11 +7988,11 @@ statisticalGraphError error_message:string = StatisticalGraph; //@description Describes a message sent in the chat @message_id Message identifier chatStatisticsObjectTypeMessage message_id:int53 = ChatStatisticsObjectType; -//@description Describes a story sent by the chat @story_id Story identifier +//@description Describes a story posted on behalf of the chat @story_id Story identifier chatStatisticsObjectTypeStory story_id:int32 = ChatStatisticsObjectType; -//@description Contains statistics about interactions with a message sent in the chat or a story sent by the chat +//@description Contains statistics about interactions with a message sent in the chat or a story posted on behalf of the chat //@object_type Type of the object //@view_count Number of times the object was viewed //@forward_count Number of times the object was forwarded @@ -7978,9 +8045,9 @@ chatStatisticsSupergroup period:dateRange member_count:statisticalValue message_ //@mean_message_view_count Mean number of times the recently sent messages were viewed //@mean_message_share_count Mean number of times the recently sent messages were shared //@mean_message_reaction_count Mean number of times reactions were added to the recently sent messages -//@mean_story_view_count Mean number of times the recently sent stories were viewed -//@mean_story_share_count Mean number of times the recently sent stories were shared -//@mean_story_reaction_count Mean number of times reactions were added to the recently sent stories +//@mean_story_view_count Mean number of times the recently posted stories were viewed +//@mean_story_share_count Mean number of times the recently posted stories were shared +//@mean_story_reaction_count Mean number of times reactions were added to the recently posted stories //@enabled_notifications_percentage A percentage of users with enabled notifications for the chat; 0-100 //@member_count_graph A graph containing number of members in the chat //@join_graph A graph containing number of members joined and left the chat @@ -7994,7 +8061,7 @@ chatStatisticsSupergroup period:dateRange member_count:statisticalValue message_ //@story_interaction_graph A graph containing number of story views and shares //@story_reaction_graph A graph containing number of reactions on stories //@instant_view_interaction_graph A graph containing number of views of associated with the chat instant views -//@recent_interactions Detailed statistics about number of views and shares of recently sent messages and stories +//@recent_interactions Detailed statistics about number of views and shares of recently sent messages and posted stories chatStatisticsChannel period:dateRange member_count:statisticalValue mean_message_view_count:statisticalValue mean_message_share_count:statisticalValue mean_message_reaction_count:statisticalValue mean_story_view_count:statisticalValue mean_story_share_count:statisticalValue mean_story_reaction_count:statisticalValue enabled_notifications_percentage:double member_count_graph:StatisticalGraph join_graph:StatisticalGraph mute_graph:StatisticalGraph view_count_by_hour_graph:StatisticalGraph view_count_by_source_graph:StatisticalGraph join_by_source_graph:StatisticalGraph language_graph:StatisticalGraph message_interaction_graph:StatisticalGraph message_reaction_graph:StatisticalGraph story_interaction_graph:StatisticalGraph story_reaction_graph:StatisticalGraph instant_view_interaction_graph:StatisticalGraph recent_interactions:vector = ChatStatistics; @@ -8359,9 +8426,10 @@ updateForumTopicInfo info:forumTopicInfo = Update; //@chat_id Chat identifier //@message_thread_id Message thread identifier of the topic //@is_pinned True, if the topic is pinned in the topic list +//@last_read_inbox_message_id Identifier of the last read incoming message //@last_read_outbox_message_id Identifier of the last read outgoing message //@notification_settings Notification settings for the topic -updateForumTopic chat_id:int53 message_thread_id:int53 is_pinned:Bool last_read_outbox_message_id:int53 notification_settings:chatNotificationSettings = Update; +updateForumTopic chat_id:int53 message_thread_id:int53 is_pinned:Bool last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 notification_settings:chatNotificationSettings = Update; //@description Notification settings for some type of chats were updated @scope Types of chats for which notification settings were updated @notification_settings The new notification settings updateScopeNotificationSettings scope:NotificationSettingsScope notification_settings:scopeNotificationSettings = Update; @@ -8486,14 +8554,26 @@ updateApplicationRecaptchaVerificationRequired verification_id:int53 action:stri //@description New call was created or information about a call was updated @call New data about a call updateCall call:call = Update; -//@description Information about a group call was updated @group_call New data about a group call +//@description Information about a group call was updated @group_call New data about the group call updateGroupCall group_call:groupCall = Update; //@description Information about a group call participant was changed. The updates are sent only after the group call is received through getGroupCall and only if the call is joined or being joined -//@group_call_id Identifier of group call -//@participant New data about a participant +//@group_call_id Identifier of the group call +//@participant New data about the participant updateGroupCallParticipant group_call_id:int32 participant:groupCallParticipant = Update; +//@description The list of group call participants that can send and receive encrypted call data has changed; for group calls not bound to a chat only +//@group_call_id Identifier of the group call +//@participant_user_ids New list of group call participant user identifiers. The identifiers may be invalid or the corresponding users may be unknown. +//-The participants must be shown in the list of group call participants even there is no information about them +updateGroupCallParticipants group_call_id:int32 participant_user_ids:vector = Update; + +//@description The verification state of an encrypted group call has changed; for group calls not bound to a chat only +//@group_call_id Identifier of the group call +//@generation The call state generation to which the emoji corresponds. If generation is different for two users, then their emoji may be also different +//@emojis Group call state fingerprint represented as 4 emoji; may be empty if the state isn't verified yet +updateGroupCallVerificationState group_call_id:int32 generation:int32 emojis:vector = Update; + //@description New call signaling data arrived @call_id The call identifier @data The data updateNewCallSignalingData call_id:int32 data:bytes = Update; @@ -8518,17 +8598,17 @@ updateUnreadChatCount chat_list:ChatList total_count:int32 unread_count:int32 un //@description A story was changed @story The new information about the story updateStory story:story = Update; -//@description A story became inaccessible @story_sender_chat_id Identifier of the chat that posted the story @story_id Story identifier -updateStoryDeleted story_sender_chat_id:int53 story_id:int32 = Update; +//@description A story became inaccessible @story_poster_chat_id Identifier of the chat that posted the story @story_id Story identifier +updateStoryDeleted story_poster_chat_id:int53 story_id:int32 = Update; -//@description A story has been successfully sent @story The sent story @old_story_id The previous temporary story identifier -updateStorySendSucceeded story:story old_story_id:int32 = Update; +//@description A story has been successfully posted @story The posted story @old_story_id The previous temporary story identifier +updateStoryPostSucceeded story:story old_story_id:int32 = Update; -//@description A story failed to send. If the story sending is canceled, then updateStoryDeleted will be received instead of this update -//@story The failed to send story -//@error The cause of the story sending failure +//@description A story failed to post. If the story posting is canceled, then updateStoryDeleted will be received instead of this update +//@story The failed to post story +//@error The cause of the story posting failure //@error_type Type of the error; may be null if unknown -updateStorySendFailed story:story error:error error_type:CanSendStoryResult = Update; +updateStoryPostFailed story:story error:error error_type:CanPostStoryResult = Update; //@description The list of active stories posted by a specific chat has changed //@active_stories The new list of active stories @@ -9339,7 +9419,7 @@ searchSecretMessages chat_id:int53 query:string offset:string limit:int32 filter //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit searchSavedMessages saved_messages_topic_id:int53 tag:ReactionType query:string from_message_id:int53 offset:int32 limit:int32 = FoundChatMessages; -//@description Searches for call messages. Returns the results in reverse chronological order (i.e., in order of decreasing message_id). For optimal performance, the number of returned messages is chosen by TDLib +//@description Searches for call and group call messages. Returns the results in reverse chronological order (i.e., in order of decreasing message_id). For optimal performance, the number of returned messages is chosen by TDLib //@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results //@limit The maximum number of messages to be returned; up to 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit //@only_missed Pass true to search only for messages with missed/declined calls @@ -9357,11 +9437,11 @@ searchOutgoingDocumentMessages query:string limit:int32 = FoundMessages; searchPublicMessagesByTag tag:string offset:string limit:int32 = FoundMessages; //@description Searches for public stories containing the given hashtag or cashtag. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit -//@story_sender_chat_id Identifier of the chat that posted the stories to search for; pass 0 to search stories in all chats +//@story_poster_chat_id Identifier of the chat that posted the stories to search for; pass 0 to search stories in all chats //@tag Hashtag or cashtag to search for //@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results //@limit The maximum number of stories to be returned; up to 100. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit -searchPublicStoriesByTag story_sender_chat_id:int53 tag:string offset:string limit:int32 = FoundStories; +searchPublicStoriesByTag story_poster_chat_id:int53 tag:string offset:string limit:int32 = FoundStories; //@description Searches for public stories by the given address location. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit //@address Address of the location @@ -9788,16 +9868,16 @@ readBusinessMessage business_connection_id:string chat_id:int53 message_id:int53 //@message_ids Identifier of the messages deleteBusinessMessages business_connection_id:string message_ids:vector = Ok; -//@description Changes a story sent by the bot on behalf of a business account; for bots only -//@story_sender_chat_id Identifier of the chat that posted the story +//@description Changes a story posted by the bot on behalf of a business account; for bots only +//@story_poster_chat_id Identifier of the chat that posted the story //@story_id Identifier of the story to edit //@content New content of the story //@areas New clickable rectangle areas to be shown on the story media //@caption New story caption //@privacy_settings The new privacy settings for the story -editBusinessStory story_sender_chat_id:int53 story_id:int32 content:InputStoryContent areas:inputStoryAreas caption:formattedText privacy_settings:StoryPrivacySettings = Story; +editBusinessStory story_poster_chat_id:int53 story_id:int32 content:InputStoryContent areas:inputStoryAreas caption:formattedText privacy_settings:StoryPrivacySettings = Story; -//@description Deletes a story sent by the bot on behalf of a business account; for bots only +//@description Deletes a story posted by the bot on behalf of a business account; for bots only //@business_connection_id Unique identifier of business connection //@story_id Identifier of the story to delete deleteBusinessStory business_connection_id:string story_id:int32 = Ok; @@ -10718,43 +10798,43 @@ getCurrentWeather location:location = CurrentWeather; //@description Returns a story -//@story_sender_chat_id Identifier of the chat that posted the story +//@story_poster_chat_id Identifier of the chat that posted the story //@story_id Story identifier //@only_local Pass true to get only locally available information without sending network requests -getStory story_sender_chat_id:int53 story_id:int32 only_local:Bool = Story; +getStory story_poster_chat_id:int53 story_id:int32 only_local:Bool = Story; -//@description Returns supergroup and channel chats in which the current user has the right to post stories. The chats must be rechecked with canSendStory before actually trying to post a story there -getChatsToSendStories = Chats; +//@description Returns supergroup and channel chats in which the current user has the right to post stories. The chats must be rechecked with canPostStory before actually trying to post a story there +getChatsToPostStories = Chats; -//@description Checks whether the current user can send a story on behalf of a chat; requires can_post_stories right for supergroup and channel chats +//@description Checks whether the current user can post a story on behalf of a chat; requires can_post_stories right for supergroup and channel chats //@chat_id Chat identifier. Pass Saved Messages chat identifier when posting a story on behalf of the current user -canSendStory chat_id:int53 = CanSendStoryResult; +canPostStory chat_id:int53 = CanPostStoryResult; -//@description Sends a new story to a chat; requires can_post_stories right for supergroup and channel chats. Returns a temporary story +//@description Posts a new story on behalf of a chat; requires can_post_stories right for supergroup and channel chats. Returns a temporary story //@chat_id Identifier of the chat that will post the story. Pass Saved Messages chat identifier when posting a story on behalf of the current user //@content Content of the story //@areas Clickable rectangle areas to be shown on the story media; pass null if none //@caption Story caption; pass null to use an empty caption; 0-getOption("story_caption_length_max") characters; can have entities only if getOption("can_use_text_entities_in_story_caption") -//@privacy_settings The privacy settings for the story; ignored for stories sent to supergroup and channel chats +//@privacy_settings The privacy settings for the story; ignored for stories posted on behalf of supergroup and channel chats //@active_period Period after which the story is moved to archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400 for Telegram Premium users, and 86400 otherwise //@from_story_full_id Full identifier of the original story, which content was used to create the story; pass null if the story isn't repost of another story //@is_posted_to_chat_page Pass true to keep the story accessible after expiration //@protect_content Pass true if the content of the story must be protected from forwarding and screenshotting -sendStory chat_id:int53 content:InputStoryContent areas:inputStoryAreas caption:formattedText privacy_settings:StoryPrivacySettings active_period:int32 from_story_full_id:storyFullId is_posted_to_chat_page:Bool protect_content:Bool = Story; +postStory chat_id:int53 content:InputStoryContent areas:inputStoryAreas caption:formattedText privacy_settings:StoryPrivacySettings active_period:int32 from_story_full_id:storyFullId is_posted_to_chat_page:Bool protect_content:Bool = Story; //@description Changes content and caption of a story. Can be called only if story.can_be_edited == true -//@story_sender_chat_id Identifier of the chat that posted the story +//@story_poster_chat_id Identifier of the chat that posted the story //@story_id Identifier of the story to edit //@content New content of the story; pass null to keep the current content //@areas New clickable rectangle areas to be shown on the story media; pass null to keep the current areas. Areas can't be edited if story content isn't changed //@caption New story caption; pass null to keep the current caption -editStory story_sender_chat_id:int53 story_id:int32 content:InputStoryContent areas:inputStoryAreas caption:formattedText = Ok; +editStory story_poster_chat_id:int53 story_id:int32 content:InputStoryContent areas:inputStoryAreas caption:formattedText = Ok; //@description Changes cover of a video story. Can be called only if story.can_be_edited == true and the story isn't being edited now -//@story_sender_chat_id Identifier of the chat that posted the story +//@story_poster_chat_id Identifier of the chat that posted the story //@story_id Identifier of the story to edit //@cover_frame_timestamp New timestamp of the frame, which will be used as video thumbnail -editStoryCover story_sender_chat_id:int53 story_id:int32 cover_frame_timestamp:double = Ok; +editStoryCover story_poster_chat_id:int53 story_id:int32 cover_frame_timestamp:double = Ok; //@description Changes privacy settings of a story. The method can be called only for stories posted on behalf of the current user and if story.can_be_edited == true //@story_id Identifier of the story @@ -10762,21 +10842,21 @@ editStoryCover story_sender_chat_id:int53 story_id:int32 cover_frame_timestamp:d setStoryPrivacySettings story_id:int32 privacy_settings:StoryPrivacySettings = Ok; //@description Toggles whether a story is accessible after expiration. Can be called only if story.can_toggle_is_posted_to_chat_page == true -//@story_sender_chat_id Identifier of the chat that posted the story +//@story_poster_chat_id Identifier of the chat that posted the story //@story_id Identifier of the story //@is_posted_to_chat_page Pass true to make the story accessible after expiration; pass false to make it private -toggleStoryIsPostedToChatPage story_sender_chat_id:int53 story_id:int32 is_posted_to_chat_page:Bool = Ok; +toggleStoryIsPostedToChatPage story_poster_chat_id:int53 story_id:int32 is_posted_to_chat_page:Bool = Ok; -//@description Deletes a previously sent story. Can be called only if story.can_be_deleted == true -//@story_sender_chat_id Identifier of the chat that posted the story +//@description Deletes a previously posted story. Can be called only if story.can_be_deleted == true +//@story_poster_chat_id Identifier of the chat that posted the story //@story_id Identifier of the story to delete -deleteStory story_sender_chat_id:int53 story_id:int32 = Ok; +deleteStory story_poster_chat_id:int53 story_id:int32 = Ok; //@description Returns the list of chats with non-default notification settings for stories getStoryNotificationSettingsExceptions = Chats; //@description Loads more active stories from a story list. The loaded stories will be sent through updates. Active stories are sorted by -//-the pair (active_stories.order, active_stories.story_sender_chat_id) in descending order. Returns a 404 error if all active stories have been loaded +//-the pair (active_stories.order, active_stories.story_poster_chat_id) in descending order. Returns a 404 error if all active stories have been loaded //@story_list The story list in which to load active stories loadActiveStories story_list:StoryList = Ok; @@ -10808,24 +10888,24 @@ getChatArchivedStories chat_id:int53 from_story_id:int32 limit:int32 = Stories; setChatPinnedStories chat_id:int53 story_ids:vector = Ok; //@description Informs TDLib that a story is opened and is being viewed by the user -//@story_sender_chat_id The identifier of the sender of the opened story +//@story_poster_chat_id The identifier of the chat that posted the opened story //@story_id The identifier of the story -openStory story_sender_chat_id:int53 story_id:int32 = Ok; +openStory story_poster_chat_id:int53 story_id:int32 = Ok; //@description Informs TDLib that a story is closed by the user -//@story_sender_chat_id The identifier of the sender of the story to close +//@story_poster_chat_id The identifier of the poster of the story to close //@story_id The identifier of the story -closeStory story_sender_chat_id:int53 story_id:int32 = Ok; +closeStory story_poster_chat_id:int53 story_id:int32 = Ok; //@description Returns reactions, which can be chosen for a story @row_size Number of reaction per row, 5-25 getStoryAvailableReactions row_size:int32 = AvailableReactions; //@description Changes chosen reaction on a story that has already been sent -//@story_sender_chat_id The identifier of the sender of the story +//@story_poster_chat_id The identifier of the poster of the story //@story_id The identifier of the story //@reaction_type Type of the reaction to set; pass null to remove the reaction. Custom emoji reactions can be used only by Telegram Premium users. Paid reactions can't be set //@update_recent_reactions Pass true if the reaction needs to be added to recent reactions -setStoryReaction story_sender_chat_id:int53 story_id:int32 reaction_type:ReactionType update_recent_reactions:Bool = Ok; +setStoryReaction story_poster_chat_id:int53 story_id:int32 reaction_type:ReactionType update_recent_reactions:Bool = Ok; //@description Returns interactions with a story. The method can be called only for stories posted on behalf of the current user //@story_id Story identifier @@ -10838,20 +10918,20 @@ setStoryReaction story_sender_chat_id:int53 story_id:int32 reaction_type:Reactio getStoryInteractions story_id:int32 query:string only_contacts:Bool prefer_forwards:Bool prefer_with_reaction:Bool offset:string limit:int32 = StoryInteractions; //@description Returns interactions with a story posted in a chat. Can be used only if story is posted on behalf of a chat and the user is an administrator in the chat -//@story_sender_chat_id The identifier of the sender of the story +//@story_poster_chat_id The identifier of the poster of the story //@story_id Story identifier //@reaction_type Pass the default heart reaction or a suggested reaction type to receive only interactions with the specified reaction type; pass null to receive all interactions; reactionTypePaid isn't supported //@prefer_forwards Pass true to get forwards and reposts first, then reactions, then other views; pass false to get interactions sorted just by interaction date //@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results //@limit The maximum number of story interactions to return -getChatStoryInteractions story_sender_chat_id:int53 story_id:int32 reaction_type:ReactionType prefer_forwards:Bool offset:string limit:int32 = StoryInteractions; +getChatStoryInteractions story_poster_chat_id:int53 story_id:int32 reaction_type:ReactionType prefer_forwards:Bool offset:string limit:int32 = StoryInteractions; //@description Reports a story to the Telegram moderators -//@story_sender_chat_id The identifier of the sender of the story to report +//@story_poster_chat_id The identifier of the poster of the story to report //@story_id The identifier of the story to report //@option_id Option identifier chosen by the user; leave empty for the initial request //@text Additional report details; 0-1024 characters; leave empty for the initial request -reportStory story_sender_chat_id:int53 story_id:int32 option_id:bytes text:string = ReportStoryResult; +reportStory story_poster_chat_id:int53 story_id:int32 option_id:bytes text:string = ReportStoryResult; //@description Activates stealth mode for stories, which hides all views of stories from the current user in the last "story_stealth_mode_past_period" seconds //-and for the next "story_stealth_mode_future_period" seconds; for Telegram Premium users only @@ -10859,11 +10939,11 @@ activateStoryStealthMode = Ok; //@description Returns forwards of a story as a message to public chats and reposts by public channels. Can be used only if the story is posted on behalf of the current user or story.can_get_statistics == true. //-For optimal performance, the number of returned messages and stories is chosen by TDLib -//@story_sender_chat_id The identifier of the sender of the story +//@story_poster_chat_id The identifier of the poster of the story //@story_id The identifier of the story //@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results //@limit The maximum number of messages and stories to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned objects is chosen by TDLib and can be smaller than the specified limit -getStoryPublicForwards story_sender_chat_id:int53 story_id:int32 offset:string limit:int32 = PublicForwards; +getStoryPublicForwards story_poster_chat_id:int53 story_id:int32 offset:string limit:int32 = PublicForwards; //@description Returns the list of features available on the specific chat boost level. This is an offline method @@ -10990,7 +11070,7 @@ finishFileGeneration generation_id:int64 error:error = Ok; //@file_id Identifier of the file. The file must be located in the TDLib file cache //@offset The offset from which to read the file //@count Number of bytes to read. An error will be returned if there are not enough bytes available in the file from the specified position. Pass 0 to read all available data from the specified position -readFilePart file_id:int32 offset:int53 count:int53 = FilePart; +readFilePart file_id:int32 offset:int53 count:int53 = Data; //@description Deletes a file from the TDLib file cache @file_id Identifier of the file to delete deleteFile file_id:int32 = Ok; @@ -11152,8 +11232,7 @@ processChatJoinRequests chat_id:int53 invite_link:string approve:Bool = Ok; //@user_id Identifier of the user to be called //@protocol The call protocols supported by the application //@is_video Pass true to create a video call -//@group_call_id Identifier of the group call to which the user will be added after exchanging private key via the call; pass 0 if none -createCall user_id:int53 protocol:callProtocol is_video:Bool group_call_id:int32 = CallId; +createCall user_id:int53 protocol:callProtocol is_video:Bool = CallId; //@description Accepts an incoming call @call_id Call identifier @protocol The call protocols supported by the application acceptCall call_id:int32 protocol:callProtocol = Ok; @@ -11164,10 +11243,11 @@ sendCallSignalingData call_id:int32 data:bytes = Ok; //@description Discards a call //@call_id Call identifier //@is_disconnected Pass true if the user was disconnected +//@invite_link If the call was upgraded to a group call, pass invite link to the group call //@duration The call duration, in seconds //@is_video Pass true if the call was a video call //@connection_id Identifier of the connection used during the call -discardCall call_id:int32 is_disconnected:Bool duration:int32 is_video:Bool connection_id:int64 = Ok; +discardCall call_id:int32 is_disconnected:Bool invite_link:string duration:int32 is_video:Bool connection_id:int64 = Ok; //@description Sends a call rating //@call_id Call identifier @@ -11196,36 +11276,35 @@ setVideoChatDefaultParticipant chat_id:int53 default_participant_id:MessageSende //@is_rtmp_stream Pass true to create an RTMP stream instead of an ordinary video chat createVideoChat chat_id:int53 title:string start_date:int32 is_rtmp_stream:Bool = GroupCallId; -//@description Creates a group call from a one-to-one call @call_id Call identifier -createGroupCall call_id:int32 = Ok; +//@description Creates a new group call that isn't bound to a chat @join_parameters Parameters to join the call; pass null to only create call link without joining the call +createGroupCall join_parameters:groupCallJoinParameters = GroupCallInfo; -//@description Returns RTMP URL for streaming to the chat; requires can_manage_video_chats administrator right @chat_id Chat identifier +//@description Returns RTMP URL for streaming to the video chat of a chat; requires can_manage_video_chats administrator right @chat_id Chat identifier getVideoChatRtmpUrl chat_id:int53 = RtmpUrl; -//@description Replaces the current RTMP URL for streaming to the chat; requires owner privileges @chat_id Chat identifier +//@description Replaces the current RTMP URL for streaming to the video chat of a chat; requires owner privileges in the chat @chat_id Chat identifier replaceVideoChatRtmpUrl chat_id:int53 = RtmpUrl; //@description Returns information about a group call @group_call_id Group call identifier getGroupCall group_call_id:int32 = GroupCall; -//@description Starts a scheduled group call @group_call_id Group call identifier -startScheduledGroupCall group_call_id:int32 = Ok; +//@description Starts a scheduled video chat @group_call_id Group call identifier of the video chat +startScheduledVideoChat group_call_id:int32 = Ok; -//@description Toggles whether the current user will receive a notification when the group call starts; scheduled group calls only +//@description Toggles whether the current user will receive a notification when the video chat starts; for scheduled video chats only //@group_call_id Group call identifier //@enabled_start_notification New value of the enabled_start_notification setting -toggleGroupCallEnabledStartNotification group_call_id:int32 enabled_start_notification:Bool = Ok; +toggleVideoChatEnabledStartNotification group_call_id:int32 enabled_start_notification:Bool = Ok; -//@description Joins an active group call. Returns join response payload for tgcalls +//@description Joins a group call that is not bound to a chat @input_group_call The group call to join @join_parameters Parameters to join the call +joinGroupCall input_group_call:InputGroupCall join_parameters:groupCallJoinParameters = GroupCallInfo; + +//@description Joins an active video chat. Returns join response payload for tgcalls //@group_call_id Group call identifier //@participant_id Identifier of a group call participant, which will be used to join the call; pass null to join as self; video chats only -//@audio_source_id Caller audio channel synchronization source identifier; received from tgcalls -//@payload Group call join payload; received from tgcalls -//@is_muted Pass true to join the call with muted microphone -//@is_my_video_enabled Pass true if the user's video is enabled -//@invite_hash If non-empty, invite hash to be used to join the group call without being muted by administrators -//@key_fingerprint Fingerprint of the encryption key for E2E group calls not bound to a chat; pass 0 for voice chats -joinGroupCall group_call_id:int32 participant_id:MessageSender audio_source_id:int32 payload:string is_muted:Bool is_my_video_enabled:Bool invite_hash:string key_fingerprint:int64 = Text; +//@join_parameters Parameters to join the call +//@invite_hash Invite hash as received from internalLinkTypeVideoChat +joinVideoChat group_call_id:int32 participant_id:MessageSender join_parameters:groupCallJoinParameters invite_hash:string = Text; //@description Starts screen sharing in a joined group call. Returns join response payload for tgcalls //@group_call_id Group call identifier @@ -11239,35 +11318,52 @@ toggleGroupCallScreenSharingIsPaused group_call_id:int32 is_paused:Bool = Ok; //@description Ends screen sharing in a joined group call @group_call_id Group call identifier endGroupCallScreenSharing group_call_id:int32 = Ok; -//@description Sets group call title. Requires groupCall.can_be_managed group call flag @group_call_id Group call identifier @title New group call title; 1-64 characters -setGroupCallTitle group_call_id:int32 title:string = Ok; +//@description Sets title of a video chat; requires groupCall.can_be_managed right @group_call_id Group call identifier @title New group call title; 1-64 characters +setVideoChatTitle group_call_id:int32 title:string = Ok; -//@description Toggles whether new participants of a group call can be unmuted only by administrators of the group call. Requires groupCall.can_toggle_mute_new_participants group call flag +//@description Toggles whether new participants of a video chat can be unmuted only by administrators of the video chat. Requires groupCall.can_toggle_mute_new_participants right //@group_call_id Group call identifier //@mute_new_participants New value of the mute_new_participants setting -toggleGroupCallMuteNewParticipants group_call_id:int32 mute_new_participants:Bool = Ok; +toggleVideoChatMuteNewParticipants group_call_id:int32 mute_new_participants:Bool = Ok; -//@description Invites users to an active group call. Sends a service message of type messageInviteVideoChatParticipants for video chats +//@description Invites a user to an active group call; for group calls not bound to a chat only. Sends a service message of the type messageGroupCall. +//-The group call can have at most getOption("group_call_participant_count_max") participants +//@group_call_id Group call identifier +//@user_id User identifier +//@is_video Pass true if the group call is a video call +inviteGroupCallParticipant group_call_id:int32 user_id:int53 is_video:Bool = InviteGroupCallParticipantResult; + +//@description Declines an invitation to an active group call via messageGroupCall. Can be called both by the sender and the receiver of the invitation +//@chat_id Identifier of the chat with the message +//@message_id Identifier of the message of the type messageGroupCall +declineGroupCallInvitation chat_id:int53 message_id:int53 = Ok; + +//@description Bans users from a group call not bound to a chat; requires groupCall.is_owned. Only the owner of the group call can invite the banned users back +//@group_call_id Group call identifier +//@user_ids Identifiers of group call participants to ban; identifiers of unknown users from the update updateGroupCallParticipants can be also passed to the method +banGroupCallParticipants group_call_id:int32 user_ids:vector = Ok; + +//@description Invites users to an active video chat. Sends a service message of the type messageInviteVideoChatParticipants to the chat bound to the group call //@group_call_id Group call identifier //@user_ids User identifiers. At most 10 users can be invited simultaneously -inviteGroupCallParticipants group_call_id:int32 user_ids:vector = Ok; +inviteVideoChatParticipants group_call_id:int32 user_ids:vector = Ok; //@description Returns invite link to a video chat in a public chat //@group_call_id Group call identifier -//@can_self_unmute Pass true if the invite link needs to contain an invite hash, passing which to joinGroupCall would allow the invited user to unmute themselves. Requires groupCall.can_be_managed group call flag -getGroupCallInviteLink group_call_id:int32 can_self_unmute:Bool = HttpUrl; +//@can_self_unmute Pass true if the invite link needs to contain an invite hash, passing which to joinVideoChat would allow the invited user to unmute themselves. Requires groupCall.can_be_managed right +getVideoChatInviteLink group_call_id:int32 can_self_unmute:Bool = HttpUrl; -//@description Revokes invite link for a group call. Requires groupCall.can_be_managed group call flag @group_call_id Group call identifier +//@description Revokes invite link for a group call. Requires groupCall.can_be_managed right for video chats or groupCall.is_owned otherwise @group_call_id Group call identifier revokeGroupCallInviteLink group_call_id:int32 = Ok; -//@description Starts recording of an active group call. Requires groupCall.can_be_managed group call flag +//@description Starts recording of an active group call; for video chats only. Requires groupCall.can_be_managed right //@group_call_id Group call identifier //@title Group call recording title; 0-64 characters //@record_video Pass true to record a video file instead of an audio file //@use_portrait_orientation Pass true to use portrait orientation for video instead of landscape one startGroupCallRecording group_call_id:int32 title:string record_video:Bool use_portrait_orientation:Bool = Ok; -//@description Ends recording of an active group call. Requires groupCall.can_be_managed group call flag @group_call_id Group call identifier +//@description Ends recording of an active group call; for video chats only. Requires groupCall.can_be_managed right @group_call_id Group call identifier endGroupCallRecording group_call_id:int32 = Ok; //@description Toggles whether current user's video is paused @group_call_id Group call identifier @is_my_video_paused Pass true if the current user's video is paused @@ -11276,7 +11372,7 @@ toggleGroupCallIsMyVideoPaused group_call_id:int32 is_my_video_paused:Bool = Ok; //@description Toggles whether current user's video is enabled @group_call_id Group call identifier @is_my_video_enabled Pass true if the current user's video is enabled toggleGroupCallIsMyVideoEnabled group_call_id:int32 is_my_video_enabled:Bool = Ok; -//@description Informs TDLib that speaking state of a participant of an active group has changed +//@description Informs TDLib that speaking state of a participant of an active group call has changed //@group_call_id Group call identifier //@audio_source Group call participant's synchronization audio source identifier, or 0 for the current user //@is_speaking Pass true if the user is speaking @@ -11288,18 +11384,24 @@ setGroupCallParticipantIsSpeaking group_call_id:int32 audio_source:int32 is_spea //@is_muted Pass true to mute the user; pass false to unmute them toggleGroupCallParticipantIsMuted group_call_id:int32 participant_id:MessageSender is_muted:Bool = Ok; -//@description Changes volume level of a participant of an active group call. If the current user can manage the group call, then the participant's volume level will be changed for all users with the default volume level +//@description Changes volume level of a participant of an active group call. If the current user can manage the group call or is the owner of the group call, +//-then the participant's volume level will be changed for all users with the default volume level //@group_call_id Group call identifier //@participant_id Participant identifier //@volume_level New participant's volume level; 1-20000 in hundreds of percents setGroupCallParticipantVolumeLevel group_call_id:int32 participant_id:MessageSender volume_level:int32 = Ok; -//@description Toggles whether a group call participant hand is rased +//@description Toggles whether a group call participant hand is rased; for video chats only //@group_call_id Group call identifier //@participant_id Participant identifier -//@is_hand_raised Pass true if the user's hand needs to be raised. Only self hand can be raised. Requires groupCall.can_be_managed group call flag to lower other's hand +//@is_hand_raised Pass true if the user's hand needs to be raised. Only self hand can be raised. Requires groupCall.can_be_managed right to lower other's hand toggleGroupCallParticipantIsHandRaised group_call_id:int32 participant_id:MessageSender is_hand_raised:Bool = Ok; +//@description Returns information about participants of a non-joined group call that is not bound to a chat +//@input_group_call The group call which participants will be returned +//@limit The maximum number of participants to return; must be positive +getGroupCallParticipants input_group_call:InputGroupCall limit:int32 = GroupCallParticipants; + //@description Loads more participants of a group call. The loaded participants will be received through updates. Use the field groupCall.loaded_all_participants to check whether all participants have already been loaded //@group_call_id Group call identifier. The group call must be previously received through getGroupCall and must be joined or being joined //@limit The maximum number of participants to load; up to 100 @@ -11308,19 +11410,33 @@ loadGroupCallParticipants group_call_id:int32 limit:int32 = Ok; //@description Leaves a group call @group_call_id Group call identifier leaveGroupCall group_call_id:int32 = Ok; -//@description Ends a group call. Requires groupCall.can_be_managed @group_call_id Group call identifier +//@description Ends a group call. Requires groupCall.can_be_managed right for video chats or groupCall.is_owned otherwise @group_call_id Group call identifier endGroupCall group_call_id:int32 = Ok; -//@description Returns information about available group call streams @group_call_id Group call identifier -getGroupCallStreams group_call_id:int32 = GroupCallStreams; +//@description Returns information about available video chat streams @group_call_id Group call identifier +getVideoChatStreams group_call_id:int32 = VideoChatStreams; -//@description Returns a file with a segment of a group call stream in a modified OGG format for audio or MPEG-4 format for video +//@description Returns a file with a segment of a video chat stream in a modified OGG format for audio or MPEG-4 format for video //@group_call_id Group call identifier //@time_offset Point in time when the stream segment begins; Unix timestamp in milliseconds //@scale Segment duration scale; 0-1. Segment's duration is 1000/(2**scale) milliseconds //@channel_id Identifier of an audio/video channel to get as received from tgcalls //@video_quality Video quality as received from tgcalls; pass null to get the worst available quality -getGroupCallStreamSegment group_call_id:int32 time_offset:int53 scale:int32 channel_id:int32 video_quality:GroupCallVideoQuality = FilePart; +getVideoChatStreamSegment group_call_id:int32 time_offset:int53 scale:int32 channel_id:int32 video_quality:GroupCallVideoQuality = Data; + +//@description Encrypts group call data before sending them over network using tgcalls +//@group_call_id Group call identifier. The call must not be a video chat +//@data_channel Data channel for which data is encrypted +//@data Data to encrypt +//@unencrypted_prefix_size Size of data prefix that must be kept unencrypted +encryptGroupCallData group_call_id:int32 data_channel:GroupCallDataChannel data:bytes unencrypted_prefix_size:int32 = Data; + +//@description Decrypts group call data received by tgcalls +//@group_call_id Group call identifier. The call must not be a video chat +//@participant_id Identifier of the group call participant, which sent the data +//@data_channel Data channel for which data was encrypted; pass null if unknown +//@data Data to decrypt +decryptGroupCallData group_call_id:int32 participant_id:MessageSender data_channel:GroupCallDataChannel data:bytes = Data; //@description Changes the block list of a message sender. Currently, only users and supergroup chats can be blocked From eb767ed26e973d845b3f56090ab4b05b9762fbf1 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Thu, 1 May 2025 20:32:42 +0800 Subject: [PATCH 41/54] Improve command parser --- client/extra.go | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/client/extra.go b/client/extra.go index 827c857..c199cbf 100644 --- a/client/extra.go +++ b/client/extra.go @@ -15,33 +15,29 @@ func UuidV4Generator() ExtraGenerator { } func IsCommand(text string) bool { - if text != "" { - if text[0] == '/' { - return true - } + if i := strings.Index(text, "/"); i == 0 { + return true } return false } func CheckCommand(text string, entities []*TextEntity) string { if IsCommand(text) { + var cmd string + // e.g. ["/hello 123", "/hell o 123"] // Result: "/hello", "/hell" if i := strings.Index(text, " "); i != -1 { - // Fallback: remove @bot - if i2 := strings.Index(text, "@"); i2 != -1 { - return text[:i2] - } - return text[:i] + cmd = text[:i] } // e.g.: ["/hello@world_bot", "/hello@", "/hello@123"] // Result: "/hello" if i := strings.Index(text, "@"); i != -1 { - return text[:i] + cmd = text[:i] } - return text + return cmd } return "" } From 3a8d30fd35cb717fa240c1d025e26d6db49596bb Mon Sep 17 00:00:00 2001 From: c0re100 Date: Thu, 1 May 2025 20:45:52 +0800 Subject: [PATCH 42/54] Add tde2e to LDFLAGS --- client/tdlib.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/tdlib.go b/client/tdlib.go index c9c07db..dc943a0 100644 --- a/client/tdlib.go +++ b/client/tdlib.go @@ -4,9 +4,9 @@ package client //#cgo freebsd CFLAGS: -I/usr/local/include //#cgo darwin CFLAGS: -I/usr/local/include //#cgo windows CFLAGS: -IE:/src/tdlib -IE:/src/tdlib/build -//#cgo linux LDFLAGS: -L/usr/local/lib -ltdjson_static -ltdjson_private -ltdclient -ltdcore -ltdapi -ltdactor -ltddb -ltdsqlite -ltdmtproto -ltdnet -ltdutils -lstdc++ -lssl -lcrypto -ldl -lz -lm -//#cgo freebsd LDFLAGS: -L/usr/local/lib -ltdjson_static -ltdjson_private -ltdclient -ltdcore -ltdapi -ltdactor -ltddb -ltdsqlite -ltdmtproto -ltdnet -ltdutils -lstdc++ -lssl -lcrypto -ldl -lz -lm -//#cgo darwin LDFLAGS: -L/usr/local/lib -L/usr/local/opt/openssl/lib -ltdjson_static -ltdjson_private -ltdclient -ltdcore -ltdapi -ltdactor -ltddb -ltdsqlite -ltdmtproto -ltdnet -ltdutils -lstdc++ -lssl -lcrypto -ldl -lz -lm +//#cgo linux LDFLAGS: -L/usr/local/lib -ltdjson_static -ltdjson_private -ltdclient -ltdcore -ltdapi -ltdactor -ltddb -ltde2e -ltdsqlite -ltdmtproto -ltdnet -ltdutils -lstdc++ -lssl -lcrypto -ldl -lz -lm +//#cgo freebsd LDFLAGS: -L/usr/local/lib -ltdjson_static -ltdjson_private -ltdclient -ltdcore -ltdapi -ltdactor -ltddb -ltde2e -ltdsqlite -ltdmtproto -ltdnet -ltdutils -lstdc++ -lssl -lcrypto -ldl -lz -lm +//#cgo darwin LDFLAGS: -L/usr/local/lib -L/usr/local/opt/openssl/lib -ltdjson_static -ltdjson_private -ltdclient -ltdcore -ltdapi -ltdactor -ltddb -ltde2e -ltdsqlite -ltdmtproto -ltdnet -ltdutils -lstdc++ -lssl -lcrypto -ldl -lz -lm //#cgo windows LDFLAGS: -LE:/src/tdlib/build/Release -ltdjson //#include //#include From e5eeec83b356158480f2e51a9a16f04a0ab79c96 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Fri, 2 May 2025 03:40:05 +0800 Subject: [PATCH 43/54] Fix command parser Return text without argument --- client/extra.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/extra.go b/client/extra.go index c199cbf..c786893 100644 --- a/client/extra.go +++ b/client/extra.go @@ -37,6 +37,10 @@ func CheckCommand(text string, entities []*TextEntity) string { cmd = text[:i] } + if cmd == "" { + return text + } + return cmd } return "" From 969ddb47467c4fa95337eaf250269fd7000058dd Mon Sep 17 00:00:00 2001 From: c0re100 Date: Fri, 9 May 2025 14:42:54 +0800 Subject: [PATCH 44/54] Update to TDLib 1.8.49 --- client/function.go | 135 +++++++++- client/type.go | 600 +++++++++++++++++++++++++++++++++++++++--- client/unmarshaler.go | 298 ++++++++++++++++++++- data/td_api.tl | 155 +++++++++-- 4 files changed, 1125 insertions(+), 63 deletions(-) diff --git a/client/function.go b/client/function.go index ed53166..1102459 100755 --- a/client/function.go +++ b/client/function.go @@ -8708,6 +8708,9 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeMessageDraft: return UnmarshalInternalLinkTypeMessageDraft(result.Data) + case TypeInternalLinkTypeMyStars: + return UnmarshalInternalLinkTypeMyStars(result.Data) + case TypeInternalLinkTypePassportDataRequest: return UnmarshalInternalLinkTypePassportDataRequest(result.Data) @@ -19163,6 +19166,35 @@ func (client *Client) ToggleSupergroupCanHaveSponsoredMessages(req *ToggleSuperg return UnmarshalOk(result.Data) } +type ToggleSupergroupHasAutomaticTranslationRequest struct { + // The identifier of the channel + SupergroupId int64 `json:"supergroup_id"` + // The new value of has_automatic_translation + HasAutomaticTranslation bool `json:"has_automatic_translation"` +} + +// Toggles whether messages are automatically translated in the channel chat; requires can_change_info administrator right in the channel. The chat must have at least chatBoostFeatures.min_automatic_translation_boost_level boost level to enable automatic translation +func (client *Client) ToggleSupergroupHasAutomaticTranslation(req *ToggleSupergroupHasAutomaticTranslationRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleSupergroupHasAutomaticTranslation", + }, + Data: map[string]interface{}{ + "supergroup_id": req.SupergroupId, + "has_automatic_translation": req.HasAutomaticTranslation, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type ToggleSupergroupHasHiddenMembersRequest struct { // Identifier of the supergroup SupergroupId int64 `json:"supergroup_id"` @@ -19670,7 +19702,7 @@ func (client *Client) SetGiftSettings(req *SetGiftSettingsRequest) (*Ok, error) } // Returns gifts that can be sent to other users and channel chats -func (client *Client) GetAvailableGifts() (*Gifts, error) { +func (client *Client) GetAvailableGifts() (*AvailableGifts, error) { result, err := client.Send(Request{ meta: meta{ Type: "getAvailableGifts", @@ -19685,7 +19717,7 @@ func (client *Client) GetAvailableGifts() (*Gifts, error) { return nil, buildResponseError(result.Data) } - return UnmarshalGifts(result.Data) + return UnmarshalAvailableGifts(result.Data) } type SendGiftRequest struct { @@ -19938,6 +19970,38 @@ func (client *Client) TransferGift(req *TransferGiftRequest) (*Ok, error) { return UnmarshalOk(result.Data) } +type SendResoldGiftRequest struct { + // Name of the upgraded gift to send + GiftName string `json:"gift_name"` + // Identifier of the user or the channel chat that will receive the gift + OwnerId MessageSender `json:"owner_id"` + // The amount of Telegram Stars required to pay for the gift + StarCount int64 `json:"star_count"` +} + +// Sends an upgraded gift that is available for resale to another user or channel chat; gifts already owned by the current user must be transferred using transferGift and can't be passed to the method +func (client *Client) SendResoldGift(req *SendResoldGiftRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendResoldGift", + }, + Data: map[string]interface{}{ + "gift_name": req.GiftName, + "owner_id": req.OwnerId, + "star_count": req.StarCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type GetReceivedGiftsRequest struct { // Unique identifier of business connection on behalf of which to send the request; for bots only BusinessConnectionId string `json:"business_connection_id"` @@ -20072,6 +20136,73 @@ func (client *Client) GetUpgradedGiftWithdrawalUrl(req *GetUpgradedGiftWithdrawa return UnmarshalHttpUrl(result.Data) } +type SetGiftResalePriceRequest struct { + // Identifier of the unique gift + ReceivedGiftId string `json:"received_gift_id"` + // The new price for the unique gift; 0 or getOption("gift_resale_star_count_min")-getOption("gift_resale_star_count_max"). Pass 0 to disallow gift resale. The current user will receive getOption("gift_resale_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for the gift + ResaleStarCount int64 `json:"resale_star_count"` +} + +// Changes resale price of a unique gift owned by the current user +func (client *Client) SetGiftResalePrice(req *SetGiftResalePriceRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setGiftResalePrice", + }, + Data: map[string]interface{}{ + "received_gift_id": req.ReceivedGiftId, + "resale_star_count": req.ResaleStarCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SearchGiftsForResaleRequest struct { + // Identifier of the regular gift that was upgraded to a unique gift + GiftId JsonInt64 `json:"gift_id"` + // Order in which the results will be sorted + Order GiftForResaleOrder `json:"order"` + // Attributes used to filter received gifts. If multiple attributes of the same type are specified, then all of them are allowed. If none attributes of specific type are specified, then all values for this attribute type are allowed + Attributes []UpgradedGiftAttributeId `json:"attributes"` + // Offset of the first entry to return as received from the previous request with the same order and attributes; use empty string to get the first chunk of results + Offset string `json:"offset"` + // The maximum number of gifts to return + Limit int32 `json:"limit"` +} + +// Returns upgraded gifts that can be bought from other owners +func (client *Client) SearchGiftsForResale(req *SearchGiftsForResaleRequest) (*GiftsForResale, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchGiftsForResale", + }, + Data: map[string]interface{}{ + "gift_id": req.GiftId, + "order": req.Order, + "attributes": req.Attributes, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGiftsForResale(result.Data) +} + type CreateInvoiceLinkRequest struct { // Unique identifier of business connection on behalf of which to send the request BusinessConnectionId string `json:"business_connection_id"` diff --git a/client/type.go b/client/type.go index 1848a98..ab92cfc 100755 --- a/client/type.go +++ b/client/type.go @@ -26,6 +26,8 @@ const ( ClassStarSubscriptionType = "StarSubscriptionType" ClassAffiliateType = "AffiliateType" ClassAffiliateProgramSortOrder = "AffiliateProgramSortOrder" + ClassUpgradedGiftAttributeId = "UpgradedGiftAttributeId" + ClassGiftForResaleOrder = "GiftForResaleOrder" ClassSentGift = "SentGift" ClassStarTransactionDirection = "StarTransactionDirection" ClassStarTransactionType = "StarTransactionType" @@ -280,9 +282,15 @@ const ( ClassUpgradedGiftBackdrop = "UpgradedGiftBackdrop" ClassUpgradedGiftOriginalDetails = "UpgradedGiftOriginalDetails" ClassGift = "Gift" - ClassGifts = "Gifts" ClassUpgradedGift = "UpgradedGift" ClassUpgradeGiftResult = "UpgradeGiftResult" + ClassAvailableGift = "AvailableGift" + ClassAvailableGifts = "AvailableGifts" + ClassUpgradedGiftModelCount = "UpgradedGiftModelCount" + ClassUpgradedGiftSymbolCount = "UpgradedGiftSymbolCount" + ClassUpgradedGiftBackdropCount = "UpgradedGiftBackdropCount" + ClassGiftForResale = "GiftForResale" + ClassGiftsForResale = "GiftsForResale" ClassReceivedGift = "ReceivedGift" ClassReceivedGifts = "ReceivedGifts" ClassGiftUpgradePreview = "GiftUpgradePreview" @@ -798,9 +806,21 @@ const ( TypeUpgradedGiftBackdrop = "upgradedGiftBackdrop" TypeUpgradedGiftOriginalDetails = "upgradedGiftOriginalDetails" TypeGift = "gift" - TypeGifts = "gifts" TypeUpgradedGift = "upgradedGift" TypeUpgradeGiftResult = "upgradeGiftResult" + TypeAvailableGift = "availableGift" + TypeAvailableGifts = "availableGifts" + TypeUpgradedGiftAttributeIdModel = "upgradedGiftAttributeIdModel" + TypeUpgradedGiftAttributeIdSymbol = "upgradedGiftAttributeIdSymbol" + TypeUpgradedGiftAttributeIdBackdrop = "upgradedGiftAttributeIdBackdrop" + TypeUpgradedGiftModelCount = "upgradedGiftModelCount" + TypeUpgradedGiftSymbolCount = "upgradedGiftSymbolCount" + TypeUpgradedGiftBackdropCount = "upgradedGiftBackdropCount" + TypeGiftForResaleOrderPrice = "giftForResaleOrderPrice" + TypeGiftForResaleOrderPriceChangeDate = "giftForResaleOrderPriceChangeDate" + TypeGiftForResaleOrderNumber = "giftForResaleOrderNumber" + TypeGiftForResale = "giftForResale" + TypeGiftsForResale = "giftsForResale" TypeSentGiftRegular = "sentGiftRegular" TypeSentGiftUpgraded = "sentGiftUpgraded" TypeReceivedGift = "receivedGift" @@ -831,6 +851,8 @@ const ( TypeStarTransactionTypeGiftTransfer = "starTransactionTypeGiftTransfer" TypeStarTransactionTypeGiftSale = "starTransactionTypeGiftSale" TypeStarTransactionTypeGiftUpgrade = "starTransactionTypeGiftUpgrade" + TypeStarTransactionTypeUpgradedGiftPurchase = "starTransactionTypeUpgradedGiftPurchase" + TypeStarTransactionTypeUpgradedGiftSale = "starTransactionTypeUpgradedGiftSale" TypeStarTransactionTypeChannelPaidReactionSend = "starTransactionTypeChannelPaidReactionSend" TypeStarTransactionTypeChannelPaidReactionReceive = "starTransactionTypeChannelPaidReactionReceive" TypeStarTransactionTypeAffiliateProgramCommission = "starTransactionTypeAffiliateProgramCommission" @@ -1701,6 +1723,7 @@ const ( TypeChatEventHasAggressiveAntiSpamEnabledToggled = "chatEventHasAggressiveAntiSpamEnabledToggled" TypeChatEventSignMessagesToggled = "chatEventSignMessagesToggled" TypeChatEventShowMessageSenderToggled = "chatEventShowMessageSenderToggled" + TypeChatEventAutomaticTranslationToggled = "chatEventAutomaticTranslationToggled" TypeChatEventInviteLinkEdited = "chatEventInviteLinkEdited" TypeChatEventInviteLinkRevoked = "chatEventInviteLinkRevoked" TypeChatEventInviteLinkDeleted = "chatEventInviteLinkDeleted" @@ -2033,6 +2056,7 @@ const ( TypeInternalLinkTypeMainWebApp = "internalLinkTypeMainWebApp" TypeInternalLinkTypeMessage = "internalLinkTypeMessage" TypeInternalLinkTypeMessageDraft = "internalLinkTypeMessageDraft" + TypeInternalLinkTypeMyStars = "internalLinkTypeMyStars" TypeInternalLinkTypePassportDataRequest = "internalLinkTypePassportDataRequest" TypeInternalLinkTypePhoneNumberConfirmation = "internalLinkTypePhoneNumberConfirmation" TypeInternalLinkTypePremiumFeatures = "internalLinkTypePremiumFeatures" @@ -2141,6 +2165,7 @@ const ( TypeSuggestedActionSetProfilePhoto = "suggestedActionSetProfilePhoto" TypeSuggestedActionExtendPremium = "suggestedActionExtendPremium" TypeSuggestedActionExtendStarSubscriptions = "suggestedActionExtendStarSubscriptions" + TypeSuggestedActionCustom = "suggestedActionCustom" TypeCount = "count" TypeText = "text" TypeData = "data" @@ -2464,6 +2489,16 @@ type AffiliateProgramSortOrder interface { AffiliateProgramSortOrderType() string } +// Contains identifier of an upgraded gift attribute to search for +type UpgradedGiftAttributeId interface { + UpgradedGiftAttributeIdType() string +} + +// Describes order in which upgraded gifts for resale will be sorted +type GiftForResaleOrder interface { + GiftForResaleOrderType() string +} + // Represents content of a gift received by a user or a channel chat type SentGift interface { SentGiftType() string @@ -8766,6 +8801,8 @@ func (*UpgradedGiftBackdropColors) GetType() string { // Describes a backdrop of an upgraded gift type UpgradedGiftBackdrop struct { meta + // Unique identifier of the backdrop + Id int32 `json:"id"` // Name of the backdrop Name string `json:"name"` // Colors of the backdrop @@ -8885,29 +8922,6 @@ func (*Gift) GetType() string { return TypeGift } -// Contains a list of gifts that can be sent to another user or channel chat -type Gifts struct { - meta - // The list of gifts - Gifts []*Gift `json:"gifts"` -} - -func (entity *Gifts) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub Gifts - - return json.Marshal((*stub)(entity)) -} - -func (*Gifts) GetClass() string { - return ClassGifts -} - -func (*Gifts) GetType() string { - return TypeGifts -} - // Describes an upgraded gift that can be transferred to another owner or transferred to the TON blockchain as an NFT type UpgradedGift struct { meta @@ -8915,7 +8929,7 @@ type UpgradedGift struct { Id JsonInt64 `json:"id"` // The title of the upgraded gift Title string `json:"title"` - // Unique name of the upgraded gift that can be used with internalLinkTypeUpgradedGift + // Unique name of the upgraded gift that can be used with internalLinkTypeUpgradedGift or sendResoldGift Name string `json:"name"` // Unique number of the upgraded gift among gifts upgraded from the same gift Number int32 `json:"number"` @@ -8939,6 +8953,8 @@ type UpgradedGift struct { Backdrop *UpgradedGiftBackdrop `json:"backdrop"` // Information about the originally sent gift; may be null if unknown OriginalDetails *UpgradedGiftOriginalDetails `json:"original_details"` + // Number of Telegram Stars that must be paid to buy the gift and send it to someone else; 0 if resale isn't possible + ResaleStarCount int64 `json:"resale_star_count"` } func (entity *UpgradedGift) MarshalJSON() ([]byte, error) { @@ -8973,6 +8989,7 @@ func (upgradedGift *UpgradedGift) UnmarshalJSON(data []byte) error { Symbol *UpgradedGiftSymbol `json:"symbol"` Backdrop *UpgradedGiftBackdrop `json:"backdrop"` OriginalDetails *UpgradedGiftOriginalDetails `json:"original_details"` + ResaleStarCount int64 `json:"resale_star_count"` } err := json.Unmarshal(data, &tmp) @@ -8993,6 +9010,7 @@ func (upgradedGift *UpgradedGift) UnmarshalJSON(data []byte) error { upgradedGift.Symbol = tmp.Symbol upgradedGift.Backdrop = tmp.Backdrop upgradedGift.OriginalDetails = tmp.OriginalDetails + upgradedGift.ResaleStarCount = tmp.ResaleStarCount fieldOwnerId, _ := UnmarshalMessageSender(tmp.OwnerId) upgradedGift.OwnerId = fieldOwnerId @@ -9013,6 +9031,10 @@ type UpgradeGiftResult struct { CanBeTransferred bool `json:"can_be_transferred"` // Number of Telegram Stars that must be paid to transfer the upgraded gift TransferStarCount int64 `json:"transfer_star_count"` + // Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible + NextTransferDate int32 `json:"next_transfer_date"` + // Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift + NextResaleDate int32 `json:"next_resale_date"` // Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT ExportDate int32 `json:"export_date"` } @@ -9033,6 +9055,347 @@ func (*UpgradeGiftResult) GetType() string { return TypeUpgradeGiftResult } +// Describes a gift that is available for purchase +type AvailableGift struct { + meta + // The gift + Gift *Gift `json:"gift"` + // Number of gifts that are available for resale + ResaleCount int32 `json:"resale_count"` + // The minimum price for the gifts available for resale; 0 if there are no such gifts + MinResaleStarCount int64 `json:"min_resale_star_count"` + // The title of the upgraded gift; empty if the gift isn't available for resale + Title string `json:"title"` +} + +func (entity *AvailableGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AvailableGift + + return json.Marshal((*stub)(entity)) +} + +func (*AvailableGift) GetClass() string { + return ClassAvailableGift +} + +func (*AvailableGift) GetType() string { + return TypeAvailableGift +} + +// Contains a list of gifts that can be sent to another user or channel chat +type AvailableGifts struct { + meta + // The list of gifts + Gifts []*AvailableGift `json:"gifts"` +} + +func (entity *AvailableGifts) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AvailableGifts + + return json.Marshal((*stub)(entity)) +} + +func (*AvailableGifts) GetClass() string { + return ClassAvailableGifts +} + +func (*AvailableGifts) GetType() string { + return TypeAvailableGifts +} + +// Identifier of a gift model +type UpgradedGiftAttributeIdModel struct { + meta + // Identifier of the sticker representing the model + StickerId JsonInt64 `json:"sticker_id"` +} + +func (entity *UpgradedGiftAttributeIdModel) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftAttributeIdModel + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftAttributeIdModel) GetClass() string { + return ClassUpgradedGiftAttributeId +} + +func (*UpgradedGiftAttributeIdModel) GetType() string { + return TypeUpgradedGiftAttributeIdModel +} + +func (*UpgradedGiftAttributeIdModel) UpgradedGiftAttributeIdType() string { + return TypeUpgradedGiftAttributeIdModel +} + +// Identifier of a gift symbol +type UpgradedGiftAttributeIdSymbol struct { + meta + // Identifier of the sticker representing the symbol + StickerId JsonInt64 `json:"sticker_id"` +} + +func (entity *UpgradedGiftAttributeIdSymbol) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftAttributeIdSymbol + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftAttributeIdSymbol) GetClass() string { + return ClassUpgradedGiftAttributeId +} + +func (*UpgradedGiftAttributeIdSymbol) GetType() string { + return TypeUpgradedGiftAttributeIdSymbol +} + +func (*UpgradedGiftAttributeIdSymbol) UpgradedGiftAttributeIdType() string { + return TypeUpgradedGiftAttributeIdSymbol +} + +// Identifier of a gift backdrop +type UpgradedGiftAttributeIdBackdrop struct { + meta + // Identifier of the backdrop + BackdropId int32 `json:"backdrop_id"` +} + +func (entity *UpgradedGiftAttributeIdBackdrop) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftAttributeIdBackdrop + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftAttributeIdBackdrop) GetClass() string { + return ClassUpgradedGiftAttributeId +} + +func (*UpgradedGiftAttributeIdBackdrop) GetType() string { + return TypeUpgradedGiftAttributeIdBackdrop +} + +func (*UpgradedGiftAttributeIdBackdrop) UpgradedGiftAttributeIdType() string { + return TypeUpgradedGiftAttributeIdBackdrop +} + +// Describes a model of an upgraded gift with the number of gifts found +type UpgradedGiftModelCount struct { + meta + // The model + Model *UpgradedGiftModel `json:"model"` + // Total number of gifts with the model + TotalCount int32 `json:"total_count"` +} + +func (entity *UpgradedGiftModelCount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftModelCount + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftModelCount) GetClass() string { + return ClassUpgradedGiftModelCount +} + +func (*UpgradedGiftModelCount) GetType() string { + return TypeUpgradedGiftModelCount +} + +// Describes a symbol shown on the pattern of an upgraded gift +type UpgradedGiftSymbolCount struct { + meta + // The symbol + Symbol *UpgradedGiftSymbol `json:"symbol"` + // Total number of gifts with the symbol + TotalCount int32 `json:"total_count"` +} + +func (entity *UpgradedGiftSymbolCount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftSymbolCount + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftSymbolCount) GetClass() string { + return ClassUpgradedGiftSymbolCount +} + +func (*UpgradedGiftSymbolCount) GetType() string { + return TypeUpgradedGiftSymbolCount +} + +// Describes a backdrop of an upgraded gift +type UpgradedGiftBackdropCount struct { + meta + // The backdrop + Backdrop *UpgradedGiftBackdrop `json:"backdrop"` + // Total number of gifts with the symbol + TotalCount int32 `json:"total_count"` +} + +func (entity *UpgradedGiftBackdropCount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftBackdropCount + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftBackdropCount) GetClass() string { + return ClassUpgradedGiftBackdropCount +} + +func (*UpgradedGiftBackdropCount) GetType() string { + return TypeUpgradedGiftBackdropCount +} + +// The gifts will be sorted by their price from the lowest to the highest +type GiftForResaleOrderPrice struct{ + meta +} + +func (entity *GiftForResaleOrderPrice) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftForResaleOrderPrice + + return json.Marshal((*stub)(entity)) +} + +func (*GiftForResaleOrderPrice) GetClass() string { + return ClassGiftForResaleOrder +} + +func (*GiftForResaleOrderPrice) GetType() string { + return TypeGiftForResaleOrderPrice +} + +func (*GiftForResaleOrderPrice) GiftForResaleOrderType() string { + return TypeGiftForResaleOrderPrice +} + +// The gifts will be sorted by the last date when their price was changed from the newest to the oldest +type GiftForResaleOrderPriceChangeDate struct{ + meta +} + +func (entity *GiftForResaleOrderPriceChangeDate) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftForResaleOrderPriceChangeDate + + return json.Marshal((*stub)(entity)) +} + +func (*GiftForResaleOrderPriceChangeDate) GetClass() string { + return ClassGiftForResaleOrder +} + +func (*GiftForResaleOrderPriceChangeDate) GetType() string { + return TypeGiftForResaleOrderPriceChangeDate +} + +func (*GiftForResaleOrderPriceChangeDate) GiftForResaleOrderType() string { + return TypeGiftForResaleOrderPriceChangeDate +} + +// The gifts will be sorted by their number from the smallest to the largest +type GiftForResaleOrderNumber struct{ + meta +} + +func (entity *GiftForResaleOrderNumber) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftForResaleOrderNumber + + return json.Marshal((*stub)(entity)) +} + +func (*GiftForResaleOrderNumber) GetClass() string { + return ClassGiftForResaleOrder +} + +func (*GiftForResaleOrderNumber) GetType() string { + return TypeGiftForResaleOrderNumber +} + +func (*GiftForResaleOrderNumber) GiftForResaleOrderType() string { + return TypeGiftForResaleOrderNumber +} + +// Describes a gift available for resale +type GiftForResale struct { + meta + // The gift + Gift *UpgradedGift `json:"gift"` + // Unique identifier of the received gift for the current user; only for the gifts owned by the current user + ReceivedGiftId string `json:"received_gift_id"` +} + +func (entity *GiftForResale) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftForResale + + return json.Marshal((*stub)(entity)) +} + +func (*GiftForResale) GetClass() string { + return ClassGiftForResale +} + +func (*GiftForResale) GetType() string { + return TypeGiftForResale +} + +// Describes gifts available for resale +type GiftsForResale struct { + meta + // Total number of gifts found + TotalCount int32 `json:"total_count"` + // The gifts + Gifts []*GiftForResale `json:"gifts"` + // Available models; for searchGiftsForResale requests without offset and attributes only + Models []*UpgradedGiftModelCount `json:"models"` + // Available symbols; for searchGiftsForResale requests without offset and attributes only + Symbols []*UpgradedGiftSymbolCount `json:"symbols"` + // Available backdrops; for searchGiftsForResale requests without offset and attributes only + Backdrops []*UpgradedGiftBackdropCount `json:"backdrops"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` +} + +func (entity *GiftsForResale) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftsForResale + + return json.Marshal((*stub)(entity)) +} + +func (*GiftsForResale) GetClass() string { + return ClassGiftsForResale +} + +func (*GiftsForResale) GetType() string { + return TypeGiftsForResale +} + // Regular gift type SentGiftRegular struct { meta @@ -9118,6 +9481,10 @@ type ReceivedGift struct { PrepaidUpgradeStarCount int64 `json:"prepaid_upgrade_star_count"` // Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift TransferStarCount int64 `json:"transfer_star_count"` + // Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift + NextTransferDate int32 `json:"next_transfer_date"` + // Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift + NextResaleDate int32 `json:"next_resale_date"` // Point in time (Unix timestamp) when the upgraded gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift ExportDate int32 `json:"export_date"` } @@ -9154,6 +9521,8 @@ func (receivedGift *ReceivedGift) UnmarshalJSON(data []byte) error { SellStarCount int64 `json:"sell_star_count"` PrepaidUpgradeStarCount int64 `json:"prepaid_upgrade_star_count"` TransferStarCount int64 `json:"transfer_star_count"` + NextTransferDate int32 `json:"next_transfer_date"` + NextResaleDate int32 `json:"next_resale_date"` ExportDate int32 `json:"export_date"` } @@ -9174,6 +9543,8 @@ func (receivedGift *ReceivedGift) UnmarshalJSON(data []byte) error { receivedGift.SellStarCount = tmp.SellStarCount receivedGift.PrepaidUpgradeStarCount = tmp.PrepaidUpgradeStarCount receivedGift.TransferStarCount = tmp.TransferStarCount + receivedGift.NextTransferDate = tmp.NextTransferDate + receivedGift.NextResaleDate = tmp.NextResaleDate receivedGift.ExportDate = tmp.ExportDate fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) @@ -10092,6 +10463,66 @@ func (*StarTransactionTypeGiftUpgrade) StarTransactionTypeType() string { return TypeStarTransactionTypeGiftUpgrade } +// The transaction is a purchase of an upgraded gift for some user or channel; for regular users only +type StarTransactionTypeUpgradedGiftPurchase struct { + meta + // Identifier of the user that sold the gift + UserId int64 `json:"user_id"` + // The gift + Gift *UpgradedGift `json:"gift"` +} + +func (entity *StarTransactionTypeUpgradedGiftPurchase) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeUpgradedGiftPurchase + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeUpgradedGiftPurchase) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeUpgradedGiftPurchase) GetType() string { + return TypeStarTransactionTypeUpgradedGiftPurchase +} + +func (*StarTransactionTypeUpgradedGiftPurchase) StarTransactionTypeType() string { + return TypeStarTransactionTypeUpgradedGiftPurchase +} + +// The transaction is a sale of an upgraded gift; for regular users only +type StarTransactionTypeUpgradedGiftSale struct { + meta + // Identifier of the user that bought the gift + UserId int64 `json:"user_id"` + // The gift + Gift *UpgradedGift `json:"gift"` + // Information about commission received by Telegram from the transaction + Affiliate *AffiliateInfo `json:"affiliate"` +} + +func (entity *StarTransactionTypeUpgradedGiftSale) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeUpgradedGiftSale + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeUpgradedGiftSale) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeUpgradedGiftSale) GetType() string { + return TypeStarTransactionTypeUpgradedGiftSale +} + +func (*StarTransactionTypeUpgradedGiftSale) StarTransactionTypeType() string { + return TypeStarTransactionTypeUpgradedGiftSale +} + // The transaction is a sending of a paid reaction to a message in a channel chat by the current user; for regular users only type StarTransactionTypeChannelPaidReactionSend struct { meta @@ -12712,6 +13143,8 @@ type Supergroup struct { MemberCount int32 `json:"member_count"` // Approximate boost level for the chat BoostLevel int32 `json:"boost_level"` + // True, if automatic translation of messages is enabled in the channel + HasAutomaticTranslation bool `json:"has_automatic_translation"` // True, if the channel has a discussion group, or the supergroup is the designated discussion group for a channel HasLinkedChat bool `json:"has_linked_chat"` // True, if the supergroup is connected to a location, i.e. the supergroup is a location-based supergroup @@ -12771,6 +13204,7 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { Status json.RawMessage `json:"status"` MemberCount int32 `json:"member_count"` BoostLevel int32 `json:"boost_level"` + HasAutomaticTranslation bool `json:"has_automatic_translation"` HasLinkedChat bool `json:"has_linked_chat"` HasLocation bool `json:"has_location"` SignMessages bool `json:"sign_messages"` @@ -12800,6 +13234,7 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { supergroup.Date = tmp.Date supergroup.MemberCount = tmp.MemberCount supergroup.BoostLevel = tmp.BoostLevel + supergroup.HasAutomaticTranslation = tmp.HasAutomaticTranslation supergroup.HasLinkedChat = tmp.HasLinkedChat supergroup.HasLocation = tmp.HasLocation supergroup.SignMessages = tmp.SignMessages @@ -28100,7 +28535,7 @@ type MessageUpgradedGift struct { SenderId MessageSender `json:"sender_id"` // Unique identifier of the received gift for the current user; only for the receiver of the gift ReceivedGiftId string `json:"received_gift_id"` - // True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred gift + // True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift IsUpgrade bool `json:"is_upgrade"` // True, if the gift is displayed on the user's or the channel's profile page; only for the receiver of the gift IsSaved bool `json:"is_saved"` @@ -28108,8 +28543,14 @@ type MessageUpgradedGift struct { CanBeTransferred bool `json:"can_be_transferred"` // True, if the gift was transferred to another owner; only for the receiver of the gift WasTransferred bool `json:"was_transferred"` + // Number of Telegram Stars that were paid by the sender for the gift; 0 if the gift was upgraded or transferred + LastResaleStarCount int64 `json:"last_resale_star_count"` // Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift TransferStarCount int64 `json:"transfer_star_count"` + // Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift + NextTransferDate int32 `json:"next_transfer_date"` + // Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift + NextResaleDate int32 `json:"next_resale_date"` // Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift ExportDate int32 `json:"export_date"` } @@ -28143,7 +28584,10 @@ func (messageUpgradedGift *MessageUpgradedGift) UnmarshalJSON(data []byte) error IsSaved bool `json:"is_saved"` CanBeTransferred bool `json:"can_be_transferred"` WasTransferred bool `json:"was_transferred"` + LastResaleStarCount int64 `json:"last_resale_star_count"` TransferStarCount int64 `json:"transfer_star_count"` + NextTransferDate int32 `json:"next_transfer_date"` + NextResaleDate int32 `json:"next_resale_date"` ExportDate int32 `json:"export_date"` } @@ -28158,7 +28602,10 @@ func (messageUpgradedGift *MessageUpgradedGift) UnmarshalJSON(data []byte) error messageUpgradedGift.IsSaved = tmp.IsSaved messageUpgradedGift.CanBeTransferred = tmp.CanBeTransferred messageUpgradedGift.WasTransferred = tmp.WasTransferred + messageUpgradedGift.LastResaleStarCount = tmp.LastResaleStarCount messageUpgradedGift.TransferStarCount = tmp.TransferStarCount + messageUpgradedGift.NextTransferDate = tmp.NextTransferDate + messageUpgradedGift.NextResaleDate = tmp.NextResaleDate messageUpgradedGift.ExportDate = tmp.ExportDate fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) @@ -28174,7 +28621,7 @@ type MessageRefundedUpgradedGift struct { Gift *Gift `json:"gift"` // Sender of the gift SenderId MessageSender `json:"sender_id"` - // True, if the gift was obtained by upgrading of a previously received gift + // True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift IsUpgrade bool `json:"is_upgrade"` } @@ -34116,6 +34563,8 @@ type ChatBoostLevelFeatures struct { CanSetCustomBackground bool `json:"can_set_custom_background"` // True, if custom emoji sticker set can be set for the chat CanSetCustomEmojiStickerSet bool `json:"can_set_custom_emoji_sticker_set"` + // True, if automatic translation of messages can be enabled in the chat + CanEnableAutomaticTranslation bool `json:"can_enable_automatic_translation"` // True, if speech recognition can be used for video note and voice note messages by all users CanRecognizeSpeech bool `json:"can_recognize_speech"` // True, if sponsored messages can be disabled in the chat @@ -34155,6 +34604,8 @@ type ChatBoostFeatures struct { MinCustomBackgroundBoostLevel int32 `json:"min_custom_background_boost_level"` // The minimum boost level required to set custom emoji sticker set for the chat; for supergroup chats only MinCustomEmojiStickerSetBoostLevel int32 `json:"min_custom_emoji_sticker_set_boost_level"` + // The minimum boost level allowing to enable automatic translation of messages for non-Premium users; for channel chats only + MinAutomaticTranslationBoostLevel int32 `json:"min_automatic_translation_boost_level"` // The minimum boost level allowing to recognize speech in video note and voice note messages for non-Premium users; for supergroup chats only MinSpeechRecognitionBoostLevel int32 `json:"min_speech_recognition_boost_level"` // The minimum boost level allowing to disable sponsored messages in the chat; for channel chats only @@ -39936,6 +40387,33 @@ func (*ChatEventShowMessageSenderToggled) ChatEventActionType() string { return TypeChatEventShowMessageSenderToggled } +// The has_automatic_translation setting of a channel was toggled +type ChatEventAutomaticTranslationToggled struct { + meta + // New value of has_automatic_translation + HasAutomaticTranslation bool `json:"has_automatic_translation"` +} + +func (entity *ChatEventAutomaticTranslationToggled) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventAutomaticTranslationToggled + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventAutomaticTranslationToggled) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventAutomaticTranslationToggled) GetType() string { + return TypeChatEventAutomaticTranslationToggled +} + +func (*ChatEventAutomaticTranslationToggled) ChatEventActionType() string { + return TypeChatEventAutomaticTranslationToggled +} + // A chat invite link was edited type ChatEventInviteLinkEdited struct { meta @@ -44061,8 +44539,10 @@ func (*Hashtags) GetType() string { } // A story can be sent -type CanPostStoryResultOk struct{ +type CanPostStoryResultOk struct { meta + // Number of stories that can be posted by the user + StoryCount int32 `json:"story_count"` } func (entity *CanPostStoryResultOk) MarshalJSON() ([]byte, error) { @@ -45191,7 +45671,7 @@ func (*PushMessageContentGift) PushMessageContentType() string { // A message with an upgraded gift type PushMessageContentUpgradedGift struct { meta - // True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred gift + // True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift IsUpgrade bool `json:"is_upgrade"` } @@ -49413,6 +49893,31 @@ func (*InternalLinkTypeMessageDraft) InternalLinkTypeType() string { return TypeInternalLinkTypeMessageDraft } +// The link is a link to the screen with information about Telegram Star balance and transactions of the current user +type InternalLinkTypeMyStars struct{ + meta +} + +func (entity *InternalLinkTypeMyStars) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeMyStars + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeMyStars) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeMyStars) GetType() string { + return TypeInternalLinkTypeMyStars +} + +func (*InternalLinkTypeMyStars) InternalLinkTypeType() string { + return TypeInternalLinkTypeMyStars +} + // The link contains a request of Telegram passport data. Call getPassportAuthorizationForm with the given parameters to process the link if the link was received from outside of the application; otherwise, ignore it type InternalLinkTypePassportDataRequest struct { meta @@ -52402,6 +52907,39 @@ func (*SuggestedActionExtendStarSubscriptions) SuggestedActionType() string { return TypeSuggestedActionExtendStarSubscriptions } +// A custom suggestion to be shown at the top of the chat list +type SuggestedActionCustom struct { + meta + // Unique name of the suggestion + Name string `json:"name"` + // Title of the suggestion + Title *FormattedText `json:"title"` + // Description of the suggestion + Description *FormattedText `json:"description"` + // The link to open when the suggestion is clicked + Url string `json:"url"` +} + +func (entity *SuggestedActionCustom) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedActionCustom + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedActionCustom) GetClass() string { + return ClassSuggestedAction +} + +func (*SuggestedActionCustom) GetType() string { + return TypeSuggestedActionCustom +} + +func (*SuggestedActionCustom) SuggestedActionType() string { + return TypeSuggestedActionCustom +} + // Contains a counter type Count struct { meta @@ -54003,7 +54541,7 @@ func (*VectorPathCommandLine) VectorPathCommandType() string { return TypeVectorPathCommandLine } -// A cubic Bézier curve to a given point +// A cubic Bézier curve to a given point type VectorPathCommandCubicBezierCurve struct { meta // The start control point of the curve diff --git a/client/unmarshaler.go b/client/unmarshaler.go index dd0a41a..d5efa81 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -770,6 +770,80 @@ func UnmarshalListOfAffiliateProgramSortOrder(dataList []json.RawMessage) ([]Aff return list, nil } +func UnmarshalUpgradedGiftAttributeId(data json.RawMessage) (UpgradedGiftAttributeId, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeUpgradedGiftAttributeIdModel: + return UnmarshalUpgradedGiftAttributeIdModel(data) + + case TypeUpgradedGiftAttributeIdSymbol: + return UnmarshalUpgradedGiftAttributeIdSymbol(data) + + case TypeUpgradedGiftAttributeIdBackdrop: + return UnmarshalUpgradedGiftAttributeIdBackdrop(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfUpgradedGiftAttributeId(dataList []json.RawMessage) ([]UpgradedGiftAttributeId, error) { + list := []UpgradedGiftAttributeId{} + + for _, data := range dataList { + entity, err := UnmarshalUpgradedGiftAttributeId(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalGiftForResaleOrder(data json.RawMessage) (GiftForResaleOrder, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeGiftForResaleOrderPrice: + return UnmarshalGiftForResaleOrderPrice(data) + + case TypeGiftForResaleOrderPriceChangeDate: + return UnmarshalGiftForResaleOrderPriceChangeDate(data) + + case TypeGiftForResaleOrderNumber: + return UnmarshalGiftForResaleOrderNumber(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfGiftForResaleOrder(dataList []json.RawMessage) ([]GiftForResaleOrder, error) { + list := []GiftForResaleOrder{} + + for _, data := range dataList { + entity, err := UnmarshalGiftForResaleOrder(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalSentGift(data json.RawMessage) (SentGift, error) { var meta meta @@ -916,6 +990,12 @@ func UnmarshalStarTransactionType(data json.RawMessage) (StarTransactionType, er case TypeStarTransactionTypeGiftUpgrade: return UnmarshalStarTransactionTypeGiftUpgrade(data) + case TypeStarTransactionTypeUpgradedGiftPurchase: + return UnmarshalStarTransactionTypeUpgradedGiftPurchase(data) + + case TypeStarTransactionTypeUpgradedGiftSale: + return UnmarshalStarTransactionTypeUpgradedGiftSale(data) + case TypeStarTransactionTypeChannelPaidReactionSend: return UnmarshalStarTransactionTypeChannelPaidReactionSend(data) @@ -5410,6 +5490,9 @@ func UnmarshalChatEventAction(data json.RawMessage) (ChatEventAction, error) { case TypeChatEventShowMessageSenderToggled: return UnmarshalChatEventShowMessageSenderToggled(data) + case TypeChatEventAutomaticTranslationToggled: + return UnmarshalChatEventAutomaticTranslationToggled(data) + case TypeChatEventInviteLinkEdited: return UnmarshalChatEventInviteLinkEdited(data) @@ -7231,6 +7314,9 @@ func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { case TypeInternalLinkTypeMessageDraft: return UnmarshalInternalLinkTypeMessageDraft(data) + case TypeInternalLinkTypeMyStars: + return UnmarshalInternalLinkTypeMyStars(data) + case TypeInternalLinkTypePassportDataRequest: return UnmarshalInternalLinkTypePassportDataRequest(data) @@ -7750,6 +7836,9 @@ func UnmarshalSuggestedAction(data json.RawMessage) (SuggestedAction, error) { case TypeSuggestedActionExtendStarSubscriptions: return UnmarshalSuggestedActionExtendStarSubscriptions(data) + case TypeSuggestedActionCustom: + return UnmarshalSuggestedActionCustom(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -10123,14 +10212,6 @@ func UnmarshalGift(data json.RawMessage) (*Gift, error) { return &resp, err } -func UnmarshalGifts(data json.RawMessage) (*Gifts, error) { - var resp Gifts - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - func UnmarshalUpgradedGift(data json.RawMessage) (*UpgradedGift, error) { var resp UpgradedGift @@ -10147,6 +10228,110 @@ func UnmarshalUpgradeGiftResult(data json.RawMessage) (*UpgradeGiftResult, error return &resp, err } +func UnmarshalAvailableGift(data json.RawMessage) (*AvailableGift, error) { + var resp AvailableGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAvailableGifts(data json.RawMessage) (*AvailableGifts, error) { + var resp AvailableGifts + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftAttributeIdModel(data json.RawMessage) (*UpgradedGiftAttributeIdModel, error) { + var resp UpgradedGiftAttributeIdModel + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftAttributeIdSymbol(data json.RawMessage) (*UpgradedGiftAttributeIdSymbol, error) { + var resp UpgradedGiftAttributeIdSymbol + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftAttributeIdBackdrop(data json.RawMessage) (*UpgradedGiftAttributeIdBackdrop, error) { + var resp UpgradedGiftAttributeIdBackdrop + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftModelCount(data json.RawMessage) (*UpgradedGiftModelCount, error) { + var resp UpgradedGiftModelCount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftSymbolCount(data json.RawMessage) (*UpgradedGiftSymbolCount, error) { + var resp UpgradedGiftSymbolCount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftBackdropCount(data json.RawMessage) (*UpgradedGiftBackdropCount, error) { + var resp UpgradedGiftBackdropCount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftForResaleOrderPrice(data json.RawMessage) (*GiftForResaleOrderPrice, error) { + var resp GiftForResaleOrderPrice + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftForResaleOrderPriceChangeDate(data json.RawMessage) (*GiftForResaleOrderPriceChangeDate, error) { + var resp GiftForResaleOrderPriceChangeDate + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftForResaleOrderNumber(data json.RawMessage) (*GiftForResaleOrderNumber, error) { + var resp GiftForResaleOrderNumber + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftForResale(data json.RawMessage) (*GiftForResale, error) { + var resp GiftForResale + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftsForResale(data json.RawMessage) (*GiftsForResale, error) { + var resp GiftsForResale + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalSentGiftRegular(data json.RawMessage) (*SentGiftRegular, error) { var resp SentGiftRegular @@ -10387,6 +10572,22 @@ func UnmarshalStarTransactionTypeGiftUpgrade(data json.RawMessage) (*StarTransac return &resp, err } +func UnmarshalStarTransactionTypeUpgradedGiftPurchase(data json.RawMessage) (*StarTransactionTypeUpgradedGiftPurchase, error) { + var resp StarTransactionTypeUpgradedGiftPurchase + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeUpgradedGiftSale(data json.RawMessage) (*StarTransactionTypeUpgradedGiftSale, error) { + var resp StarTransactionTypeUpgradedGiftSale + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarTransactionTypeChannelPaidReactionSend(data json.RawMessage) (*StarTransactionTypeChannelPaidReactionSend, error) { var resp StarTransactionTypeChannelPaidReactionSend @@ -17347,6 +17548,14 @@ func UnmarshalChatEventShowMessageSenderToggled(data json.RawMessage) (*ChatEven return &resp, err } +func UnmarshalChatEventAutomaticTranslationToggled(data json.RawMessage) (*ChatEventAutomaticTranslationToggled, error) { + var resp ChatEventAutomaticTranslationToggled + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatEventInviteLinkEdited(data json.RawMessage) (*ChatEventInviteLinkEdited, error) { var resp ChatEventInviteLinkEdited @@ -20003,6 +20212,14 @@ func UnmarshalInternalLinkTypeMessageDraft(data json.RawMessage) (*InternalLinkT return &resp, err } +func UnmarshalInternalLinkTypeMyStars(data json.RawMessage) (*InternalLinkTypeMyStars, error) { + var resp InternalLinkTypeMyStars + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInternalLinkTypePassportDataRequest(data json.RawMessage) (*InternalLinkTypePassportDataRequest, error) { var resp InternalLinkTypePassportDataRequest @@ -20867,6 +21084,14 @@ func UnmarshalSuggestedActionExtendStarSubscriptions(data json.RawMessage) (*Sug return &resp, err } +func UnmarshalSuggestedActionCustom(data json.RawMessage) (*SuggestedActionCustom, error) { + var resp SuggestedActionCustom + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalCount(data json.RawMessage) (*Count, error) { var resp Count @@ -23227,15 +23452,51 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeGift: return UnmarshalGift(data) - case TypeGifts: - return UnmarshalGifts(data) - case TypeUpgradedGift: return UnmarshalUpgradedGift(data) case TypeUpgradeGiftResult: return UnmarshalUpgradeGiftResult(data) + case TypeAvailableGift: + return UnmarshalAvailableGift(data) + + case TypeAvailableGifts: + return UnmarshalAvailableGifts(data) + + case TypeUpgradedGiftAttributeIdModel: + return UnmarshalUpgradedGiftAttributeIdModel(data) + + case TypeUpgradedGiftAttributeIdSymbol: + return UnmarshalUpgradedGiftAttributeIdSymbol(data) + + case TypeUpgradedGiftAttributeIdBackdrop: + return UnmarshalUpgradedGiftAttributeIdBackdrop(data) + + case TypeUpgradedGiftModelCount: + return UnmarshalUpgradedGiftModelCount(data) + + case TypeUpgradedGiftSymbolCount: + return UnmarshalUpgradedGiftSymbolCount(data) + + case TypeUpgradedGiftBackdropCount: + return UnmarshalUpgradedGiftBackdropCount(data) + + case TypeGiftForResaleOrderPrice: + return UnmarshalGiftForResaleOrderPrice(data) + + case TypeGiftForResaleOrderPriceChangeDate: + return UnmarshalGiftForResaleOrderPriceChangeDate(data) + + case TypeGiftForResaleOrderNumber: + return UnmarshalGiftForResaleOrderNumber(data) + + case TypeGiftForResale: + return UnmarshalGiftForResale(data) + + case TypeGiftsForResale: + return UnmarshalGiftsForResale(data) + case TypeSentGiftRegular: return UnmarshalSentGiftRegular(data) @@ -23326,6 +23587,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarTransactionTypeGiftUpgrade: return UnmarshalStarTransactionTypeGiftUpgrade(data) + case TypeStarTransactionTypeUpgradedGiftPurchase: + return UnmarshalStarTransactionTypeUpgradedGiftPurchase(data) + + case TypeStarTransactionTypeUpgradedGiftSale: + return UnmarshalStarTransactionTypeUpgradedGiftSale(data) + case TypeStarTransactionTypeChannelPaidReactionSend: return UnmarshalStarTransactionTypeChannelPaidReactionSend(data) @@ -25936,6 +26203,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatEventShowMessageSenderToggled: return UnmarshalChatEventShowMessageSenderToggled(data) + case TypeChatEventAutomaticTranslationToggled: + return UnmarshalChatEventAutomaticTranslationToggled(data) + case TypeChatEventInviteLinkEdited: return UnmarshalChatEventInviteLinkEdited(data) @@ -26932,6 +27202,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInternalLinkTypeMessageDraft: return UnmarshalInternalLinkTypeMessageDraft(data) + case TypeInternalLinkTypeMyStars: + return UnmarshalInternalLinkTypeMyStars(data) + case TypeInternalLinkTypePassportDataRequest: return UnmarshalInternalLinkTypePassportDataRequest(data) @@ -27256,6 +27529,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSuggestedActionExtendStarSubscriptions: return UnmarshalSuggestedActionExtendStarSubscriptions(data) + case TypeSuggestedActionCustom: + return UnmarshalSuggestedActionCustom(data) + case TypeCount: return UnmarshalCount(data) diff --git a/data/td_api.tl b/data/td_api.tl index eb49cac..b4ebb53 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -1093,10 +1093,11 @@ upgradedGiftSymbol name:string sticker:sticker rarity_per_mille:int32 = Upgraded upgradedGiftBackdropColors center_color:int32 edge_color:int32 symbol_color:int32 text_color:int32 = UpgradedGiftBackdropColors; //@description Describes a backdrop of an upgraded gift +//@id Unique identifier of the backdrop //@name Name of the backdrop //@colors Colors of the backdrop //@rarity_per_mille The number of upgraded gifts that receive this backdrop for each 1000 gifts upgraded -upgradedGiftBackdrop name:string colors:upgradedGiftBackdropColors rarity_per_mille:int32 = UpgradedGiftBackdrop; +upgradedGiftBackdrop id:int32 name:string colors:upgradedGiftBackdropColors rarity_per_mille:int32 = UpgradedGiftBackdrop; //@description Describes the original details about the gift //@sender_id Identifier of the user or the chat that sent the gift; may be null if the gift was private @@ -1118,13 +1119,10 @@ upgradedGiftOriginalDetails sender_id:MessageSender receiver_id:MessageSender te //@last_send_date Point in time (Unix timestamp) when the gift was send for the last time; for sold out gifts only gift id:int64 sticker:sticker star_count:int53 default_sell_star_count:int53 upgrade_star_count:int53 is_for_birthday:Bool remaining_count:int32 total_count:int32 first_send_date:int32 last_send_date:int32 = Gift; -//@description Contains a list of gifts that can be sent to another user or channel chat @gifts The list of gifts -gifts gifts:vector = Gifts; - //@description Describes an upgraded gift that can be transferred to another owner or transferred to the TON blockchain as an NFT //@id Unique identifier of the gift //@title The title of the upgraded gift -//@name Unique name of the upgraded gift that can be used with internalLinkTypeUpgradedGift +//@name Unique name of the upgraded gift that can be used with internalLinkTypeUpgradedGift or sendResoldGift //@number Unique number of the upgraded gift among gifts upgraded from the same gift //@total_upgraded_count Total number of gifts that were upgraded from the same gift //@max_upgraded_count The maximum number of gifts that can be upgraded from the same gift @@ -1136,7 +1134,8 @@ gifts gifts:vector = Gifts; //@symbol Symbol of the upgraded gift //@backdrop Backdrop of the upgraded gift //@original_details Information about the originally sent gift; may be null if unknown -upgradedGift id:int64 title:string name:string number:int32 total_upgraded_count:int32 max_upgraded_count:int32 owner_id:MessageSender owner_address:string owner_name:string gift_address:string model:upgradedGiftModel symbol:upgradedGiftSymbol backdrop:upgradedGiftBackdrop original_details:upgradedGiftOriginalDetails = UpgradedGift; +//@resale_star_count Number of Telegram Stars that must be paid to buy the gift and send it to someone else; 0 if resale isn't possible +upgradedGift id:int64 title:string name:string number:int32 total_upgraded_count:int32 max_upgraded_count:int32 owner_id:MessageSender owner_address:string owner_name:string gift_address:string model:upgradedGiftModel symbol:upgradedGiftSymbol backdrop:upgradedGiftBackdrop original_details:upgradedGiftOriginalDetails resale_star_count:int53 = UpgradedGift; //@description Contains result of gift upgrading //@gift The upgraded gift @@ -1144,8 +1143,69 @@ upgradedGift id:int64 title:string name:string number:int32 total_upgraded_count //@is_saved True, if the gift is displayed on the user's or the channel's profile page //@can_be_transferred True, if the gift can be transferred to another owner //@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift +//@next_transfer_date Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible +//@next_resale_date Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift //@export_date Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT -upgradeGiftResult gift:upgradedGift received_gift_id:string is_saved:Bool can_be_transferred:Bool transfer_star_count:int53 export_date:int32 = UpgradeGiftResult; +upgradeGiftResult gift:upgradedGift received_gift_id:string is_saved:Bool can_be_transferred:Bool transfer_star_count:int53 next_transfer_date:int32 next_resale_date:int32 export_date:int32 = UpgradeGiftResult; + +//@description Describes a gift that is available for purchase +//@gift The gift +//@resale_count Number of gifts that are available for resale +//@min_resale_star_count The minimum price for the gifts available for resale; 0 if there are no such gifts +//@title The title of the upgraded gift; empty if the gift isn't available for resale +availableGift gift:gift resale_count:int32 min_resale_star_count:int53 title:string = AvailableGift; + +//@description Contains a list of gifts that can be sent to another user or channel chat @gifts The list of gifts +availableGifts gifts:vector = AvailableGifts; + + +//@class UpgradedGiftAttributeId @description Contains identifier of an upgraded gift attribute to search for + +//@description Identifier of a gift model @sticker_id Identifier of the sticker representing the model +upgradedGiftAttributeIdModel sticker_id:int64 = UpgradedGiftAttributeId; + +//@description Identifier of a gift symbol @sticker_id Identifier of the sticker representing the symbol +upgradedGiftAttributeIdSymbol sticker_id:int64 = UpgradedGiftAttributeId; + +//@description Identifier of a gift backdrop @backdrop_id Identifier of the backdrop +upgradedGiftAttributeIdBackdrop backdrop_id:int32 = UpgradedGiftAttributeId; + + +//@description Describes a model of an upgraded gift with the number of gifts found @model The model @total_count Total number of gifts with the model +upgradedGiftModelCount model:upgradedGiftModel total_count:int32 = UpgradedGiftModelCount; + +//@description Describes a symbol shown on the pattern of an upgraded gift @symbol The symbol @total_count Total number of gifts with the symbol +upgradedGiftSymbolCount symbol:upgradedGiftSymbol total_count:int32 = UpgradedGiftSymbolCount; + +//@description Describes a backdrop of an upgraded gift @backdrop The backdrop @total_count Total number of gifts with the symbol +upgradedGiftBackdropCount backdrop:upgradedGiftBackdrop total_count:int32 = UpgradedGiftBackdropCount; + + +//@class GiftForResaleOrder @description Describes order in which upgraded gifts for resale will be sorted + +//@description The gifts will be sorted by their price from the lowest to the highest +giftForResaleOrderPrice = GiftForResaleOrder; + +//@description The gifts will be sorted by the last date when their price was changed from the newest to the oldest +giftForResaleOrderPriceChangeDate = GiftForResaleOrder; + +//@description The gifts will be sorted by their number from the smallest to the largest +giftForResaleOrderNumber = GiftForResaleOrder; + + +//@description Describes a gift available for resale +//@gift The gift +//@received_gift_id Unique identifier of the received gift for the current user; only for the gifts owned by the current user +giftForResale gift:upgradedGift received_gift_id:string = GiftForResale; + +//@description Describes gifts available for resale +//@total_count Total number of gifts found +//@gifts The gifts +//@models Available models; for searchGiftsForResale requests without offset and attributes only +//@symbols Available symbols; for searchGiftsForResale requests without offset and attributes only +//@backdrops Available backdrops; for searchGiftsForResale requests without offset and attributes only +//@next_offset The offset for the next request. If empty, then there are no more results +giftsForResale total_count:int32 gifts:vector models:vector symbols:vector backdrops:vector next_offset:string = GiftsForResale; //@class SentGift @description Represents content of a gift received by a user or a channel chat @@ -1172,8 +1232,10 @@ sentGiftUpgraded gift:upgradedGift = SentGift; //@sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the regular gift; 0 if the gift can't be sold by the current user //@prepaid_upgrade_star_count Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift //@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift +//@next_transfer_date Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift +//@next_resale_date Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift //@export_date Point in time (Unix timestamp) when the upgraded gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift -receivedGift received_gift_id:string sender_id:MessageSender text:formattedText is_private:Bool is_saved:Bool is_pinned:Bool can_be_upgraded:Bool can_be_transferred:Bool was_refunded:Bool date:int32 gift:SentGift sell_star_count:int53 prepaid_upgrade_star_count:int53 transfer_star_count:int53 export_date:int32 = ReceivedGift; +receivedGift received_gift_id:string sender_id:MessageSender text:formattedText is_private:Bool is_saved:Bool is_pinned:Bool can_be_upgraded:Bool can_be_transferred:Bool was_refunded:Bool date:int32 gift:SentGift sell_star_count:int53 prepaid_upgrade_star_count:int53 transfer_star_count:int53 next_transfer_date:int32 next_resale_date:int32 export_date:int32 = ReceivedGift; //@description Represents a list of gifts received by a user or a chat //@total_count The total number of received gifts @@ -1304,6 +1366,15 @@ starTransactionTypeGiftSale user_id:int53 gift:gift = StarTransactionType; //@description The transaction is an upgrade of a gift; for regular users only @user_id Identifier of the user that initially sent the gift @gift The upgraded gift starTransactionTypeGiftUpgrade user_id:int53 gift:upgradedGift = StarTransactionType; +//@description The transaction is a purchase of an upgraded gift for some user or channel; for regular users only @user_id Identifier of the user that sold the gift @gift The gift +starTransactionTypeUpgradedGiftPurchase user_id:int53 gift:upgradedGift = StarTransactionType; + +//@description The transaction is a sale of an upgraded gift; for regular users only +//@user_id Identifier of the user that bought the gift +//@gift The gift +//@affiliate Information about commission received by Telegram from the transaction +starTransactionTypeUpgradedGiftSale user_id:int53 gift:upgradedGift affiliate:affiliateInfo = StarTransactionType; + //@description The transaction is a sending of a paid reaction to a message in a channel chat by the current user; for regular users only //@chat_id Identifier of the channel chat //@message_id Identifier of the reacted message; can be 0 or an identifier of a deleted message @@ -1779,6 +1850,7 @@ basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int53 memb //-getUserPrivacySettingRules, getVideoChatAvailableParticipants, searchPublicChats, or in chatFolderInviteLinkInfo.missing_chat_ids, or in userFullInfo.personal_chat_id, //-or for chats with messages or stories from publicForwards and foundStories //@boost_level Approximate boost level for the chat +//@has_automatic_translation True, if automatic translation of messages is enabled in the channel //@has_linked_chat True, if the channel has a discussion group, or the supergroup is the designated discussion group for a channel //@has_location True, if the supergroup is connected to a location, i.e. the supergroup is a location-based supergroup //@sign_messages True, if messages sent to the channel contains name of the sender. This field is only applicable to channels @@ -1795,7 +1867,7 @@ basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int53 memb //@paid_message_star_count Number of Telegram Stars that must be paid by non-administrator users of the supergroup chat for each sent message //@has_active_stories True, if the supergroup or channel has non-expired stories available to the current user //@has_unread_active_stories True, if the supergroup or channel has unread non-expired stories available to the current user -supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 boost_level:int32 has_linked_chat:Bool has_location:Bool sign_messages:Bool show_message_sender:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool verification_status:verificationStatus has_sensitive_content:Bool restriction_reason:string paid_message_star_count:int53 has_active_stories:Bool has_unread_active_stories:Bool = Supergroup; +supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 boost_level:int32 has_automatic_translation:Bool has_linked_chat:Bool has_location:Bool sign_messages:Bool show_message_sender:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool verification_status:verificationStatus has_sensitive_content:Bool restriction_reason:string paid_message_star_count:int53 has_active_stories:Bool has_unread_active_stories:Bool = Supergroup; //@description Contains full information about a supergroup or channel //@photo Chat photo; may be null if empty or unknown. If non-null, then it is the same photo as in chat.photo @@ -4189,18 +4261,21 @@ messageGift gift:gift sender_id:MessageSender received_gift_id:string text:forma //@gift The gift //@sender_id Sender of the gift; may be null for anonymous gifts //@received_gift_id Unique identifier of the received gift for the current user; only for the receiver of the gift -//@is_upgrade True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred gift +//@is_upgrade True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift //@is_saved True, if the gift is displayed on the user's or the channel's profile page; only for the receiver of the gift //@can_be_transferred True, if the gift can be transferred to another owner; only for the receiver of the gift //@was_transferred True, if the gift was transferred to another owner; only for the receiver of the gift +//@last_resale_star_count Number of Telegram Stars that were paid by the sender for the gift; 0 if the gift was upgraded or transferred //@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift +//@next_transfer_date Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift +//@next_resale_date Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift //@export_date Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift -messageUpgradedGift gift:upgradedGift sender_id:MessageSender received_gift_id:string is_upgrade:Bool is_saved:Bool can_be_transferred:Bool was_transferred:Bool transfer_star_count:int53 export_date:int32 = MessageContent; +messageUpgradedGift gift:upgradedGift sender_id:MessageSender received_gift_id:string is_upgrade:Bool is_saved:Bool can_be_transferred:Bool was_transferred:Bool last_resale_star_count:int53 transfer_star_count:int53 next_transfer_date:int32 next_resale_date:int32 export_date:int32 = MessageContent; //@description A gift which purchase, upgrade or transfer were refunded //@gift The gift //@sender_id Sender of the gift -//@is_upgrade True, if the gift was obtained by upgrading of a previously received gift +//@is_upgrade True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift messageRefundedUpgradedGift gift:gift sender_id:MessageSender is_upgrade:Bool = MessageContent; //@description Paid messages were refunded @message_count The number of refunded messages @star_count The number of refunded Telegram Stars @@ -5124,9 +5199,10 @@ botMediaPreviewInfo previews:vector language_codes:vector min_profile_background_custom_emoji_boost_level:int32 min_background_custom_emoji_boost_level:int32 min_emoji_status_boost_level:int32 min_chat_theme_background_boost_level:int32 min_custom_background_boost_level:int32 min_custom_emoji_sticker_set_boost_level:int32 min_speech_recognition_boost_level:int32 min_sponsored_message_disable_boost_level:int32 = ChatBoostFeatures; +chatBoostFeatures features:vector min_profile_background_custom_emoji_boost_level:int32 min_background_custom_emoji_boost_level:int32 min_emoji_status_boost_level:int32 min_chat_theme_background_boost_level:int32 min_custom_background_boost_level:int32 min_custom_emoji_sticker_set_boost_level:int32 min_automatic_translation_boost_level:int32 min_speech_recognition_boost_level:int32 min_sponsored_message_disable_boost_level:int32 = ChatBoostFeatures; //@class ChatBoostSource @description Describes source of a chat boost @@ -6064,6 +6141,9 @@ chatEventSignMessagesToggled sign_messages:Bool = ChatEventAction; //@description The show_message_sender setting of a channel was toggled @show_message_sender New value of show_message_sender chatEventShowMessageSenderToggled show_message_sender:Bool = ChatEventAction; +//@description The has_automatic_translation setting of a channel was toggled @has_automatic_translation New value of has_automatic_translation +chatEventAutomaticTranslationToggled has_automatic_translation:Bool = ChatEventAction; + //@description A chat invite link was edited @old_invite_link Previous information about the invite link @new_invite_link New information about the invite link chatEventInviteLinkEdited old_invite_link:chatInviteLink new_invite_link:chatInviteLink = ChatEventAction; @@ -6655,8 +6735,8 @@ hashtags hashtags:vector = Hashtags; //@class CanPostStoryResult @description Represents result of checking whether the current user can post a story on behalf of the specific chat -//@description A story can be sent -canPostStoryResultOk = CanPostStoryResult; +//@description A story can be sent @story_count Number of stories that can be posted by the user +canPostStoryResultOk story_count:int32 = CanPostStoryResult; //@description The user must subscribe to Telegram Premium to be able to post stories canPostStoryResultPremiumNeeded = CanPostStoryResult; @@ -6809,7 +6889,7 @@ pushMessageContentGiveaway winner_count:int32 prize:GiveawayPrize is_pinned:Bool pushMessageContentGift star_count:int53 = PushMessageContent; //@description A message with an upgraded gift -//@is_upgrade True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred gift +//@is_upgrade True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift pushMessageContentUpgradedGift is_upgrade:Bool = PushMessageContent; //@description A screenshot of a message in the chat has been taken @@ -7438,6 +7518,9 @@ internalLinkTypeMessage url:string = InternalLinkType; //@contains_link True, if the first line of the text contains a link. If true, the input field needs to be focused and the text after the link must be selected internalLinkTypeMessageDraft text:formattedText contains_link:Bool = InternalLinkType; +//@description The link is a link to the screen with information about Telegram Star balance and transactions of the current user +internalLinkTypeMyStars = InternalLinkType; + //@description The link contains a request of Telegram passport data. Call getPassportAuthorizationForm with the given parameters to process the link if the link was received from outside of the application; otherwise, ignore it //@bot_user_id User identifier of the service's bot; the corresponding user may be unknown yet //@scope Telegram Passport element types requested by the service @@ -7894,6 +7977,13 @@ suggestedActionExtendPremium manage_premium_subscription_url:string = SuggestedA //-to get the number of expiring subscriptions and the number of required to buy Telegram Stars suggestedActionExtendStarSubscriptions = SuggestedAction; +//@description A custom suggestion to be shown at the top of the chat list +//@name Unique name of the suggestion +//@title Title of the suggestion +//@param_description Description of the suggestion +//@url The link to open when the suggestion is clicked +suggestedActionCustom name:string title:formattedText description:formattedText url:string = SuggestedAction; + //@description Contains a counter @count Count count count:int32 = Count; @@ -8157,7 +8247,7 @@ point x:double y:double = Point; //@description A straight line to a given point @end_point The end point of the straight line vectorPathCommandLine end_point:point = VectorPathCommand; -//@description A cubic Bézier curve to a given point @start_control_point The start control point of the curve @end_control_point The end control point of the curve @end_point The end point of the curve +//@description A cubic Bézier curve to a given point @start_control_point The start control point of the curve @end_control_point The end control point of the curve @end_point The end point of the curve vectorPathCommandCubicBezierCurve start_control_point:point end_control_point:point end_point:point = VectorPathCommand; @@ -12058,6 +12148,12 @@ toggleSupergroupIsAllHistoryAvailable supergroup_id:int53 is_all_history_availab //@can_have_sponsored_messages The new value of can_have_sponsored_messages toggleSupergroupCanHaveSponsoredMessages supergroup_id:int53 can_have_sponsored_messages:Bool = Ok; +//@description Toggles whether messages are automatically translated in the channel chat; requires can_change_info administrator right in the channel. +//-The chat must have at least chatBoostFeatures.min_automatic_translation_boost_level boost level to enable automatic translation +//@supergroup_id The identifier of the channel +//@has_automatic_translation The new value of has_automatic_translation +toggleSupergroupHasAutomaticTranslation supergroup_id:int53 has_automatic_translation:Bool = Ok; + //@description Toggles whether non-administrators can receive only administrators and bots using getSupergroupMembers or searchChatMembers. Can be called only if supergroupFullInfo.can_hide_members == true //@supergroup_id Identifier of the supergroup //@has_hidden_members New value of has_hidden_members @@ -12147,7 +12243,7 @@ deleteSavedCredentials = Ok; setGiftSettings settings:giftSettings = Ok; //@description Returns gifts that can be sent to other users and channel chats -getAvailableGifts = Gifts; +getAvailableGifts = AvailableGifts; //@description Sends a gift to another user or channel chat. May return an error with a message "STARGIFT_USAGE_LIMITED" if the gift was sold out //@gift_id Identifier of the gift to send @@ -12195,6 +12291,13 @@ upgradeGift business_connection_id:string received_gift_id:string keep_original_ //@star_count The amount of Telegram Stars required to pay for the transfer transferGift business_connection_id:string received_gift_id:string new_owner_id:MessageSender star_count:int53 = Ok; +//@description Sends an upgraded gift that is available for resale to another user or channel chat; gifts already owned by the current user +//-must be transferred using transferGift and can't be passed to the method +//@gift_name Name of the upgraded gift to send +//@owner_id Identifier of the user or the channel chat that will receive the gift +//@star_count The amount of Telegram Stars required to pay for the gift +sendResoldGift gift_name:string owner_id:MessageSender star_count:int53 = Ok; + //@description Returns gifts received by the given user or chat //@business_connection_id Unique identifier of business connection on behalf of which to send the request; for bots only //@owner_id Identifier of the gift receiver @@ -12219,6 +12322,20 @@ getUpgradedGift name:string = UpgradedGift; //@password The 2-step verification password of the current user getUpgradedGiftWithdrawalUrl received_gift_id:string password:string = HttpUrl; +//@description Changes resale price of a unique gift owned by the current user +//@received_gift_id Identifier of the unique gift +//@resale_star_count The new price for the unique gift; 0 or getOption("gift_resale_star_count_min")-getOption("gift_resale_star_count_max"). Pass 0 to disallow gift resale. +//-The current user will receive getOption("gift_resale_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for the gift +setGiftResalePrice received_gift_id:string resale_star_count:int53 = Ok; + +//@description Returns upgraded gifts that can be bought from other owners +//@gift_id Identifier of the regular gift that was upgraded to a unique gift +//@order Order in which the results will be sorted +//@attributes Attributes used to filter received gifts. If multiple attributes of the same type are specified, then all of them are allowed. +//-If none attributes of specific type are specified, then all values for this attribute type are allowed +//@offset Offset of the first entry to return as received from the previous request with the same order and attributes; use empty string to get the first chunk of results +//@limit The maximum number of gifts to return +searchGiftsForResale gift_id:int64 order:GiftForResaleOrder attributes:vector offset:string limit:int32 = GiftsForResale; //@description Creates a link for the given invoice; for bots only //@business_connection_id Unique identifier of business connection on behalf of which to send the request From bc2b5f58230b2ff037cf0b6603be9599af96f6b9 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Tue, 10 Jun 2025 23:44:57 +0800 Subject: [PATCH 45/54] Update to TDLib 1.8.50 --- client/function.go | 454 +++++++++++++++++++++++++++++++++++++++--- client/type.go | 407 ++++++++++++++++++++++++++++++++++--- client/unmarshaler.go | 137 +++++++++++++ data/td_api.tl | 244 ++++++++++++++++++----- 4 files changed, 1133 insertions(+), 109 deletions(-) diff --git a/client/function.go b/client/function.go index 1102459..072145a 100755 --- a/client/function.go +++ b/client/function.go @@ -1672,6 +1672,35 @@ func (client *Client) GetMessageViewers(req *GetMessageViewersRequest) (*Message return UnmarshalMessageViewers(result.Data) } +type GetMessageAuthorRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` +} + +// Returns information about actual author of a message sent on behalf of a channel. The method can be called if messageProperties.can_get_author == true +func (client *Client) GetMessageAuthor(req *GetMessageAuthorRequest) (*User, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getMessageAuthor", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalUser(result.Data) +} + type GetFileRequest struct { // Identifier of the file to get FileId int32 `json:"file_id"` @@ -2387,7 +2416,7 @@ func (client *Client) GetSuitableDiscussionChats() (*Chats, error) { return UnmarshalChats(result.Data) } -// Returns a list of recently inactive supergroups and channels. Can be used when user reaches limit on the number of joined supergroups and channels and receives CHANNELS_TOO_MUCH error. Also, the limit can be increased with Telegram Premium +// Returns a list of recently inactive supergroups and channels. Can be used when user reaches limit on the number of joined supergroups and channels and receives the error "CHANNELS_TOO_MUCH". Also, the limit can be increased with Telegram Premium func (client *Client) GetInactiveSupergroupChats() (*Chats, error) { result, err := client.Send(Request{ meta: meta{ @@ -2425,6 +2454,320 @@ func (client *Client) GetSuitablePersonalChats() (*Chats, error) { return UnmarshalChats(result.Data) } +type LoadDirectMessagesChatTopicsRequest struct { + // Chat identifier of the channel direct messages chat + ChatId int64 `json:"chat_id"` + // The maximum number of topics to be loaded. For optimal performance, the number of loaded topics is chosen by TDLib and can be smaller than the specified limit, even if the end of the list is not reached + Limit int32 `json:"limit"` +} + +// Loads more topics in a channel direct messages chat administered by the current user. The loaded topics will be sent through updateDirectMessagesChatTopic. Topics are sorted by their topic.order in descending order. Returns a 404 error if all topics have been loaded +func (client *Client) LoadDirectMessagesChatTopics(req *LoadDirectMessagesChatTopicsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "loadDirectMessagesChatTopics", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetDirectMessagesChatTopicRequest struct { + // Chat identifier of the channel direct messages chat + ChatId int64 `json:"chat_id"` + // Identifier of the topic to get + TopicId int64 `json:"topic_id"` +} + +// Returns information about the topic in a channel direct messages chat administered by the current user +func (client *Client) GetDirectMessagesChatTopic(req *GetDirectMessagesChatTopicRequest) (*DirectMessagesChatTopic, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getDirectMessagesChatTopic", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalDirectMessagesChatTopic(result.Data) +} + +type GetDirectMessagesChatTopicHistoryRequest struct { + // Chat identifier of the channel direct messages chat + ChatId int64 `json:"chat_id"` + // Identifier of the topic which messages will be fetched + TopicId int64 `json:"topic_id"` + // Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message + FromMessageId int64 `json:"from_message_id"` + // Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages + Offset int32 `json:"offset"` + // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit + Limit int32 `json:"limit"` +} + +// Returns messages in the topic in a channel direct messages chat administered by the current user. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id) +func (client *Client) GetDirectMessagesChatTopicHistory(req *GetDirectMessagesChatTopicHistoryRequest) (*Messages, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getDirectMessagesChatTopicHistory", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + "from_message_id": req.FromMessageId, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessages(result.Data) +} + +type GetDirectMessagesChatTopicMessageByDateRequest struct { + // Chat identifier of the channel direct messages chat + ChatId int64 `json:"chat_id"` + // Identifier of the topic which messages will be fetched + TopicId int64 `json:"topic_id"` + // Point in time (Unix timestamp) relative to which to search for messages + Date int32 `json:"date"` +} + +// Returns the last message sent in the topic in a channel direct messages chat administered by the current user no later than the specified date +func (client *Client) GetDirectMessagesChatTopicMessageByDate(req *GetDirectMessagesChatTopicMessageByDateRequest) (*Message, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getDirectMessagesChatTopicMessageByDate", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + "date": req.Date, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessage(result.Data) +} + +type DeleteDirectMessagesChatTopicHistoryRequest struct { + // Chat identifier of the channel direct messages chat + ChatId int64 `json:"chat_id"` + // Identifier of the topic which messages will be deleted + TopicId int64 `json:"topic_id"` +} + +// Deletes all messages in the topic in a channel direct messages chat administered by the current user +func (client *Client) DeleteDirectMessagesChatTopicHistory(req *DeleteDirectMessagesChatTopicHistoryRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteDirectMessagesChatTopicHistory", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DeleteDirectMessagesChatTopicMessagesByDateRequest struct { + // Chat identifier of the channel direct messages chat + ChatId int64 `json:"chat_id"` + // Identifier of the topic which messages will be deleted + TopicId int64 `json:"topic_id"` + // The minimum date of the messages to delete + MinDate int32 `json:"min_date"` + // The maximum date of the messages to delete + MaxDate int32 `json:"max_date"` +} + +// Deletes all messages between the specified dates in the topic in a channel direct messages chat administered by the current user. Messages sent in the last 30 seconds will not be deleted +func (client *Client) DeleteDirectMessagesChatTopicMessagesByDate(req *DeleteDirectMessagesChatTopicMessagesByDateRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteDirectMessagesChatTopicMessagesByDate", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + "min_date": req.MinDate, + "max_date": req.MaxDate, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetDirectMessagesChatTopicIsMarkedAsUnreadRequest struct { + // Chat identifier of the channel direct messages chat + ChatId int64 `json:"chat_id"` + // Topic identifier + TopicId int64 `json:"topic_id"` + // New value of is_marked_as_unread + IsMarkedAsUnread bool `json:"is_marked_as_unread"` +} + +// Changes the marked as unread state of the topic in a channel direct messages chat administered by the current user +func (client *Client) SetDirectMessagesChatTopicIsMarkedAsUnread(req *SetDirectMessagesChatTopicIsMarkedAsUnreadRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setDirectMessagesChatTopicIsMarkedAsUnread", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + "is_marked_as_unread": req.IsMarkedAsUnread, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetDirectMessagesChatTopicDraftMessageRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Topic identifier + TopicId int64 `json:"topic_id"` + // New draft message; pass null to remove the draft. All files in draft message content must be of the type inputFileLocal. Media thumbnails and captions are ignored + DraftMessage *DraftMessage `json:"draft_message"` +} + +// Changes the draft message in the topic in a channel direct messages chat administered by the current user +func (client *Client) SetDirectMessagesChatTopicDraftMessage(req *SetDirectMessagesChatTopicDraftMessageRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setDirectMessagesChatTopicDraftMessage", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + "draft_message": req.DraftMessage, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type UnpinAllDirectMessagesChatTopicMessagesRequest struct { + // Identifier of the chat + ChatId int64 `json:"chat_id"` + // Topic identifier + TopicId int64 `json:"topic_id"` +} + +// Removes all pinned messages from the topic in a channel direct messages chat administered by the current user +func (client *Client) UnpinAllDirectMessagesChatTopicMessages(req *UnpinAllDirectMessagesChatTopicMessagesRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "unpinAllDirectMessagesChatTopicMessages", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ReadAllDirectMessagesChatTopicReactionsRequest struct { + // Identifier of the chat + ChatId int64 `json:"chat_id"` + // Topic identifier + TopicId int64 `json:"topic_id"` +} + +// Removes all unread reactions in the topic in a channel direct messages chat administered by the current user +func (client *Client) ReadAllDirectMessagesChatTopicReactions(req *ReadAllDirectMessagesChatTopicReactionsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "readAllDirectMessagesChatTopicReactions", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type LoadSavedMessagesTopicsRequest struct { // The maximum number of topics to be loaded. For optimal performance, the number of loaded topics is chosen by TDLib and can be smaller than the specified limit, even if the end of the list is not reached Limit int32 `json:"limit"` @@ -2797,6 +3140,8 @@ func (client *Client) DeleteChat(req *DeleteChatRequest) (*Ok, error) { type SearchChatMessagesRequest struct { // Identifier of the chat in which to search messages ChatId int64 `json:"chat_id"` + // Pass topic identifier to search messages only in specific topic; pass null to search for messages in all topics + TopicId MessageTopic `json:"topic_id"` // Query to search for Query string `json:"query"` // Identifier of the sender of messages to search for; pass null to search for messages from any sender. Not supported in secret chats @@ -2809,13 +3154,9 @@ type SearchChatMessagesRequest struct { Limit int32 `json:"limit"` // Additional filter for messages to search; pass null to search for all messages Filter SearchMessagesFilter `json:"filter"` - // If not 0, only messages in the specified thread will be returned; supergroups only - MessageThreadId int64 `json:"message_thread_id"` - // If not 0, only messages in the specified Saved Messages topic will be returned; pass 0 to return all messages, or for chats other than Saved Messages - SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` } -// Searches for messages with given words in the chat. Returns the results in reverse chronological order, i.e. in order of decreasing message_id. Cannot be used in secret chats with a non-empty query (searchSecretMessages must be used instead), or without an enabled message database. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit. A combination of query, sender_id, filter and message_thread_id search criteria is expected to be supported, only if it is required for Telegram official application implementation +// Searches for messages with given words in the chat. Returns the results in reverse chronological order, i.e. in order of decreasing message_id. Cannot be used in secret chats with a non-empty query (searchSecretMessages must be used instead), or without an enabled message database. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit. A combination of query, sender_id, filter and topic_id search criteria is expected to be supported, only if it is required for Telegram official application implementation func (client *Client) SearchChatMessages(req *SearchChatMessagesRequest) (*FoundChatMessages, error) { result, err := client.Send(Request{ meta: meta{ @@ -2823,14 +3164,13 @@ func (client *Client) SearchChatMessages(req *SearchChatMessagesRequest) (*Found }, Data: map[string]interface{}{ "chat_id": req.ChatId, + "topic_id": req.TopicId, "query": req.Query, "sender_id": req.SenderId, "from_message_id": req.FromMessageId, "offset": req.Offset, "limit": req.Limit, "filter": req.Filter, - "message_thread_id": req.MessageThreadId, - "saved_messages_topic_id": req.SavedMessagesTopicId, }, }) if err != nil { @@ -3371,12 +3711,12 @@ func (client *Client) GetChatSparseMessagePositions(req *GetChatSparseMessagePos type GetChatMessageCalendarRequest struct { // Identifier of the chat in which to return information about messages ChatId int64 `json:"chat_id"` + // Pass topic identifier to get the result only in specific topic; pass null to get the result in all topics; forum topics aren't supported + TopicId MessageTopic `json:"topic_id"` // Filter for message content. Filters searchMessagesFilterEmpty, searchMessagesFilterMention, searchMessagesFilterUnreadMention, and searchMessagesFilterUnreadReaction are unsupported in this function Filter SearchMessagesFilter `json:"filter"` // The message identifier from which to return information about messages; use 0 to get results from the last message FromMessageId int64 `json:"from_message_id"` - // If not0, only messages in the specified Saved Messages topic will be considered; pass 0 to consider all messages, or for chats other than Saved Messages - SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` } // Returns information about the next messages of the specified type in the chat split by days. Returns the results in reverse chronological order. Can return partial result for the last returned day. Behavior of this method depends on the value of the option "utc_time_offset" @@ -3387,9 +3727,9 @@ func (client *Client) GetChatMessageCalendar(req *GetChatMessageCalendarRequest) }, Data: map[string]interface{}{ "chat_id": req.ChatId, + "topic_id": req.TopicId, "filter": req.Filter, "from_message_id": req.FromMessageId, - "saved_messages_topic_id": req.SavedMessagesTopicId, }, }) if err != nil { @@ -3406,15 +3746,15 @@ func (client *Client) GetChatMessageCalendar(req *GetChatMessageCalendarRequest) type GetChatMessageCountRequest struct { // Identifier of the chat in which to count messages ChatId int64 `json:"chat_id"` + // Pass topic identifier to get number of messages only in specific topic; pass null to get number of messages in all topics + TopicId MessageTopic `json:"topic_id"` // Filter for message content; searchMessagesFilterEmpty is unsupported in this function Filter SearchMessagesFilter `json:"filter"` - // If not 0, only messages in the specified Saved Messages topic will be counted; pass 0 to count all messages, or for chats other than Saved Messages - SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` // Pass true to get the number of messages without sending network requests, or -1 if the number of messages is unknown locally ReturnLocal bool `json:"return_local"` } -// Returns approximate number of messages of the specified type in the chat +// Returns approximate number of messages of the specified type in the chat or its topic func (client *Client) GetChatMessageCount(req *GetChatMessageCountRequest) (*Count, error) { result, err := client.Send(Request{ meta: meta{ @@ -3422,8 +3762,8 @@ func (client *Client) GetChatMessageCount(req *GetChatMessageCountRequest) (*Cou }, Data: map[string]interface{}{ "chat_id": req.ChatId, + "topic_id": req.TopicId, "filter": req.Filter, - "saved_messages_topic_id": req.SavedMessagesTopicId, "return_local": req.ReturnLocal, }, }) @@ -3441,17 +3781,15 @@ func (client *Client) GetChatMessageCount(req *GetChatMessageCountRequest) (*Cou type GetChatMessagePositionRequest struct { // Identifier of the chat in which to find message position ChatId int64 `json:"chat_id"` - // Message identifier - MessageId int64 `json:"message_id"` + // Pass topic identifier to get position among messages only in specific topic; pass null to get position among all chat messages + TopicId MessageTopic `json:"topic_id"` // Filter for message content; searchMessagesFilterEmpty, searchMessagesFilterUnreadMention, searchMessagesFilterUnreadReaction, and searchMessagesFilterFailedToSend are unsupported in this function Filter SearchMessagesFilter `json:"filter"` - // If not 0, only messages in the specified thread will be considered; supergroups only - MessageThreadId int64 `json:"message_thread_id"` - // If not 0, only messages in the specified Saved Messages topic will be considered; pass 0 to consider all relevant messages, or for chats other than Saved Messages - SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` + // Message identifier + MessageId int64 `json:"message_id"` } -// Returns approximate 1-based position of a message among messages, which can be found by the specified filter in the chat. Cannot be used in secret chats +// Returns approximate 1-based position of a message among messages, which can be found by the specified filter in the chat and topic. Cannot be used in secret chats func (client *Client) GetChatMessagePosition(req *GetChatMessagePositionRequest) (*Count, error) { result, err := client.Send(Request{ meta: meta{ @@ -3459,10 +3797,9 @@ func (client *Client) GetChatMessagePosition(req *GetChatMessagePositionRequest) }, Data: map[string]interface{}{ "chat_id": req.ChatId, - "message_id": req.MessageId, + "topic_id": req.TopicId, "filter": req.Filter, - "message_thread_id": req.MessageThreadId, - "saved_messages_topic_id": req.SavedMessagesTopicId, + "message_id": req.MessageId, }, }) if err != nil { @@ -4235,7 +4572,7 @@ type ForwardMessagesRequest struct { MessageIds []int64 `json:"message_ids"` // Options to be used to send the messages; pass null to use default options Options *MessageSendOptions `json:"options"` - // Pass true to copy content of the messages without reference to the original sender. Always true if the messages are forwarded to a secret chat or are local. Use messageProperties.can_be_saved and messageProperties.can_be_copied_to_secret_chat to check whether the message is suitable + // Pass true to copy content of the messages without reference to the original sender. Always true if the messages are forwarded to a secret chat or are local. Use messageProperties.can_be_copied and messageProperties.can_be_copied_to_secret_chat to check whether the message is suitable SendCopy bool `json:"send_copy"` // Pass true to remove media captions of message copies. Ignored if send_copy is false RemoveCaption bool `json:"remove_caption"` @@ -4362,7 +4699,7 @@ func (client *Client) SendChatScreenshotTakenNotification(req *SendChatScreensho } type AddLocalMessageRequest struct { - // Target chat + // Target chat; channel direct messages chats aren't supported ChatId int64 `json:"chat_id"` // Identifier of the sender of the message SenderId MessageSender `json:"sender_id"` @@ -7976,8 +8313,10 @@ type OpenWebAppRequest struct { BotUserId int64 `json:"bot_user_id"` // The URL from an inlineKeyboardButtonTypeWebApp button, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an empty string otherwise Url string `json:"url"` - // If not 0, the message thread identifier in which the message will be sent + // If not 0, the message thread identifier to which the message will be sent MessageThreadId int64 `json:"message_thread_id"` + // If not 0, unique identifier of the topic of channel direct messages chat to which the message will be sent + DirectMessagesChatTopicId int64 `json:"direct_messages_chat_topic_id"` // Information about the message or story to be replied in the message sent by the Web App; pass null if none ReplyTo InputMessageReplyTo `json:"reply_to"` // Parameters to use to open the Web App @@ -7995,6 +8334,7 @@ func (client *Client) OpenWebApp(req *OpenWebAppRequest) (*WebAppInfo, error) { "bot_user_id": req.BotUserId, "url": req.Url, "message_thread_id": req.MessageThreadId, + "direct_messages_chat_topic_id": req.DirectMessagesChatTopicId, "reply_to": req.ReplyTo, "parameters": req.Parameters, }, @@ -10449,6 +10789,38 @@ func (client *Client) SetChatDiscussionGroup(req *SetChatDiscussionGroupRequest) return UnmarshalOk(result.Data) } +type SetChatDirectMessagesGroupRequest struct { + // Identifier of the channel chat + ChatId int64 `json:"chat_id"` + // Pass true if the direct messages group is enabled for the channel chat; pass false otherwise + IsEnabled bool `json:"is_enabled"` + // The new number of Telegram Stars that must be paid for each message that is sent to the direct messages chat unless the sender is an administrator of the channel chat; 0-getOption("paid_message_star_count_max"). The channel will receive getOption("paid_message_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for message sending. Requires supergroupFullInfo.can_enable_paid_messages for positive amounts + PaidMessageStarCount int64 `json:"paid_message_star_count"` +} + +// Changes direct messages group settings for a channel chat; requires owner privileges in the chat +func (client *Client) SetChatDirectMessagesGroup(req *SetChatDirectMessagesGroupRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setChatDirectMessagesGroup", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "is_enabled": req.IsEnabled, + "paid_message_star_count": req.PaidMessageStarCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type SetChatLocationRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -13114,7 +13486,7 @@ func (client *Client) SearchFileDownloads(req *SearchFileDownloadsRequest) (*Fou type SetApplicationVerificationTokenRequest struct { // Unique identifier for the verification process as received from updateApplicationVerificationRequired or updateApplicationRecaptchaVerificationRequired VerificationId int64 `json:"verification_id"` - // Play Integrity API token for the Android application, or secret from push notification for the iOS application for application verification, or reCAPTCHA token for reCAPTCHA verifications; pass an empty string to abort verification and receive error VERIFICATION_FAILED for the request + // Play Integrity API token for the Android application, or secret from push notification for the iOS application for application verification, or reCAPTCHA token for reCAPTCHA verifications; pass an empty string to abort verification and receive the error "VERIFICATION_FAILED" for the request Token string `json:"token"` } @@ -14779,8 +15151,8 @@ type SetGroupCallParticipantIsSpeakingRequest struct { IsSpeaking bool `json:"is_speaking"` } -// Informs TDLib that speaking state of a participant of an active group call has changed -func (client *Client) SetGroupCallParticipantIsSpeaking(req *SetGroupCallParticipantIsSpeakingRequest) (*Ok, error) { +// Informs TDLib that speaking state of a participant of an active group call has changed. Returns identifier of the participant if it is found +func (client *Client) SetGroupCallParticipantIsSpeaking(req *SetGroupCallParticipantIsSpeakingRequest) (MessageSender, error) { result, err := client.Send(Request{ meta: meta{ Type: "setGroupCallParticipantIsSpeaking", @@ -14799,7 +15171,16 @@ func (client *Client) SetGroupCallParticipantIsSpeaking(req *SetGroupCallPartici return nil, buildResponseError(result.Data) } - return UnmarshalOk(result.Data) + switch result.Type { + case TypeMessageSenderUser: + return UnmarshalMessageSenderUser(result.Data) + + case TypeMessageSenderChat: + return UnmarshalMessageSenderChat(result.Data) + + default: + return nil, errors.New("invalid type") + } } type ToggleGroupCallParticipantIsMutedRequest struct { @@ -19258,6 +19639,8 @@ type ToggleSupergroupIsForumRequest struct { SupergroupId int64 `json:"supergroup_id"` // New value of is_forum IsForum bool `json:"is_forum"` + // New value of has_forum_tabs; ignored if is_forum is false + HasForumTabs bool `json:"has_forum_tabs"` } // Toggles whether the supergroup is a forum; requires owner privileges in the supergroup. Discussion supergroups can't be converted to forums @@ -19269,6 +19652,7 @@ func (client *Client) ToggleSupergroupIsForum(req *ToggleSupergroupIsForumReques Data: map[string]interface{}{ "supergroup_id": req.SupergroupId, "is_forum": req.IsForum, + "has_forum_tabs": req.HasForumTabs, }, }) if err != nil { @@ -25371,6 +25755,12 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateSavedMessagesTopicCount: return UnmarshalUpdateSavedMessagesTopicCount(result.Data) + case TypeUpdateDirectMessagesChatTopic: + return UnmarshalUpdateDirectMessagesChatTopic(result.Data) + + case TypeUpdateTopicMessageCount: + return UnmarshalUpdateTopicMessageCount(result.Data) + case TypeUpdateQuickReplyShortcut: return UnmarshalUpdateQuickReplyShortcut(result.Data) diff --git a/client/type.go b/client/type.go index ab92cfc..2fd662d 100755 --- a/client/type.go +++ b/client/type.go @@ -45,6 +45,7 @@ const ( ClassMessageOrigin = "MessageOrigin" ClassReactionType = "ReactionType" ClassPaidReactionType = "PaidReactionType" + ClassMessageTopic = "MessageTopic" ClassMessageEffectType = "MessageEffectType" ClassMessageSendingState = "MessageSendingState" ClassMessageReplyTo = "MessageReplyTo" @@ -400,6 +401,7 @@ const ( ClassWebAppOpenParameters = "WebAppOpenParameters" ClassMessageThreadInfo = "MessageThreadInfo" ClassSavedMessagesTopic = "SavedMessagesTopic" + ClassDirectMessagesChatTopic = "DirectMessagesChatTopic" ClassForumTopicIcon = "ForumTopicIcon" ClassForumTopicInfo = "ForumTopicInfo" ClassForumTopic = "ForumTopic" @@ -965,6 +967,9 @@ const ( TypeMessageReactions = "messageReactions" TypeMessageInteractionInfo = "messageInteractionInfo" TypeUnreadReaction = "unreadReaction" + TypeMessageTopicForum = "messageTopicForum" + TypeMessageTopicDirectMessages = "messageTopicDirectMessages" + TypeMessageTopicSavedMessages = "messageTopicSavedMessages" TypeMessageEffectTypeEmojiReaction = "messageEffectTypeEmojiReaction" TypeMessageEffectTypePremiumSticker = "messageEffectTypePremiumSticker" TypeMessageEffect = "messageEffect" @@ -991,6 +996,7 @@ const ( TypeMessageSourceChatHistory = "messageSourceChatHistory" TypeMessageSourceMessageThreadHistory = "messageSourceMessageThreadHistory" TypeMessageSourceForumTopicHistory = "messageSourceForumTopicHistory" + TypeMessageSourceDirectMessagesChatTopicHistory = "messageSourceDirectMessagesChatTopicHistory" TypeMessageSourceHistoryPreview = "messageSourceHistoryPreview" TypeMessageSourceChatList = "messageSourceChatList" TypeMessageSourceSearch = "messageSourceSearch" @@ -1101,6 +1107,7 @@ const ( TypeSavedMessagesTopicTypeAuthorHidden = "savedMessagesTopicTypeAuthorHidden" TypeSavedMessagesTopicTypeSavedFromChat = "savedMessagesTopicTypeSavedFromChat" TypeSavedMessagesTopic = "savedMessagesTopic" + TypeDirectMessagesChatTopic = "directMessagesChatTopic" TypeForumTopicIcon = "forumTopicIcon" TypeForumTopicInfo = "forumTopicInfo" TypeForumTopic = "forumTopic" @@ -1384,6 +1391,7 @@ const ( TypeMessageRefundedUpgradedGift = "messageRefundedUpgradedGift" TypeMessagePaidMessagesRefunded = "messagePaidMessagesRefunded" TypeMessagePaidMessagePriceChanged = "messagePaidMessagePriceChanged" + TypeMessageDirectMessagePriceChanged = "messageDirectMessagePriceChanged" TypeMessageContactRegistered = "messageContactRegistered" TypeMessageUsersShared = "messageUsersShared" TypeMessageChatShared = "messageChatShared" @@ -2273,6 +2281,8 @@ const ( TypeUpdateChatOnlineMemberCount = "updateChatOnlineMemberCount" TypeUpdateSavedMessagesTopic = "updateSavedMessagesTopic" TypeUpdateSavedMessagesTopicCount = "updateSavedMessagesTopicCount" + TypeUpdateDirectMessagesChatTopic = "updateDirectMessagesChatTopic" + TypeUpdateTopicMessageCount = "updateTopicMessageCount" TypeUpdateQuickReplyShortcut = "updateQuickReplyShortcut" TypeUpdateQuickReplyShortcutDeleted = "updateQuickReplyShortcutDeleted" TypeUpdateQuickReplyShortcuts = "updateQuickReplyShortcuts" @@ -2584,6 +2594,11 @@ type PaidReactionType interface { PaidReactionTypeType() string } +// Describes a topic of messages in a chat +type MessageTopic interface { + MessageTopicType() string +} + // Describes type of emoji effect type MessageEffectType interface { MessageEffectTypeType() string @@ -7626,11 +7641,11 @@ func (*ChatPermissions) GetType() string { // Describes rights of the administrator type ChatAdministratorRights struct { meta - // True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report supergroup spam messages and ignore slow mode. Implied by any other privilege; applicable to supergroups and channels only + // True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report supergroup spam messages, ignore slow mode, and send messages to the chat without paying Telegram Stars. Implied by any other privilege; applicable to supergroups and channels only CanManageChat bool `json:"can_manage_chat"` // True, if the administrator can change the chat title, photo, and other settings CanChangeInfo bool `json:"can_change_info"` - // True, if the administrator can create channel posts or view channel statistics; applicable to channels only + // True, if the administrator can create channel posts, answer to channel direct messages, or view channel statistics; applicable to channels only CanPostMessages bool `json:"can_post_messages"` // True, if the administrator can edit messages of other users and pin messages; applicable to channels only CanEditMessages bool `json:"can_edit_messages"` @@ -10639,7 +10654,7 @@ func (*StarTransactionTypePaidMessageSend) StarTransactionTypeType() string { return TypeStarTransactionTypePaidMessageSend } -// The transaction is a receiving of a paid message; for regular users and supergroup chats only +// The transaction is a receiving of a paid message; for regular users, supergroup and channel chats only type StarTransactionTypePaidMessageReceive struct { meta // Identifier of the sender of the message @@ -13165,8 +13180,16 @@ type Supergroup struct { IsBroadcastGroup bool `json:"is_broadcast_group"` // True, if the supergroup is a forum with topics IsForum bool `json:"is_forum"` + // True, if the supergroup is a direct message group for a channel chat + IsDirectMessagesGroup bool `json:"is_direct_messages_group"` + // True, if the supergroup is a direct messages group for a channel chat that is administered by the current user + IsAdministeredDirectMessagesGroup bool `json:"is_administered_direct_messages_group"` // Information about verification status of the supergroup or channel; may be null if none VerificationStatus *VerificationStatus `json:"verification_status"` + // True, if the channel has direct messages group + HasDirectMessagesGroup bool `json:"has_direct_messages_group"` + // True, if the supergroup is a forum, which topics are shown in the same way as in channel direct messages groups + HasForumTabs bool `json:"has_forum_tabs"` // True, if content of media messages in the supergroup or channel chat must be hidden with 18+ spoiler HasSensitiveContent bool `json:"has_sensitive_content"` // If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted @@ -13215,7 +13238,11 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { IsChannel bool `json:"is_channel"` IsBroadcastGroup bool `json:"is_broadcast_group"` IsForum bool `json:"is_forum"` + IsDirectMessagesGroup bool `json:"is_direct_messages_group"` + IsAdministeredDirectMessagesGroup bool `json:"is_administered_direct_messages_group"` VerificationStatus *VerificationStatus `json:"verification_status"` + HasDirectMessagesGroup bool `json:"has_direct_messages_group"` + HasForumTabs bool `json:"has_forum_tabs"` HasSensitiveContent bool `json:"has_sensitive_content"` RestrictionReason string `json:"restriction_reason"` PaidMessageStarCount int64 `json:"paid_message_star_count"` @@ -13245,7 +13272,11 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { supergroup.IsChannel = tmp.IsChannel supergroup.IsBroadcastGroup = tmp.IsBroadcastGroup supergroup.IsForum = tmp.IsForum + supergroup.IsDirectMessagesGroup = tmp.IsDirectMessagesGroup + supergroup.IsAdministeredDirectMessagesGroup = tmp.IsAdministeredDirectMessagesGroup supergroup.VerificationStatus = tmp.VerificationStatus + supergroup.HasDirectMessagesGroup = tmp.HasDirectMessagesGroup + supergroup.HasForumTabs = tmp.HasForumTabs supergroup.HasSensitiveContent = tmp.HasSensitiveContent supergroup.RestrictionReason = tmp.RestrictionReason supergroup.PaidMessageStarCount = tmp.PaidMessageStarCount @@ -13275,6 +13306,8 @@ type SupergroupFullInfo struct { BannedCount int32 `json:"banned_count"` // 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 `json:"linked_chat_id"` + // 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 `json:"direct_messages_chat_id"` // Delay between consecutive sent messages for non-administrator supergroup members, in seconds SlowModeDelay int32 `json:"slow_mode_delay"` // 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 @@ -14515,6 +14548,87 @@ func (unreadReaction *UnreadReaction) UnmarshalJSON(data []byte) error { return nil } +// A topic in a forum supergroup chat +type MessageTopicForum struct { + meta + // Unique identifier of the forum topic; all messages in a non-forum supergroup chats belongs to the General topic + ForumTopicId int64 `json:"forum_topic_id"` +} + +func (entity *MessageTopicForum) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageTopicForum + + return json.Marshal((*stub)(entity)) +} + +func (*MessageTopicForum) GetClass() string { + return ClassMessageTopic +} + +func (*MessageTopicForum) GetType() string { + return TypeMessageTopicForum +} + +func (*MessageTopicForum) MessageTopicType() string { + return TypeMessageTopicForum +} + +// A topic in a channel direct messages chat administered by the current user +type MessageTopicDirectMessages struct { + meta + // Unique identifier of the topic + DirectMessagesChatTopicId int64 `json:"direct_messages_chat_topic_id"` +} + +func (entity *MessageTopicDirectMessages) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageTopicDirectMessages + + return json.Marshal((*stub)(entity)) +} + +func (*MessageTopicDirectMessages) GetClass() string { + return ClassMessageTopic +} + +func (*MessageTopicDirectMessages) GetType() string { + return TypeMessageTopicDirectMessages +} + +func (*MessageTopicDirectMessages) MessageTopicType() string { + return TypeMessageTopicDirectMessages +} + +// A topic in Saved Messages chat +type MessageTopicSavedMessages struct { + meta + // Unique identifier of the Saved Messages topic + SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` +} + +func (entity *MessageTopicSavedMessages) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageTopicSavedMessages + + return json.Marshal((*stub)(entity)) +} + +func (*MessageTopicSavedMessages) GetClass() string { + return ClassMessageTopic +} + +func (*MessageTopicSavedMessages) GetType() string { + return TypeMessageTopicSavedMessages +} + +func (*MessageTopicSavedMessages) MessageTopicType() string { + return TypeMessageTopicSavedMessages +} + // An effect from an emoji reaction type MessageEffectTypeEmojiReaction struct { meta @@ -14973,14 +15087,12 @@ type Message struct { IsPinned bool `json:"is_pinned"` // True, if the message was sent because of a scheduled action by the message sender, for example, as away, or greeting service message IsFromOffline bool `json:"is_from_offline"` - // True, if content of the message can be saved locally or copied using inputMessageForwarded or forwardMessages with copy options + // True, if content of the message can be saved locally CanBeSaved bool `json:"can_be_saved"` // True, if media timestamp entities refers to a media in this message as opposed to a media in the replied message HasTimestampedMedia bool `json:"has_timestamped_media"` // True, if the message is a channel post. All messages to channels are channel posts, all other messages are not channel posts IsChannelPost bool `json:"is_channel_post"` - // True, if the message is a forum topic message - IsTopicMessage bool `json:"is_topic_message"` // True, if the message contains an unread mention for the current user ContainsUnreadMention bool `json:"contains_unread_mention"` // Point in time (Unix timestamp) when the message was sent; 0 for scheduled messages @@ -15001,8 +15113,8 @@ type Message struct { ReplyTo MessageReplyTo `json:"reply_to"` // If non-zero, the identifier of the message thread the message belongs to; unique within the chat to which the message belongs MessageThreadId int64 `json:"message_thread_id"` - // Identifier of the Saved Messages topic for the message; 0 for messages not from Saved Messages - SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` + // Identifier of the topic within the chat to which the message belongs; may be null if none + TopicId MessageTopic `json:"topic_id"` // The message's self-destruct type; may be null if none SelfDestructType MessageSelfDestructType `json:"self_destruct_type"` // Time left before the message self-destruct timer expires, in seconds; 0 if self-destruction isn't scheduled yet @@ -15062,7 +15174,6 @@ func (message *Message) UnmarshalJSON(data []byte) error { CanBeSaved bool `json:"can_be_saved"` HasTimestampedMedia bool `json:"has_timestamped_media"` IsChannelPost bool `json:"is_channel_post"` - IsTopicMessage bool `json:"is_topic_message"` ContainsUnreadMention bool `json:"contains_unread_mention"` Date int32 `json:"date"` EditDate int32 `json:"edit_date"` @@ -15073,7 +15184,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { FactCheck *FactCheck `json:"fact_check"` ReplyTo json.RawMessage `json:"reply_to"` MessageThreadId int64 `json:"message_thread_id"` - SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` + TopicId json.RawMessage `json:"topic_id"` SelfDestructType json.RawMessage `json:"self_destruct_type"` SelfDestructIn float64 `json:"self_destruct_in"` AutoDeleteIn float64 `json:"auto_delete_in"` @@ -15103,7 +15214,6 @@ func (message *Message) UnmarshalJSON(data []byte) error { message.CanBeSaved = tmp.CanBeSaved message.HasTimestampedMedia = tmp.HasTimestampedMedia message.IsChannelPost = tmp.IsChannelPost - message.IsTopicMessage = tmp.IsTopicMessage message.ContainsUnreadMention = tmp.ContainsUnreadMention message.Date = tmp.Date message.EditDate = tmp.EditDate @@ -15113,7 +15223,6 @@ func (message *Message) UnmarshalJSON(data []byte) error { message.UnreadReactions = tmp.UnreadReactions message.FactCheck = tmp.FactCheck message.MessageThreadId = tmp.MessageThreadId - message.SavedMessagesTopicId = tmp.SavedMessagesTopicId message.SelfDestructIn = tmp.SelfDestructIn message.AutoDeleteIn = tmp.AutoDeleteIn message.ViaBotUserId = tmp.ViaBotUserId @@ -15138,6 +15247,9 @@ func (message *Message) UnmarshalJSON(data []byte) error { fieldReplyTo, _ := UnmarshalMessageReplyTo(tmp.ReplyTo) message.ReplyTo = fieldReplyTo + fieldTopicId, _ := UnmarshalMessageTopic(tmp.TopicId) + message.TopicId = fieldTopicId + fieldSelfDestructType, _ := UnmarshalMessageSelfDestructType(tmp.SelfDestructType) message.SelfDestructType = fieldSelfDestructType @@ -15404,7 +15516,7 @@ func (*MessageSourceChatHistory) MessageSourceType() string { return TypeMessageSourceChatHistory } -// The message is from a message thread history +// The message is from history of a message thread type MessageSourceMessageThreadHistory struct{ meta } @@ -15429,7 +15541,7 @@ func (*MessageSourceMessageThreadHistory) MessageSourceType() string { return TypeMessageSourceMessageThreadHistory } -// The message is from a forum topic history +// The message is from history of a forum topic type MessageSourceForumTopicHistory struct{ meta } @@ -15454,6 +15566,31 @@ func (*MessageSourceForumTopicHistory) MessageSourceType() string { return TypeMessageSourceForumTopicHistory } +// The message is from history of a topic in a channel direct messages chat administered by the current user +type MessageSourceDirectMessagesChatTopicHistory struct{ + meta +} + +func (entity *MessageSourceDirectMessagesChatTopicHistory) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSourceDirectMessagesChatTopicHistory + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSourceDirectMessagesChatTopicHistory) GetClass() string { + return ClassMessageSource +} + +func (*MessageSourceDirectMessagesChatTopicHistory) GetType() string { + return TypeMessageSourceDirectMessagesChatTopicHistory +} + +func (*MessageSourceDirectMessagesChatTopicHistory) MessageSourceType() string { + return TypeMessageSourceDirectMessagesChatTopicHistory +} + // The message is from chat, message thread or forum topic history preview type MessageSourceHistoryPreview struct{ meta @@ -19020,6 +19157,86 @@ func (savedMessagesTopic *SavedMessagesTopic) UnmarshalJSON(data []byte) error { return nil } +// Contains information about a topic in a channel direct messages chat administered by the current user +type DirectMessagesChatTopic struct { + meta + // Identifier of the chat to which the topic belongs + ChatId int64 `json:"chat_id"` + // Unique topic identifier + Id int64 `json:"id"` + // Identifier of the user or chat that sends the messages to the topic + SenderId MessageSender `json:"sender_id"` + // A parameter used to determine order of the topic in the topic list. Topics must be sorted by the order in descending order + Order JsonInt64 `json:"order"` + // True, if the forum topic is marked as unread + IsMarkedAsUnread bool `json:"is_marked_as_unread"` + // Number of unread messages in the chat + UnreadCount int64 `json:"unread_count"` + // Identifier of the last read incoming message + LastReadInboxMessageId int64 `json:"last_read_inbox_message_id"` + // Identifier of the last read outgoing message + LastReadOutboxMessageId int64 `json:"last_read_outbox_message_id"` + // Number of messages with unread reactions in the chat + UnreadReactionCount int64 `json:"unread_reaction_count"` + // Last message in the topic; may be null if none or unknown + LastMessage *Message `json:"last_message"` + // A draft of a message in the topic; may be null if none + DraftMessage *DraftMessage `json:"draft_message"` +} + +func (entity *DirectMessagesChatTopic) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub DirectMessagesChatTopic + + return json.Marshal((*stub)(entity)) +} + +func (*DirectMessagesChatTopic) GetClass() string { + return ClassDirectMessagesChatTopic +} + +func (*DirectMessagesChatTopic) GetType() string { + return TypeDirectMessagesChatTopic +} + +func (directMessagesChatTopic *DirectMessagesChatTopic) UnmarshalJSON(data []byte) error { + var tmp struct { + ChatId int64 `json:"chat_id"` + Id int64 `json:"id"` + SenderId json.RawMessage `json:"sender_id"` + Order JsonInt64 `json:"order"` + IsMarkedAsUnread bool `json:"is_marked_as_unread"` + UnreadCount int64 `json:"unread_count"` + LastReadInboxMessageId int64 `json:"last_read_inbox_message_id"` + LastReadOutboxMessageId int64 `json:"last_read_outbox_message_id"` + UnreadReactionCount int64 `json:"unread_reaction_count"` + LastMessage *Message `json:"last_message"` + DraftMessage *DraftMessage `json:"draft_message"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + directMessagesChatTopic.ChatId = tmp.ChatId + directMessagesChatTopic.Id = tmp.Id + directMessagesChatTopic.Order = tmp.Order + directMessagesChatTopic.IsMarkedAsUnread = tmp.IsMarkedAsUnread + directMessagesChatTopic.UnreadCount = tmp.UnreadCount + directMessagesChatTopic.LastReadInboxMessageId = tmp.LastReadInboxMessageId + directMessagesChatTopic.LastReadOutboxMessageId = tmp.LastReadOutboxMessageId + directMessagesChatTopic.UnreadReactionCount = tmp.UnreadReactionCount + directMessagesChatTopic.LastMessage = tmp.LastMessage + directMessagesChatTopic.DraftMessage = tmp.DraftMessage + + fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) + directMessagesChatTopic.SenderId = fieldSenderId + + return nil +} + // Describes a forum topic icon type ForumTopicIcon struct { meta @@ -19050,6 +19267,8 @@ type ForumTopicInfo struct { meta // Identifier of the forum chat to which the topic belongs ChatId int64 `json:"chat_id"` + // Forum topic identifier of the topic + ForumTopicId int64 `json:"forum_topic_id"` // Message thread identifier of the topic MessageThreadId int64 `json:"message_thread_id"` // Name of the topic @@ -19089,6 +19308,7 @@ func (*ForumTopicInfo) GetType() string { func (forumTopicInfo *ForumTopicInfo) UnmarshalJSON(data []byte) error { var tmp struct { ChatId int64 `json:"chat_id"` + ForumTopicId int64 `json:"forum_topic_id"` MessageThreadId int64 `json:"message_thread_id"` Name string `json:"name"` Icon *ForumTopicIcon `json:"icon"` @@ -19106,6 +19326,7 @@ func (forumTopicInfo *ForumTopicInfo) UnmarshalJSON(data []byte) error { } forumTopicInfo.ChatId = tmp.ChatId + forumTopicInfo.ForumTopicId = tmp.ForumTopicId forumTopicInfo.MessageThreadId = tmp.MessageThreadId forumTopicInfo.Name = tmp.Name forumTopicInfo.Icon = tmp.Icon @@ -27045,7 +27266,7 @@ func (messageCall *MessageCall) UnmarshalJSON(data []byte) error { return nil } -// A message with information about a group call not bound to a chat. If the message is incoming, the call isn't active, isn't missed, and has no duration, and getOption("can_accept_calls") is true, then incoming call screen must be shown to the user. Use joinGroupCall to accept the call or declineGroupCallInvitation to decline it. If the call become active or missed, then the call screen must be hidden +// A message with information about a group call not bound to a chat. If the message is incoming, the call isn't active, isn't missed, and has no duration, and getOption("can_accept_calls") is true, then incoming call screen must be shown to the user. Use getGroupCallParticipants to show current group call participants on the screen. Use joinGroupCall to accept the call or declineGroupCallInvitation to decline it. If the call become active or missed, then the call screen must be hidden type MessageGroupCall struct { meta // True, if the call is active, i.e. the called user joined the call @@ -28441,6 +28662,8 @@ type MessageGift struct { Gift *Gift `json:"gift"` // Sender of the gift SenderId MessageSender `json:"sender_id"` + // Receiver of the gift + ReceiverId MessageSender `json:"receiver_id"` // Unique identifier of the received gift for the current user; only for the receiver of the gift ReceivedGiftId string `json:"received_gift_id"` // Message added to the gift @@ -28489,6 +28712,7 @@ func (messageGift *MessageGift) UnmarshalJSON(data []byte) error { var tmp struct { Gift *Gift `json:"gift"` SenderId json.RawMessage `json:"sender_id"` + ReceiverId json.RawMessage `json:"receiver_id"` ReceivedGiftId string `json:"received_gift_id"` Text *FormattedText `json:"text"` SellStarCount int64 `json:"sell_star_count"` @@ -28523,6 +28747,9 @@ func (messageGift *MessageGift) UnmarshalJSON(data []byte) error { fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) messageGift.SenderId = fieldSenderId + fieldReceiverId, _ := UnmarshalMessageSender(tmp.ReceiverId) + messageGift.ReceiverId = fieldReceiverId + return nil } @@ -28533,6 +28760,8 @@ type MessageUpgradedGift struct { Gift *UpgradedGift `json:"gift"` // Sender of the gift; may be null for anonymous gifts SenderId MessageSender `json:"sender_id"` + // Receiver of the gift + ReceiverId MessageSender `json:"receiver_id"` // Unique identifier of the received gift for the current user; only for the receiver of the gift ReceivedGiftId string `json:"received_gift_id"` // True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift @@ -28579,6 +28808,7 @@ func (messageUpgradedGift *MessageUpgradedGift) UnmarshalJSON(data []byte) error var tmp struct { Gift *UpgradedGift `json:"gift"` SenderId json.RawMessage `json:"sender_id"` + ReceiverId json.RawMessage `json:"receiver_id"` ReceivedGiftId string `json:"received_gift_id"` IsUpgrade bool `json:"is_upgrade"` IsSaved bool `json:"is_saved"` @@ -28611,6 +28841,9 @@ func (messageUpgradedGift *MessageUpgradedGift) UnmarshalJSON(data []byte) error fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) messageUpgradedGift.SenderId = fieldSenderId + fieldReceiverId, _ := UnmarshalMessageSender(tmp.ReceiverId) + messageUpgradedGift.ReceiverId = fieldReceiverId + return nil } @@ -28621,6 +28854,8 @@ type MessageRefundedUpgradedGift struct { Gift *Gift `json:"gift"` // Sender of the gift SenderId MessageSender `json:"sender_id"` + // Receiver of the gift + ReceiverId MessageSender `json:"receiver_id"` // True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift IsUpgrade bool `json:"is_upgrade"` } @@ -28649,6 +28884,7 @@ func (messageRefundedUpgradedGift *MessageRefundedUpgradedGift) UnmarshalJSON(da var tmp struct { Gift *Gift `json:"gift"` SenderId json.RawMessage `json:"sender_id"` + ReceiverId json.RawMessage `json:"receiver_id"` IsUpgrade bool `json:"is_upgrade"` } @@ -28663,6 +28899,9 @@ func (messageRefundedUpgradedGift *MessageRefundedUpgradedGift) UnmarshalJSON(da fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) messageRefundedUpgradedGift.SenderId = fieldSenderId + fieldReceiverId, _ := UnmarshalMessageSender(tmp.ReceiverId) + messageRefundedUpgradedGift.ReceiverId = fieldReceiverId + return nil } @@ -28722,6 +28961,35 @@ func (*MessagePaidMessagePriceChanged) MessageContentType() string { return TypeMessagePaidMessagePriceChanged } +// A price for direct messages was changed in the channel chat +type MessageDirectMessagePriceChanged struct { + meta + // True, if direct messages group was enabled for the channel; false otherwise + IsEnabled bool `json:"is_enabled"` + // The new number of Telegram Stars that must be paid by non-administrator users of the channel chat for each message sent to the direct messages group; 0 if the direct messages group was disabled or the messages are free + PaidMessageStarCount int64 `json:"paid_message_star_count"` +} + +func (entity *MessageDirectMessagePriceChanged) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageDirectMessagePriceChanged + + return json.Marshal((*stub)(entity)) +} + +func (*MessageDirectMessagePriceChanged) GetClass() string { + return ClassMessageContent +} + +func (*MessageDirectMessagePriceChanged) GetType() string { + return TypeMessageDirectMessagePriceChanged +} + +func (*MessageDirectMessagePriceChanged) MessageContentType() string { + return TypeMessageDirectMessagePriceChanged +} + // A contact has registered with Telegram type MessageContactRegistered struct{ meta @@ -29940,6 +30208,8 @@ func (*MessageSelfDestructTypeImmediately) MessageSelfDestructTypeType() string // Options to be used when a message is sent type MessageSendOptions struct { meta + // Unique identifier of the topic in a channel direct messages chat administered by the current user; pass 0 if the chat isn't a channel direct messages chat administered by the current user + DirectMessagesChatTopicId int64 `json:"direct_messages_chat_topic_id"` // Pass true to disable notification for the message DisableNotification bool `json:"disable_notification"` // Pass true if the message is sent from the background @@ -29952,7 +30222,7 @@ type MessageSendOptions struct { PaidMessageStarCount int64 `json:"paid_message_star_count"` // Pass true if the user explicitly chosen a sticker or a custom emoji from an installed sticker set; applicable only to sendMessage and sendMessageAlbum UpdateOrderOfInstalledStickerSets bool `json:"update_order_of_installed_sticker_sets"` - // Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, to a chat with paid messages, live location messages and self-destructing messages can't be scheduled + // Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, to a chat with paid messages, to a channel direct messages chat, live location messages and self-destructing messages can't be scheduled SchedulingState MessageSchedulingState `json:"scheduling_state"` // Identifier of the effect to apply to the message; pass 0 if none; applicable only to sendMessage and sendMessageAlbum in private chats EffectId JsonInt64 `json:"effect_id"` @@ -29980,6 +30250,7 @@ func (*MessageSendOptions) GetType() string { func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { var tmp struct { + DirectMessagesChatTopicId int64 `json:"direct_messages_chat_topic_id"` DisableNotification bool `json:"disable_notification"` FromBackground bool `json:"from_background"` ProtectContent bool `json:"protect_content"` @@ -29997,6 +30268,7 @@ func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { return err } + messageSendOptions.DirectMessagesChatTopicId = tmp.DirectMessagesChatTopicId messageSendOptions.DisableNotification = tmp.DisableNotification messageSendOptions.FromBackground = tmp.FromBackground messageSendOptions.ProtectContent = tmp.ProtectContent @@ -30016,7 +30288,7 @@ func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { // Options to be used when a message content is copied without reference to the original sender. Service messages, messages with messageInvoice, messagePaidMedia, messageGiveaway, or messageGiveawayWinners content can't be copied type MessageCopyOptions struct { meta - // True, if content of the message needs to be copied without reference to the original sender. Always true if the message is forwarded to a secret chat or is local. Use messageProperties.can_be_saved and messageProperties.can_be_copied_to_secret_chat to check whether the message is suitable + // True, if content of the message needs to be copied without reference to the original sender. Always true if the message is forwarded to a secret chat or is local. Use messageProperties.can_be_copied and messageProperties.can_be_copied_to_secret_chat to check whether the message is suitable SendCopy bool `json:"send_copy"` // True, if media caption of the message copy needs to be replaced. Ignored if send_copy is false ReplaceCaption bool `json:"replace_caption"` @@ -30858,12 +31130,12 @@ func (*InputMessageInvoice) InputMessageContentType() string { return TypeInputMessageInvoice } -// A message with a poll. Polls can't be sent to secret chats. Polls can be sent only to a private chat with a bot +// A message with a poll. Polls can't be sent to secret chats and channel direct messages chats. Polls can be sent to a private chat only if the chat is a chat with a bot or the Saved Messages chat type InputMessagePoll struct { meta // Poll question; 1-255 characters (up to 300 characters for bots). Only custom emoji entities are allowed to be added and only by Premium users Question *FormattedText `json:"question"` - // List of poll answer options, 2-10 strings 1-100 characters each. Only custom emoji entities are allowed to be added and only by Premium users + // List of poll answer options, 2-getOption("poll_answer_count_max") strings 1-100 characters each. Only custom emoji entities are allowed to be added and only by Premium users Options []*FormattedText `json:"options"` // True, if the poll voters are anonymous. Non-anonymous polls can't be sent or forwarded to channels IsAnonymous bool `json:"is_anonymous"` @@ -30995,6 +31267,8 @@ func (*InputMessageForwarded) InputMessageContentType() string { // Contains properties of a message and describes actions that can be done with the message right now type MessageProperties struct { meta + // True, if content of the message can be copied using inputMessageForwarded or forwardMessages with copy options + CanBeCopied bool `json:"can_be_copied"` // True, if content of the message can be copied to a secret chat using inputMessageForwarded or forwardMessages with copy options CanBeCopiedToSecretChat bool `json:"can_be_copied_to_secret_chat"` // True, if the message can be deleted only for the current user while other users will continue to see it using the method deleteMessages with revoke == false @@ -31003,7 +31277,7 @@ type MessageProperties struct { CanBeDeletedForAllUsers bool `json:"can_be_deleted_for_all_users"` // True, if the message can be edited using the methods editMessageText, editMessageCaption, or editMessageReplyMarkup. For live location and poll messages this fields shows whether editMessageLiveLocation or stopPoll can be used with this message CanBeEdited bool `json:"can_be_edited"` - // True, if the message can be forwarded using inputMessageForwarded or forwardMessages + // True, if the message can be forwarded using inputMessageForwarded or forwardMessages without copy options CanBeForwarded bool `json:"can_be_forwarded"` // True, if the message can be paid using inputInvoiceMessage CanBePaid bool `json:"can_be_paid"` @@ -31013,7 +31287,7 @@ type MessageProperties struct { CanBeReplied bool `json:"can_be_replied"` // True, if the message can be replied in another chat or forum topic using inputMessageReplyToExternalMessage CanBeRepliedInAnotherChat bool `json:"can_be_replied_in_another_chat"` - // True, if content of the message can be saved locally or copied using inputMessageForwarded or forwardMessages with copy options + // True, if content of the message can be saved locally CanBeSaved bool `json:"can_be_saved"` // True, if the message can be shared in a story using inputStoryAreaTypeMessage CanBeSharedInStory bool `json:"can_be_shared_in_story"` @@ -31021,6 +31295,8 @@ type MessageProperties struct { CanEditMedia bool `json:"can_edit_media"` // True, if scheduling state of the message can be edited CanEditSchedulingState bool `json:"can_edit_scheduling_state"` + // True, if author of the message sent on behalf of a chat can be received through getMessageAuthor + CanGetAuthor bool `json:"can_get_author"` // True, if code for message embedding can be received using getMessageEmbeddingCode CanGetEmbeddingCode bool `json:"can_get_embedding_code"` // True, if a link can be generated for the message using getMessageLink @@ -34981,7 +35257,7 @@ func (*ResendCodeReasonUserRequest) ResendCodeReasonType() string { // The code is re-sent, because device verification has failed type ResendCodeReasonVerificationFailed struct { meta - // Cause of the verification failure, for example, PLAY_SERVICES_NOT_AVAILABLE, APNS_RECEIVE_TIMEOUT, or APNS_INIT_FAILED + // Cause of the verification failure, for example, "PLAY_SERVICES_NOT_AVAILABLE", "APNS_RECEIVE_TIMEOUT", or "APNS_INIT_FAILED" ErrorMessage string `json:"error_message"` } @@ -49650,7 +49926,7 @@ func (*InternalLinkTypeGame) InternalLinkTypeType() string { return TypeInternalLinkTypeGame } -// The link is a link to a group call that isn't bound to a chat. Call joinGroupCall with the given invite_link +// The link is a link to a group call that isn't bound to a chat. Use getGroupCallParticipants to get the list of group call participants and show them on the join group call screen. Call joinGroupCall with the given invite_link to join the call type InternalLinkTypeGroupCall struct { meta // Internal representation of the invite link @@ -54541,7 +54817,7 @@ func (*VectorPathCommandLine) VectorPathCommandType() string { return TypeVectorPathCommandLine } -// A cubic Bézier curve to a given point +// A cubic Bézier curve to a given point type VectorPathCommandCubicBezierCurve struct { meta // The start control point of the curve @@ -56538,6 +56814,85 @@ func (*UpdateSavedMessagesTopicCount) UpdateType() string { return TypeUpdateSavedMessagesTopicCount } +// Basic information about a topic in a channel direct messages chat administered by the current user has changed. This update is guaranteed to come before the topic identifier is returned to the application +type UpdateDirectMessagesChatTopic struct { + meta + // New data about the topic + Topic *DirectMessagesChatTopic `json:"topic"` +} + +func (entity *UpdateDirectMessagesChatTopic) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateDirectMessagesChatTopic + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateDirectMessagesChatTopic) GetClass() string { + return ClassUpdate +} + +func (*UpdateDirectMessagesChatTopic) GetType() string { + return TypeUpdateDirectMessagesChatTopic +} + +func (*UpdateDirectMessagesChatTopic) UpdateType() string { + return TypeUpdateDirectMessagesChatTopic +} + +// Number of messages in a topic has changed; for Saved Messages and channel direct messages chat topics only +type UpdateTopicMessageCount struct { + meta + // Identifier of the chat in topic of which the number of messages has changed + ChatId int64 `json:"chat_id"` + // Identifier of the topic + TopicId MessageTopic `json:"topic_id"` + // Approximate number of messages in the topics + MessageCount int32 `json:"message_count"` +} + +func (entity *UpdateTopicMessageCount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateTopicMessageCount + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateTopicMessageCount) GetClass() string { + return ClassUpdate +} + +func (*UpdateTopicMessageCount) GetType() string { + return TypeUpdateTopicMessageCount +} + +func (*UpdateTopicMessageCount) UpdateType() string { + return TypeUpdateTopicMessageCount +} + +func (updateTopicMessageCount *UpdateTopicMessageCount) UnmarshalJSON(data []byte) error { + var tmp struct { + ChatId int64 `json:"chat_id"` + TopicId json.RawMessage `json:"topic_id"` + MessageCount int32 `json:"message_count"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + updateTopicMessageCount.ChatId = tmp.ChatId + updateTopicMessageCount.MessageCount = tmp.MessageCount + + fieldTopicId, _ := UnmarshalMessageTopic(tmp.TopicId) + updateTopicMessageCount.TopicId = fieldTopicId + + return nil +} + // Basic information about a quick reply shortcut has changed. This update is guaranteed to come before the quick shortcut name is returned to the application type UpdateQuickReplyShortcut struct { meta @@ -56688,6 +57043,10 @@ type UpdateForumTopic struct { LastReadInboxMessageId int64 `json:"last_read_inbox_message_id"` // Identifier of the last read outgoing message LastReadOutboxMessageId int64 `json:"last_read_outbox_message_id"` + // Number of unread messages with a mention/reply in the topic + UnreadMentionCount int32 `json:"unread_mention_count"` + // Number of messages with unread reactions in the topic + UnreadReactionCount int32 `json:"unread_reaction_count"` // Notification settings for the topic NotificationSettings *ChatNotificationSettings `json:"notification_settings"` } diff --git a/client/unmarshaler.go b/client/unmarshaler.go index d5efa81..6adae01 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -1599,6 +1599,43 @@ func UnmarshalListOfPaidReactionType(dataList []json.RawMessage) ([]PaidReaction return list, nil } +func UnmarshalMessageTopic(data json.RawMessage) (MessageTopic, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeMessageTopicForum: + return UnmarshalMessageTopicForum(data) + + case TypeMessageTopicDirectMessages: + return UnmarshalMessageTopicDirectMessages(data) + + case TypeMessageTopicSavedMessages: + return UnmarshalMessageTopicSavedMessages(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfMessageTopic(dataList []json.RawMessage) ([]MessageTopic, error) { + list := []MessageTopic{} + + for _, data := range dataList { + entity, err := UnmarshalMessageTopic(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalMessageEffectType(data json.RawMessage) (MessageEffectType, error) { var meta meta @@ -1756,6 +1793,9 @@ func UnmarshalMessageSource(data json.RawMessage) (MessageSource, error) { case TypeMessageSourceForumTopicHistory: return UnmarshalMessageSourceForumTopicHistory(data) + case TypeMessageSourceDirectMessagesChatTopicHistory: + return UnmarshalMessageSourceDirectMessagesChatTopicHistory(data) + case TypeMessageSourceHistoryPreview: return UnmarshalMessageSourceHistoryPreview(data) @@ -3608,6 +3648,9 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessagePaidMessagePriceChanged: return UnmarshalMessagePaidMessagePriceChanged(data) + case TypeMessageDirectMessagePriceChanged: + return UnmarshalMessageDirectMessagePriceChanged(data) + case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) @@ -8393,6 +8436,12 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateSavedMessagesTopicCount: return UnmarshalUpdateSavedMessagesTopicCount(data) + case TypeUpdateDirectMessagesChatTopic: + return UnmarshalUpdateDirectMessagesChatTopic(data) + + case TypeUpdateTopicMessageCount: + return UnmarshalUpdateTopicMessageCount(data) + case TypeUpdateQuickReplyShortcut: return UnmarshalUpdateQuickReplyShortcut(data) @@ -11484,6 +11533,30 @@ func UnmarshalUnreadReaction(data json.RawMessage) (*UnreadReaction, error) { return &resp, err } +func UnmarshalMessageTopicForum(data json.RawMessage) (*MessageTopicForum, error) { + var resp MessageTopicForum + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageTopicDirectMessages(data json.RawMessage) (*MessageTopicDirectMessages, error) { + var resp MessageTopicDirectMessages + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageTopicSavedMessages(data json.RawMessage) (*MessageTopicSavedMessages, error) { + var resp MessageTopicSavedMessages + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageEffectTypeEmojiReaction(data json.RawMessage) (*MessageEffectTypeEmojiReaction, error) { var resp MessageEffectTypeEmojiReaction @@ -11692,6 +11765,14 @@ func UnmarshalMessageSourceForumTopicHistory(data json.RawMessage) (*MessageSour return &resp, err } +func UnmarshalMessageSourceDirectMessagesChatTopicHistory(data json.RawMessage) (*MessageSourceDirectMessagesChatTopicHistory, error) { + var resp MessageSourceDirectMessagesChatTopicHistory + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageSourceHistoryPreview(data json.RawMessage) (*MessageSourceHistoryPreview, error) { var resp MessageSourceHistoryPreview @@ -12572,6 +12653,14 @@ func UnmarshalSavedMessagesTopic(data json.RawMessage) (*SavedMessagesTopic, err return &resp, err } +func UnmarshalDirectMessagesChatTopic(data json.RawMessage) (*DirectMessagesChatTopic, error) { + var resp DirectMessagesChatTopic + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalForumTopicIcon(data json.RawMessage) (*ForumTopicIcon, error) { var resp ForumTopicIcon @@ -14836,6 +14925,14 @@ func UnmarshalMessagePaidMessagePriceChanged(data json.RawMessage) (*MessagePaid return &resp, err } +func UnmarshalMessageDirectMessagePriceChanged(data json.RawMessage) (*MessageDirectMessagePriceChanged, error) { + var resp MessageDirectMessagePriceChanged + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageContactRegistered(data json.RawMessage) (*MessageContactRegistered, error) { var resp MessageContactRegistered @@ -21948,6 +22045,22 @@ func UnmarshalUpdateSavedMessagesTopicCount(data json.RawMessage) (*UpdateSavedM return &resp, err } +func UnmarshalUpdateDirectMessagesChatTopic(data json.RawMessage) (*UpdateDirectMessagesChatTopic, error) { + var resp UpdateDirectMessagesChatTopic + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateTopicMessageCount(data json.RawMessage) (*UpdateTopicMessageCount, error) { + var resp UpdateTopicMessageCount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateQuickReplyShortcut(data json.RawMessage) (*UpdateQuickReplyShortcut, error) { var resp UpdateQuickReplyShortcut @@ -23929,6 +24042,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUnreadReaction: return UnmarshalUnreadReaction(data) + case TypeMessageTopicForum: + return UnmarshalMessageTopicForum(data) + + case TypeMessageTopicDirectMessages: + return UnmarshalMessageTopicDirectMessages(data) + + case TypeMessageTopicSavedMessages: + return UnmarshalMessageTopicSavedMessages(data) + case TypeMessageEffectTypeEmojiReaction: return UnmarshalMessageEffectTypeEmojiReaction(data) @@ -24007,6 +24129,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageSourceForumTopicHistory: return UnmarshalMessageSourceForumTopicHistory(data) + case TypeMessageSourceDirectMessagesChatTopicHistory: + return UnmarshalMessageSourceDirectMessagesChatTopicHistory(data) + case TypeMessageSourceHistoryPreview: return UnmarshalMessageSourceHistoryPreview(data) @@ -24337,6 +24462,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSavedMessagesTopic: return UnmarshalSavedMessagesTopic(data) + case TypeDirectMessagesChatTopic: + return UnmarshalDirectMessagesChatTopic(data) + case TypeForumTopicIcon: return UnmarshalForumTopicIcon(data) @@ -25186,6 +25314,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessagePaidMessagePriceChanged: return UnmarshalMessagePaidMessagePriceChanged(data) + case TypeMessageDirectMessagePriceChanged: + return UnmarshalMessageDirectMessagePriceChanged(data) + case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) @@ -27853,6 +27984,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateSavedMessagesTopicCount: return UnmarshalUpdateSavedMessagesTopicCount(data) + case TypeUpdateDirectMessagesChatTopic: + return UnmarshalUpdateDirectMessagesChatTopic(data) + + case TypeUpdateTopicMessageCount: + return UnmarshalUpdateTopicMessageCount(data) + case TypeUpdateQuickReplyShortcut: return UnmarshalUpdateQuickReplyShortcut(data) diff --git a/data/td_api.tl b/data/td_api.tl index b4ebb53..5b4847b 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -838,9 +838,10 @@ inputChatPhotoSticker sticker:chatPhotoSticker = InputChatPhoto; chatPermissions can_send_basic_messages:Bool can_send_audios:Bool can_send_documents:Bool can_send_photos:Bool can_send_videos:Bool can_send_video_notes:Bool can_send_voice_notes:Bool can_send_polls:Bool can_send_stickers:Bool can_send_animations:Bool can_send_games:Bool can_use_inline_bots:Bool can_add_link_previews:Bool can_change_info:Bool can_invite_users:Bool can_pin_messages:Bool can_create_topics:Bool = ChatPermissions; //@description Describes rights of the administrator -//@can_manage_chat True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report supergroup spam messages and ignore slow mode. Implied by any other privilege; applicable to supergroups and channels only +//@can_manage_chat True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report supergroup spam messages, +//-ignore slow mode, and send messages to the chat without paying Telegram Stars. Implied by any other privilege; applicable to supergroups and channels only //@can_change_info True, if the administrator can change the chat title, photo, and other settings -//@can_post_messages True, if the administrator can create channel posts or view channel statistics; applicable to channels only +//@can_post_messages True, if the administrator can create channel posts, answer to channel direct messages, or view channel statistics; applicable to channels only //@can_edit_messages True, if the administrator can edit messages of other users and pin messages; applicable to channels only //@can_delete_messages True, if the administrator can delete messages of other users //@can_invite_users True, if the administrator can invite new users to the chat @@ -1393,7 +1394,7 @@ starTransactionTypeAffiliateProgramCommission chat_id:int53 commission_per_mille //@description The transaction is a sending of a paid message; for regular users only @chat_id Identifier of the chat that received the payment @message_count Number of sent paid messages starTransactionTypePaidMessageSend chat_id:int53 message_count:int32 = StarTransactionType; -//@description The transaction is a receiving of a paid message; for regular users and supergroup chats only +//@description The transaction is a receiving of a paid message; for regular users, supergroup and channel chats only //@sender_id Identifier of the sender of the message //@message_count Number of received paid messages //@commission_per_mille The number of Telegram Stars received by the Telegram for each 1000 Telegram Stars paid for message sending @@ -1861,13 +1862,17 @@ basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int53 memb //@is_channel True, if the supergroup is a channel //@is_broadcast_group True, if the supergroup is a broadcast group, i.e. only administrators can send messages and there is no limit on the number of members //@is_forum True, if the supergroup is a forum with topics +//@is_direct_messages_group True, if the supergroup is a direct message group for a channel chat +//@is_administered_direct_messages_group True, if the supergroup is a direct messages group for a channel chat that is administered by the current user //@verification_status Information about verification status of the supergroup or channel; may be null if none +//@has_direct_messages_group True, if the channel has direct messages group +//@has_forum_tabs True, if the supergroup is a forum, which topics are shown in the same way as in channel direct messages groups //@has_sensitive_content True, if content of media messages in the supergroup or channel chat must be hidden with 18+ spoiler //@restriction_reason If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted //@paid_message_star_count Number of Telegram Stars that must be paid by non-administrator users of the supergroup chat for each sent message //@has_active_stories True, if the supergroup or channel has non-expired stories available to the current user //@has_unread_active_stories True, if the supergroup or channel has unread non-expired stories available to the current user -supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 boost_level:int32 has_automatic_translation:Bool has_linked_chat:Bool has_location:Bool sign_messages:Bool show_message_sender:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool verification_status:verificationStatus has_sensitive_content:Bool restriction_reason:string paid_message_star_count:int53 has_active_stories:Bool has_unread_active_stories:Bool = Supergroup; +supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 boost_level:int32 has_automatic_translation:Bool has_linked_chat:Bool has_location:Bool sign_messages:Bool show_message_sender:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool is_direct_messages_group:Bool is_administered_direct_messages_group:Bool verification_status:verificationStatus has_direct_messages_group:Bool has_forum_tabs:Bool has_sensitive_content:Bool restriction_reason:string paid_message_star_count:int53 has_active_stories:Bool has_unread_active_stories:Bool = Supergroup; //@description Contains full information about a supergroup or channel //@photo Chat photo; may be null if empty or unknown. If non-null, then it is the same photo as in chat.photo @@ -1877,6 +1882,7 @@ supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:Chat //@restricted_count Number of restricted users in the supergroup; 0 if unknown //@banned_count Number of users banned from chat; 0 if unknown //@linked_chat_id 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 +//@direct_messages_chat_id 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 //@slow_mode_delay Delay between consecutive sent messages for non-administrator supergroup members, in seconds //@slow_mode_delay_expires_in 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 //@can_enable_paid_messages True, if paid messages can be enabled in the supergroup chat; for supergroup only @@ -1908,7 +1914,7 @@ supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:Chat //@bot_verification Information about verification status of the supergroup or the channel provided by a bot; may be null if none or unknown //@upgraded_from_basic_group_id Identifier of the basic group from which supergroup was upgraded; 0 if none //@upgraded_from_max_message_id Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none -supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_enable_paid_messages:Bool can_enable_paid_reaction:Bool can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_get_revenue_statistics:Bool can_get_star_revenue_statistics:Bool can_send_gift:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool can_have_sponsored_messages:Bool has_aggressive_anti_spam_enabled:Bool has_paid_media_allowed:Bool has_pinned_stories:Bool gift_count:int32 my_boost_count:int32 unrestrict_boost_count:int32 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector bot_verification:botVerification upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; +supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 direct_messages_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_enable_paid_messages:Bool can_enable_paid_reaction:Bool can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_get_revenue_statistics:Bool can_get_star_revenue_statistics:Bool can_send_gift:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool can_have_sponsored_messages:Bool has_aggressive_anti_spam_enabled:Bool has_paid_media_allowed:Bool has_pinned_stories:Bool gift_count:int32 my_boost_count:int32 unrestrict_boost_count:int32 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector bot_verification:botVerification upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; //@class SecretChatState @description Describes the current secret chat state @@ -2091,6 +2097,18 @@ messageInteractionInfo view_count:int32 forward_count:int32 reply_info:messageRe unreadReaction type:ReactionType sender_id:MessageSender is_big:Bool = UnreadReaction; +//@class MessageTopic @description Describes a topic of messages in a chat + +//@description A topic in a forum supergroup chat @forum_topic_id Unique identifier of the forum topic; all messages in a non-forum supergroup chats belongs to the General topic +messageTopicForum forum_topic_id:int53 = MessageTopic; + +//@description A topic in a channel direct messages chat administered by the current user @direct_messages_chat_topic_id Unique identifier of the topic +messageTopicDirectMessages direct_messages_chat_topic_id:int53 = MessageTopic; + +//@description A topic in Saved Messages chat @saved_messages_topic_id Unique identifier of the Saved Messages topic +messageTopicSavedMessages saved_messages_topic_id:int53 = MessageTopic; + + //@class MessageEffectType @description Describes type of emoji effect //@description An effect from an emoji reaction @select_animation Select animation for the effect in TGS format @effect_animation Effect animation for the effect in TGS format @@ -2189,10 +2207,9 @@ factCheck text:formattedText country_code:string = FactCheck; //@is_outgoing True, if the message is outgoing //@is_pinned True, if the message is pinned //@is_from_offline True, if the message was sent because of a scheduled action by the message sender, for example, as away, or greeting service message -//@can_be_saved True, if content of the message can be saved locally or copied using inputMessageForwarded or forwardMessages with copy options +//@can_be_saved True, if content of the message can be saved locally //@has_timestamped_media True, if media timestamp entities refers to a media in this message as opposed to a media in the replied message //@is_channel_post True, if the message is a channel post. All messages to channels are channel posts, all other messages are not channel posts -//@is_topic_message True, if the message is a forum topic message //@contains_unread_mention True, if the message contains an unread mention for the current user //@date Point in time (Unix timestamp) when the message was sent; 0 for scheduled messages //@edit_date Point in time (Unix timestamp) when the message was last edited; 0 for scheduled messages @@ -2203,7 +2220,7 @@ factCheck text:formattedText country_code:string = FactCheck; //@fact_check Information about fact-check added to the message; may be null if none //@reply_to Information about the message or the story this message is replying to; may be null if none //@message_thread_id If non-zero, the identifier of the message thread the message belongs to; unique within the chat to which the message belongs -//@saved_messages_topic_id Identifier of the Saved Messages topic for the message; 0 for messages not from Saved Messages +//@topic_id Identifier of the topic within the chat to which the message belongs; may be null if none //@self_destruct_type The message's self-destruct type; may be null if none //@self_destruct_in Time left before the message self-destruct timer expires, in seconds; 0 if self-destruction isn't scheduled yet //@auto_delete_in Time left before the message will be automatically deleted by message_auto_delete_time setting of the chat, in seconds; 0 if never @@ -2218,7 +2235,7 @@ factCheck text:formattedText country_code:string = FactCheck; //@restriction_reason If non-empty, contains a human-readable description of the reason why access to this message must be restricted //@content Content of the message //@reply_markup Reply markup for the message; may be null if none -message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool is_from_offline:Bool can_be_saved:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector fact_check:factCheck reply_to:MessageReplyTo message_thread_id:int53 saved_messages_topic_id:int53 self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 sender_business_bot_user_id:int53 sender_boost_count:int32 paid_message_star_count:int53 author_signature:string media_album_id:int64 effect_id:int64 has_sensitive_content:Bool restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; +message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool is_from_offline:Bool can_be_saved:Bool has_timestamped_media:Bool is_channel_post:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector fact_check:factCheck reply_to:MessageReplyTo message_thread_id:int53 topic_id:MessageTopic self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 sender_business_bot_user_id:int53 sender_boost_count:int32 paid_message_star_count:int53 author_signature:string media_album_id:int64 effect_id:int64 has_sensitive_content:Bool restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; //@description Contains a list of messages @total_count Approximate total number of messages found @messages List of messages; messages may be null @@ -2255,12 +2272,15 @@ businessMessages messages:vector = BusinessMessages; //@description The message is from a chat history messageSourceChatHistory = MessageSource; -//@description The message is from a message thread history +//@description The message is from history of a message thread messageSourceMessageThreadHistory = MessageSource; -//@description The message is from a forum topic history +//@description The message is from history of a forum topic messageSourceForumTopicHistory = MessageSource; +//@description The message is from history of a topic in a channel direct messages chat administered by the current user +messageSourceDirectMessagesChatTopicHistory = MessageSource; + //@description The message is from chat, message thread or forum topic history preview messageSourceHistoryPreview = MessageSource; @@ -2892,11 +2912,27 @@ savedMessagesTopicTypeSavedFromChat chat_id:int53 = SavedMessagesTopicType; savedMessagesTopic id:int53 type:SavedMessagesTopicType is_pinned:Bool order:int64 last_message:message draft_message:draftMessage = SavedMessagesTopic; +//@description Contains information about a topic in a channel direct messages chat administered by the current user +//@chat_id Identifier of the chat to which the topic belongs +//@id Unique topic identifier +//@sender_id Identifier of the user or chat that sends the messages to the topic +//@order A parameter used to determine order of the topic in the topic list. Topics must be sorted by the order in descending order +//@is_marked_as_unread True, if the forum topic is marked as unread +//@unread_count Number of unread messages in the chat +//@last_read_inbox_message_id Identifier of the last read incoming message +//@last_read_outbox_message_id Identifier of the last read outgoing message +//@unread_reaction_count Number of messages with unread reactions in the chat +//@last_message Last message in the topic; may be null if none or unknown +//@draft_message A draft of a message in the topic; may be null if none +directMessagesChatTopic chat_id:int53 id:int53 sender_id:MessageSender order:int64 is_marked_as_unread:Bool unread_count:int53 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_reaction_count:int53 last_message:message draft_message:draftMessage = DirectMessagesChatTopic; + + //@description Describes a forum topic icon @color Color of the topic icon in RGB format @custom_emoji_id Unique identifier of the custom emoji shown on the topic icon; 0 if none forumTopicIcon color:int32 custom_emoji_id:int64 = ForumTopicIcon; //@description Contains basic information about a forum topic //@chat_id Identifier of the forum chat to which the topic belongs +//@forum_topic_id Forum topic identifier of the topic //@message_thread_id Message thread identifier of the topic //@name Name of the topic //@icon Icon of the topic @@ -2906,7 +2942,7 @@ forumTopicIcon color:int32 custom_emoji_id:int64 = ForumTopicIcon; //@is_outgoing True, if the topic was created by the current user //@is_closed True, if the topic is closed //@is_hidden True, if the topic is hidden above the topic list and closed; for General topic only -forumTopicInfo chat_id:int53 message_thread_id:int53 name:string icon:forumTopicIcon creation_date:int32 creator_id:MessageSender is_general:Bool is_outgoing:Bool is_closed:Bool is_hidden:Bool = ForumTopicInfo; +forumTopicInfo chat_id:int53 forum_topic_id:int53 message_thread_id:int53 name:string icon:forumTopicIcon creation_date:int32 creator_id:MessageSender is_general:Bool is_outgoing:Bool is_closed:Bool is_hidden:Bool = ForumTopicInfo; //@description Describes a forum topic //@info Basic information about the topic @@ -4030,8 +4066,8 @@ messageInvoice product_info:productInfo currency:string total_amount:int53 start messageCall is_video:Bool discard_reason:CallDiscardReason duration:int32 = MessageContent; //@description A message with information about a group call not bound to a chat. If the message is incoming, the call isn't active, isn't missed, and has no duration, -//-and getOption("can_accept_calls") is true, then incoming call screen must be shown to the user. Use joinGroupCall to accept the call or declineGroupCallInvitation to decline it. -//-If the call become active or missed, then the call screen must be hidden +//-and getOption("can_accept_calls") is true, then incoming call screen must be shown to the user. Use getGroupCallParticipants to show current group call participants on the screen. +//-Use joinGroupCall to accept the call or declineGroupCallInvitation to decline it. If the call become active or missed, then the call screen must be hidden //@is_active True, if the call is active, i.e. the called user joined the call //@was_missed True, if the called user missed or declined the call //@is_video True, if the call is a video call @@ -4244,6 +4280,7 @@ messageGiveawayPrizeStars star_count:int53 transaction_id:string boosted_chat_id //@description A regular gift was received or sent by the current user, or the current user was notified about a channel gift //@gift The gift //@sender_id Sender of the gift +//@receiver_id Receiver of the gift //@received_gift_id Unique identifier of the received gift for the current user; only for the receiver of the gift //@text Message added to the gift //@sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the regular gift; 0 if the gift can't be sold by the receiver @@ -4255,11 +4292,12 @@ messageGiveawayPrizeStars star_count:int53 transaction_id:string boosted_chat_id //@was_upgraded True, if the gift was upgraded to a unique gift //@was_refunded True, if the gift was refunded and isn't available anymore //@upgraded_received_gift_id Identifier of the corresponding upgraded gift; may be empty if unknown. Use getReceivedGift to get information about the gift -messageGift gift:gift sender_id:MessageSender received_gift_id:string text:formattedText sell_star_count:int53 prepaid_upgrade_star_count:int53 is_private:Bool is_saved:Bool can_be_upgraded:Bool was_converted:Bool was_upgraded:Bool was_refunded:Bool upgraded_received_gift_id:string = MessageContent; +messageGift gift:gift sender_id:MessageSender receiver_id:MessageSender received_gift_id:string text:formattedText sell_star_count:int53 prepaid_upgrade_star_count:int53 is_private:Bool is_saved:Bool can_be_upgraded:Bool was_converted:Bool was_upgraded:Bool was_refunded:Bool upgraded_received_gift_id:string = MessageContent; //@description An upgraded gift was received or sent by the current user, or the current user was notified about a channel gift //@gift The gift //@sender_id Sender of the gift; may be null for anonymous gifts +//@receiver_id Receiver of the gift //@received_gift_id Unique identifier of the received gift for the current user; only for the receiver of the gift //@is_upgrade True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift //@is_saved True, if the gift is displayed on the user's or the channel's profile page; only for the receiver of the gift @@ -4270,13 +4308,14 @@ messageGift gift:gift sender_id:MessageSender received_gift_id:string text:forma //@next_transfer_date Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift //@next_resale_date Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift //@export_date Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift -messageUpgradedGift gift:upgradedGift sender_id:MessageSender received_gift_id:string is_upgrade:Bool is_saved:Bool can_be_transferred:Bool was_transferred:Bool last_resale_star_count:int53 transfer_star_count:int53 next_transfer_date:int32 next_resale_date:int32 export_date:int32 = MessageContent; +messageUpgradedGift gift:upgradedGift sender_id:MessageSender receiver_id:MessageSender received_gift_id:string is_upgrade:Bool is_saved:Bool can_be_transferred:Bool was_transferred:Bool last_resale_star_count:int53 transfer_star_count:int53 next_transfer_date:int32 next_resale_date:int32 export_date:int32 = MessageContent; //@description A gift which purchase, upgrade or transfer were refunded //@gift The gift //@sender_id Sender of the gift +//@receiver_id Receiver of the gift //@is_upgrade True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift -messageRefundedUpgradedGift gift:gift sender_id:MessageSender is_upgrade:Bool = MessageContent; +messageRefundedUpgradedGift gift:gift sender_id:MessageSender receiver_id:MessageSender is_upgrade:Bool = MessageContent; //@description Paid messages were refunded @message_count The number of refunded messages @star_count The number of refunded Telegram Stars messagePaidMessagesRefunded message_count:int32 star_count:int53 = MessageContent; @@ -4284,6 +4323,12 @@ messagePaidMessagesRefunded message_count:int32 star_count:int53 = MessageConten //@description A price for paid messages was changed in the supergroup chat @paid_message_star_count The new number of Telegram Stars that must be paid by non-administrator users of the supergroup chat for each sent message messagePaidMessagePriceChanged paid_message_star_count:int53 = MessageContent; +//@description A price for direct messages was changed in the channel chat +//@is_enabled True, if direct messages group was enabled for the channel; false otherwise +//@paid_message_star_count The new number of Telegram Stars that must be paid by non-administrator users of the channel chat for each message sent to the direct messages group; +//-0 if the direct messages group was disabled or the messages are free +messageDirectMessagePriceChanged is_enabled:Bool paid_message_star_count:int53 = MessageContent; + //@description A contact has registered with Telegram messageContactRegistered = MessageContent; @@ -4437,21 +4482,23 @@ messageSelfDestructTypeImmediately = MessageSelfDestructType; //@description Options to be used when a message is sent +//@direct_messages_chat_topic_id Unique identifier of the topic in a channel direct messages chat administered by the current user; pass 0 if the chat isn't a channel direct messages chat administered by the current user //@disable_notification Pass true to disable notification for the message //@from_background Pass true if the message is sent from the background //@protect_content Pass true if the content of the message must be protected from forwarding and saving; for bots only //@allow_paid_broadcast Pass true to allow the message to ignore regular broadcast limits for a small fee; for bots only //@paid_message_star_count The number of Telegram Stars the user agreed to pay to send the messages //@update_order_of_installed_sticker_sets Pass true if the user explicitly chosen a sticker or a custom emoji from an installed sticker set; applicable only to sendMessage and sendMessageAlbum -//@scheduling_state Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, to a chat with paid messages, live location messages and self-destructing messages can't be scheduled +//@scheduling_state Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, to a chat with paid messages, to a channel direct messages chat, +//-live location messages and self-destructing messages can't be scheduled //@effect_id Identifier of the effect to apply to the message; pass 0 if none; applicable only to sendMessage and sendMessageAlbum in private chats //@sending_id Non-persistent identifier, which will be returned back in messageSendingStatePending object and can be used to match sent messages and corresponding updateNewMessage updates //@only_preview Pass true to get a fake message instead of actually sending them -messageSendOptions disable_notification:Bool from_background:Bool protect_content:Bool allow_paid_broadcast:Bool paid_message_star_count:int53 update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState effect_id:int64 sending_id:int32 only_preview:Bool = MessageSendOptions; +messageSendOptions direct_messages_chat_topic_id:int53 disable_notification:Bool from_background:Bool protect_content:Bool allow_paid_broadcast:Bool paid_message_star_count:int53 update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState effect_id:int64 sending_id:int32 only_preview:Bool = MessageSendOptions; //@description Options to be used when a message content is copied without reference to the original sender. Service messages, messages with messageInvoice, messagePaidMedia, messageGiveaway, or messageGiveawayWinners content can't be copied //@send_copy True, if content of the message needs to be copied without reference to the original sender. Always true if the message is forwarded to a secret chat or is local. -//-Use messageProperties.can_be_saved and messageProperties.can_be_copied_to_secret_chat to check whether the message is suitable +//-Use messageProperties.can_be_copied and messageProperties.can_be_copied_to_secret_chat to check whether the message is suitable //@replace_caption True, if media caption of the message copy needs to be replaced. Ignored if send_copy is false //@new_caption New message caption; pass null to copy message without caption. Ignored if replace_caption is false //@new_show_caption_above_media True, if new caption must be shown above the media; otherwise, new caption must be shown below the media; not supported in secret chats. Ignored if replace_caption is false @@ -4590,9 +4637,9 @@ inputMessageGame bot_user_id:int53 game_short_name:string = InputMessageContent; //@paid_media_caption Paid media caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters inputMessageInvoice invoice:invoice title:string description:string photo_url:string photo_size:int32 photo_width:int32 photo_height:int32 payload:bytes provider_token:string provider_data:string start_parameter:string paid_media:inputPaidMedia paid_media_caption:formattedText = InputMessageContent; -//@description A message with a poll. Polls can't be sent to secret chats. Polls can be sent only to a private chat with a bot +//@description A message with a poll. Polls can't be sent to secret chats and channel direct messages chats. Polls can be sent to a private chat only if the chat is a chat with a bot or the Saved Messages chat //@question Poll question; 1-255 characters (up to 300 characters for bots). Only custom emoji entities are allowed to be added and only by Premium users -//@options List of poll answer options, 2-10 strings 1-100 characters each. Only custom emoji entities are allowed to be added and only by Premium users +//@options List of poll answer options, 2-getOption("poll_answer_count_max") strings 1-100 characters each. Only custom emoji entities are allowed to be added and only by Premium users //@is_anonymous True, if the poll voters are anonymous. Non-anonymous polls can't be sent or forwarded to channels //@type Type of the poll //@open_period Amount of time the poll will be active after creation, in seconds; for bots only @@ -4616,20 +4663,22 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool rep //@description Contains properties of a message and describes actions that can be done with the message right now +//@can_be_copied True, if content of the message can be copied using inputMessageForwarded or forwardMessages with copy options //@can_be_copied_to_secret_chat True, if content of the message can be copied to a secret chat using inputMessageForwarded or forwardMessages with copy options //@can_be_deleted_only_for_self True, if the message can be deleted only for the current user while other users will continue to see it using the method deleteMessages with revoke == false //@can_be_deleted_for_all_users True, if the message can be deleted for all users using the method deleteMessages with revoke == true //@can_be_edited True, if the message can be edited using the methods editMessageText, editMessageCaption, or editMessageReplyMarkup. //-For live location and poll messages this fields shows whether editMessageLiveLocation or stopPoll can be used with this message -//@can_be_forwarded True, if the message can be forwarded using inputMessageForwarded or forwardMessages +//@can_be_forwarded True, if the message can be forwarded using inputMessageForwarded or forwardMessages without copy options //@can_be_paid True, if the message can be paid using inputInvoiceMessage //@can_be_pinned True, if the message can be pinned or unpinned in the chat using pinChatMessage or unpinChatMessage //@can_be_replied True, if the message can be replied in the same chat and forum topic using inputMessageReplyToMessage //@can_be_replied_in_another_chat True, if the message can be replied in another chat or forum topic using inputMessageReplyToExternalMessage -//@can_be_saved True, if content of the message can be saved locally or copied using inputMessageForwarded or forwardMessages with copy options +//@can_be_saved True, if content of the message can be saved locally //@can_be_shared_in_story True, if the message can be shared in a story using inputStoryAreaTypeMessage //@can_edit_media True, if the message can be edited using the method editMessageMedia //@can_edit_scheduling_state True, if scheduling state of the message can be edited +//@can_get_author True, if author of the message sent on behalf of a chat can be received through getMessageAuthor //@can_get_embedding_code True, if code for message embedding can be received using getMessageEmbeddingCode //@can_get_link True, if a link can be generated for the message using getMessageLink //@can_get_media_timestamp_links True, if media timestamp links can be generated for media timestamp entities in the message text, caption or link preview description using getMessageLink @@ -4643,7 +4692,7 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool rep //@can_report_supergroup_spam True, if the message can be reported using reportSupergroupSpam //@can_set_fact_check True, if fact check for the message can be changed through setMessageFactCheck //@need_show_statistics True, if message statistics must be available from context menu of the message -messageProperties can_be_copied_to_secret_chat:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_paid:Bool can_be_pinned:Bool can_be_replied:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_shared_in_story:Bool can_edit_media:Bool can_edit_scheduling_state:Bool can_get_embedding_code:Bool can_get_link:Bool can_get_media_timestamp_links:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_statistics:Bool can_get_viewers:Bool can_recognize_speech:Bool can_report_chat:Bool can_report_reactions:Bool can_report_supergroup_spam:Bool can_set_fact_check:Bool need_show_statistics:Bool = MessageProperties; +messageProperties can_be_copied:Bool can_be_copied_to_secret_chat:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_paid:Bool can_be_pinned:Bool can_be_replied:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_shared_in_story:Bool can_edit_media:Bool can_edit_scheduling_state:Bool can_get_author:Bool can_get_embedding_code:Bool can_get_link:Bool can_get_media_timestamp_links:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_statistics:Bool can_get_viewers:Bool can_recognize_speech:Bool can_report_chat:Bool can_report_reactions:Bool can_report_supergroup_spam:Bool can_set_fact_check:Bool need_show_statistics:Bool = MessageProperties; //@class SearchMessagesFilter @description Represents a filter for message search results @@ -5291,7 +5340,7 @@ chatBoostSlots slots:vector = ChatBoostSlots; resendCodeReasonUserRequest = ResendCodeReason; //@description The code is re-sent, because device verification has failed -//@error_message Cause of the verification failure, for example, PLAY_SERVICES_NOT_AVAILABLE, APNS_RECEIVE_TIMEOUT, or APNS_INIT_FAILED +//@error_message Cause of the verification failure, for example, "PLAY_SERVICES_NOT_AVAILABLE", "APNS_RECEIVE_TIMEOUT", or "APNS_INIT_FAILED" resendCodeReasonVerificationFailed error_message:string = ResendCodeReason; @@ -7478,7 +7527,9 @@ internalLinkTypeEditProfileSettings = InternalLinkType; //@game_short_name Short name of the game internalLinkTypeGame bot_username:string game_short_name:string = InternalLinkType; -//@description The link is a link to a group call that isn't bound to a chat. Call joinGroupCall with the given invite_link @invite_link Internal representation of the invite link +//@description The link is a link to a group call that isn't bound to a chat. Use getGroupCallParticipants to get the list of group call participants and show them on the join group call screen. +//-Call joinGroupCall with the given invite_link to join the call +//@invite_link Internal representation of the invite link internalLinkTypeGroupCall invite_link:string = InternalLinkType; //@description The link must be opened in an Instant View. Call getWebPageInstantView with the given URL to process the link. @@ -8247,7 +8298,7 @@ point x:double y:double = Point; //@description A straight line to a given point @end_point The end point of the straight line vectorPathCommandLine end_point:point = VectorPathCommand; -//@description A cubic Bézier curve to a given point @start_control_point The start control point of the curve @end_control_point The end control point of the curve @end_point The end point of the curve +//@description A cubic Bézier curve to a given point @start_control_point The start control point of the curve @end_control_point The end control point of the curve @end_point The end point of the curve vectorPathCommandCubicBezierCurve start_control_point:point end_control_point:point end_point:point = VectorPathCommand; @@ -8494,6 +8545,16 @@ updateSavedMessagesTopic topic:savedMessagesTopic = Update; //@description Number of Saved Messages topics has changed @topic_count Approximate total number of Saved Messages topics updateSavedMessagesTopicCount topic_count:int32 = Update; +//@description Basic information about a topic in a channel direct messages chat administered by the current user has changed. This update is guaranteed to come before the topic identifier is returned to the application +//@topic New data about the topic +updateDirectMessagesChatTopic topic:directMessagesChatTopic = Update; + +//@description Number of messages in a topic has changed; for Saved Messages and channel direct messages chat topics only +//@chat_id Identifier of the chat in topic of which the number of messages has changed +//@topic_id Identifier of the topic +//@message_count Approximate number of messages in the topics +updateTopicMessageCount chat_id:int53 topic_id:MessageTopic message_count:int32 = Update; + //@description Basic information about a quick reply shortcut has changed. This update is guaranteed to come before the quick shortcut name is returned to the application //@shortcut New data about the shortcut updateQuickReplyShortcut shortcut:quickReplyShortcut = Update; @@ -8518,8 +8579,10 @@ updateForumTopicInfo info:forumTopicInfo = Update; //@is_pinned True, if the topic is pinned in the topic list //@last_read_inbox_message_id Identifier of the last read incoming message //@last_read_outbox_message_id Identifier of the last read outgoing message +//@unread_mention_count Number of unread messages with a mention/reply in the topic +//@unread_reaction_count Number of messages with unread reactions in the topic //@notification_settings Notification settings for the topic -updateForumTopic chat_id:int53 message_thread_id:int53 is_pinned:Bool last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 notification_settings:chatNotificationSettings = Update; +updateForumTopic chat_id:int53 message_thread_id:int53 is_pinned:Bool last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 unread_reaction_count:int32 notification_settings:chatNotificationSettings = Update; //@description Notification settings for some type of chats were updated @scope Types of chats for which notification settings were updated @notification_settings The new notification settings updateScopeNotificationSettings scope:NotificationSettingsScope notification_settings:scopeNotificationSettings = Update; @@ -9282,6 +9345,11 @@ getMessageReadDate chat_id:int53 message_id:int53 = MessageReadDate; //@message_id Identifier of the message getMessageViewers chat_id:int53 message_id:int53 = MessageViewers; +//@description Returns information about actual author of a message sent on behalf of a channel. The method can be called if messageProperties.can_get_author == true +//@chat_id Chat identifier +//@message_id Identifier of the message +getMessageAuthor chat_id:int53 message_id:int53 = User; + //@description Returns information about a file. This is an offline method @file_id Identifier of the file to get getFile file_id:int32 = File; @@ -9382,13 +9450,74 @@ checkCreatedPublicChatsLimit type:PublicChatType = Ok; //-To set a returned supergroup as a discussion group, access to its old messages must be enabled using toggleSupergroupIsAllHistoryAvailable first getSuitableDiscussionChats = Chats; -//@description Returns a list of recently inactive supergroups and channels. Can be used when user reaches limit on the number of joined supergroups and channels and receives CHANNELS_TOO_MUCH error. Also, the limit can be increased with Telegram Premium +//@description Returns a list of recently inactive supergroups and channels. Can be used when user reaches limit on the number of joined supergroups and channels and receives the error "CHANNELS_TOO_MUCH". Also, the limit can be increased with Telegram Premium getInactiveSupergroupChats = Chats; //@description Returns a list of channel chats, which can be used as a personal chat getSuitablePersonalChats = Chats; +//@description Loads more topics in a channel direct messages chat administered by the current user. The loaded topics will be sent through updateDirectMessagesChatTopic. +//-Topics are sorted by their topic.order in descending order. Returns a 404 error if all topics have been loaded +//@chat_id Chat identifier of the channel direct messages chat +//@limit The maximum number of topics to be loaded. For optimal performance, the number of loaded topics is chosen by TDLib and can be smaller than the specified limit, even if the end of the list is not reached +loadDirectMessagesChatTopics chat_id:int53 limit:int32 = Ok; + +//@description Returns information about the topic in a channel direct messages chat administered by the current user +//@chat_id Chat identifier of the channel direct messages chat +//@topic_id Identifier of the topic to get +getDirectMessagesChatTopic chat_id:int53 topic_id:int53 = DirectMessagesChatTopic; + +//@description Returns messages in the topic in a channel direct messages chat administered by the current user. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id) +//@chat_id Chat identifier of the channel direct messages chat +//@topic_id Identifier of the topic which messages will be fetched +//@from_message_id Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message +//@offset Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages +//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. +//-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit +getDirectMessagesChatTopicHistory chat_id:int53 topic_id:int53 from_message_id:int53 offset:int32 limit:int32 = Messages; + +//@description Returns the last message sent in the topic in a channel direct messages chat administered by the current user no later than the specified date +//@chat_id Chat identifier of the channel direct messages chat +//@topic_id Identifier of the topic which messages will be fetched +//@date Point in time (Unix timestamp) relative to which to search for messages +getDirectMessagesChatTopicMessageByDate chat_id:int53 topic_id:int53 date:int32 = Message; + +//@description Deletes all messages in the topic in a channel direct messages chat administered by the current user +//@chat_id Chat identifier of the channel direct messages chat +//@topic_id Identifier of the topic which messages will be deleted +deleteDirectMessagesChatTopicHistory chat_id:int53 topic_id:int53 = Ok; + +//@description Deletes all messages between the specified dates in the topic in a channel direct messages chat administered by the current user. Messages sent in the last 30 seconds will not be deleted +//@chat_id Chat identifier of the channel direct messages chat +//@topic_id Identifier of the topic which messages will be deleted +//@min_date The minimum date of the messages to delete +//@max_date The maximum date of the messages to delete +deleteDirectMessagesChatTopicMessagesByDate chat_id:int53 topic_id:int53 min_date:int32 max_date:int32 = Ok; + +//@description Changes the marked as unread state of the topic in a channel direct messages chat administered by the current user +//@chat_id Chat identifier of the channel direct messages chat +//@topic_id Topic identifier +//@is_marked_as_unread New value of is_marked_as_unread +setDirectMessagesChatTopicIsMarkedAsUnread chat_id:int53 topic_id:int53 is_marked_as_unread:Bool = Ok; + +//@description Changes the draft message in the topic in a channel direct messages chat administered by the current user +//@chat_id Chat identifier +//@topic_id Topic identifier +//@draft_message New draft message; pass null to remove the draft. All files in draft message content must be of the type inputFileLocal. Media thumbnails and captions are ignored +setDirectMessagesChatTopicDraftMessage chat_id:int53 topic_id:int53 draft_message:draftMessage = Ok; + +//@description Removes all pinned messages from the topic in a channel direct messages chat administered by the current user +//@chat_id Identifier of the chat +//@topic_id Topic identifier +unpinAllDirectMessagesChatTopicMessages chat_id:int53 topic_id:int53 = Ok; + +//@description Removes all unread reactions in the topic in a channel direct messages chat administered by the current user +//@chat_id Identifier of the chat +//@topic_id Topic identifier +readAllDirectMessagesChatTopicReactions chat_id:int53 topic_id:int53 = Ok; + + //@description Loads more Saved Messages topics. The loaded topics will be sent through updateSavedMessagesTopic. Topics are sorted by their topic.order in descending order. Returns a 404 error if all topics have been loaded //@limit The maximum number of topics to be loaded. For optimal performance, the number of loaded topics is chosen by TDLib and can be smaller than the specified limit, even if the end of the list is not reached loadSavedMessagesTopics limit:int32 = Ok; @@ -9464,8 +9593,9 @@ deleteChat chat_id:int53 = Ok; //@description Searches for messages with given words in the chat. Returns the results in reverse chronological order, i.e. in order of decreasing message_id. Cannot be used in secret chats with a non-empty query //-(searchSecretMessages must be used instead), or without an enabled message database. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit. -//-A combination of query, sender_id, filter and message_thread_id search criteria is expected to be supported, only if it is required for Telegram official application implementation +//-A combination of query, sender_id, filter and topic_id search criteria is expected to be supported, only if it is required for Telegram official application implementation //@chat_id Identifier of the chat in which to search messages +//@topic_id Pass topic identifier to search messages only in specific topic; pass null to search for messages in all topics //@query Query to search for //@sender_id Identifier of the sender of messages to search for; pass null to search for messages from any sender. Not supported in secret chats //@from_message_id Identifier of the message starting from which history must be fetched; use 0 to get results from the last message @@ -9473,9 +9603,7 @@ deleteChat chat_id:int53 = Ok; //@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than -offset. //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit //@filter Additional filter for messages to search; pass null to search for all messages -//@message_thread_id If not 0, only messages in the specified thread will be returned; supergroups only -//@saved_messages_topic_id If not 0, only messages in the specified Saved Messages topic will be returned; pass 0 to return all messages, or for chats other than Saved Messages -searchChatMessages chat_id:int53 query:string sender_id:MessageSender from_message_id:int53 offset:int32 limit:int32 filter:SearchMessagesFilter message_thread_id:int53 saved_messages_topic_id:int53 = FoundChatMessages; +searchChatMessages chat_id:int53 topic_id:MessageTopic query:string sender_id:MessageSender from_message_id:int53 offset:int32 limit:int32 filter:SearchMessagesFilter = FoundChatMessages; //@description Searches for messages in all chats except secret chats. Returns the results in reverse chronological order (i.e., in order of decreasing (date, chat_id, message_id)). //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit @@ -9577,25 +9705,24 @@ getChatSparseMessagePositions chat_id:int53 filter:SearchMessagesFilter from_mes //@description Returns information about the next messages of the specified type in the chat split by days. Returns the results in reverse chronological order. Can return partial result for the last returned day. Behavior of this method depends on the value of the option "utc_time_offset" //@chat_id Identifier of the chat in which to return information about messages +//@topic_id Pass topic identifier to get the result only in specific topic; pass null to get the result in all topics; forum topics aren't supported //@filter Filter for message content. Filters searchMessagesFilterEmpty, searchMessagesFilterMention, searchMessagesFilterUnreadMention, and searchMessagesFilterUnreadReaction are unsupported in this function //@from_message_id The message identifier from which to return information about messages; use 0 to get results from the last message -//@saved_messages_topic_id If not0, only messages in the specified Saved Messages topic will be considered; pass 0 to consider all messages, or for chats other than Saved Messages -getChatMessageCalendar chat_id:int53 filter:SearchMessagesFilter from_message_id:int53 saved_messages_topic_id:int53 = MessageCalendar; +getChatMessageCalendar chat_id:int53 topic_id:MessageTopic filter:SearchMessagesFilter from_message_id:int53 = MessageCalendar; -//@description Returns approximate number of messages of the specified type in the chat +//@description Returns approximate number of messages of the specified type in the chat or its topic //@chat_id Identifier of the chat in which to count messages +//@topic_id Pass topic identifier to get number of messages only in specific topic; pass null to get number of messages in all topics //@filter Filter for message content; searchMessagesFilterEmpty is unsupported in this function -//@saved_messages_topic_id If not 0, only messages in the specified Saved Messages topic will be counted; pass 0 to count all messages, or for chats other than Saved Messages //@return_local Pass true to get the number of messages without sending network requests, or -1 if the number of messages is unknown locally -getChatMessageCount chat_id:int53 filter:SearchMessagesFilter saved_messages_topic_id:int53 return_local:Bool = Count; +getChatMessageCount chat_id:int53 topic_id:MessageTopic filter:SearchMessagesFilter return_local:Bool = Count; -//@description Returns approximate 1-based position of a message among messages, which can be found by the specified filter in the chat. Cannot be used in secret chats +//@description Returns approximate 1-based position of a message among messages, which can be found by the specified filter in the chat and topic. Cannot be used in secret chats //@chat_id Identifier of the chat in which to find message position -//@message_id Message identifier +//@topic_id Pass topic identifier to get position among messages only in specific topic; pass null to get position among all chat messages //@filter Filter for message content; searchMessagesFilterEmpty, searchMessagesFilterUnreadMention, searchMessagesFilterUnreadReaction, and searchMessagesFilterFailedToSend are unsupported in this function -//@message_thread_id If not 0, only messages in the specified thread will be considered; supergroups only -//@saved_messages_topic_id If not 0, only messages in the specified Saved Messages topic will be considered; pass 0 to consider all relevant messages, or for chats other than Saved Messages -getChatMessagePosition chat_id:int53 message_id:int53 filter:SearchMessagesFilter message_thread_id:int53 saved_messages_topic_id:int53 = Count; +//@message_id Message identifier +getChatMessagePosition chat_id:int53 topic_id:MessageTopic filter:SearchMessagesFilter message_id:int53 = Count; //@description Returns all scheduled messages in a chat. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id) @chat_id Chat identifier getChatScheduledMessages chat_id:int53 = Messages; @@ -9732,7 +9859,7 @@ sendInlineQueryResultMessage chat_id:int53 message_thread_id:int53 reply_to:Inpu //@message_ids Identifiers of the messages to forward. Message identifiers must be in a strictly increasing order. At most 100 messages can be forwarded simultaneously. A message can be forwarded only if messageProperties.can_be_forwarded //@options Options to be used to send the messages; pass null to use default options //@send_copy Pass true to copy content of the messages without reference to the original sender. Always true if the messages are forwarded to a secret chat or are local. -//-Use messageProperties.can_be_saved and messageProperties.can_be_copied_to_secret_chat to check whether the message is suitable +//-Use messageProperties.can_be_copied and messageProperties.can_be_copied_to_secret_chat to check whether the message is suitable //@remove_caption Pass true to remove media captions of message copies. Ignored if send_copy is false forwardMessages chat_id:int53 message_thread_id:int53 from_chat_id:int53 message_ids:vector options:messageSendOptions send_copy:Bool remove_caption:Bool = Messages; @@ -9754,7 +9881,7 @@ resendMessages chat_id:int53 message_ids:vector quote:inputTextQuote paid sendChatScreenshotTakenNotification chat_id:int53 = Ok; //@description Adds a local message to a chat. The message is persistent across application restarts only if the message database is used. Returns the added message -//@chat_id Target chat +//@chat_id Target chat; channel direct messages chats aren't supported //@sender_id Identifier of the sender of the message //@reply_to Information about the message or story to be replied; pass null if none //@disable_notification Pass true to disable notification for the message @@ -10405,10 +10532,11 @@ sendWebAppData bot_user_id:int53 button_text:string data:string = Ok; //@chat_id Identifier of the chat in which the Web App is opened. The Web App can't be opened in secret chats //@bot_user_id Identifier of the bot, providing the Web App. If the bot is restricted for the current user, then show an error instead of calling the method //@url The URL from an inlineKeyboardButtonTypeWebApp button, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an empty string otherwise -//@message_thread_id If not 0, the message thread identifier in which the message will be sent +//@message_thread_id If not 0, the message thread identifier to which the message will be sent +//@direct_messages_chat_topic_id If not 0, unique identifier of the topic of channel direct messages chat to which the message will be sent //@reply_to Information about the message or story to be replied in the message sent by the Web App; pass null if none //@parameters Parameters to use to open the Web App -openWebApp chat_id:int53 bot_user_id:int53 url:string message_thread_id:int53 reply_to:InputMessageReplyTo parameters:webAppOpenParameters = WebAppInfo; +openWebApp chat_id:int53 bot_user_id:int53 url:string message_thread_id:int53 direct_messages_chat_topic_id:int53 reply_to:InputMessageReplyTo parameters:webAppOpenParameters = WebAppInfo; //@description Informs TDLib that a previously opened Web App was closed @web_app_launch_id Identifier of Web App launch, received from openWebApp closeWebApp web_app_launch_id:int64 = Ok; @@ -10754,6 +10882,13 @@ setChatDescription chat_id:int53 description:string = Ok; //-Basic group chats must be first upgraded to supergroup chats. If new chat members don't have access to old messages in the supergroup, then toggleSupergroupIsAllHistoryAvailable must be used first to change that setChatDiscussionGroup chat_id:int53 discussion_chat_id:int53 = Ok; +//@description Changes direct messages group settings for a channel chat; requires owner privileges in the chat +//@chat_id Identifier of the channel chat +//@is_enabled Pass true if the direct messages group is enabled for the channel chat; pass false otherwise +//@paid_message_star_count The new number of Telegram Stars that must be paid for each message that is sent to the direct messages chat unless the sender is an administrator of the channel chat; 0-getOption("paid_message_star_count_max"). +//-The channel will receive getOption("paid_message_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for message sending. Requires supergroupFullInfo.can_enable_paid_messages for positive amounts +setChatDirectMessagesGroup chat_id:int53 is_enabled:Bool paid_message_star_count:int53 = Ok; + //@description Changes the location of a chat. Available only for some location-based supergroups, use supergroupFullInfo.can_set_location to check whether the method is allowed to use @chat_id Chat identifier @location New location for the chat; must be valid and not null setChatLocation chat_id:int53 location:chatLocation = Ok; @@ -11202,7 +11337,7 @@ searchFileDownloads query:string only_active:Bool only_completed:Bool offset:str //@description Application or reCAPTCHA verification has been completed. Can be called before authorization //@verification_id Unique identifier for the verification process as received from updateApplicationVerificationRequired or updateApplicationRecaptchaVerificationRequired //@token Play Integrity API token for the Android application, or secret from push notification for the iOS application for application verification, or reCAPTCHA token for reCAPTCHA verifications; -//-pass an empty string to abort verification and receive error VERIFICATION_FAILED for the request +//-pass an empty string to abort verification and receive the error "VERIFICATION_FAILED" for the request setApplicationVerificationToken verification_id:int53 token:string = Ok; @@ -11462,11 +11597,11 @@ toggleGroupCallIsMyVideoPaused group_call_id:int32 is_my_video_paused:Bool = Ok; //@description Toggles whether current user's video is enabled @group_call_id Group call identifier @is_my_video_enabled Pass true if the current user's video is enabled toggleGroupCallIsMyVideoEnabled group_call_id:int32 is_my_video_enabled:Bool = Ok; -//@description Informs TDLib that speaking state of a participant of an active group call has changed +//@description Informs TDLib that speaking state of a participant of an active group call has changed. Returns identifier of the participant if it is found //@group_call_id Group call identifier //@audio_source Group call participant's synchronization audio source identifier, or 0 for the current user //@is_speaking Pass true if the user is speaking -setGroupCallParticipantIsSpeaking group_call_id:int32 audio_source:int32 is_speaking:Bool = Ok; +setGroupCallParticipantIsSpeaking group_call_id:int32 audio_source:int32 is_speaking:Bool = MessageSender; //@description Toggles whether a participant of an active group call is muted, unmuted, or allowed to unmute themselves //@group_call_id Group call identifier @@ -12164,8 +12299,11 @@ toggleSupergroupHasHiddenMembers supergroup_id:int53 has_hidden_members:Bool = O //@has_aggressive_anti_spam_enabled The new value of has_aggressive_anti_spam_enabled toggleSupergroupHasAggressiveAntiSpamEnabled supergroup_id:int53 has_aggressive_anti_spam_enabled:Bool = Ok; -//@description Toggles whether the supergroup is a forum; requires owner privileges in the supergroup. Discussion supergroups can't be converted to forums @supergroup_id Identifier of the supergroup @is_forum New value of is_forum -toggleSupergroupIsForum supergroup_id:int53 is_forum:Bool = Ok; +//@description Toggles whether the supergroup is a forum; requires owner privileges in the supergroup. Discussion supergroups can't be converted to forums +//@supergroup_id Identifier of the supergroup +//@is_forum New value of is_forum +//@has_forum_tabs New value of has_forum_tabs; ignored if is_forum is false +toggleSupergroupIsForum supergroup_id:int53 is_forum:Bool has_forum_tabs:Bool = Ok; //@description Upgrades supergroup to a broadcast group; requires owner privileges in the supergroup @supergroup_id Identifier of the supergroup toggleSupergroupIsBroadcastGroup supergroup_id:int53 = Ok; From 51f3ce0659570178da6a644de60f54b4e99fdde4 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Wed, 2 Jul 2025 23:52:52 +0800 Subject: [PATCH 46/54] Update to TDLib 1.8.51 --- client/function.go | 340 +++++++++++++++++++++++++++- client/type.go | 501 ++++++++++++++++++++++++++++++++++++++++-- client/unmarshaler.go | 197 ++++++++++++++++- data/td_api.tl | 187 ++++++++++++++-- 4 files changed, 1181 insertions(+), 44 deletions(-) diff --git a/client/function.go b/client/function.go index 072145a..c2e9384 100755 --- a/client/function.go +++ b/client/function.go @@ -1429,7 +1429,7 @@ type GetRepliedMessageRequest struct { MessageId int64 `json:"message_id"` } -// Returns information about a non-bundled message that is replied by a given message. Also, returns the pinned message, the game message, the invoice message, the message with a previously set same background, the giveaway message, and the topic creation message for messages of the types messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground, messageGiveawayCompleted and topic messages without non-bundled replied message respectively. Returns a 404 error if the message doesn't exist +// Returns information about a non-bundled message that is replied by a given message. Also, returns the pinned message, the game message, the invoice message, the message with a previously set same background, the giveaway message, the checklist message, and the topic creation message for messages of the types messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground, messageGiveawayCompleted, messageChecklistTasksDone and messageChecklistTasksAdded, and topic messages without non-bundled replied message respectively. Returns a 404 error if the message doesn't exist func (client *Client) GetRepliedMessage(req *GetRepliedMessageRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -2768,6 +2768,70 @@ func (client *Client) ReadAllDirectMessagesChatTopicReactions(req *ReadAllDirect return UnmarshalOk(result.Data) } +type GetDirectMessagesChatTopicRevenueRequest struct { + // Chat identifier of the channel direct messages chat administered by the current user + ChatId int64 `json:"chat_id"` + // Identifier of the topic + TopicId int64 `json:"topic_id"` +} + +// Returns the total number of Telegram Stars received by the channel chat for direct messages from the given topic +func (client *Client) GetDirectMessagesChatTopicRevenue(req *GetDirectMessagesChatTopicRevenueRequest) (*StarCount, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getDirectMessagesChatTopicRevenue", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStarCount(result.Data) +} + +type ToggleDirectMessagesChatTopicCanSendUnpaidMessagesRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Identifier of the topic + TopicId int64 `json:"topic_id"` + // Pass true to allow unpaid messages; pass false to disallow unpaid messages + CanSendUnpaidMessages bool `json:"can_send_unpaid_messages"` + // Pass true to refund the user previously paid messages + RefundPayments bool `json:"refund_payments"` +} + +// Allows to send unpaid messages to the given topic of the channel direct messages chat administered by the current user +func (client *Client) ToggleDirectMessagesChatTopicCanSendUnpaidMessages(req *ToggleDirectMessagesChatTopicCanSendUnpaidMessagesRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleDirectMessagesChatTopicCanSendUnpaidMessages", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + "can_send_unpaid_messages": req.CanSendUnpaidMessages, + "refund_payments": req.RefundPayments, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type LoadSavedMessagesTopicsRequest struct { // The maximum number of topics to be loaded. For optimal performance, the number of loaded topics is chosen by TDLib and can be smaller than the specified limit, even if the end of the list is not reached Limit int32 `json:"limit"` @@ -4075,6 +4139,134 @@ func (client *Client) ReportSponsoredChat(req *ReportSponsoredChatRequest) (Repo } } +type GetVideoMessageAdvertisementsRequest struct { + // Identifier of the chat with the message + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` +} + +// Returns advertisements to be shown while a video from a message is watched. Available only if messageProperties.can_get_video_advertisements +func (client *Client) GetVideoMessageAdvertisements(req *GetVideoMessageAdvertisementsRequest) (*VideoMessageAdvertisements, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getVideoMessageAdvertisements", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalVideoMessageAdvertisements(result.Data) +} + +type ViewVideoMessageAdvertisementRequest struct { + // Unique identifier of the advertisement + AdvertisementUniqueId int64 `json:"advertisement_unique_id"` +} + +// Informs TDLib that the user viewed a video message advertisement +func (client *Client) ViewVideoMessageAdvertisement(req *ViewVideoMessageAdvertisementRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "viewVideoMessageAdvertisement", + }, + Data: map[string]interface{}{ + "advertisement_unique_id": req.AdvertisementUniqueId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ClickVideoMessageAdvertisementRequest struct { + // Unique identifier of the advertisement + AdvertisementUniqueId int64 `json:"advertisement_unique_id"` +} + +// Informs TDLib that the user clicked a video message advertisement +func (client *Client) ClickVideoMessageAdvertisement(req *ClickVideoMessageAdvertisementRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "clickVideoMessageAdvertisement", + }, + Data: map[string]interface{}{ + "advertisement_unique_id": req.AdvertisementUniqueId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ReportVideoMessageAdvertisementRequest struct { + // Unique identifier of the advertisement + AdvertisementUniqueId int64 `json:"advertisement_unique_id"` + // Option identifier chosen by the user; leave empty for the initial request + OptionId []byte `json:"option_id"` +} + +// Reports a video message advertisement to Telegram moderators +func (client *Client) ReportVideoMessageAdvertisement(req *ReportVideoMessageAdvertisementRequest) (ReportSponsoredResult, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reportVideoMessageAdvertisement", + }, + Data: map[string]interface{}{ + "advertisement_unique_id": req.AdvertisementUniqueId, + "option_id": req.OptionId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypeReportSponsoredResultOk: + return UnmarshalReportSponsoredResultOk(result.Data) + + case TypeReportSponsoredResultFailed: + return UnmarshalReportSponsoredResultFailed(result.Data) + + case TypeReportSponsoredResultOptionRequired: + return UnmarshalReportSponsoredResultOptionRequired(result.Data) + + case TypeReportSponsoredResultAdsHidden: + return UnmarshalReportSponsoredResultAdsHidden(result.Data) + + case TypeReportSponsoredResultPremiumRequired: + return UnmarshalReportSponsoredResultPremiumRequired(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + type RemoveNotificationRequest struct { // Identifier of notification group to which the notification belongs NotificationGroupId int32 `json:"notification_group_id"` @@ -4911,6 +5103,41 @@ func (client *Client) EditMessageLiveLocation(req *EditMessageLiveLocationReques return UnmarshalMessage(result.Data) } +type EditMessageChecklistRequest struct { + // The chat the message belongs to + ChatId int64 `json:"chat_id"` + // Identifier of the message. Use messageProperties.can_be_edited to check whether the message can be edited + MessageId int64 `json:"message_id"` + // The new message reply markup; pass null if none; for bots only + ReplyMarkup ReplyMarkup `json:"reply_markup"` + // The new checklist. If some tasks were completed, this information will be kept + Checklist *InputChecklist `json:"checklist"` +} + +// Edits the message content of a checklist. Returns the edited message after the edit is completed on the server side +func (client *Client) EditMessageChecklist(req *EditMessageChecklistRequest) (*Message, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editMessageChecklist", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "reply_markup": req.ReplyMarkup, + "checklist": req.Checklist, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessage(result.Data) +} + type EditMessageMediaRequest struct { // The chat the message belongs to ChatId int64 `json:"chat_id"` @@ -5425,6 +5652,44 @@ func (client *Client) EditBusinessMessageLiveLocation(req *EditBusinessMessageLi return UnmarshalBusinessMessage(result.Data) } +type EditBusinessMessageChecklistRequest struct { + // Unique identifier of business connection on behalf of which the message was sent + BusinessConnectionId string `json:"business_connection_id"` + // The chat the message belongs to + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` + // The new message reply markup; pass null if none + ReplyMarkup ReplyMarkup `json:"reply_markup"` + // The new checklist. If some tasks were completed, this information will be kept + Checklist *InputChecklist `json:"checklist"` +} + +// Edits the content of a checklist in a message sent on behalf of a business account; for bots only +func (client *Client) EditBusinessMessageChecklist(req *EditBusinessMessageChecklistRequest) (*BusinessMessage, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editBusinessMessageChecklist", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "chat_id": req.ChatId, + "message_id": req.MessageId, + "reply_markup": req.ReplyMarkup, + "checklist": req.Checklist, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBusinessMessage(result.Data) +} + type EditBusinessMessageMediaRequest struct { // Unique identifier of business connection on behalf of which the message was sent BusinessConnectionId string `json:"business_connection_id"` @@ -6137,7 +6402,7 @@ type AddQuickReplyShortcutMessageRequest struct { ShortcutName string `json:"shortcut_name"` // Identifier of a quick reply message in the same shortcut to be replied; pass 0 if none ReplyToMessageId int64 `json:"reply_to_message_id"` - // The content of the message to be added; inputMessagePoll, inputMessageForwarded and inputMessageLocation with live_period aren't supported + // The content of the message to be added; inputMessagePaidMedia, inputMessageForwarded and inputMessageLocation with live_period aren't supported InputMessageContent InputMessageContent `json:"input_message_content"` } @@ -6268,11 +6533,11 @@ type EditQuickReplyMessageRequest struct { ShortcutId int32 `json:"shortcut_id"` // Identifier of the message MessageId int64 `json:"message_id"` - // New content of the message. Must be one of the following types: inputMessageText, inputMessageAnimation, inputMessageAudio, inputMessageDocument, inputMessagePhoto or inputMessageVideo + // New content of the message. Must be one of the following types: inputMessageAnimation, inputMessageAudio, inputMessageChecklist, inputMessageDocument, inputMessagePhoto, inputMessageText, or inputMessageVideo InputMessageContent InputMessageContent `json:"input_message_content"` } -// Asynchronously edits the text, media or caption of a quick reply message. Use quickReplyMessage.can_be_edited to check whether a message can be edited. Media message can be edited only to a media message. The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa +// Asynchronously edits the text, media or caption of a quick reply message. Use quickReplyMessage.can_be_edited to check whether a message can be edited. Media message can be edited only to a media message. Checklist messages can be edited only to a checklist message. The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa func (client *Client) EditQuickReplyMessage(req *EditQuickReplyMessageRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -7719,6 +7984,73 @@ func (client *Client) StopPoll(req *StopPollRequest) (*Ok, error) { return UnmarshalOk(result.Data) } +type AddChecklistTasksRequest struct { + // Identifier of the chat with the message + ChatId int64 `json:"chat_id"` + // Identifier of the message containing the checklist. Use messageProperties.can_add_tasks to check whether the tasks can be added + MessageId int64 `json:"message_id"` + // List of added tasks + Tasks []*InputChecklistTask `json:"tasks"` +} + +// Adds tasks to a checklist in a message +func (client *Client) AddChecklistTasks(req *AddChecklistTasksRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addChecklistTasks", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "tasks": req.Tasks, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type MarkChecklistTasksAsDoneRequest struct { + // Identifier of the chat with the message + ChatId int64 `json:"chat_id"` + // Identifier of the message containing the checklist. Use messageProperties.can_mark_tasks_as_done to check whether the tasks can be marked as done or not done + MessageId int64 `json:"message_id"` + // Identifiers of tasks that were marked as done + MarkedAsDoneTaskIds []int32 `json:"marked_as_done_task_ids"` + // Identifiers of tasks that were marked as not done + MarkedAsNotDoneTaskIds []int32 `json:"marked_as_not_done_task_ids"` +} + +// Adds tasks of a checklist in a message as done or not done +func (client *Client) MarkChecklistTasksAsDone(req *MarkChecklistTasksAsDoneRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "markChecklistTasksAsDone", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "marked_as_done_task_ids": req.MarkedAsDoneTaskIds, + "marked_as_not_done_task_ids": req.MarkedAsNotDoneTaskIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type HideSuggestedActionRequest struct { // Suggested action to hide Action SuggestedAction `json:"action"` diff --git a/client/type.go b/client/type.go index 2fd662d..9f487c5 100755 --- a/client/type.go +++ b/client/type.go @@ -200,6 +200,10 @@ const ( ClassClosedVectorPath = "ClosedVectorPath" ClassOutline = "Outline" ClassPollOption = "PollOption" + ClassChecklistTask = "ChecklistTask" + ClassInputChecklistTask = "InputChecklistTask" + ClassChecklist = "Checklist" + ClassInputChecklist = "InputChecklist" ClassAnimation = "Animation" ClassAudio = "Audio" ClassDocument = "Document" @@ -216,6 +220,7 @@ const ( ClassWebApp = "WebApp" ClassPoll = "Poll" ClassAlternativeVideo = "AlternativeVideo" + ClassVideoStoryboard = "VideoStoryboard" ClassBackground = "Background" ClassBackgrounds = "Backgrounds" ClassChatBackground = "ChatBackground" @@ -357,11 +362,13 @@ const ( ClassMessageCalendar = "MessageCalendar" ClassBusinessMessage = "BusinessMessage" ClassBusinessMessages = "BusinessMessages" - ClassMessageSponsor = "MessageSponsor" + ClassAdvertisementSponsor = "AdvertisementSponsor" ClassSponsoredMessage = "SponsoredMessage" ClassSponsoredMessages = "SponsoredMessages" ClassSponsoredChat = "SponsoredChat" ClassSponsoredChats = "SponsoredChats" + ClassVideoMessageAdvertisement = "VideoMessageAdvertisement" + ClassVideoMessageAdvertisements = "VideoMessageAdvertisements" ClassReportOption = "ReportOption" ClassFileDownload = "FileDownload" ClassDownloadedFileCounts = "DownloadedFileCounts" @@ -704,6 +711,10 @@ const ( TypePollOption = "pollOption" TypePollTypeRegular = "pollTypeRegular" TypePollTypeQuiz = "pollTypeQuiz" + TypeChecklistTask = "checklistTask" + TypeInputChecklistTask = "inputChecklistTask" + TypeChecklist = "checklist" + TypeInputChecklist = "inputChecklist" TypeAnimation = "animation" TypeAudio = "audio" TypeDocument = "document" @@ -720,6 +731,7 @@ const ( TypeWebApp = "webApp" TypePoll = "poll" TypeAlternativeVideo = "alternativeVideo" + TypeVideoStoryboard = "videoStoryboard" TypeBackground = "background" TypeBackgrounds = "backgrounds" TypeChatBackground = "chatBackground" @@ -1004,11 +1016,13 @@ const ( TypeMessageSourceNotification = "messageSourceNotification" TypeMessageSourceScreenshot = "messageSourceScreenshot" TypeMessageSourceOther = "messageSourceOther" - TypeMessageSponsor = "messageSponsor" + TypeAdvertisementSponsor = "advertisementSponsor" TypeSponsoredMessage = "sponsoredMessage" TypeSponsoredMessages = "sponsoredMessages" TypeSponsoredChat = "sponsoredChat" TypeSponsoredChats = "sponsoredChats" + TypeVideoMessageAdvertisement = "videoMessageAdvertisement" + TypeVideoMessageAdvertisements = "videoMessageAdvertisements" TypeReportOption = "reportOption" TypeReportSponsoredResultOk = "reportSponsoredResultOk" TypeReportSponsoredResultFailed = "reportSponsoredResultFailed" @@ -1344,6 +1358,7 @@ const ( TypeMessageGame = "messageGame" TypeMessagePoll = "messagePoll" TypeMessageStory = "messageStory" + TypeMessageChecklist = "messageChecklist" TypeMessageInvoice = "messageInvoice" TypeMessageCall = "messageCall" TypeMessageGroupCall = "messageGroupCall" @@ -1392,6 +1407,8 @@ const ( TypeMessagePaidMessagesRefunded = "messagePaidMessagesRefunded" TypeMessagePaidMessagePriceChanged = "messagePaidMessagePriceChanged" TypeMessageDirectMessagePriceChanged = "messageDirectMessagePriceChanged" + TypeMessageChecklistTasksDone = "messageChecklistTasksDone" + TypeMessageChecklistTasksAdded = "messageChecklistTasksAdded" TypeMessageContactRegistered = "messageContactRegistered" TypeMessageUsersShared = "messageUsersShared" TypeMessageChatShared = "messageChatShared" @@ -1453,6 +1470,7 @@ const ( TypeInputMessageInvoice = "inputMessageInvoice" TypeInputMessagePoll = "inputMessagePoll" TypeInputMessageStory = "inputMessageStory" + TypeInputMessageChecklist = "inputMessageChecklist" TypeInputMessageForwarded = "inputMessageForwarded" TypeMessageProperties = "messageProperties" TypeSearchMessagesFilterEmpty = "searchMessagesFilterEmpty" @@ -1800,6 +1818,7 @@ const ( TypePremiumFeatureLastSeenTimes = "premiumFeatureLastSeenTimes" TypePremiumFeatureBusiness = "premiumFeatureBusiness" TypePremiumFeatureMessageEffects = "premiumFeatureMessageEffects" + TypePremiumFeatureChecklists = "premiumFeatureChecklists" TypeBusinessFeatureLocation = "businessFeatureLocation" TypeBusinessFeatureOpeningHours = "businessFeatureOpeningHours" TypeBusinessFeatureQuickReplies = "businessFeatureQuickReplies" @@ -1919,6 +1938,7 @@ const ( TypePushMessageContentSticker = "pushMessageContentSticker" TypePushMessageContentStory = "pushMessageContentStory" TypePushMessageContentText = "pushMessageContentText" + TypePushMessageContentChecklist = "pushMessageContentChecklist" TypePushMessageContentVideo = "pushMessageContentVideo" TypePushMessageContentVideoNote = "pushMessageContentVideoNote" TypePushMessageContentVoiceNote = "pushMessageContentVoiceNote" @@ -1937,6 +1957,8 @@ const ( TypePushMessageContentRecurringPayment = "pushMessageContentRecurringPayment" TypePushMessageContentSuggestProfilePhoto = "pushMessageContentSuggestProfilePhoto" TypePushMessageContentProximityAlertTriggered = "pushMessageContentProximityAlertTriggered" + TypePushMessageContentChecklistTasksAdded = "pushMessageContentChecklistTasksAdded" + TypePushMessageContentChecklistTasksDone = "pushMessageContentChecklistTasksDone" TypePushMessageContentMessageForwards = "pushMessageContentMessageForwards" TypePushMessageContentMediaAlbum = "pushMessageContentMediaAlbum" TypeNotificationTypeNewMessage = "notificationTypeNewMessage" @@ -5493,6 +5515,122 @@ func (*PollTypeQuiz) PollTypeType() string { return TypePollTypeQuiz } +// Describes a task in a checklist +type ChecklistTask struct { + meta + // Unique identifier of the task + Id int32 `json:"id"` + // Text of the task; may contain only Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, Url, EmailAddress, Mention, Hashtag, Cashtag and PhoneNumber entities + Text *FormattedText `json:"text"` + // Identifier of the user that completed the task; 0 if the task isn't completed + CompletedByUserId int64 `json:"completed_by_user_id"` + // Point in time (Unix timestamp) when the task was completed; 0 if the task isn't completed + CompletionDate int32 `json:"completion_date"` +} + +func (entity *ChecklistTask) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChecklistTask + + return json.Marshal((*stub)(entity)) +} + +func (*ChecklistTask) GetClass() string { + return ClassChecklistTask +} + +func (*ChecklistTask) GetType() string { + return TypeChecklistTask +} + +// Describes a task in a checklist to be sent +type InputChecklistTask struct { + meta + // Unique identifier of the task; must be positive + Id int32 `json:"id"` + // Text of the task; 1-getOption("checklist_task_text_length_max") characters without line feeds. May contain only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities + Text *FormattedText `json:"text"` +} + +func (entity *InputChecklistTask) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputChecklistTask + + return json.Marshal((*stub)(entity)) +} + +func (*InputChecklistTask) GetClass() string { + return ClassInputChecklistTask +} + +func (*InputChecklistTask) GetType() string { + return TypeInputChecklistTask +} + +// Describes a checklist +type Checklist struct { + meta + // Title of the checklist; may contain only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities + Title *FormattedText `json:"title"` + // List of tasks in the checklist + Tasks []*ChecklistTask `json:"tasks"` + // True, if users other than creator of the list can add tasks to the list + OthersCanAddTasks bool `json:"others_can_add_tasks"` + // True, if the current user can add tasks to the list if they have Telegram Premium subscription + CanAddTasks bool `json:"can_add_tasks"` + // True, if users other than creator of the list can mark tasks as done or not done. If true, then the checklist is called "group checklist" + OthersCanMarkTasksAsDone bool `json:"others_can_mark_tasks_as_done"` + // True, if the current user can mark tasks as done or not done if they have Telegram Premium subscription + CanMarkTasksAsDone bool `json:"can_mark_tasks_as_done"` +} + +func (entity *Checklist) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Checklist + + return json.Marshal((*stub)(entity)) +} + +func (*Checklist) GetClass() string { + return ClassChecklist +} + +func (*Checklist) GetType() string { + return TypeChecklist +} + +// Describes a checklist to be sent +type InputChecklist struct { + meta + // Title of the checklist; 1-getOption("checklist_title_length_max") characters. May contain only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities + Title *FormattedText `json:"title"` + // List of tasks in the checklist; 1-getOption("checklist_task_count_max") tasks + Tasks []*InputChecklistTask `json:"tasks"` + // True, if other users can add tasks to the list + OthersCanAddTasks bool `json:"others_can_add_tasks"` + // True, if other users can mark tasks as done or not done + OthersCanMarkTasksAsDone bool `json:"others_can_mark_tasks_as_done"` +} + +func (entity *InputChecklist) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputChecklist + + return json.Marshal((*stub)(entity)) +} + +func (*InputChecklist) GetClass() string { + return ClassInputChecklist +} + +func (*InputChecklist) GetType() string { + return TypeInputChecklist +} + // Describes an animation file. The animation must be encoded in GIF or MPEG4 format type Animation struct { meta @@ -6163,6 +6301,35 @@ func (*AlternativeVideo) GetType() string { return TypeAlternativeVideo } +// Describes a storyboard for a video +type VideoStoryboard struct { + meta + // A JPEG file that contains tiled previews of video + StoryboardFile *File `json:"storyboard_file"` + // Width of a tile + Width int32 `json:"width"` + // Height of a tile + Height int32 `json:"height"` + // File that describes mapping of position in the video to a tile in the JPEG file + MapFile *File `json:"map_file"` +} + +func (entity *VideoStoryboard) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub VideoStoryboard + + return json.Marshal((*stub)(entity)) +} + +func (*VideoStoryboard) GetClass() string { + return ClassVideoStoryboard +} + +func (*VideoStoryboard) GetType() string { + return TypeVideoStoryboard +} + // Describes a chat background type Background struct { meta @@ -7600,7 +7767,7 @@ type ChatPermissions struct { CanSendVideoNotes bool `json:"can_send_video_notes"` // True, if the user can send voice notes CanSendVoiceNotes bool `json:"can_send_voice_notes"` - // True, if the user can send polls + // True, if the user can send polls and checklists CanSendPolls bool `json:"can_send_polls"` // True, if the user can send stickers. Implies can_send_messages permissions CanSendStickers bool `json:"can_send_stickers"` @@ -13352,6 +13519,8 @@ type SupergroupFullInfo struct { MyBoostCount int32 `json:"my_boost_count"` // Number of times the supergroup must be boosted by a user to ignore slow mode and chat permission restrictions; 0 if unspecified UnrestrictBoostCount int32 `json:"unrestrict_boost_count"` + // Number of Telegram Stars that must be paid by the current user for each sent message to the supergroup + OutgoingPaidMessageStarCount int64 `json:"outgoing_paid_message_star_count"` // Identifier of the supergroup sticker set that must be shown before user sticker sets; 0 if none StickerSetId JsonInt64 `json:"sticker_set_id"` // Identifier of the custom emoji sticker set that can be used in the supergroup without Telegram Premium subscription; 0 if none @@ -14872,7 +15041,7 @@ type MessageReplyToMessage struct { Origin MessageOrigin `json:"origin"` // Point in time (Unix timestamp) when the message was sent if the message was from another chat or topic; 0 for messages from the same chat OriginSendDate int32 `json:"origin_send_date"` - // Media content of the message if the message was from another chat or topic; may be null for messages from the same chat and messages without media. Can be only one of the following types: messageAnimation, messageAudio, messageContact, messageDice, messageDocument, messageGame, messageGiveaway, messageGiveawayWinners, messageInvoice, messageLocation, messagePaidMedia, messagePhoto, messagePoll, messageSticker, messageStory, messageText (for link preview), messageVenue, messageVideo, messageVideoNote, or messageVoiceNote + // Media content of the message if the message was from another chat or topic; may be null for messages from the same chat and messages without media. Can be only one of the following types: messageAnimation, messageAudio, messageChecklist, messageContact, messageDice, messageDocument, messageGame, messageGiveaway, messageGiveawayWinners, messageInvoice, messageLocation, messagePaidMedia, messagePhoto, messagePoll, messageSticker, messageStory, messageText (for link preview), messageVenue, messageVideo, messageVideoNote, or messageVoiceNote Content MessageContent `json:"content"` } @@ -15766,31 +15935,31 @@ func (*MessageSourceOther) MessageSourceType() string { return TypeMessageSourceOther } -// Information about the sponsor of a message -type MessageSponsor struct { +// Information about the sponsor of an advertisement +type AdvertisementSponsor struct { meta - // URL of the sponsor to be opened when the message is clicked + // URL of the sponsor to be opened when the advertisement is clicked Url string `json:"url"` // Photo of the sponsor; may be null if must not be shown Photo *Photo `json:"photo"` - // Additional optional information about the sponsor to be shown along with the message + // Additional optional information about the sponsor to be shown along with the advertisement Info string `json:"info"` } -func (entity *MessageSponsor) MarshalJSON() ([]byte, error) { +func (entity *AdvertisementSponsor) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub MessageSponsor + type stub AdvertisementSponsor return json.Marshal((*stub)(entity)) } -func (*MessageSponsor) GetClass() string { - return ClassMessageSponsor +func (*AdvertisementSponsor) GetClass() string { + return ClassAdvertisementSponsor } -func (*MessageSponsor) GetType() string { - return TypeMessageSponsor +func (*AdvertisementSponsor) GetType() string { + return TypeAdvertisementSponsor } // Describes a sponsored message @@ -15805,7 +15974,7 @@ type SponsoredMessage struct { // Content of the message. Currently, can be only of the types messageText, messageAnimation, messagePhoto, or messageVideo. Video messages can be viewed fullscreen Content MessageContent `json:"content"` // Information about the sponsor of the message - Sponsor *MessageSponsor `json:"sponsor"` + Sponsor *AdvertisementSponsor `json:"sponsor"` // Title of the sponsored message Title string `json:"title"` // Text for the message action button @@ -15840,7 +16009,7 @@ func (sponsoredMessage *SponsoredMessage) UnmarshalJSON(data []byte) error { IsRecommended bool `json:"is_recommended"` CanBeReported bool `json:"can_be_reported"` Content json.RawMessage `json:"content"` - Sponsor *MessageSponsor `json:"sponsor"` + Sponsor *AdvertisementSponsor `json:"sponsor"` Title string `json:"title"` ButtonText string `json:"button_text"` AccentColorId int32 `json:"accent_color_id"` @@ -15946,6 +16115,70 @@ func (*SponsoredChats) GetType() string { return TypeSponsoredChats } +// Describes an advertisent to be shown while a video from a message is watched +type VideoMessageAdvertisement struct { + meta + // Unique identifier of this result + UniqueId int64 `json:"unique_id"` + // Text of the advertisement + Text string `json:"text"` + // The minimum amount of time the advertisement must be dispalyed before it can be hidden by the user, in seconds + MinDisplayDuration int32 `json:"min_display_duration"` + // The maximum amount of time the advertisement must be dispalyed before it must be automatically hidden, in seconds + MaxDisplayDuration int32 `json:"max_display_duration"` + // True, if the advertisement can be reported to Telegram moderators through reportVideoMessageAdvertisement + CanBeReported bool `json:"can_be_reported"` + // Information about the sponsor of the advertisement + Sponsor *AdvertisementSponsor `json:"sponsor"` + // Title of the sponsored message + Title string `json:"title"` + // If non-empty, additional information about the sponsored message to be shown along with the message + AdditionalInfo string `json:"additional_info"` +} + +func (entity *VideoMessageAdvertisement) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub VideoMessageAdvertisement + + return json.Marshal((*stub)(entity)) +} + +func (*VideoMessageAdvertisement) GetClass() string { + return ClassVideoMessageAdvertisement +} + +func (*VideoMessageAdvertisement) GetType() string { + return TypeVideoMessageAdvertisement +} + +// Contains a list of advertisements to be shown while a video from a message is watched +type VideoMessageAdvertisements struct { + meta + // List of advertisements + Advertisements []*VideoMessageAdvertisement `json:"advertisements"` + // Delay before the first advertisement is shown, in seconds + StartDelay int32 `json:"start_delay"` + // Delay between consecutive advertisements, in seconds + BetweenDelay int32 `json:"between_delay"` +} + +func (entity *VideoMessageAdvertisements) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub VideoMessageAdvertisements + + return json.Marshal((*stub)(entity)) +} + +func (*VideoMessageAdvertisements) GetClass() string { + return ClassVideoMessageAdvertisements +} + +func (*VideoMessageAdvertisements) GetType() string { + return TypeVideoMessageAdvertisements +} + // Describes an option to report an entity to Telegram type ReportOption struct { meta @@ -19168,6 +19401,8 @@ type DirectMessagesChatTopic struct { SenderId MessageSender `json:"sender_id"` // A parameter used to determine order of the topic in the topic list. Topics must be sorted by the order in descending order Order JsonInt64 `json:"order"` + // True, if the other party can send unpaid messages even if the chat has paid messages enabled + CanSendUnpaidMessages bool `json:"can_send_unpaid_messages"` // True, if the forum topic is marked as unread IsMarkedAsUnread bool `json:"is_marked_as_unread"` // Number of unread messages in the chat @@ -19206,6 +19441,7 @@ func (directMessagesChatTopic *DirectMessagesChatTopic) UnmarshalJSON(data []byt Id int64 `json:"id"` SenderId json.RawMessage `json:"sender_id"` Order JsonInt64 `json:"order"` + CanSendUnpaidMessages bool `json:"can_send_unpaid_messages"` IsMarkedAsUnread bool `json:"is_marked_as_unread"` UnreadCount int64 `json:"unread_count"` LastReadInboxMessageId int64 `json:"last_read_inbox_message_id"` @@ -19223,6 +19459,7 @@ func (directMessagesChatTopic *DirectMessagesChatTopic) UnmarshalJSON(data []byt directMessagesChatTopic.ChatId = tmp.ChatId directMessagesChatTopic.Id = tmp.Id directMessagesChatTopic.Order = tmp.Order + directMessagesChatTopic.CanSendUnpaidMessages = tmp.CanSendUnpaidMessages directMessagesChatTopic.IsMarkedAsUnread = tmp.IsMarkedAsUnread directMessagesChatTopic.UnreadCount = tmp.UnreadCount directMessagesChatTopic.LastReadInboxMessageId = tmp.LastReadInboxMessageId @@ -26677,6 +26914,8 @@ type MessageVideo struct { Video *Video `json:"video"` // Alternative qualities of the video AlternativeVideos []*AlternativeVideo `json:"alternative_videos"` + // Available storyboards for the video + Storyboards []*VideoStoryboard `json:"storyboards"` // Cover of the video; may be null if none Cover *Photo `json:"cover"` // Timestamp from which the video playing must start, in seconds @@ -27138,6 +27377,33 @@ func (*MessageStory) MessageContentType() string { return TypeMessageStory } +// A message with a checklist +type MessageChecklist struct { + meta + // The checklist description + List *Checklist `json:"list"` +} + +func (entity *MessageChecklist) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageChecklist + + return json.Marshal((*stub)(entity)) +} + +func (*MessageChecklist) GetClass() string { + return ClassMessageContent +} + +func (*MessageChecklist) GetType() string { + return TypeMessageChecklist +} + +func (*MessageChecklist) MessageContentType() string { + return TypeMessageChecklist +} + // A message with an invoice from a bot. Use getInternalLink with internalLinkTypeBotStart to share the invoice type MessageInvoice struct { meta @@ -28990,6 +29256,66 @@ func (*MessageDirectMessagePriceChanged) MessageContentType() string { return TypeMessageDirectMessagePriceChanged } +// Some tasks from a checklist were marked as done or not done +type MessageChecklistTasksDone struct { + meta + // Identifier of the message with the checklist; can be 0 if the message was deleted + ChecklistMessageId int64 `json:"checklist_message_id"` + // Identifiers of tasks that were marked as done + MarkedAsDoneTaskIds []int32 `json:"marked_as_done_task_ids"` + // Identifiers of tasks that were marked as not done + MarkedAsNotDoneTaskIds []int32 `json:"marked_as_not_done_task_ids"` +} + +func (entity *MessageChecklistTasksDone) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageChecklistTasksDone + + return json.Marshal((*stub)(entity)) +} + +func (*MessageChecklistTasksDone) GetClass() string { + return ClassMessageContent +} + +func (*MessageChecklistTasksDone) GetType() string { + return TypeMessageChecklistTasksDone +} + +func (*MessageChecklistTasksDone) MessageContentType() string { + return TypeMessageChecklistTasksDone +} + +// Some tasks were added to a checklist +type MessageChecklistTasksAdded struct { + meta + // Identifier of the message with the checklist; can be 0 if the message was deleted + ChecklistMessageId int64 `json:"checklist_message_id"` + // List of tasks added to the checklist + Tasks []*ChecklistTask `json:"tasks"` +} + +func (entity *MessageChecklistTasksAdded) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageChecklistTasksAdded + + return json.Marshal((*stub)(entity)) +} + +func (*MessageChecklistTasksAdded) GetClass() string { + return ClassMessageContent +} + +func (*MessageChecklistTasksAdded) GetType() string { + return TypeMessageChecklistTasksAdded +} + +func (*MessageChecklistTasksAdded) MessageContentType() string { + return TypeMessageChecklistTasksAdded +} + // A contact has registered with Telegram type MessageContactRegistered struct{ meta @@ -31227,6 +31553,33 @@ func (*InputMessageStory) InputMessageContentType() string { return TypeInputMessageStory } +// A message with a checklist. Checklists can't be sent to secret chats, channel chats and channel direct messages chats; for Telegram Premium users only +type InputMessageChecklist struct { + meta + // The checklist to send + Checklist *InputChecklist `json:"checklist"` +} + +func (entity *InputMessageChecklist) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputMessageChecklist + + return json.Marshal((*stub)(entity)) +} + +func (*InputMessageChecklist) GetClass() string { + return ClassInputMessageContent +} + +func (*InputMessageChecklist) GetType() string { + return TypeInputMessageChecklist +} + +func (*InputMessageChecklist) InputMessageContentType() string { + return TypeInputMessageChecklist +} + // A forwarded message type InputMessageForwarded struct { meta @@ -31267,6 +31620,8 @@ func (*InputMessageForwarded) InputMessageContentType() string { // Contains properties of a message and describes actions that can be done with the message right now type MessageProperties struct { meta + // True, if tasks can be added to the message's checklist using addChecklistTasks if the current user has Telegram Premium subscription + CanAddTasks bool `json:"can_add_tasks"` // True, if content of the message can be copied using inputMessageForwarded or forwardMessages with copy options CanBeCopied bool `json:"can_be_copied"` // True, if content of the message can be copied to a secret chat using inputMessageForwarded or forwardMessages with copy options @@ -31275,7 +31630,7 @@ type MessageProperties struct { CanBeDeletedOnlyForSelf bool `json:"can_be_deleted_only_for_self"` // True, if the message can be deleted for all users using the method deleteMessages with revoke == true CanBeDeletedForAllUsers bool `json:"can_be_deleted_for_all_users"` - // True, if the message can be edited using the methods editMessageText, editMessageCaption, or editMessageReplyMarkup. For live location and poll messages this fields shows whether editMessageLiveLocation or stopPoll can be used with this message + // True, if the message can be edited using the methods editMessageText, editMessageCaption, or editMessageReplyMarkup. For live location, poll, and checklist messages this fields shows whether editMessageLiveLocation, stopPoll, or editMessageChecklist respectively can be used with this message CanBeEdited bool `json:"can_be_edited"` // True, if the message can be forwarded using inputMessageForwarded or forwardMessages without copy options CanBeForwarded bool `json:"can_be_forwarded"` @@ -31309,8 +31664,12 @@ type MessageProperties struct { CanGetReadDate bool `json:"can_get_read_date"` // True, if message statistics are available through getMessageStatistics and message forwards can be received using getMessagePublicForwards CanGetStatistics bool `json:"can_get_statistics"` + // True, if advertisements for video of the message can be received though getVideoMessageAdvertisements + CanGetVideoAdvertisements bool `json:"can_get_video_advertisements"` // True, if chat members already viewed the message can be received through getMessageViewers CanGetViewers bool `json:"can_get_viewers"` + // True, if tasks can be marked as done or not done in the message's checklist using markChecklistTasksAsDone if the current user has Telegram Premium subscription + CanMarkTasksAsDone bool `json:"can_mark_tasks_as_done"` // True, if speech can be recognized for the message through recognizeSpeech CanRecognizeSpeech bool `json:"can_recognize_speech"` // True, if the message can be reported using reportChat @@ -42570,6 +42929,31 @@ func (*PremiumFeatureMessageEffects) PremiumFeatureType() string { return TypePremiumFeatureMessageEffects } +// The ability to create and use checklist messages +type PremiumFeatureChecklists struct{ + meta +} + +func (entity *PremiumFeatureChecklists) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumFeatureChecklists + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumFeatureChecklists) GetClass() string { + return ClassPremiumFeature +} + +func (*PremiumFeatureChecklists) GetType() string { + return TypePremiumFeatureChecklists +} + +func (*PremiumFeatureChecklists) PremiumFeatureType() string { + return TypePremiumFeatureChecklists +} + // The ability to set location type BusinessFeatureLocation struct{ meta @@ -46085,6 +46469,35 @@ func (*PushMessageContentText) PushMessageContentType() string { return TypePushMessageContentText } +// A message with a checklist +type PushMessageContentChecklist struct { + meta + // Checklist title + Title string `json:"title"` + // True, if the message is a pinned message with the specified content + IsPinned bool `json:"is_pinned"` +} + +func (entity *PushMessageContentChecklist) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentChecklist + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentChecklist) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentChecklist) GetType() string { + return TypePushMessageContentChecklist +} + +func (*PushMessageContentChecklist) PushMessageContentType() string { + return TypePushMessageContentChecklist +} + // A video message type PushMessageContentVideo struct { meta @@ -46575,6 +46988,60 @@ func (*PushMessageContentProximityAlertTriggered) PushMessageContentType() strin return TypePushMessageContentProximityAlertTriggered } +// Some tasks were added to a checklist +type PushMessageContentChecklistTasksAdded struct { + meta + // Number of added tasks + TaskCount int32 `json:"task_count"` +} + +func (entity *PushMessageContentChecklistTasksAdded) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentChecklistTasksAdded + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentChecklistTasksAdded) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentChecklistTasksAdded) GetType() string { + return TypePushMessageContentChecklistTasksAdded +} + +func (*PushMessageContentChecklistTasksAdded) PushMessageContentType() string { + return TypePushMessageContentChecklistTasksAdded +} + +// Some tasks from a checklist were marked as done or not done +type PushMessageContentChecklistTasksDone struct { + meta + // Number of changed tasks + TaskCount int32 `json:"task_count"` +} + +func (entity *PushMessageContentChecklistTasksDone) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentChecklistTasksDone + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentChecklistTasksDone) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentChecklistTasksDone) GetType() string { + return TypePushMessageContentChecklistTasksDone +} + +func (*PushMessageContentChecklistTasksDone) PushMessageContentType() string { + return TypePushMessageContentChecklistTasksDone +} + // A forwarded messages type PushMessageContentMessageForwards struct { meta diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 6adae01..5991657 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -3507,6 +3507,9 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessageStory: return UnmarshalMessageStory(data) + case TypeMessageChecklist: + return UnmarshalMessageChecklist(data) + case TypeMessageInvoice: return UnmarshalMessageInvoice(data) @@ -3651,6 +3654,12 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessageDirectMessagePriceChanged: return UnmarshalMessageDirectMessagePriceChanged(data) + case TypeMessageChecklistTasksDone: + return UnmarshalMessageChecklistTasksDone(data) + + case TypeMessageChecklistTasksAdded: + return UnmarshalMessageChecklistTasksAdded(data) + case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) @@ -3962,6 +3971,9 @@ func UnmarshalInputMessageContent(data json.RawMessage) (InputMessageContent, er case TypeInputMessageStory: return UnmarshalInputMessageStory(data) + case TypeInputMessageChecklist: + return UnmarshalInputMessageChecklist(data) + case TypeInputMessageForwarded: return UnmarshalInputMessageForwarded(data) @@ -5803,6 +5815,9 @@ func UnmarshalPremiumFeature(data json.RawMessage) (PremiumFeature, error) { case TypePremiumFeatureMessageEffects: return UnmarshalPremiumFeatureMessageEffects(data) + case TypePremiumFeatureChecklists: + return UnmarshalPremiumFeatureChecklists(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -6603,6 +6618,9 @@ func UnmarshalPushMessageContent(data json.RawMessage) (PushMessageContent, erro case TypePushMessageContentText: return UnmarshalPushMessageContentText(data) + case TypePushMessageContentChecklist: + return UnmarshalPushMessageContentChecklist(data) + case TypePushMessageContentVideo: return UnmarshalPushMessageContentVideo(data) @@ -6657,6 +6675,12 @@ func UnmarshalPushMessageContent(data json.RawMessage) (PushMessageContent, erro case TypePushMessageContentProximityAlertTriggered: return UnmarshalPushMessageContentProximityAlertTriggered(data) + case TypePushMessageContentChecklistTasksAdded: + return UnmarshalPushMessageContentChecklistTasksAdded(data) + + case TypePushMessageContentChecklistTasksDone: + return UnmarshalPushMessageContentChecklistTasksDone(data) + case TypePushMessageContentMessageForwards: return UnmarshalPushMessageContentMessageForwards(data) @@ -9429,6 +9453,38 @@ func UnmarshalPollTypeQuiz(data json.RawMessage) (*PollTypeQuiz, error) { return &resp, err } +func UnmarshalChecklistTask(data json.RawMessage) (*ChecklistTask, error) { + var resp ChecklistTask + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputChecklistTask(data json.RawMessage) (*InputChecklistTask, error) { + var resp InputChecklistTask + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChecklist(data json.RawMessage) (*Checklist, error) { + var resp Checklist + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputChecklist(data json.RawMessage) (*InputChecklist, error) { + var resp InputChecklist + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalAnimation(data json.RawMessage) (*Animation, error) { var resp Animation @@ -9557,6 +9613,14 @@ func UnmarshalAlternativeVideo(data json.RawMessage) (*AlternativeVideo, error) return &resp, err } +func UnmarshalVideoStoryboard(data json.RawMessage) (*VideoStoryboard, error) { + var resp VideoStoryboard + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalBackground(data json.RawMessage) (*Background, error) { var resp Background @@ -11829,8 +11893,8 @@ func UnmarshalMessageSourceOther(data json.RawMessage) (*MessageSourceOther, err return &resp, err } -func UnmarshalMessageSponsor(data json.RawMessage) (*MessageSponsor, error) { - var resp MessageSponsor +func UnmarshalAdvertisementSponsor(data json.RawMessage) (*AdvertisementSponsor, error) { + var resp AdvertisementSponsor err := json.Unmarshal(data, &resp) @@ -11869,6 +11933,22 @@ func UnmarshalSponsoredChats(data json.RawMessage) (*SponsoredChats, error) { return &resp, err } +func UnmarshalVideoMessageAdvertisement(data json.RawMessage) (*VideoMessageAdvertisement, error) { + var resp VideoMessageAdvertisement + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalVideoMessageAdvertisements(data json.RawMessage) (*VideoMessageAdvertisements, error) { + var resp VideoMessageAdvertisements + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalReportOption(data json.RawMessage) (*ReportOption, error) { var resp ReportOption @@ -14549,6 +14629,14 @@ func UnmarshalMessageStory(data json.RawMessage) (*MessageStory, error) { return &resp, err } +func UnmarshalMessageChecklist(data json.RawMessage) (*MessageChecklist, error) { + var resp MessageChecklist + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageInvoice(data json.RawMessage) (*MessageInvoice, error) { var resp MessageInvoice @@ -14933,6 +15021,22 @@ func UnmarshalMessageDirectMessagePriceChanged(data json.RawMessage) (*MessageDi return &resp, err } +func UnmarshalMessageChecklistTasksDone(data json.RawMessage) (*MessageChecklistTasksDone, error) { + var resp MessageChecklistTasksDone + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageChecklistTasksAdded(data json.RawMessage) (*MessageChecklistTasksAdded, error) { + var resp MessageChecklistTasksAdded + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageContactRegistered(data json.RawMessage) (*MessageContactRegistered, error) { var resp MessageContactRegistered @@ -15421,6 +15525,14 @@ func UnmarshalInputMessageStory(data json.RawMessage) (*InputMessageStory, error return &resp, err } +func UnmarshalInputMessageChecklist(data json.RawMessage) (*InputMessageChecklist, error) { + var resp InputMessageChecklist + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInputMessageForwarded(data json.RawMessage) (*InputMessageForwarded, error) { var resp InputMessageForwarded @@ -18197,6 +18309,14 @@ func UnmarshalPremiumFeatureMessageEffects(data json.RawMessage) (*PremiumFeatur return &resp, err } +func UnmarshalPremiumFeatureChecklists(data json.RawMessage) (*PremiumFeatureChecklists, error) { + var resp PremiumFeatureChecklists + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalBusinessFeatureLocation(data json.RawMessage) (*BusinessFeatureLocation, error) { var resp BusinessFeatureLocation @@ -19149,6 +19269,14 @@ func UnmarshalPushMessageContentText(data json.RawMessage) (*PushMessageContentT return &resp, err } +func UnmarshalPushMessageContentChecklist(data json.RawMessage) (*PushMessageContentChecklist, error) { + var resp PushMessageContentChecklist + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPushMessageContentVideo(data json.RawMessage) (*PushMessageContentVideo, error) { var resp PushMessageContentVideo @@ -19293,6 +19421,22 @@ func UnmarshalPushMessageContentProximityAlertTriggered(data json.RawMessage) (* return &resp, err } +func UnmarshalPushMessageContentChecklistTasksAdded(data json.RawMessage) (*PushMessageContentChecklistTasksAdded, error) { + var resp PushMessageContentChecklistTasksAdded + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentChecklistTasksDone(data json.RawMessage) (*PushMessageContentChecklistTasksDone, error) { + var resp PushMessageContentChecklistTasksDone + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPushMessageContentMessageForwards(data json.RawMessage) (*PushMessageContentMessageForwards, error) { var resp PushMessageContentMessageForwards @@ -23253,6 +23397,18 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePollTypeQuiz: return UnmarshalPollTypeQuiz(data) + case TypeChecklistTask: + return UnmarshalChecklistTask(data) + + case TypeInputChecklistTask: + return UnmarshalInputChecklistTask(data) + + case TypeChecklist: + return UnmarshalChecklist(data) + + case TypeInputChecklist: + return UnmarshalInputChecklist(data) + case TypeAnimation: return UnmarshalAnimation(data) @@ -23301,6 +23457,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeAlternativeVideo: return UnmarshalAlternativeVideo(data) + case TypeVideoStoryboard: + return UnmarshalVideoStoryboard(data) + case TypeBackground: return UnmarshalBackground(data) @@ -24153,8 +24312,8 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageSourceOther: return UnmarshalMessageSourceOther(data) - case TypeMessageSponsor: - return UnmarshalMessageSponsor(data) + case TypeAdvertisementSponsor: + return UnmarshalAdvertisementSponsor(data) case TypeSponsoredMessage: return UnmarshalSponsoredMessage(data) @@ -24168,6 +24327,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSponsoredChats: return UnmarshalSponsoredChats(data) + case TypeVideoMessageAdvertisement: + return UnmarshalVideoMessageAdvertisement(data) + + case TypeVideoMessageAdvertisements: + return UnmarshalVideoMessageAdvertisements(data) + case TypeReportOption: return UnmarshalReportOption(data) @@ -25173,6 +25338,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageStory: return UnmarshalMessageStory(data) + case TypeMessageChecklist: + return UnmarshalMessageChecklist(data) + case TypeMessageInvoice: return UnmarshalMessageInvoice(data) @@ -25317,6 +25485,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageDirectMessagePriceChanged: return UnmarshalMessageDirectMessagePriceChanged(data) + case TypeMessageChecklistTasksDone: + return UnmarshalMessageChecklistTasksDone(data) + + case TypeMessageChecklistTasksAdded: + return UnmarshalMessageChecklistTasksAdded(data) + case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) @@ -25500,6 +25674,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInputMessageStory: return UnmarshalInputMessageStory(data) + case TypeInputMessageChecklist: + return UnmarshalInputMessageChecklist(data) + case TypeInputMessageForwarded: return UnmarshalInputMessageForwarded(data) @@ -26541,6 +26718,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePremiumFeatureMessageEffects: return UnmarshalPremiumFeatureMessageEffects(data) + case TypePremiumFeatureChecklists: + return UnmarshalPremiumFeatureChecklists(data) + case TypeBusinessFeatureLocation: return UnmarshalBusinessFeatureLocation(data) @@ -26898,6 +27078,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePushMessageContentText: return UnmarshalPushMessageContentText(data) + case TypePushMessageContentChecklist: + return UnmarshalPushMessageContentChecklist(data) + case TypePushMessageContentVideo: return UnmarshalPushMessageContentVideo(data) @@ -26952,6 +27135,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePushMessageContentProximityAlertTriggered: return UnmarshalPushMessageContentProximityAlertTriggered(data) + case TypePushMessageContentChecklistTasksAdded: + return UnmarshalPushMessageContentChecklistTasksAdded(data) + + case TypePushMessageContentChecklistTasksDone: + return UnmarshalPushMessageContentChecklistTasksDone(data) + case TypePushMessageContentMessageForwards: return UnmarshalPushMessageContentMessageForwards(data) diff --git a/data/td_api.tl b/data/td_api.tl index 5b4847b..29d016b 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -388,6 +388,35 @@ pollTypeRegular allow_multiple_answers:Bool = PollType; pollTypeQuiz correct_option_id:int32 explanation:formattedText = PollType; +//@description Describes a task in a checklist +//@id Unique identifier of the task +//@text Text of the task; may contain only Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, Url, EmailAddress, Mention, Hashtag, Cashtag and PhoneNumber entities +//@completed_by_user_id Identifier of the user that completed the task; 0 if the task isn't completed +//@completion_date Point in time (Unix timestamp) when the task was completed; 0 if the task isn't completed +checklistTask id:int32 text:formattedText completed_by_user_id:int53 completion_date:int32 = ChecklistTask; + +//@description Describes a task in a checklist to be sent +//@id Unique identifier of the task; must be positive +//@text Text of the task; 1-getOption("checklist_task_text_length_max") characters without line feeds. May contain only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities +inputChecklistTask id:int32 text:formattedText = InputChecklistTask; + +//@description Describes a checklist +//@title Title of the checklist; may contain only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities +//@tasks List of tasks in the checklist +//@others_can_add_tasks True, if users other than creator of the list can add tasks to the list +//@can_add_tasks True, if the current user can add tasks to the list if they have Telegram Premium subscription +//@others_can_mark_tasks_as_done True, if users other than creator of the list can mark tasks as done or not done. If true, then the checklist is called "group checklist" +//@can_mark_tasks_as_done True, if the current user can mark tasks as done or not done if they have Telegram Premium subscription +checklist title:formattedText tasks:vector others_can_add_tasks:Bool can_add_tasks:Bool others_can_mark_tasks_as_done:Bool can_mark_tasks_as_done:Bool = Checklist; + +//@description Describes a checklist to be sent +//@title Title of the checklist; 1-getOption("checklist_title_length_max") characters. May contain only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities +//@tasks List of tasks in the checklist; 1-getOption("checklist_task_count_max") tasks +//@others_can_add_tasks True, if other users can add tasks to the list +//@others_can_mark_tasks_as_done True, if other users can mark tasks as done or not done +inputChecklist title:formattedText tasks:vector others_can_add_tasks:Bool others_can_mark_tasks_as_done:Bool = InputChecklist; + + //@description Describes an animation file. The animation must be encoded in GIF or MPEG4 format //@duration Duration of the animation, in seconds; as defined by the sender //@width Width of the animation @@ -541,6 +570,13 @@ poll id:int64 question:formattedText options:vector total_voter_coun //@video File containing the video alternativeVideo id:int64 width:int32 height:int32 codec:string hls_file:file video:file = AlternativeVideo; +//@description Describes a storyboard for a video +//@storyboard_file A JPEG file that contains tiled previews of video +//@width Width of a tile +//@height Height of a tile +//@map_file File that describes mapping of position in the video to a tile in the JPEG file +videoStoryboard storyboard_file:file width:int32 height:int32 map_file:file = VideoStoryboard; + //@description Describes a chat background //@id Unique background identifier @@ -825,7 +861,7 @@ inputChatPhotoSticker sticker:chatPhotoSticker = InputChatPhoto; //@can_send_videos True, if the user can send videos //@can_send_video_notes True, if the user can send video notes //@can_send_voice_notes True, if the user can send voice notes -//@can_send_polls True, if the user can send polls +//@can_send_polls True, if the user can send polls and checklists //@can_send_stickers True, if the user can send stickers. Implies can_send_messages permissions //@can_send_animations True, if the user can send animations. Implies can_send_messages permissions //@can_send_games True, if the user can send games. Implies can_send_messages permissions @@ -1906,6 +1942,7 @@ supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:Chat //@gift_count Number of saved to profile gifts for channels without can_post_messages administrator right, otherwise, the total number of received gifts //@my_boost_count Number of times the current user boosted the supergroup or channel //@unrestrict_boost_count Number of times the supergroup must be boosted by a user to ignore slow mode and chat permission restrictions; 0 if unspecified +//@outgoing_paid_message_star_count Number of Telegram Stars that must be paid by the current user for each sent message to the supergroup //@sticker_set_id Identifier of the supergroup sticker set that must be shown before user sticker sets; 0 if none //@custom_emoji_sticker_set_id Identifier of the custom emoji sticker set that can be used in the supergroup without Telegram Premium subscription; 0 if none //@location Location to which the supergroup is connected; may be null if none @@ -1914,7 +1951,7 @@ supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:Chat //@bot_verification Information about verification status of the supergroup or the channel provided by a bot; may be null if none or unknown //@upgraded_from_basic_group_id Identifier of the basic group from which supergroup was upgraded; 0 if none //@upgraded_from_max_message_id Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none -supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 direct_messages_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_enable_paid_messages:Bool can_enable_paid_reaction:Bool can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_get_revenue_statistics:Bool can_get_star_revenue_statistics:Bool can_send_gift:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool can_have_sponsored_messages:Bool has_aggressive_anti_spam_enabled:Bool has_paid_media_allowed:Bool has_pinned_stories:Bool gift_count:int32 my_boost_count:int32 unrestrict_boost_count:int32 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector bot_verification:botVerification upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; +supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 direct_messages_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_enable_paid_messages:Bool can_enable_paid_reaction:Bool can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_get_revenue_statistics:Bool can_get_star_revenue_statistics:Bool can_send_gift:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool can_have_sponsored_messages:Bool has_aggressive_anti_spam_enabled:Bool has_paid_media_allowed:Bool has_pinned_stories:Bool gift_count:int32 my_boost_count:int32 unrestrict_boost_count:int32 outgoing_paid_message_star_count:int53 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector bot_verification:botVerification upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; //@class SecretChatState @description Describes the current secret chat state @@ -2164,9 +2201,9 @@ inputTextQuote text:formattedText position:int32 = InputTextQuote; //@origin Information about origin of the message if the message was from another chat or topic; may be null for messages from the same chat //@origin_send_date Point in time (Unix timestamp) when the message was sent if the message was from another chat or topic; 0 for messages from the same chat //@content Media content of the message if the message was from another chat or topic; may be null for messages from the same chat and messages without media. -//-Can be only one of the following types: messageAnimation, messageAudio, messageContact, messageDice, messageDocument, messageGame, messageGiveaway, messageGiveawayWinners, -//-messageInvoice, messageLocation, messagePaidMedia, messagePhoto, messagePoll, messageSticker, messageStory, messageText (for link preview), messageVenue, messageVideo, -//-messageVideoNote, or messageVoiceNote +//-Can be only one of the following types: messageAnimation, messageAudio, messageChecklist, messageContact, messageDice, messageDocument, messageGame, +//-messageGiveaway, messageGiveawayWinners, messageInvoice, messageLocation, messagePaidMedia, messagePhoto, messagePoll, messageSticker, messageStory, +//-messageText (for link preview), messageVenue, messageVideo, messageVideoNote, or messageVoiceNote messageReplyToMessage chat_id:int53 message_id:int53 quote:textQuote origin:MessageOrigin origin_send_date:int32 content:MessageContent = MessageReplyTo; //@description Describes a story replied by a given message @story_poster_chat_id The identifier of the poster of the story @story_id The identifier of the story @@ -2303,11 +2340,11 @@ messageSourceScreenshot = MessageSource; messageSourceOther = MessageSource; -//@description Information about the sponsor of a message -//@url URL of the sponsor to be opened when the message is clicked +//@description Information about the sponsor of an advertisement +//@url URL of the sponsor to be opened when the advertisement is clicked //@photo Photo of the sponsor; may be null if must not be shown -//@info Additional optional information about the sponsor to be shown along with the message -messageSponsor url:string photo:photo info:string = MessageSponsor; +//@info Additional optional information about the sponsor to be shown along with the advertisement +advertisementSponsor url:string photo:photo info:string = AdvertisementSponsor; //@description Describes a sponsored message //@message_id Message identifier; unique for the chat to which the sponsored message belongs among both ordinary and sponsored messages @@ -2320,7 +2357,7 @@ messageSponsor url:string photo:photo info:string = MessageSponsor; //@accent_color_id Identifier of the accent color for title, button text and message background //@background_custom_emoji_id Identifier of a custom emoji to be shown on the message background; 0 if none //@additional_info If non-empty, additional information about the sponsored message to be shown along with the message -sponsoredMessage message_id:int53 is_recommended:Bool can_be_reported:Bool content:MessageContent sponsor:messageSponsor title:string button_text:string accent_color_id:int32 background_custom_emoji_id:int64 additional_info:string = SponsoredMessage; +sponsoredMessage message_id:int53 is_recommended:Bool can_be_reported:Bool content:MessageContent sponsor:advertisementSponsor title:string button_text:string accent_color_id:int32 background_custom_emoji_id:int64 additional_info:string = SponsoredMessage; //@description Contains a list of sponsored messages @messages List of sponsored messages @messages_between The minimum number of messages between shown sponsored messages, or 0 if only one sponsored message must be shown after all ordinary messages sponsoredMessages messages:vector messages_between:int32 = SponsoredMessages; @@ -2335,6 +2372,23 @@ sponsoredChat unique_id:int53 chat_id:int53 sponsor_info:string additional_info: //@description Contains a list of sponsored chats @chats List of sponsored chats sponsoredChats chats:vector = SponsoredChats; +//@description Describes an advertisent to be shown while a video from a message is watched +//@unique_id Unique identifier of this result +//@text Text of the advertisement +//@min_display_duration The minimum amount of time the advertisement must be dispalyed before it can be hidden by the user, in seconds +//@max_display_duration The maximum amount of time the advertisement must be dispalyed before it must be automatically hidden, in seconds +//@can_be_reported True, if the advertisement can be reported to Telegram moderators through reportVideoMessageAdvertisement +//@sponsor Information about the sponsor of the advertisement +//@title Title of the sponsored message +//@additional_info If non-empty, additional information about the sponsored message to be shown along with the message +videoMessageAdvertisement unique_id:int53 text:string min_display_duration:int32 max_display_duration:int32 can_be_reported:Bool sponsor:advertisementSponsor title:string additional_info:string = VideoMessageAdvertisement; + +//@description Contains a list of advertisements to be shown while a video from a message is watched +//@advertisements List of advertisements +//@start_delay Delay before the first advertisement is shown, in seconds +//@between_delay Delay between consecutive advertisements, in seconds +videoMessageAdvertisements advertisements:vector start_delay:int32 between_delay:int32 = VideoMessageAdvertisements; + //@description Describes an option to report an entity to Telegram @id Unique identifier of the option @text Text of the option reportOption id:bytes text:string = ReportOption; @@ -2917,6 +2971,7 @@ savedMessagesTopic id:int53 type:SavedMessagesTopicType is_pinned:Bool order:int //@id Unique topic identifier //@sender_id Identifier of the user or chat that sends the messages to the topic //@order A parameter used to determine order of the topic in the topic list. Topics must be sorted by the order in descending order +//@can_send_unpaid_messages True, if the other party can send unpaid messages even if the chat has paid messages enabled //@is_marked_as_unread True, if the forum topic is marked as unread //@unread_count Number of unread messages in the chat //@last_read_inbox_message_id Identifier of the last read incoming message @@ -2924,7 +2979,7 @@ savedMessagesTopic id:int53 type:SavedMessagesTopicType is_pinned:Bool order:int //@unread_reaction_count Number of messages with unread reactions in the chat //@last_message Last message in the topic; may be null if none or unknown //@draft_message A draft of a message in the topic; may be null if none -directMessagesChatTopic chat_id:int53 id:int53 sender_id:MessageSender order:int64 is_marked_as_unread:Bool unread_count:int53 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_reaction_count:int53 last_message:message draft_message:draftMessage = DirectMessagesChatTopic; +directMessagesChatTopic chat_id:int53 id:int53 sender_id:MessageSender order:int64 can_send_unpaid_messages:Bool is_marked_as_unread:Bool unread_count:int53 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_reaction_count:int53 last_message:message draft_message:draftMessage = DirectMessagesChatTopic; //@description Describes a forum topic icon @color Color of the topic icon in RGB format @custom_emoji_id Unique identifier of the custom emoji shown on the topic icon; 0 if none @@ -3987,13 +4042,14 @@ messageSticker sticker:sticker is_premium:Bool = MessageContent; //@description A video message //@video The video description //@alternative_videos Alternative qualities of the video +//@storyboards Available storyboards for the video //@cover Cover of the video; may be null if none //@start_timestamp Timestamp from which the video playing must start, in seconds //@caption Video caption //@show_caption_above_media True, if the caption must be shown above the video; otherwise, the caption must be shown below the video //@has_spoiler True, if the video preview must be covered by a spoiler animation //@is_secret True, if the video thumbnail must be blurred and the video must be shown only while tapped -messageVideo video:video alternative_videos:vector cover:photo start_timestamp:int32 caption:formattedText show_caption_above_media:Bool has_spoiler:Bool is_secret:Bool = MessageContent; +messageVideo video:video alternative_videos:vector storyboards:vector cover:photo start_timestamp:int32 caption:formattedText show_caption_above_media:Bool has_spoiler:Bool is_secret:Bool = MessageContent; //@description A video note message @video_note The video note description @is_viewed True, if at least one of the recipients has viewed the video note @is_secret True, if the video note thumbnail must be blurred and the video note must be shown only while tapped messageVideoNote video_note:videoNote is_viewed:Bool is_secret:Bool = MessageContent; @@ -4050,6 +4106,9 @@ messagePoll poll:poll = MessageContent; //@via_mention True, if the story was automatically forwarded because of a mention of the user messageStory story_poster_chat_id:int53 story_id:int32 via_mention:Bool = MessageContent; +//@description A message with a checklist @list The checklist description +messageChecklist list:checklist = MessageContent; + //@description A message with an invoice from a bot. Use getInternalLink with internalLinkTypeBotStart to share the invoice //@product_info Information about the product //@currency Currency for the product price @@ -4329,6 +4388,17 @@ messagePaidMessagePriceChanged paid_message_star_count:int53 = MessageContent; //-0 if the direct messages group was disabled or the messages are free messageDirectMessagePriceChanged is_enabled:Bool paid_message_star_count:int53 = MessageContent; +//@description Some tasks from a checklist were marked as done or not done +//@checklist_message_id Identifier of the message with the checklist; can be 0 if the message was deleted +//@marked_as_done_task_ids Identifiers of tasks that were marked as done +//@marked_as_not_done_task_ids Identifiers of tasks that were marked as not done +messageChecklistTasksDone checklist_message_id:int53 marked_as_done_task_ids:vector marked_as_not_done_task_ids:vector = MessageContent; + +//@description Some tasks were added to a checklist +//@checklist_message_id Identifier of the message with the checklist; can be 0 if the message was deleted +//@tasks List of tasks added to the checklist +messageChecklistTasksAdded checklist_message_id:int53 tasks:vector = MessageContent; + //@description A contact has registered with Telegram messageContactRegistered = MessageContent; @@ -4652,6 +4722,10 @@ inputMessagePoll question:formattedText options:vector is_anonymo //@story_id Story identifier inputMessageStory story_poster_chat_id:int53 story_id:int32 = InputMessageContent; +//@description A message with a checklist. Checklists can't be sent to secret chats, channel chats and channel direct messages chats; for Telegram Premium users only +//@checklist The checklist to send +inputMessageChecklist checklist:inputChecklist = InputMessageContent; + //@description A forwarded message //@from_chat_id Identifier for the chat this forwarded message came from //@message_id Identifier of the message to forward. A message can be forwarded only if messageProperties.can_be_forwarded @@ -4663,12 +4737,13 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool rep //@description Contains properties of a message and describes actions that can be done with the message right now +//@can_add_tasks True, if tasks can be added to the message's checklist using addChecklistTasks if the current user has Telegram Premium subscription //@can_be_copied True, if content of the message can be copied using inputMessageForwarded or forwardMessages with copy options //@can_be_copied_to_secret_chat True, if content of the message can be copied to a secret chat using inputMessageForwarded or forwardMessages with copy options //@can_be_deleted_only_for_self True, if the message can be deleted only for the current user while other users will continue to see it using the method deleteMessages with revoke == false //@can_be_deleted_for_all_users True, if the message can be deleted for all users using the method deleteMessages with revoke == true //@can_be_edited True, if the message can be edited using the methods editMessageText, editMessageCaption, or editMessageReplyMarkup. -//-For live location and poll messages this fields shows whether editMessageLiveLocation or stopPoll can be used with this message +//-For live location, poll, and checklist messages this fields shows whether editMessageLiveLocation, stopPoll, or editMessageChecklist respectively can be used with this message //@can_be_forwarded True, if the message can be forwarded using inputMessageForwarded or forwardMessages without copy options //@can_be_paid True, if the message can be paid using inputInvoiceMessage //@can_be_pinned True, if the message can be pinned or unpinned in the chat using pinChatMessage or unpinChatMessage @@ -4685,14 +4760,16 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool rep //@can_get_message_thread True, if information about the message thread is available through getMessageThread and getMessageThreadHistory //@can_get_read_date True, if read date of the message can be received through getMessageReadDate //@can_get_statistics True, if message statistics are available through getMessageStatistics and message forwards can be received using getMessagePublicForwards +//@can_get_video_advertisements True, if advertisements for video of the message can be received though getVideoMessageAdvertisements //@can_get_viewers True, if chat members already viewed the message can be received through getMessageViewers +//@can_mark_tasks_as_done True, if tasks can be marked as done or not done in the message's checklist using markChecklistTasksAsDone if the current user has Telegram Premium subscription //@can_recognize_speech True, if speech can be recognized for the message through recognizeSpeech //@can_report_chat True, if the message can be reported using reportChat //@can_report_reactions True, if reactions on the message can be reported through reportMessageReactions //@can_report_supergroup_spam True, if the message can be reported using reportSupergroupSpam //@can_set_fact_check True, if fact check for the message can be changed through setMessageFactCheck //@need_show_statistics True, if message statistics must be available from context menu of the message -messageProperties can_be_copied:Bool can_be_copied_to_secret_chat:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_paid:Bool can_be_pinned:Bool can_be_replied:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_shared_in_story:Bool can_edit_media:Bool can_edit_scheduling_state:Bool can_get_author:Bool can_get_embedding_code:Bool can_get_link:Bool can_get_media_timestamp_links:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_statistics:Bool can_get_viewers:Bool can_recognize_speech:Bool can_report_chat:Bool can_report_reactions:Bool can_report_supergroup_spam:Bool can_set_fact_check:Bool need_show_statistics:Bool = MessageProperties; +messageProperties can_add_tasks:Bool can_be_copied:Bool can_be_copied_to_secret_chat:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_paid:Bool can_be_pinned:Bool can_be_replied:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_shared_in_story:Bool can_edit_media:Bool can_edit_scheduling_state:Bool can_get_author:Bool can_get_embedding_code:Bool can_get_link:Bool can_get_media_timestamp_links:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_statistics:Bool can_get_video_advertisements:Bool can_get_viewers:Bool can_mark_tasks_as_done:Bool can_recognize_speech:Bool can_report_chat:Bool can_report_reactions:Bool can_report_supergroup_spam:Bool can_set_fact_check:Bool need_show_statistics:Bool = MessageProperties; //@class SearchMessagesFilter @description Represents a filter for message search results @@ -6445,6 +6522,9 @@ premiumFeatureBusiness = PremiumFeature; //@description The ability to use all available message effects premiumFeatureMessageEffects = PremiumFeature; +//@description The ability to create and use checklist messages +premiumFeatureChecklists = PremiumFeature; + //@class BusinessFeature @description Describes a feature available to Business user accounts @@ -6956,6 +7036,11 @@ pushMessageContentStory is_mention:Bool is_pinned:Bool = PushMessageContent; //@description A text message @text Message text @is_pinned True, if the message is a pinned message with the specified content pushMessageContentText text:string is_pinned:Bool = PushMessageContent; +//@description A message with a checklist +//@title Checklist title +//@is_pinned True, if the message is a pinned message with the specified content +pushMessageContentChecklist title:string is_pinned:Bool = PushMessageContent; + //@description A video message //@video Message content; may be null //@caption Video caption @@ -7021,6 +7106,12 @@ pushMessageContentSuggestProfilePhoto = PushMessageContent; //@description A user in the chat came within proximity alert range from the current user @distance The distance to the user pushMessageContentProximityAlertTriggered distance:int32 = PushMessageContent; +//@description Some tasks were added to a checklist @task_count Number of added tasks +pushMessageContentChecklistTasksAdded task_count:int32 = PushMessageContent; + +//@description Some tasks from a checklist were marked as done or not done @task_count Number of changed tasks +pushMessageContentChecklistTasksDone task_count:int32 = PushMessageContent; + //@description A forwarded messages @total_count Number of forwarded messages pushMessageContentMessageForwards total_count:int32 = PushMessageContent; @@ -9313,8 +9404,8 @@ getMessage chat_id:int53 message_id:int53 = Message; getMessageLocally chat_id:int53 message_id:int53 = Message; //@description Returns information about a non-bundled message that is replied by a given message. Also, returns the pinned message, the game message, the invoice message, -//-the message with a previously set same background, the giveaway message, and the topic creation message for messages of the types -//-messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground, messageGiveawayCompleted and topic messages without non-bundled replied message respectively. +//-the message with a previously set same background, the giveaway message, the checklist message, and the topic creation message for messages of the types +//-messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground, messageGiveawayCompleted, messageChecklistTasksDone and messageChecklistTasksAdded, and topic messages without non-bundled replied message respectively. //-Returns a 404 error if the message doesn't exist //@chat_id Identifier of the chat the message belongs to //@message_id Identifier of the reply message @@ -9517,6 +9608,18 @@ unpinAllDirectMessagesChatTopicMessages chat_id:int53 topic_id:int53 = Ok; //@topic_id Topic identifier readAllDirectMessagesChatTopicReactions chat_id:int53 topic_id:int53 = Ok; +//@description Returns the total number of Telegram Stars received by the channel chat for direct messages from the given topic +//@chat_id Chat identifier of the channel direct messages chat administered by the current user +//@topic_id Identifier of the topic +getDirectMessagesChatTopicRevenue chat_id:int53 topic_id:int53 = StarCount; + +//@description Allows to send unpaid messages to the given topic of the channel direct messages chat administered by the current user +//@chat_id Chat identifier +//@topic_id Identifier of the topic +//@can_send_unpaid_messages Pass true to allow unpaid messages; pass false to disallow unpaid messages +//@refund_payments Pass true to refund the user previously paid messages +toggleDirectMessagesChatTopicCanSendUnpaidMessages chat_id:int53 topic_id:int53 can_send_unpaid_messages:Bool refund_payments:Bool = Ok; + //@description Loads more Saved Messages topics. The loaded topics will be sent through updateSavedMessagesTopic. Topics are sorted by their topic.order in descending order. Returns a 404 error if all topics have been loaded //@limit The maximum number of topics to be loaded. For optimal performance, the number of loaded topics is chosen by TDLib and can be smaller than the specified limit, even if the end of the list is not reached @@ -9757,6 +9860,22 @@ openSponsoredChat sponsored_chat_unique_id:int53 = Ok; //@option_id Option identifier chosen by the user; leave empty for the initial request reportSponsoredChat sponsored_chat_unique_id:int53 option_id:bytes = ReportSponsoredResult; +//@description Returns advertisements to be shown while a video from a message is watched. Available only if messageProperties.can_get_video_advertisements +//@chat_id Identifier of the chat with the message +//@message_id Identifier of the message +getVideoMessageAdvertisements chat_id:int53 message_id:int53 = VideoMessageAdvertisements; + +//@description Informs TDLib that the user viewed a video message advertisement @advertisement_unique_id Unique identifier of the advertisement +viewVideoMessageAdvertisement advertisement_unique_id:int53 = Ok; + +//@description Informs TDLib that the user clicked a video message advertisement @advertisement_unique_id Unique identifier of the advertisement +clickVideoMessageAdvertisement advertisement_unique_id:int53 = Ok; + +//@description Reports a video message advertisement to Telegram moderators +//@advertisement_unique_id Unique identifier of the advertisement +//@option_id Option identifier chosen by the user; leave empty for the initial request +reportVideoMessageAdvertisement advertisement_unique_id:int53 option_id:bytes = ReportSponsoredResult; + //@description Removes an active notification from notification list. Needs to be called only if the notification is removed by the current user @notification_group_id Identifier of notification group to which the notification belongs @notification_id Identifier of removed notification removeNotification notification_group_id:int32 notification_id:int32 = Ok; @@ -9924,6 +10043,13 @@ editMessageText chat_id:int53 message_id:int53 reply_markup:ReplyMarkup input_me //@proximity_alert_radius The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled editMessageLiveLocation chat_id:int53 message_id:int53 reply_markup:ReplyMarkup location:location live_period:int32 heading:int32 proximity_alert_radius:int32 = Message; +//@description Edits the message content of a checklist. Returns the edited message after the edit is completed on the server side +//@chat_id The chat the message belongs to +//@message_id Identifier of the message. Use messageProperties.can_be_edited to check whether the message can be edited +//@reply_markup The new message reply markup; pass null if none; for bots only +//@checklist The new checklist. If some tasks were completed, this information will be kept +editMessageChecklist chat_id:int53 message_id:int53 reply_markup:ReplyMarkup checklist:inputChecklist = Message; + //@description Edits the media content of a message, including message caption. If only the caption needs to be edited, use editMessageCaption instead. //-The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa. Returns the edited message after the edit is completed on the server side //@chat_id The chat the message belongs to @@ -10036,6 +10162,14 @@ editBusinessMessageText business_connection_id:string chat_id:int53 message_id:i //@proximity_alert_radius The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled editBusinessMessageLiveLocation business_connection_id:string chat_id:int53 message_id:int53 reply_markup:ReplyMarkup location:location live_period:int32 heading:int32 proximity_alert_radius:int32 = BusinessMessage; +//@description Edits the content of a checklist in a message sent on behalf of a business account; for bots only +//@business_connection_id Unique identifier of business connection on behalf of which the message was sent +//@chat_id The chat the message belongs to +//@message_id Identifier of the message +//@reply_markup The new message reply markup; pass null if none +//@checklist The new checklist. If some tasks were completed, this information will be kept +editBusinessMessageChecklist business_connection_id:string chat_id:int53 message_id:int53 reply_markup:ReplyMarkup checklist:inputChecklist = BusinessMessage; + //@description Edits the media content of a message with a text, an animation, an audio, a document, a photo or a video in a message sent on behalf of a business account; for bots only //@business_connection_id Unique identifier of business connection on behalf of which the message was sent //@chat_id The chat the message belongs to @@ -10163,7 +10297,7 @@ deleteQuickReplyShortcutMessages shortcut_id:int32 message_ids:vector = O //-The shortcut must not contain more than getOption("quick_reply_shortcut_message_count_max") messages after adding the new message. Returns the added message //@shortcut_name Name of the target shortcut //@reply_to_message_id Identifier of a quick reply message in the same shortcut to be replied; pass 0 if none -//@input_message_content The content of the message to be added; inputMessagePoll, inputMessageForwarded and inputMessageLocation with live_period aren't supported +//@input_message_content The content of the message to be added; inputMessagePaidMedia, inputMessageForwarded and inputMessageLocation with live_period aren't supported addQuickReplyShortcutMessage shortcut_name:string reply_to_message_id:int53 input_message_content:InputMessageContent = QuickReplyMessage; //@description Adds a message to a quick reply shortcut via inline bot. If shortcut doesn't exist and there are less than getOption("quick_reply_shortcut_count_max") shortcuts, then a new shortcut is created. @@ -10189,10 +10323,11 @@ addQuickReplyShortcutMessageAlbum shortcut_name:string reply_to_message_id:int53 readdQuickReplyShortcutMessages shortcut_name:string message_ids:vector = QuickReplyMessages; //@description Asynchronously edits the text, media or caption of a quick reply message. Use quickReplyMessage.can_be_edited to check whether a message can be edited. -//-Media message can be edited only to a media message. The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa +//-Media message can be edited only to a media message. Checklist messages can be edited only to a checklist message. +//-The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa //@shortcut_id Unique identifier of the quick reply shortcut with the message //@message_id Identifier of the message -//@input_message_content New content of the message. Must be one of the following types: inputMessageText, inputMessageAnimation, inputMessageAudio, inputMessageDocument, inputMessagePhoto or inputMessageVideo +//@input_message_content New content of the message. Must be one of the following types: inputMessageAnimation, inputMessageAudio, inputMessageChecklist, inputMessageDocument, inputMessagePhoto, inputMessageText, or inputMessageVideo editQuickReplyMessage shortcut_id:int32 message_id:int53 input_message_content:InputMessageContent = Ok; @@ -10412,6 +10547,20 @@ getPollVoters chat_id:int53 message_id:int53 option_id:int32 offset:int32 limit: stopPoll chat_id:int53 message_id:int53 reply_markup:ReplyMarkup = Ok; +//@description Adds tasks to a checklist in a message +//@chat_id Identifier of the chat with the message +//@message_id Identifier of the message containing the checklist. Use messageProperties.can_add_tasks to check whether the tasks can be added +//@tasks List of added tasks +addChecklistTasks chat_id:int53 message_id:int53 tasks:vector = Ok; + +//@description Adds tasks of a checklist in a message as done or not done +//@chat_id Identifier of the chat with the message +//@message_id Identifier of the message containing the checklist. Use messageProperties.can_mark_tasks_as_done to check whether the tasks can be marked as done or not done +//@marked_as_done_task_ids Identifiers of tasks that were marked as done +//@marked_as_not_done_task_ids Identifiers of tasks that were marked as not done +markChecklistTasksAsDone chat_id:int53 message_id:int53 marked_as_done_task_ids:vector marked_as_not_done_task_ids:vector = Ok; + + //@description Hides a suggested action @action Suggested action to hide hideSuggestedAction action:SuggestedAction = Ok; From 5c5078ec427b2444302480aa3526ea4c30332970 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Tue, 2 Sep 2025 18:58:30 +0800 Subject: [PATCH 47/54] Fix command parser --- client/extra.go | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/client/extra.go b/client/extra.go index c786893..9b32fc9 100644 --- a/client/extra.go +++ b/client/extra.go @@ -23,22 +23,18 @@ func IsCommand(text string) bool { func CheckCommand(text string, entities []*TextEntity) string { if IsCommand(text) { - var cmd string + cmd := text // e.g. ["/hello 123", "/hell o 123"] // Result: "/hello", "/hell" - if i := strings.Index(text, " "); i != -1 { - cmd = text[:i] + if i := strings.Index(cmd, " "); i != -1 { + cmd = cmd[:i] } // e.g.: ["/hello@world_bot", "/hello@", "/hello@123"] // Result: "/hello" - if i := strings.Index(text, "@"); i != -1 { - cmd = text[:i] - } - - if cmd == "" { - return text + if i := strings.Index(cmd, "@"); i != -1 { + cmd = cmd[:i] } return cmd From 14418433a409d1f0003bf6dbaa6f5445865d5b6e Mon Sep 17 00:00:00 2001 From: c0re100 Date: Tue, 2 Sep 2025 19:11:19 +0800 Subject: [PATCH 48/54] Update to TDLib 1.8.52 --- client/function.go | 205 +++++-- client/type.go | 1230 ++++++++++++++++++++++++++++++++++++++--- client/unmarshaler.go | 616 +++++++++++++++++++-- data/td_api.tl | 352 +++++++++--- 4 files changed, 2174 insertions(+), 229 deletions(-) diff --git a/client/function.go b/client/function.go index c2e9384..63ba51e 100755 --- a/client/function.go +++ b/client/function.go @@ -1429,7 +1429,7 @@ type GetRepliedMessageRequest struct { MessageId int64 `json:"message_id"` } -// Returns information about a non-bundled message that is replied by a given message. Also, returns the pinned message, the game message, the invoice message, the message with a previously set same background, the giveaway message, the checklist message, and the topic creation message for messages of the types messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground, messageGiveawayCompleted, messageChecklistTasksDone and messageChecklistTasksAdded, and topic messages without non-bundled replied message respectively. Returns a 404 error if the message doesn't exist +// Returns information about a non-bundled message that is replied by a given message. Also, returns the pinned message for messagePinMessage, the game message for messageGameScore, the invoice message for messagePaymentSuccessful, the message with a previously set same background for messageChatSetBackground, the giveaway message for messageGiveawayCompleted, the checklist message for messageChecklistTasksDone, messageChecklistTasksAdded, the message with suggested post information for messageSuggestedPostApprovalFailed, messageSuggestedPostApproved, messageSuggestedPostDeclined, messageSuggestedPostPaid, messageSuggestedPostRefunded, the message with the regular gift that was upgraded for messageUpgradedGift with origin of the type upgradedGiftOriginUpgrade, and the topic creation message for topic messages without non-bundled replied message. Returns a 404 error if the message doesn't exist func (client *Client) GetRepliedMessage(req *GetRepliedMessageRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -2519,9 +2519,9 @@ type GetDirectMessagesChatTopicHistoryRequest struct { TopicId int64 `json:"topic_id"` // Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message FromMessageId int64 `json:"from_message_id"` - // Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages + // Specify 0 to get results from exactly the message from_message_id or a negative number from -99 to -1 to get additionally -offset newer messages Offset int32 `json:"offset"` - // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit + // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than or equal to -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit Limit int32 `json:"limit"` } @@ -2863,9 +2863,9 @@ type GetSavedMessagesTopicHistoryRequest struct { SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` // Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message FromMessageId int64 `json:"from_message_id"` - // Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages + // Specify 0 to get results from exactly the message from_message_id or a negative number from -99 to -1 to get additionally -offset newer messages Offset int32 `json:"offset"` - // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit + // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than or equal to -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit Limit int32 `json:"limit"` } @@ -3072,9 +3072,9 @@ type GetChatHistoryRequest struct { ChatId int64 `json:"chat_id"` // Identifier of the message starting from which history must be fetched; use 0 to get results from the last message FromMessageId int64 `json:"from_message_id"` - // Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages + // Specify 0 to get results from exactly the message from_message_id or a negative number from -99 to -1 to get additionally -offset newer messages Offset int32 `json:"offset"` - // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit + // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than or equal to -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit Limit int32 `json:"limit"` // Pass true to get only messages that are available without sending network requests OnlyLocal bool `json:"only_local"` @@ -3112,9 +3112,9 @@ type GetMessageThreadHistoryRequest struct { MessageId int64 `json:"message_id"` // Identifier of the message starting from which history must be fetched; use 0 to get results from the last message FromMessageId int64 `json:"from_message_id"` - // Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages + // Specify 0 to get results from exactly the message from_message_id or a negative number from -99 to -1 to get additionally -offset newer messages Offset int32 `json:"offset"` - // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit + // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than or equal to -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit Limit int32 `json:"limit"` } @@ -3212,9 +3212,9 @@ type SearchChatMessagesRequest struct { SenderId MessageSender `json:"sender_id"` // Identifier of the message starting from which history must be fetched; use 0 to get results from the last message FromMessageId int64 `json:"from_message_id"` - // Specify 0 to get results from exactly the message from_message_id or a negative offset to get the specified message and some newer messages + // Specify 0 to get results from exactly the message from_message_id or a negative number to get the specified message and some newer messages Offset int32 `json:"offset"` - // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit + // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit Limit int32 `json:"limit"` // Additional filter for messages to search; pass null to search for all messages Filter SearchMessagesFilter `json:"filter"` @@ -3342,9 +3342,9 @@ type SearchSavedMessagesRequest struct { Query string `json:"query"` // Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message FromMessageId int64 `json:"from_message_id"` - // Specify 0 to get results from exactly the message from_message_id or a negative offset to get the specified message and some newer messages + // Specify 0 to get results from exactly the message from_message_id or a negative number to get the specified message and some newer messages Offset int32 `json:"offset"` - // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit + // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit Limit int32 `json:"limit"` } @@ -6071,7 +6071,7 @@ type SetBusinessAccountProfilePhotoRequest struct { BusinessConnectionId string `json:"business_connection_id"` // Profile photo to set; pass null to remove the photo Photo InputChatPhoto `json:"photo"` - // Pass true to set the public photo, which will be visible even the main photo is hidden by privacy settings + // Pass true to set the public photo, which will be visible even if the main photo is hidden by privacy settings IsPublic bool `json:"is_public"` } @@ -6624,7 +6624,7 @@ type EditForumTopicRequest struct { IconCustomEmojiId JsonInt64 `json:"icon_custom_emoji_id"` } -// Edits title and icon of a topic in a forum supergroup chat; requires can_manage_topics right in the supergroup unless the user is creator of the topic +// Edits title and icon of a topic in a forum supergroup chat; requires can_manage_topics administrator right in the supergroup unless the user is creator of the topic func (client *Client) EditForumTopic(req *EditForumTopicRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -6789,7 +6789,7 @@ type ToggleForumTopicIsClosedRequest struct { IsClosed bool `json:"is_closed"` } -// Toggles whether a topic is closed in a forum supergroup chat; requires can_manage_topics right in the supergroup unless the user is creator of the topic +// Toggles whether a topic is closed in a forum supergroup chat; requires can_manage_topics administrator right in the supergroup unless the user is creator of the topic func (client *Client) ToggleForumTopicIsClosed(req *ToggleForumTopicIsClosedRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -6819,7 +6819,7 @@ type ToggleGeneralForumTopicIsHiddenRequest struct { IsHidden bool `json:"is_hidden"` } -// Toggles whether a General topic is hidden in a forum supergroup chat; requires can_manage_topics right in the supergroup +// Toggles whether a General topic is hidden in a forum supergroup chat; requires can_manage_topics administrator right in the supergroup func (client *Client) ToggleGeneralForumTopicIsHidden(req *ToggleGeneralForumTopicIsHiddenRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -6850,7 +6850,7 @@ type ToggleForumTopicIsPinnedRequest struct { IsPinned bool `json:"is_pinned"` } -// Changes the pinned state of a forum topic; requires can_manage_topics right in the supergroup. There can be up to getOption("pinned_forum_topic_count_max") pinned forum topics +// Changes the pinned state of a forum topic; requires can_manage_topics administrator right in the supergroup. There can be up to getOption("pinned_forum_topic_count_max") pinned forum topics func (client *Client) ToggleForumTopicIsPinned(req *ToggleForumTopicIsPinnedRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -6880,7 +6880,7 @@ type SetPinnedForumTopicsRequest struct { MessageThreadIds []int64 `json:"message_thread_ids"` } -// Changes the order of pinned forum topics; requires can_manage_topics right in the supergroup +// Changes the order of pinned forum topics; requires can_manage_topics administrator right in the supergroup func (client *Client) SetPinnedForumTopics(req *SetPinnedForumTopicsRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -9163,7 +9163,7 @@ type ViewMessagesRequest struct { MessageIds []int64 `json:"message_ids"` // Source of the message view; pass null to guess the source based on chat open state Source MessageSource `json:"source"` - // Pass true to mark as read the specified messages even the chat is closed + // Pass true to mark as read the specified messages even if the chat is closed ForceRead bool `json:"force_read"` } @@ -9383,6 +9383,9 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeMyStars: return UnmarshalInternalLinkTypeMyStars(result.Data) + case TypeInternalLinkTypeMyToncoins: + return UnmarshalInternalLinkTypeMyToncoins(result.Data) + case TypeInternalLinkTypePassportDataRequest: return UnmarshalInternalLinkTypePassportDataRequest(result.Data) @@ -11189,7 +11192,7 @@ type SetChatSlowModeDelayRequest struct { SlowModeDelay int32 `json:"slow_mode_delay"` } -// Changes the slow mode delay of a chat. Available only for supergroups; requires can_restrict_members right +// Changes the slow mode delay of a chat. Available only for supergroups; requires can_restrict_members administrator right func (client *Client) SetChatSlowModeDelay(req *SetChatSlowModeDelayRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -12087,7 +12090,7 @@ type CanPostStoryRequest struct { ChatId int64 `json:"chat_id"` } -// Checks whether the current user can post a story on behalf of a chat; requires can_post_stories right for supergroup and channel chats +// Checks whether the current user can post a story on behalf of a chat; requires can_post_stories administrator right for supergroup and channel chats func (client *Client) CanPostStory(req *CanPostStoryRequest) (CanPostStoryResult, error) { result, err := client.Send(Request{ meta: meta{ @@ -12150,7 +12153,7 @@ type PostStoryRequest struct { ProtectContent bool `json:"protect_content"` } -// Posts a new story on behalf of a chat; requires can_post_stories right for supergroup and channel chats. Returns a temporary story +// Posts a new story on behalf of a chat; requires can_post_stories administrator right for supergroup and channel chats. Returns a temporary story func (client *Client) PostStory(req *PostStoryRequest) (*Story, error) { result, err := client.Send(Request{ meta: meta{ @@ -12480,7 +12483,7 @@ type GetChatArchivedStoriesRequest struct { Limit int32 `json:"limit"` } -// Returns the list of all stories posted by the given chat; requires can_edit_stories right in the chat. The stories are returned in reverse chronological order (i.e., in order of decreasing story_id). For optimal performance, the number of returned stories is chosen by TDLib +// Returns the list of all stories posted by the given chat; requires can_edit_stories administrator right in the chat. The stories are returned in reverse chronological order (i.e., in order of decreasing story_id). For optimal performance, the number of returned stories is chosen by TDLib func (client *Client) GetChatArchivedStories(req *GetChatArchivedStoriesRequest) (*Stories, error) { result, err := client.Send(Request{ meta: meta{ @@ -12510,7 +12513,7 @@ type SetChatPinnedStoriesRequest struct { StoryIds []int32 `json:"story_ids"` } -// Changes the list of pinned stories on a chat page; requires can_edit_stories right in the chat +// Changes the list of pinned stories on a chat page; requires can_edit_stories administrator right in the chat func (client *Client) SetChatPinnedStories(req *SetChatPinnedStoriesRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -13273,7 +13276,7 @@ func (client *Client) GetDefaultChatEmojiStatuses() (*EmojiStatusCustomEmojis, e return UnmarshalEmojiStatusCustomEmojis(result.Data) } -// Returns the list of emoji statuses, which can't be used as chat emoji status, even they are from a sticker set with is_allowed_as_chat_emoji_status == true +// Returns the list of emoji statuses, which can't be used as chat emoji status, even if they are from a sticker set with is_allowed_as_chat_emoji_status == true func (client *Client) GetDisallowedChatEmojiStatuses() (*EmojiStatusCustomEmojis, error) { result, err := client.Send(Request{ meta: meta{ @@ -14484,6 +14487,102 @@ func (client *Client) ProcessChatJoinRequests(req *ProcessChatJoinRequestsReques return UnmarshalOk(result.Data) } +type ApproveSuggestedPostRequest struct { + // Chat identifier of the channel direct messages chat + ChatId int64 `json:"chat_id"` + // Identifier of the message with the suggested post. Use messageProperties.can_be_approved to check whether the suggested post can be approved + MessageId int64 `json:"message_id"` + // Point in time (Unix timestamp) when the post is expected to be published; pass 0 if the date has already been chosen. If specified, then the date must be in the future, but at most getOption("suggested_post_send_delay_max") seconds in the future + SendDate int32 `json:"send_date"` +} + +// Approves a suggested post in a channel direct messages chat +func (client *Client) ApproveSuggestedPost(req *ApproveSuggestedPostRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "approveSuggestedPost", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "send_date": req.SendDate, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DeclineSuggestedPostRequest struct { + // Chat identifier of the channel direct messages chat + ChatId int64 `json:"chat_id"` + // Identifier of the message with the suggested post. Use messageProperties.can_be_declined to check whether the suggested post can be declined + MessageId int64 `json:"message_id"` + // Comment for the creator of the suggested post; 0-128 characters + Comment string `json:"comment"` +} + +// Declines a suggested post in a channel direct messages chat +func (client *Client) DeclineSuggestedPost(req *DeclineSuggestedPostRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "declineSuggestedPost", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "comment": req.Comment, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type AddOfferRequest struct { + // Identifier of the channel direct messages chat + ChatId int64 `json:"chat_id"` + // Identifier of the message in the chat which will be sent as suggested post. Use messageProperties.can_add_offer to check whether an offer can be added or messageProperties.can_edit_suggested_post_info to check whether price or time of sending of the post can be changed + MessageId int64 `json:"message_id"` + // Options to be used to send the message. New information about the suggested post must always be specified + Options *MessageSendOptions `json:"options"` +} + +// Sent a suggested post based on a previously sent message in a channel direct messages chat. Can be also used to suggest price or time change for an existing suggested post. Returns the sent message +func (client *Client) AddOffer(req *AddOfferRequest) (*Message, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addOffer", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "options": req.Options, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessage(result.Data) +} + type CreateCallRequest struct { // Identifier of the user to be called UserId int64 `json:"user_id"` @@ -17576,7 +17675,7 @@ func (client *Client) GetWebPageInstantView(req *GetWebPageInstantViewRequest) ( type SetProfilePhotoRequest struct { // Profile photo to set Photo InputChatPhoto `json:"photo"` - // Pass true to set the public photo, which will be visible even the main photo is hidden by privacy settings + // Pass true to set the public photo, which will be visible even if the main photo is hidden by privacy settings IsPublic bool `json:"is_public"` } @@ -20481,7 +20580,7 @@ type SellGiftRequest struct { ReceivedGiftId string `json:"received_gift_id"` } -// Sells a gift for Telegram Stars +// Sells a gift for Telegram Stars; requires owner privileges for gifts owned by a chat func (client *Client) SellGift(req *SellGiftRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -20894,7 +20993,7 @@ type SearchGiftsForResaleRequest struct { Limit int32 `json:"limit"` } -// Returns upgraded gifts that can be bought from other owners +// Returns upgraded gifts that can be bought from other owners using sendResoldGift func (client *Client) SearchGiftsForResale(req *SearchGiftsForResaleRequest) (*GiftsForResale, error) { result, err := client.Send(Request{ meta: meta{ @@ -22206,9 +22305,9 @@ func (client *Client) GetChatRevenueWithdrawalUrl(req *GetChatRevenueWithdrawalU type GetChatRevenueTransactionsRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` - // Number of transactions to skip - Offset int32 `json:"offset"` - // The maximum number of transactions to be returned; up to 200 + // Offset of the first transaction to return as received from the previous request; use empty string to get the first chunk of results + Offset string `json:"offset"` + // The maximum number of transactions to be returned; up to 100 Limit int32 `json:"limit"` } @@ -22235,6 +22334,38 @@ func (client *Client) GetChatRevenueTransactions(req *GetChatRevenueTransactions return UnmarshalChatRevenueTransactions(result.Data) } +type GetTonTransactionsRequest struct { + // Direction of the transactions to receive; pass null to get all transactions + Direction TransactionDirection `json:"direction"` + // Offset of the first transaction to return as received from the previous request; use empty string to get the first chunk of results + Offset string `json:"offset"` + // The maximum number of transactions to return + Limit int32 `json:"limit"` +} + +// Returns the list of Toncoin transactions of the current user +func (client *Client) GetTonTransactions(req *GetTonTransactionsRequest) (*TonTransactions, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getTonTransactions", + }, + Data: map[string]interface{}{ + "direction": req.Direction, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalTonTransactions(result.Data) +} + type GetStarRevenueStatisticsRequest struct { // Identifier of the owner of the Telegram Stars; can be identifier of the current user, an owned bot, or a supergroup or a channel chat with supergroupFullInfo.can_get_star_revenue_statistics == true OwnerId MessageSender `json:"owner_id"` @@ -22267,7 +22398,7 @@ func (client *Client) GetStarRevenueStatistics(req *GetStarRevenueStatisticsRequ type GetStarWithdrawalUrlRequest struct { // Identifier of the owner of the Telegram Stars; can be identifier of the current user, an owned bot, or an owned supergroup or channel chat OwnerId MessageSender `json:"owner_id"` - // The number of Telegram Stars to withdraw. Must be at least getOption("star_withdrawal_count_min") + // The number of Telegram Stars to withdraw; must be between getOption("star_withdrawal_count_min") and getOption("star_withdrawal_count_max") StarCount int64 `json:"star_count"` // The 2-step verification password of the current user Password string `json:"password"` @@ -24271,7 +24402,7 @@ type GetStarTransactionsRequest struct { // If non-empty, only transactions related to the Star Subscription will be returned SubscriptionId string `json:"subscription_id"` // Direction of the transactions to receive; pass null to get all transactions - Direction StarTransactionDirection `json:"direction"` + Direction TransactionDirection `json:"direction"` // Offset of the first transaction to return as received from the previous request; use empty string to get the first chunk of results Offset string `json:"offset"` // The maximum number of transactions to return @@ -25970,6 +26101,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateMessageFactCheck: return UnmarshalUpdateMessageFactCheck(result.Data) + case TypeUpdateMessageSuggestedPostInfo: + return UnmarshalUpdateMessageSuggestedPostInfo(result.Data) + case TypeUpdateMessageLiveLocationViewed: return UnmarshalUpdateMessageLiveLocationViewed(result.Data) @@ -26315,6 +26449,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateOwnedStarCount: return UnmarshalUpdateOwnedStarCount(result.Data) + case TypeUpdateOwnedTonCount: + return UnmarshalUpdateOwnedTonCount(result.Data) + case TypeUpdateChatRevenueAmount: return UnmarshalUpdateChatRevenueAmount(result.Data) diff --git a/client/type.go b/client/type.go index 9f487c5..a98e665 100755 --- a/client/type.go +++ b/client/type.go @@ -23,14 +23,19 @@ const ( ClassBusinessAwayMessageSchedule = "BusinessAwayMessageSchedule" ClassChatPhotoStickerType = "ChatPhotoStickerType" ClassInputChatPhoto = "InputChatPhoto" + ClassSuggestedPostPrice = "SuggestedPostPrice" + ClassSuggestedPostState = "SuggestedPostState" + ClassSuggestedPostRefundReason = "SuggestedPostRefundReason" ClassStarSubscriptionType = "StarSubscriptionType" ClassAffiliateType = "AffiliateType" ClassAffiliateProgramSortOrder = "AffiliateProgramSortOrder" + ClassUpgradedGiftOrigin = "UpgradedGiftOrigin" ClassUpgradedGiftAttributeId = "UpgradedGiftAttributeId" ClassGiftForResaleOrder = "GiftForResaleOrder" ClassSentGift = "SentGift" - ClassStarTransactionDirection = "StarTransactionDirection" + ClassTransactionDirection = "TransactionDirection" ClassStarTransactionType = "StarTransactionType" + ClassTonTransactionType = "TonTransactionType" ClassGiveawayParticipantStatus = "GiveawayParticipantStatus" ClassGiveawayInfo = "GiveawayInfo" ClassGiveawayPrize = "GiveawayPrize" @@ -256,6 +261,8 @@ const ( ClassChatPhotos = "ChatPhotos" ClassChatPermissions = "ChatPermissions" ClassChatAdministratorRights = "ChatAdministratorRights" + ClassSuggestedPostInfo = "SuggestedPostInfo" + ClassInputSuggestedPostInfo = "InputSuggestedPostInfo" ClassStarAmount = "StarAmount" ClassStarSubscriptionPricing = "StarSubscriptionPricing" ClassStarSubscription = "StarSubscription" @@ -302,6 +309,8 @@ const ( ClassGiftUpgradePreview = "GiftUpgradePreview" ClassStarTransaction = "StarTransaction" ClassStarTransactions = "StarTransactions" + ClassTonTransaction = "TonTransaction" + ClassTonTransactions = "TonTransactions" ClassAccentColor = "AccentColor" ClassProfileAccentColors = "ProfileAccentColors" ClassProfileAccentColor = "ProfileAccentColor" @@ -780,6 +789,15 @@ const ( TypeInputChatPhotoSticker = "inputChatPhotoSticker" TypeChatPermissions = "chatPermissions" TypeChatAdministratorRights = "chatAdministratorRights" + TypeSuggestedPostPriceStar = "suggestedPostPriceStar" + TypeSuggestedPostPriceTon = "suggestedPostPriceTon" + TypeSuggestedPostStatePending = "suggestedPostStatePending" + TypeSuggestedPostStateApproved = "suggestedPostStateApproved" + TypeSuggestedPostStateDeclined = "suggestedPostStateDeclined" + TypeSuggestedPostInfo = "suggestedPostInfo" + TypeInputSuggestedPostInfo = "inputSuggestedPostInfo" + TypeSuggestedPostRefundReasonPostDeleted = "suggestedPostRefundReasonPostDeleted" + TypeSuggestedPostRefundReasonPaymentRefunded = "suggestedPostRefundReasonPaymentRefunded" TypeStarAmount = "starAmount" TypeStarSubscriptionTypeChannel = "starSubscriptionTypeChannel" TypeStarSubscriptionTypeBot = "starSubscriptionTypeBot" @@ -814,6 +832,9 @@ const ( TypeStarGiveawayPaymentOptions = "starGiveawayPaymentOptions" TypeAcceptedGiftTypes = "acceptedGiftTypes" TypeGiftSettings = "giftSettings" + TypeUpgradedGiftOriginUpgrade = "upgradedGiftOriginUpgrade" + TypeUpgradedGiftOriginTransfer = "upgradedGiftOriginTransfer" + TypeUpgradedGiftOriginResale = "upgradedGiftOriginResale" TypeUpgradedGiftModel = "upgradedGiftModel" TypeUpgradedGiftSymbol = "upgradedGiftSymbol" TypeUpgradedGiftBackdropColors = "upgradedGiftBackdropColors" @@ -840,8 +861,8 @@ const ( TypeReceivedGift = "receivedGift" TypeReceivedGifts = "receivedGifts" TypeGiftUpgradePreview = "giftUpgradePreview" - TypeStarTransactionDirectionIncoming = "starTransactionDirectionIncoming" - TypeStarTransactionDirectionOutgoing = "starTransactionDirectionOutgoing" + TypeTransactionDirectionIncoming = "transactionDirectionIncoming" + TypeTransactionDirectionOutgoing = "transactionDirectionOutgoing" TypeStarTransactionTypePremiumBotDeposit = "starTransactionTypePremiumBotDeposit" TypeStarTransactionTypeAppStoreDeposit = "starTransactionTypeAppStoreDeposit" TypeStarTransactionTypeGooglePlayDeposit = "starTransactionTypeGooglePlayDeposit" @@ -872,12 +893,19 @@ const ( TypeStarTransactionTypeAffiliateProgramCommission = "starTransactionTypeAffiliateProgramCommission" TypeStarTransactionTypePaidMessageSend = "starTransactionTypePaidMessageSend" TypeStarTransactionTypePaidMessageReceive = "starTransactionTypePaidMessageReceive" + TypeStarTransactionTypeSuggestedPostPaymentSend = "starTransactionTypeSuggestedPostPaymentSend" + TypeStarTransactionTypeSuggestedPostPaymentReceive = "starTransactionTypeSuggestedPostPaymentReceive" TypeStarTransactionTypePremiumPurchase = "starTransactionTypePremiumPurchase" TypeStarTransactionTypeBusinessBotTransferSend = "starTransactionTypeBusinessBotTransferSend" TypeStarTransactionTypeBusinessBotTransferReceive = "starTransactionTypeBusinessBotTransferReceive" TypeStarTransactionTypeUnsupported = "starTransactionTypeUnsupported" TypeStarTransaction = "starTransaction" TypeStarTransactions = "starTransactions" + TypeTonTransactionTypeFragmentDeposit = "tonTransactionTypeFragmentDeposit" + TypeTonTransactionTypeSuggestedPostPayment = "tonTransactionTypeSuggestedPostPayment" + TypeTonTransactionTypeUnsupported = "tonTransactionTypeUnsupported" + TypeTonTransaction = "tonTransaction" + TypeTonTransactions = "tonTransactions" TypeGiveawayParticipantStatusEligible = "giveawayParticipantStatusEligible" TypeGiveawayParticipantStatusParticipating = "giveawayParticipantStatusParticipating" TypeGiveawayParticipantStatusAlreadyWasMember = "giveawayParticipantStatusAlreadyWasMember" @@ -1400,6 +1428,7 @@ const ( TypeMessageGiveawayCompleted = "messageGiveawayCompleted" TypeMessageGiveawayWinners = "messageGiveawayWinners" TypeMessageGiftedStars = "messageGiftedStars" + TypeMessageGiftedTon = "messageGiftedTon" TypeMessageGiveawayPrizeStars = "messageGiveawayPrizeStars" TypeMessageGift = "messageGift" TypeMessageUpgradedGift = "messageUpgradedGift" @@ -1409,6 +1438,11 @@ const ( TypeMessageDirectMessagePriceChanged = "messageDirectMessagePriceChanged" TypeMessageChecklistTasksDone = "messageChecklistTasksDone" TypeMessageChecklistTasksAdded = "messageChecklistTasksAdded" + TypeMessageSuggestedPostApprovalFailed = "messageSuggestedPostApprovalFailed" + TypeMessageSuggestedPostApproved = "messageSuggestedPostApproved" + TypeMessageSuggestedPostDeclined = "messageSuggestedPostDeclined" + TypeMessageSuggestedPostPaid = "messageSuggestedPostPaid" + TypeMessageSuggestedPostRefunded = "messageSuggestedPostRefunded" TypeMessageContactRegistered = "messageContactRegistered" TypeMessageUsersShared = "messageUsersShared" TypeMessageChatShared = "messageChatShared" @@ -2087,6 +2121,7 @@ const ( TypeInternalLinkTypeMessage = "internalLinkTypeMessage" TypeInternalLinkTypeMessageDraft = "internalLinkTypeMessageDraft" TypeInternalLinkTypeMyStars = "internalLinkTypeMyStars" + TypeInternalLinkTypeMyToncoins = "internalLinkTypeMyToncoins" TypeInternalLinkTypePassportDataRequest = "internalLinkTypePassportDataRequest" TypeInternalLinkTypePhoneNumberConfirmation = "internalLinkTypePhoneNumberConfirmation" TypeInternalLinkTypePremiumFeatures = "internalLinkTypePremiumFeatures" @@ -2231,9 +2266,11 @@ const ( TypeRevenueWithdrawalStatePending = "revenueWithdrawalStatePending" TypeRevenueWithdrawalStateSucceeded = "revenueWithdrawalStateSucceeded" TypeRevenueWithdrawalStateFailed = "revenueWithdrawalStateFailed" - TypeChatRevenueTransactionTypeEarnings = "chatRevenueTransactionTypeEarnings" - TypeChatRevenueTransactionTypeWithdrawal = "chatRevenueTransactionTypeWithdrawal" - TypeChatRevenueTransactionTypeRefund = "chatRevenueTransactionTypeRefund" + TypeChatRevenueTransactionTypeUnsupported = "chatRevenueTransactionTypeUnsupported" + TypeChatRevenueTransactionTypeSponsoredMessageEarnings = "chatRevenueTransactionTypeSponsoredMessageEarnings" + TypeChatRevenueTransactionTypeSuggestedPostEarnings = "chatRevenueTransactionTypeSuggestedPostEarnings" + TypeChatRevenueTransactionTypeFragmentWithdrawal = "chatRevenueTransactionTypeFragmentWithdrawal" + TypeChatRevenueTransactionTypeFragmentRefund = "chatRevenueTransactionTypeFragmentRefund" TypeChatRevenueTransaction = "chatRevenueTransaction" TypeChatRevenueTransactions = "chatRevenueTransactions" TypeStarRevenueStatus = "starRevenueStatus" @@ -2264,6 +2301,7 @@ const ( TypeUpdateMessageMentionRead = "updateMessageMentionRead" TypeUpdateMessageUnreadReactions = "updateMessageUnreadReactions" TypeUpdateMessageFactCheck = "updateMessageFactCheck" + TypeUpdateMessageSuggestedPostInfo = "updateMessageSuggestedPostInfo" TypeUpdateMessageLiveLocationViewed = "updateMessageLiveLocationViewed" TypeUpdateVideoPublished = "updateVideoPublished" TypeUpdateNewChat = "updateNewChat" @@ -2379,6 +2417,7 @@ const ( TypeUpdateSavedMessagesTags = "updateSavedMessagesTags" TypeUpdateActiveLiveLocationMessages = "updateActiveLiveLocationMessages" TypeUpdateOwnedStarCount = "updateOwnedStarCount" + TypeUpdateOwnedTonCount = "updateOwnedTonCount" TypeUpdateChatRevenueAmount = "updateChatRevenueAmount" TypeUpdateStarRevenueStatus = "updateStarRevenueStatus" TypeUpdateSpeechRecognitionTrial = "updateSpeechRecognitionTrial" @@ -2506,6 +2545,21 @@ type InputChatPhoto interface { InputChatPhotoType() string } +// Describes price of a suggested post +type SuggestedPostPrice interface { + SuggestedPostPriceType() string +} + +// Describes state of a suggested post +type SuggestedPostState interface { + SuggestedPostStateType() string +} + +// Describes reason for refund of the payment for a suggested post +type SuggestedPostRefundReason interface { + SuggestedPostRefundReasonType() string +} + // Describes type of subscription paid in Telegram Stars type StarSubscriptionType interface { StarSubscriptionTypeType() string @@ -2521,6 +2575,11 @@ type AffiliateProgramSortOrder interface { AffiliateProgramSortOrderType() string } +// Describes origin from which the upgraded gift was obtained +type UpgradedGiftOrigin interface { + UpgradedGiftOriginType() string +} + // Contains identifier of an upgraded gift attribute to search for type UpgradedGiftAttributeId interface { UpgradedGiftAttributeIdType() string @@ -2536,9 +2595,9 @@ type SentGift interface { SentGiftType() string } -// Describes direction of a transaction with Telegram Stars -type StarTransactionDirection interface { - StarTransactionDirectionType() string +// Describes direction of transactions in a transaction list +type TransactionDirection interface { + TransactionDirectionType() string } // Describes type of transaction with Telegram Stars @@ -2546,6 +2605,11 @@ type StarTransactionType interface { StarTransactionTypeType() string } +// Describes type of transaction with Toncoins +type TonTransactionType interface { + TonTransactionTypeType() string +} + // Contains information about status of a user in a giveaway type GiveawayParticipantStatus interface { GiveawayParticipantStatusType() string @@ -7558,7 +7622,7 @@ type ChatPhoto struct { Sizes []*PhotoSize `json:"sizes"` // A big (up to 1280x1280) animated variant of the photo in MPEG4 format; may be null Animation *AnimatedChatPhoto `json:"animation"` - // A small (160x160) animated variant of the photo in MPEG4 format; may be null even the big animation is available + // A small (160x160) animated variant of the photo in MPEG4 format; may be null even if the big animation is available SmallAnimation *AnimatedChatPhoto `json:"small_animation"` // Sticker-based version of the chat photo; may be null Sticker *ChatPhotoSticker `json:"sticker"` @@ -7812,7 +7876,7 @@ type ChatAdministratorRights struct { CanManageChat bool `json:"can_manage_chat"` // True, if the administrator can change the chat title, photo, and other settings CanChangeInfo bool `json:"can_change_info"` - // True, if the administrator can create channel posts, answer to channel direct messages, or view channel statistics; applicable to channels only + // True, if the administrator can create channel posts, approve suggested channel posts, or view channel statistics; applicable to channels only CanPostMessages bool `json:"can_post_messages"` // True, if the administrator can edit messages of other users and pin messages; applicable to channels only CanEditMessages bool `json:"can_edit_messages"` @@ -7836,6 +7900,8 @@ type ChatAdministratorRights struct { CanEditStories bool `json:"can_edit_stories"` // True, if the administrator can delete stories posted by other users; applicable to supergroups and channels only CanDeleteStories bool `json:"can_delete_stories"` + // True, if the administrator can answer to channel direct messages; applicable to channels only + CanManageDirectMessages bool `json:"can_manage_direct_messages"` // True, if the administrator isn't shown in the chat member list and sends messages anonymously; applicable to supergroups only IsAnonymous bool `json:"is_anonymous"` } @@ -7856,6 +7922,287 @@ func (*ChatAdministratorRights) GetType() string { return TypeChatAdministratorRights } +// Describes price of a suggested post in Telegram Stars +type SuggestedPostPriceStar struct { + meta + // The amount of Telegram Stars agreed to pay for the post; getOption("suggested_post_star_count_min")-getOption("suggested_post_star_count_max") + StarCount int64 `json:"star_count"` +} + +func (entity *SuggestedPostPriceStar) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedPostPriceStar + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedPostPriceStar) GetClass() string { + return ClassSuggestedPostPrice +} + +func (*SuggestedPostPriceStar) GetType() string { + return TypeSuggestedPostPriceStar +} + +func (*SuggestedPostPriceStar) SuggestedPostPriceType() string { + return TypeSuggestedPostPriceStar +} + +// Describes price of a suggested post in Toncoins +type SuggestedPostPriceTon struct { + meta + // The amount of 1/100 of Toncoin agreed to pay for the post; getOption("suggested_post_toncoin_cent_count_min")-getOption("suggested_post_toncoin_cent_count_max") + ToncoinCentCount int64 `json:"toncoin_cent_count"` +} + +func (entity *SuggestedPostPriceTon) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedPostPriceTon + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedPostPriceTon) GetClass() string { + return ClassSuggestedPostPrice +} + +func (*SuggestedPostPriceTon) GetType() string { + return TypeSuggestedPostPriceTon +} + +func (*SuggestedPostPriceTon) SuggestedPostPriceType() string { + return TypeSuggestedPostPriceTon +} + +// The post must be approved or declined +type SuggestedPostStatePending struct{ + meta +} + +func (entity *SuggestedPostStatePending) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedPostStatePending + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedPostStatePending) GetClass() string { + return ClassSuggestedPostState +} + +func (*SuggestedPostStatePending) GetType() string { + return TypeSuggestedPostStatePending +} + +func (*SuggestedPostStatePending) SuggestedPostStateType() string { + return TypeSuggestedPostStatePending +} + +// The post was approved +type SuggestedPostStateApproved struct{ + meta +} + +func (entity *SuggestedPostStateApproved) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedPostStateApproved + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedPostStateApproved) GetClass() string { + return ClassSuggestedPostState +} + +func (*SuggestedPostStateApproved) GetType() string { + return TypeSuggestedPostStateApproved +} + +func (*SuggestedPostStateApproved) SuggestedPostStateType() string { + return TypeSuggestedPostStateApproved +} + +// The post was declined +type SuggestedPostStateDeclined struct{ + meta +} + +func (entity *SuggestedPostStateDeclined) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedPostStateDeclined + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedPostStateDeclined) GetClass() string { + return ClassSuggestedPostState +} + +func (*SuggestedPostStateDeclined) GetType() string { + return TypeSuggestedPostStateDeclined +} + +func (*SuggestedPostStateDeclined) SuggestedPostStateType() string { + return TypeSuggestedPostStateDeclined +} + +// Contains information about a suggested post. If the post can be approved or declined, then changes to the post can be also suggested. Use sendMessage with reply to the message and suggested post information to suggest message changes. Use addOffer to suggest price or time changes +type SuggestedPostInfo struct { + meta + // Price of the suggested post; may be null if the post is non-paid + Price SuggestedPostPrice `json:"price"` + // Point in time (Unix timestamp) when the post is expected to be published; 0 if the specific date isn't set yet + SendDate int32 `json:"send_date"` + // State of the post + State SuggestedPostState `json:"state"` + // True, if the suggested post can be approved by the current user using approveSuggestedPost; updates aren't sent when value of this field changes + CanBeApproved bool `json:"can_be_approved"` + // True, if the suggested post can be declined by the current user using declineSuggestedPost; updates aren't sent when value of this field changes + CanBeDeclined bool `json:"can_be_declined"` +} + +func (entity *SuggestedPostInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedPostInfo + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedPostInfo) GetClass() string { + return ClassSuggestedPostInfo +} + +func (*SuggestedPostInfo) GetType() string { + return TypeSuggestedPostInfo +} + +func (suggestedPostInfo *SuggestedPostInfo) UnmarshalJSON(data []byte) error { + var tmp struct { + Price json.RawMessage `json:"price"` + SendDate int32 `json:"send_date"` + State json.RawMessage `json:"state"` + CanBeApproved bool `json:"can_be_approved"` + CanBeDeclined bool `json:"can_be_declined"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + suggestedPostInfo.SendDate = tmp.SendDate + suggestedPostInfo.CanBeApproved = tmp.CanBeApproved + suggestedPostInfo.CanBeDeclined = tmp.CanBeDeclined + + fieldPrice, _ := UnmarshalSuggestedPostPrice(tmp.Price) + suggestedPostInfo.Price = fieldPrice + + fieldState, _ := UnmarshalSuggestedPostState(tmp.State) + suggestedPostInfo.State = fieldState + + return nil +} + +// Contains information about a post to suggest +type InputSuggestedPostInfo struct { + meta + // Price of the suggested post; pass null to suggest a post without payment. If the current user isn't an administrator of the channel direct messages chat and has no enough funds to pay for the post, then the error "BALANCE_TOO_LOW" will be returned immediately + Price SuggestedPostPrice `json:"price"` + // Point in time (Unix timestamp) when the post is expected to be published; pass 0 if the date isn't restricted. If specified, then the date must be getOption("suggested_post_send_delay_min")-getOption("suggested_post_send_delay_max") seconds in the future + SendDate int32 `json:"send_date"` +} + +func (entity *InputSuggestedPostInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputSuggestedPostInfo + + return json.Marshal((*stub)(entity)) +} + +func (*InputSuggestedPostInfo) GetClass() string { + return ClassInputSuggestedPostInfo +} + +func (*InputSuggestedPostInfo) GetType() string { + return TypeInputSuggestedPostInfo +} + +func (inputSuggestedPostInfo *InputSuggestedPostInfo) UnmarshalJSON(data []byte) error { + var tmp struct { + Price json.RawMessage `json:"price"` + SendDate int32 `json:"send_date"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + inputSuggestedPostInfo.SendDate = tmp.SendDate + + fieldPrice, _ := UnmarshalSuggestedPostPrice(tmp.Price) + inputSuggestedPostInfo.Price = fieldPrice + + return nil +} + +// The post was refunded, because it was deleted by channel administrators in less than getOption("suggested_post_lifetime_min") seconds +type SuggestedPostRefundReasonPostDeleted struct{ + meta +} + +func (entity *SuggestedPostRefundReasonPostDeleted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedPostRefundReasonPostDeleted + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedPostRefundReasonPostDeleted) GetClass() string { + return ClassSuggestedPostRefundReason +} + +func (*SuggestedPostRefundReasonPostDeleted) GetType() string { + return TypeSuggestedPostRefundReasonPostDeleted +} + +func (*SuggestedPostRefundReasonPostDeleted) SuggestedPostRefundReasonType() string { + return TypeSuggestedPostRefundReasonPostDeleted +} + +// The post was refunded, because the payment for the post was refunded +type SuggestedPostRefundReasonPaymentRefunded struct{ + meta +} + +func (entity *SuggestedPostRefundReasonPaymentRefunded) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedPostRefundReasonPaymentRefunded + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedPostRefundReasonPaymentRefunded) GetClass() string { + return ClassSuggestedPostRefundReason +} + +func (*SuggestedPostRefundReasonPaymentRefunded) GetType() string { + return TypeSuggestedPostRefundReasonPaymentRefunded +} + +func (*SuggestedPostRefundReasonPaymentRefunded) SuggestedPostRefundReasonType() string { + return TypeSuggestedPostRefundReasonPaymentRefunded +} + // Describes a possibly non-integer amount of Telegram Stars type StarAmount struct { meta @@ -8897,6 +9244,85 @@ func (*GiftSettings) GetType() string { return TypeGiftSettings } +// The gift was obtained by upgrading of a previously received gift +type UpgradedGiftOriginUpgrade struct { + meta + // Identifier of the message with the regular gift that was upgraded; can be 0 or an identifier of a deleted message + GiftMessageId int64 `json:"gift_message_id"` +} + +func (entity *UpgradedGiftOriginUpgrade) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftOriginUpgrade + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftOriginUpgrade) GetClass() string { + return ClassUpgradedGiftOrigin +} + +func (*UpgradedGiftOriginUpgrade) GetType() string { + return TypeUpgradedGiftOriginUpgrade +} + +func (*UpgradedGiftOriginUpgrade) UpgradedGiftOriginType() string { + return TypeUpgradedGiftOriginUpgrade +} + +// The gift was transferred from another owner +type UpgradedGiftOriginTransfer struct{ + meta +} + +func (entity *UpgradedGiftOriginTransfer) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftOriginTransfer + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftOriginTransfer) GetClass() string { + return ClassUpgradedGiftOrigin +} + +func (*UpgradedGiftOriginTransfer) GetType() string { + return TypeUpgradedGiftOriginTransfer +} + +func (*UpgradedGiftOriginTransfer) UpgradedGiftOriginType() string { + return TypeUpgradedGiftOriginTransfer +} + +// The gift was bought from another user +type UpgradedGiftOriginResale struct { + meta + // Number of Telegram Stars that were paid by the sender for the gift + StarCount int64 `json:"star_count"` +} + +func (entity *UpgradedGiftOriginResale) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftOriginResale + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftOriginResale) GetClass() string { + return ClassUpgradedGiftOrigin +} + +func (*UpgradedGiftOriginResale) GetType() string { + return TypeUpgradedGiftOriginResale +} + +func (*UpgradedGiftOriginResale) UpgradedGiftOriginType() string { + return TypeUpgradedGiftOriginResale +} + // Describes a model of an upgraded gift type UpgradedGiftModel struct { meta @@ -9068,6 +9494,8 @@ type Gift struct { meta // Unique identifier of the gift Id JsonInt64 `json:"id"` + // Identifier of the chat that published the gift; 0 if none + PublisherChatId int64 `json:"publisher_chat_id"` // The sticker representing the gift Sticker *Sticker `json:"sticker"` // Number of Telegram Stars that must be paid for the gift @@ -9109,6 +9537,8 @@ type UpgradedGift struct { meta // Unique identifier of the gift Id JsonInt64 `json:"id"` + // Identifier of the chat that published the gift; 0 if none + PublisherChatId int64 `json:"publisher_chat_id"` // The title of the upgraded gift Title string `json:"title"` // Unique name of the upgraded gift that can be used with internalLinkTypeUpgradedGift or sendResoldGift @@ -9158,6 +9588,7 @@ func (*UpgradedGift) GetType() string { func (upgradedGift *UpgradedGift) UnmarshalJSON(data []byte) error { var tmp struct { Id JsonInt64 `json:"id"` + PublisherChatId int64 `json:"publisher_chat_id"` Title string `json:"title"` Name string `json:"name"` Number int32 `json:"number"` @@ -9180,6 +9611,7 @@ func (upgradedGift *UpgradedGift) UnmarshalJSON(data []byte) error { } upgradedGift.Id = tmp.Id + upgradedGift.PublisherChatId = tmp.PublisherChatId upgradedGift.Title = tmp.Title upgradedGift.Name = tmp.Name upgradedGift.Number = tmp.Number @@ -9794,54 +10226,54 @@ func (*GiftUpgradePreview) GetType() string { return TypeGiftUpgradePreview } -// The transaction is incoming and increases the number of owned Telegram Stars -type StarTransactionDirectionIncoming struct{ +// The transaction is incoming and increases the amount of owned currency +type TransactionDirectionIncoming struct{ meta } -func (entity *StarTransactionDirectionIncoming) MarshalJSON() ([]byte, error) { +func (entity *TransactionDirectionIncoming) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub StarTransactionDirectionIncoming + type stub TransactionDirectionIncoming return json.Marshal((*stub)(entity)) } -func (*StarTransactionDirectionIncoming) GetClass() string { - return ClassStarTransactionDirection +func (*TransactionDirectionIncoming) GetClass() string { + return ClassTransactionDirection } -func (*StarTransactionDirectionIncoming) GetType() string { - return TypeStarTransactionDirectionIncoming +func (*TransactionDirectionIncoming) GetType() string { + return TypeTransactionDirectionIncoming } -func (*StarTransactionDirectionIncoming) StarTransactionDirectionType() string { - return TypeStarTransactionDirectionIncoming +func (*TransactionDirectionIncoming) TransactionDirectionType() string { + return TypeTransactionDirectionIncoming } -// The transaction is outgoing and decreases the number of owned Telegram Stars -type StarTransactionDirectionOutgoing struct{ +// The transaction is outgoing and decreases the amount of owned currency +type TransactionDirectionOutgoing struct{ meta } -func (entity *StarTransactionDirectionOutgoing) MarshalJSON() ([]byte, error) { +func (entity *TransactionDirectionOutgoing) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub StarTransactionDirectionOutgoing + type stub TransactionDirectionOutgoing return json.Marshal((*stub)(entity)) } -func (*StarTransactionDirectionOutgoing) GetClass() string { - return ClassStarTransactionDirection +func (*TransactionDirectionOutgoing) GetClass() string { + return ClassTransactionDirection } -func (*StarTransactionDirectionOutgoing) GetType() string { - return TypeStarTransactionDirectionOutgoing +func (*TransactionDirectionOutgoing) GetType() string { + return TypeTransactionDirectionOutgoing } -func (*StarTransactionDirectionOutgoing) StarTransactionDirectionType() string { - return TypeStarTransactionDirectionOutgoing +func (*TransactionDirectionOutgoing) TransactionDirectionType() string { + return TypeTransactionDirectionOutgoing } // The transaction is a deposit of Telegram Stars from the Premium bot; for regular users only @@ -10877,6 +11309,60 @@ func (starTransactionTypePaidMessageReceive *StarTransactionTypePaidMessageRecei return nil } +// The transaction is a payment for a suggested post; for regular users only +type StarTransactionTypeSuggestedPostPaymentSend struct { + meta + // Identifier of the channel chat that posted the post + ChatId int64 `json:"chat_id"` +} + +func (entity *StarTransactionTypeSuggestedPostPaymentSend) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeSuggestedPostPaymentSend + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeSuggestedPostPaymentSend) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeSuggestedPostPaymentSend) GetType() string { + return TypeStarTransactionTypeSuggestedPostPaymentSend +} + +func (*StarTransactionTypeSuggestedPostPaymentSend) StarTransactionTypeType() string { + return TypeStarTransactionTypeSuggestedPostPaymentSend +} + +// The transaction is a receiving of a payment for a suggested post by the channel chat; for channel chats only +type StarTransactionTypeSuggestedPostPaymentReceive struct { + meta + // Identifier of the user that paid for the suggested post + UserId int64 `json:"user_id"` +} + +func (entity *StarTransactionTypeSuggestedPostPaymentReceive) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeSuggestedPostPaymentReceive + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeSuggestedPostPaymentReceive) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeSuggestedPostPaymentReceive) GetType() string { + return TypeStarTransactionTypeSuggestedPostPaymentReceive +} + +func (*StarTransactionTypeSuggestedPostPaymentReceive) StarTransactionTypeType() string { + return TypeStarTransactionTypeSuggestedPostPaymentReceive +} + // The transaction is a purchase of Telegram Premium subscription; for regular users and bots only type StarTransactionTypePremiumPurchase struct { meta @@ -11070,6 +11556,170 @@ func (*StarTransactions) GetType() string { return TypeStarTransactions } +// The transaction is a deposit of Toncoins from Fragment +type TonTransactionTypeFragmentDeposit struct { + meta + // True, if the transaction is a gift from another user + IsGift bool `json:"is_gift"` + // The sticker to be shown in the transaction information; may be null if unknown + Sticker *Sticker `json:"sticker"` +} + +func (entity *TonTransactionTypeFragmentDeposit) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TonTransactionTypeFragmentDeposit + + return json.Marshal((*stub)(entity)) +} + +func (*TonTransactionTypeFragmentDeposit) GetClass() string { + return ClassTonTransactionType +} + +func (*TonTransactionTypeFragmentDeposit) GetType() string { + return TypeTonTransactionTypeFragmentDeposit +} + +func (*TonTransactionTypeFragmentDeposit) TonTransactionTypeType() string { + return TypeTonTransactionTypeFragmentDeposit +} + +// The transaction is a payment for a suggested post +type TonTransactionTypeSuggestedPostPayment struct { + meta + // Identifier of the channel chat that posted the post + ChatId int64 `json:"chat_id"` +} + +func (entity *TonTransactionTypeSuggestedPostPayment) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TonTransactionTypeSuggestedPostPayment + + return json.Marshal((*stub)(entity)) +} + +func (*TonTransactionTypeSuggestedPostPayment) GetClass() string { + return ClassTonTransactionType +} + +func (*TonTransactionTypeSuggestedPostPayment) GetType() string { + return TypeTonTransactionTypeSuggestedPostPayment +} + +func (*TonTransactionTypeSuggestedPostPayment) TonTransactionTypeType() string { + return TypeTonTransactionTypeSuggestedPostPayment +} + +// The transaction is a transaction of an unsupported type +type TonTransactionTypeUnsupported struct{ + meta +} + +func (entity *TonTransactionTypeUnsupported) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TonTransactionTypeUnsupported + + return json.Marshal((*stub)(entity)) +} + +func (*TonTransactionTypeUnsupported) GetClass() string { + return ClassTonTransactionType +} + +func (*TonTransactionTypeUnsupported) GetType() string { + return TypeTonTransactionTypeUnsupported +} + +func (*TonTransactionTypeUnsupported) TonTransactionTypeType() string { + return TypeTonTransactionTypeUnsupported +} + +// Represents a transaction changing the amount of owned Toncoins +type TonTransaction struct { + meta + // Unique identifier of the transaction + Id string `json:"id"` + // The amount of added owned Toncoins; negative for outgoing transactions + TonAmount int64 `json:"ton_amount"` + // True, if the transaction is a refund of a previous transaction + IsRefund bool `json:"is_refund"` + // Point in time (Unix timestamp) when the transaction was completed + Date int32 `json:"date"` + // Type of the transaction + Type TonTransactionType `json:"type"` +} + +func (entity *TonTransaction) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TonTransaction + + return json.Marshal((*stub)(entity)) +} + +func (*TonTransaction) GetClass() string { + return ClassTonTransaction +} + +func (*TonTransaction) GetType() string { + return TypeTonTransaction +} + +func (tonTransaction *TonTransaction) UnmarshalJSON(data []byte) error { + var tmp struct { + Id string `json:"id"` + TonAmount int64 `json:"ton_amount"` + IsRefund bool `json:"is_refund"` + Date int32 `json:"date"` + Type json.RawMessage `json:"type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + tonTransaction.Id = tmp.Id + tonTransaction.TonAmount = tmp.TonAmount + tonTransaction.IsRefund = tmp.IsRefund + tonTransaction.Date = tmp.Date + + fieldType, _ := UnmarshalTonTransactionType(tmp.Type) + tonTransaction.Type = fieldType + + return nil +} + +// Represents a list of Toncoin transactions +type TonTransactions struct { + meta + // The total amount of owned Toncoins + TonAmount int64 `json:"ton_amount"` + // List of Toncoin transactions + Transactions []*TonTransaction `json:"transactions"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` +} + +func (entity *TonTransactions) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TonTransactions + + return json.Marshal((*stub)(entity)) +} + +func (*TonTransactions) GetClass() string { + return ClassTonTransactions +} + +func (*TonTransactions) GetType() string { + return TypeTonTransactions +} + // The user is eligible for the giveaway type GiveawayParticipantStatusEligible struct{ meta @@ -13335,7 +13985,7 @@ type Supergroup struct { SignMessages bool `json:"sign_messages"` // True, if messages sent to the channel have information about the sender user. This field is only applicable to channels ShowMessageSender bool `json:"show_message_sender"` - // True, if users need to join the supergroup before they can send messages. Always true for channels and non-discussion supergroups + // True, if users need to join the supergroup before they can send messages. May be false only for discussion supergroups and channel direct messages groups JoinToSendMessages bool `json:"join_to_send_messages"` // True, if all users directly joining the supergroup need to be approved by supergroup administrators. Always false for channels and supergroups without username, location, or a linked chat JoinByRequest bool `json:"join_by_request"` @@ -15037,6 +15687,8 @@ type MessageReplyToMessage struct { MessageId int64 `json:"message_id"` // Chosen quote from the replied message; may be null if none Quote *TextQuote `json:"quote"` + // Identifier of the checklist task in the original message that was replied; 0 if none + ChecklistTaskId int32 `json:"checklist_task_id"` // Information about origin of the message if the message was from another chat or topic; may be null for messages from the same chat Origin MessageOrigin `json:"origin"` // Point in time (Unix timestamp) when the message was sent if the message was from another chat or topic; 0 for messages from the same chat @@ -15070,6 +15722,7 @@ func (messageReplyToMessage *MessageReplyToMessage) UnmarshalJSON(data []byte) e ChatId int64 `json:"chat_id"` MessageId int64 `json:"message_id"` Quote *TextQuote `json:"quote"` + ChecklistTaskId int32 `json:"checklist_task_id"` Origin json.RawMessage `json:"origin"` OriginSendDate int32 `json:"origin_send_date"` Content json.RawMessage `json:"content"` @@ -15083,6 +15736,7 @@ func (messageReplyToMessage *MessageReplyToMessage) UnmarshalJSON(data []byte) e messageReplyToMessage.ChatId = tmp.ChatId messageReplyToMessage.MessageId = tmp.MessageId messageReplyToMessage.Quote = tmp.Quote + messageReplyToMessage.ChecklistTaskId = tmp.ChecklistTaskId messageReplyToMessage.OriginSendDate = tmp.OriginSendDate fieldOrigin, _ := UnmarshalMessageOrigin(tmp.Origin) @@ -15130,6 +15784,8 @@ type InputMessageReplyToMessage struct { MessageId int64 `json:"message_id"` // Quote from the message to be replied; pass null if none. Must always be null for replies in secret chats Quote *InputTextQuote `json:"quote"` + // Identifier of the checklist task in the message to be replied; pass 0 to reply to the whole message + ChecklistTaskId int32 `json:"checklist_task_id"` } func (entity *InputMessageReplyToMessage) MarshalJSON() ([]byte, error) { @@ -15161,6 +15817,8 @@ type InputMessageReplyToExternalMessage struct { MessageId int64 `json:"message_id"` // Quote from the message to be replied; pass null if none Quote *InputTextQuote `json:"quote"` + // Identifier of the checklist task in the message to be replied; pass 0 to reply to the whole message + ChecklistTaskId int32 `json:"checklist_task_id"` } func (entity *InputMessageReplyToExternalMessage) MarshalJSON() ([]byte, error) { @@ -15262,6 +15920,10 @@ type Message struct { HasTimestampedMedia bool `json:"has_timestamped_media"` // True, if the message is a channel post. All messages to channels are channel posts, all other messages are not channel posts IsChannelPost bool `json:"is_channel_post"` + // True, if the message is a suggested channel post which was paid in Telegram Stars; a warning must be shown if the message is deleted in less than getOption("suggested_post_lifetime_min") seconds after sending + IsPaidStarSuggestedPost bool `json:"is_paid_star_suggested_post"` + // True, if the message is a suggested channel post which was paid in Toncoins; a warning must be shown if the message is deleted in less than getOption("suggested_post_lifetime_min") seconds after sending + IsPaidTonSuggestedPost bool `json:"is_paid_ton_suggested_post"` // True, if the message contains an unread mention for the current user ContainsUnreadMention bool `json:"contains_unread_mention"` // Point in time (Unix timestamp) when the message was sent; 0 for scheduled messages @@ -15278,6 +15940,8 @@ type Message struct { UnreadReactions []*UnreadReaction `json:"unread_reactions"` // Information about fact-check added to the message; may be null if none FactCheck *FactCheck `json:"fact_check"` + // Information about the suggested post; may be null if the message isn't a suggested post + SuggestedPostInfo *SuggestedPostInfo `json:"suggested_post_info"` // Information about the message or the story this message is replying to; may be null if none ReplyTo MessageReplyTo `json:"reply_to"` // If non-zero, the identifier of the message thread the message belongs to; unique within the chat to which the message belongs @@ -15343,6 +16007,8 @@ func (message *Message) UnmarshalJSON(data []byte) error { CanBeSaved bool `json:"can_be_saved"` HasTimestampedMedia bool `json:"has_timestamped_media"` IsChannelPost bool `json:"is_channel_post"` + IsPaidStarSuggestedPost bool `json:"is_paid_star_suggested_post"` + IsPaidTonSuggestedPost bool `json:"is_paid_ton_suggested_post"` ContainsUnreadMention bool `json:"contains_unread_mention"` Date int32 `json:"date"` EditDate int32 `json:"edit_date"` @@ -15351,6 +16017,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { InteractionInfo *MessageInteractionInfo `json:"interaction_info"` UnreadReactions []*UnreadReaction `json:"unread_reactions"` FactCheck *FactCheck `json:"fact_check"` + SuggestedPostInfo *SuggestedPostInfo `json:"suggested_post_info"` ReplyTo json.RawMessage `json:"reply_to"` MessageThreadId int64 `json:"message_thread_id"` TopicId json.RawMessage `json:"topic_id"` @@ -15383,6 +16050,8 @@ func (message *Message) UnmarshalJSON(data []byte) error { message.CanBeSaved = tmp.CanBeSaved message.HasTimestampedMedia = tmp.HasTimestampedMedia message.IsChannelPost = tmp.IsChannelPost + message.IsPaidStarSuggestedPost = tmp.IsPaidStarSuggestedPost + message.IsPaidTonSuggestedPost = tmp.IsPaidTonSuggestedPost message.ContainsUnreadMention = tmp.ContainsUnreadMention message.Date = tmp.Date message.EditDate = tmp.EditDate @@ -15391,6 +16060,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { message.InteractionInfo = tmp.InteractionInfo message.UnreadReactions = tmp.UnreadReactions message.FactCheck = tmp.FactCheck + message.SuggestedPostInfo = tmp.SuggestedPostInfo message.MessageThreadId = tmp.MessageThreadId message.SelfDestructIn = tmp.SelfDestructIn message.AutoDeleteIn = tmp.AutoDeleteIn @@ -16122,9 +16792,9 @@ type VideoMessageAdvertisement struct { UniqueId int64 `json:"unique_id"` // Text of the advertisement Text string `json:"text"` - // The minimum amount of time the advertisement must be dispalyed before it can be hidden by the user, in seconds + // The minimum amount of time the advertisement must be displayed before it can be hidden by the user, in seconds MinDisplayDuration int32 `json:"min_display_duration"` - // The maximum amount of time the advertisement must be dispalyed before it must be automatically hidden, in seconds + // The maximum amount of time the advertisement must be displayed before it must be automatically hidden, in seconds MaxDisplayDuration int32 `json:"max_display_duration"` // True, if the advertisement can be reported to Telegram moderators through reportVideoMessageAdvertisement CanBeReported bool `json:"can_be_reported"` @@ -16725,6 +17395,8 @@ type DraftMessage struct { InputMessageText InputMessageContent `json:"input_message_text"` // Identifier of the effect to apply to the message when it is sent; 0 if none EffectId JsonInt64 `json:"effect_id"` + // Information about the suggested post; may be null if none + SuggestedPostInfo *InputSuggestedPostInfo `json:"suggested_post_info"` } func (entity *DraftMessage) MarshalJSON() ([]byte, error) { @@ -16749,6 +17421,7 @@ func (draftMessage *DraftMessage) UnmarshalJSON(data []byte) error { Date int32 `json:"date"` InputMessageText json.RawMessage `json:"input_message_text"` EffectId JsonInt64 `json:"effect_id"` + SuggestedPostInfo *InputSuggestedPostInfo `json:"suggested_post_info"` } err := json.Unmarshal(data, &tmp) @@ -16758,6 +17431,7 @@ func (draftMessage *DraftMessage) UnmarshalJSON(data []byte) error { draftMessage.Date = tmp.Date draftMessage.EffectId = tmp.EffectId + draftMessage.SuggestedPostInfo = tmp.SuggestedPostInfo fieldReplyTo, _ := UnmarshalInputMessageReplyTo(tmp.ReplyTo) draftMessage.ReplyTo = fieldReplyTo @@ -17636,7 +18310,7 @@ type Chat struct { LastMessage *Message `json:"last_message"` // Positions of the chat in chat lists Positions []*ChatPosition `json:"positions"` - // 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 + // Chat lists to which the chat belongs. A chat can have a non-zero position in a chat list even if it doesn't belong to the chat list and have no position in a chat list even if it belongs to the chat list ChatLists []ChatList `json:"chat_lists"` // 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 MessageSender `json:"message_sender_id"` @@ -19520,7 +20194,7 @@ type ForumTopicInfo struct { IsGeneral bool `json:"is_general"` // True, if the topic was created by the current user IsOutgoing bool `json:"is_outgoing"` - // True, if the topic is closed + // True, if the topic is closed. If the topic is closed, then the user must have can_manage_topics administrator right in the supergroup or must be the creator of the topic to send messages there IsClosed bool `json:"is_closed"` // True, if the topic is hidden above the topic list and closed; for General topic only IsHidden bool `json:"is_hidden"` @@ -23064,6 +23738,8 @@ type LinkPreviewTypeVideoChat struct { Photo *ChatPhoto `json:"photo"` // True, if the video chat is expected to be a live stream in a channel or a broadcast group IsLiveStream bool `json:"is_live_stream"` + // True, if the user can use the link to join the video chat without being muted by administrators + JoinsAsSpeaker bool `json:"joins_as_speaker"` } func (entity *LinkPreviewTypeVideoChat) MarshalJSON() ([]byte, error) { @@ -24482,7 +25158,7 @@ func (*PaidMediaUnsupported) PaidMediaType() string { // Describes parameters of a giveaway type GiveawayParameters struct { meta - // Identifier of the supergroup or channel chat, which will be automatically boosted by the winners of the giveaway for duration of the Telegram Premium subscription, or for the specified time. If the chat is a channel, then can_post_messages right is required in the channel, otherwise, the user must be an administrator in the supergroup + // Identifier of the supergroup or channel chat, which will be automatically boosted by the winners of the giveaway for duration of the Telegram Premium subscription, or for the specified time. If the chat is a channel, then can_post_messages administrator right is required in the channel, otherwise, the user must be an administrator in the supergroup BoostedChatId int64 `json:"boosted_chat_id"` // Identifiers of other supergroup or channel chats that must be subscribed by the users to be eligible for the giveaway. There can be up to getOption("giveaway_additional_chat_count_max") additional chats AdditionalChatIds []int64 `json:"additional_chat_ids"` @@ -28884,6 +29560,41 @@ func (*MessageGiftedStars) MessageContentType() string { return TypeMessageGiftedStars } +// Toncoins were gifted to a user +type MessageGiftedTon struct { + meta + // The identifier of a user that gifted Toncoins; 0 if the gift was anonymous or is outgoing + GifterUserId int64 `json:"gifter_user_id"` + // The identifier of a user that received Toncoins; 0 if the gift is incoming + ReceiverUserId int64 `json:"receiver_user_id"` + // The received amount of Toncoins, in the smallest units of the cryptocurrency + TonAmount int64 `json:"ton_amount"` + // Identifier of the transaction for Toncoin credit; for receiver only + TransactionId string `json:"transaction_id"` + // A sticker to be shown in the message; may be null if unknown + Sticker *Sticker `json:"sticker"` +} + +func (entity *MessageGiftedTon) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageGiftedTon + + return json.Marshal((*stub)(entity)) +} + +func (*MessageGiftedTon) GetClass() string { + return ClassMessageContent +} + +func (*MessageGiftedTon) GetType() string { + return TypeMessageGiftedTon +} + +func (*MessageGiftedTon) MessageContentType() string { + return TypeMessageGiftedTon +} + // A Telegram Stars were received by the current user from a giveaway type MessageGiveawayPrizeStars struct { meta @@ -29028,18 +29739,16 @@ type MessageUpgradedGift struct { SenderId MessageSender `json:"sender_id"` // Receiver of the gift ReceiverId MessageSender `json:"receiver_id"` + // Origin of the upgraded gift + Origin UpgradedGiftOrigin `json:"origin"` // Unique identifier of the received gift for the current user; only for the receiver of the gift ReceivedGiftId string `json:"received_gift_id"` - // True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift - IsUpgrade bool `json:"is_upgrade"` // True, if the gift is displayed on the user's or the channel's profile page; only for the receiver of the gift IsSaved bool `json:"is_saved"` // True, if the gift can be transferred to another owner; only for the receiver of the gift CanBeTransferred bool `json:"can_be_transferred"` - // True, if the gift was transferred to another owner; only for the receiver of the gift + // True, if the gift has already been transferred to another owner; only for the receiver of the gift WasTransferred bool `json:"was_transferred"` - // Number of Telegram Stars that were paid by the sender for the gift; 0 if the gift was upgraded or transferred - LastResaleStarCount int64 `json:"last_resale_star_count"` // Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift TransferStarCount int64 `json:"transfer_star_count"` // Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift @@ -29075,12 +29784,11 @@ func (messageUpgradedGift *MessageUpgradedGift) UnmarshalJSON(data []byte) error Gift *UpgradedGift `json:"gift"` SenderId json.RawMessage `json:"sender_id"` ReceiverId json.RawMessage `json:"receiver_id"` + Origin json.RawMessage `json:"origin"` ReceivedGiftId string `json:"received_gift_id"` - IsUpgrade bool `json:"is_upgrade"` IsSaved bool `json:"is_saved"` CanBeTransferred bool `json:"can_be_transferred"` WasTransferred bool `json:"was_transferred"` - LastResaleStarCount int64 `json:"last_resale_star_count"` TransferStarCount int64 `json:"transfer_star_count"` NextTransferDate int32 `json:"next_transfer_date"` NextResaleDate int32 `json:"next_resale_date"` @@ -29094,11 +29802,9 @@ func (messageUpgradedGift *MessageUpgradedGift) UnmarshalJSON(data []byte) error messageUpgradedGift.Gift = tmp.Gift messageUpgradedGift.ReceivedGiftId = tmp.ReceivedGiftId - messageUpgradedGift.IsUpgrade = tmp.IsUpgrade messageUpgradedGift.IsSaved = tmp.IsSaved messageUpgradedGift.CanBeTransferred = tmp.CanBeTransferred messageUpgradedGift.WasTransferred = tmp.WasTransferred - messageUpgradedGift.LastResaleStarCount = tmp.LastResaleStarCount messageUpgradedGift.TransferStarCount = tmp.TransferStarCount messageUpgradedGift.NextTransferDate = tmp.NextTransferDate messageUpgradedGift.NextResaleDate = tmp.NextResaleDate @@ -29110,6 +29816,9 @@ func (messageUpgradedGift *MessageUpgradedGift) UnmarshalJSON(data []byte) error fieldReceiverId, _ := UnmarshalMessageSender(tmp.ReceiverId) messageUpgradedGift.ReceiverId = fieldReceiverId + fieldOrigin, _ := UnmarshalUpgradedGiftOrigin(tmp.Origin) + messageUpgradedGift.Origin = fieldOrigin + return nil } @@ -29316,6 +30025,214 @@ func (*MessageChecklistTasksAdded) MessageContentType() string { return TypeMessageChecklistTasksAdded } +// Approval of suggested post has failed, because the user which proposed the post had no enough funds +type MessageSuggestedPostApprovalFailed struct { + meta + // Identifier of the message with the suggested post; can be 0 if the message was deleted + SuggestedPostMessageId int64 `json:"suggested_post_message_id"` + // Price of the suggested post + Price SuggestedPostPrice `json:"price"` +} + +func (entity *MessageSuggestedPostApprovalFailed) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSuggestedPostApprovalFailed + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSuggestedPostApprovalFailed) GetClass() string { + return ClassMessageContent +} + +func (*MessageSuggestedPostApprovalFailed) GetType() string { + return TypeMessageSuggestedPostApprovalFailed +} + +func (*MessageSuggestedPostApprovalFailed) MessageContentType() string { + return TypeMessageSuggestedPostApprovalFailed +} + +func (messageSuggestedPostApprovalFailed *MessageSuggestedPostApprovalFailed) UnmarshalJSON(data []byte) error { + var tmp struct { + SuggestedPostMessageId int64 `json:"suggested_post_message_id"` + Price json.RawMessage `json:"price"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageSuggestedPostApprovalFailed.SuggestedPostMessageId = tmp.SuggestedPostMessageId + + fieldPrice, _ := UnmarshalSuggestedPostPrice(tmp.Price) + messageSuggestedPostApprovalFailed.Price = fieldPrice + + return nil +} + +// A suggested post was approved +type MessageSuggestedPostApproved struct { + meta + // Identifier of the message with the suggested post; can be 0 if the message was deleted + SuggestedPostMessageId int64 `json:"suggested_post_message_id"` + // Price of the suggested post; may be null if the post is non-paid + Price SuggestedPostPrice `json:"price"` + // Point in time (Unix timestamp) when the post is expected to be published + SendDate int32 `json:"send_date"` +} + +func (entity *MessageSuggestedPostApproved) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSuggestedPostApproved + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSuggestedPostApproved) GetClass() string { + return ClassMessageContent +} + +func (*MessageSuggestedPostApproved) GetType() string { + return TypeMessageSuggestedPostApproved +} + +func (*MessageSuggestedPostApproved) MessageContentType() string { + return TypeMessageSuggestedPostApproved +} + +func (messageSuggestedPostApproved *MessageSuggestedPostApproved) UnmarshalJSON(data []byte) error { + var tmp struct { + SuggestedPostMessageId int64 `json:"suggested_post_message_id"` + Price json.RawMessage `json:"price"` + SendDate int32 `json:"send_date"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageSuggestedPostApproved.SuggestedPostMessageId = tmp.SuggestedPostMessageId + messageSuggestedPostApproved.SendDate = tmp.SendDate + + fieldPrice, _ := UnmarshalSuggestedPostPrice(tmp.Price) + messageSuggestedPostApproved.Price = fieldPrice + + return nil +} + +// A suggested post was declined +type MessageSuggestedPostDeclined struct { + meta + // Identifier of the message with the suggested post; can be 0 if the message was deleted + SuggestedPostMessageId int64 `json:"suggested_post_message_id"` + // Comment added by administrator of the channel when the post was declined + Comment string `json:"comment"` +} + +func (entity *MessageSuggestedPostDeclined) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSuggestedPostDeclined + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSuggestedPostDeclined) GetClass() string { + return ClassMessageContent +} + +func (*MessageSuggestedPostDeclined) GetType() string { + return TypeMessageSuggestedPostDeclined +} + +func (*MessageSuggestedPostDeclined) MessageContentType() string { + return TypeMessageSuggestedPostDeclined +} + +// A suggested post was published for getOption("suggested_post_lifetime_min") seconds and payment for the post was received +type MessageSuggestedPostPaid struct { + meta + // Identifier of the message with the suggested post; can be 0 if the message was deleted + SuggestedPostMessageId int64 `json:"suggested_post_message_id"` + // The amount of received Telegram Stars + StarAmount *StarAmount `json:"star_amount"` + // The amount of received Toncoins; in the smallest units of the cryptocurrency + TonAmount int64 `json:"ton_amount"` +} + +func (entity *MessageSuggestedPostPaid) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSuggestedPostPaid + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSuggestedPostPaid) GetClass() string { + return ClassMessageContent +} + +func (*MessageSuggestedPostPaid) GetType() string { + return TypeMessageSuggestedPostPaid +} + +func (*MessageSuggestedPostPaid) MessageContentType() string { + return TypeMessageSuggestedPostPaid +} + +// A suggested post was refunded +type MessageSuggestedPostRefunded struct { + meta + // Identifier of the message with the suggested post; can be 0 if the message was deleted + SuggestedPostMessageId int64 `json:"suggested_post_message_id"` + // Reason of the refund + Reason SuggestedPostRefundReason `json:"reason"` +} + +func (entity *MessageSuggestedPostRefunded) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSuggestedPostRefunded + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSuggestedPostRefunded) GetClass() string { + return ClassMessageContent +} + +func (*MessageSuggestedPostRefunded) GetType() string { + return TypeMessageSuggestedPostRefunded +} + +func (*MessageSuggestedPostRefunded) MessageContentType() string { + return TypeMessageSuggestedPostRefunded +} + +func (messageSuggestedPostRefunded *MessageSuggestedPostRefunded) UnmarshalJSON(data []byte) error { + var tmp struct { + SuggestedPostMessageId int64 `json:"suggested_post_message_id"` + Reason json.RawMessage `json:"reason"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageSuggestedPostRefunded.SuggestedPostMessageId = tmp.SuggestedPostMessageId + + fieldReason, _ := UnmarshalSuggestedPostRefundReason(tmp.Reason) + messageSuggestedPostRefunded.Reason = fieldReason + + return nil +} + // A contact has registered with Telegram type MessageContactRegistered struct{ meta @@ -30536,6 +31453,8 @@ type MessageSendOptions struct { meta // Unique identifier of the topic in a channel direct messages chat administered by the current user; pass 0 if the chat isn't a channel direct messages chat administered by the current user DirectMessagesChatTopicId int64 `json:"direct_messages_chat_topic_id"` + // Information about the suggested post; pass null if none. For messages to channel direct messages chat only. Applicable only to sendMessage and addOffer + SuggestedPostInfo *InputSuggestedPostInfo `json:"suggested_post_info"` // Pass true to disable notification for the message DisableNotification bool `json:"disable_notification"` // Pass true if the message is sent from the background @@ -30577,6 +31496,7 @@ func (*MessageSendOptions) GetType() string { func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { var tmp struct { DirectMessagesChatTopicId int64 `json:"direct_messages_chat_topic_id"` + SuggestedPostInfo *InputSuggestedPostInfo `json:"suggested_post_info"` DisableNotification bool `json:"disable_notification"` FromBackground bool `json:"from_background"` ProtectContent bool `json:"protect_content"` @@ -30595,6 +31515,7 @@ func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { } messageSendOptions.DirectMessagesChatTopicId = tmp.DirectMessagesChatTopicId + messageSendOptions.SuggestedPostInfo = tmp.SuggestedPostInfo messageSendOptions.DisableNotification = tmp.DisableNotification messageSendOptions.FromBackground = tmp.FromBackground messageSendOptions.ProtectContent = tmp.ProtectContent @@ -31620,12 +32541,18 @@ func (*InputMessageForwarded) InputMessageContentType() string { // Contains properties of a message and describes actions that can be done with the message right now type MessageProperties struct { meta + // True, if an offer can be added to the message using addOffer + CanAddOffer bool `json:"can_add_offer"` // True, if tasks can be added to the message's checklist using addChecklistTasks if the current user has Telegram Premium subscription CanAddTasks bool `json:"can_add_tasks"` + // True, if the message is a suggested post that can be approved by the user using approveSuggestedPost + CanBeApproved bool `json:"can_be_approved"` // True, if content of the message can be copied using inputMessageForwarded or forwardMessages with copy options CanBeCopied bool `json:"can_be_copied"` // True, if content of the message can be copied to a secret chat using inputMessageForwarded or forwardMessages with copy options CanBeCopiedToSecretChat bool `json:"can_be_copied_to_secret_chat"` + // True, if the message is a suggested post that can be declined by the user using declineSuggestedPost + CanBeDeclined bool `json:"can_be_declined"` // True, if the message can be deleted only for the current user while other users will continue to see it using the method deleteMessages with revoke == false CanBeDeletedOnlyForSelf bool `json:"can_be_deleted_only_for_self"` // True, if the message can be deleted for all users using the method deleteMessages with revoke == true @@ -31650,6 +32577,8 @@ type MessageProperties struct { CanEditMedia bool `json:"can_edit_media"` // True, if scheduling state of the message can be edited CanEditSchedulingState bool `json:"can_edit_scheduling_state"` + // True, if another price or post send time can be suggested using addOffer + CanEditSuggestedPostInfo bool `json:"can_edit_suggested_post_info"` // True, if author of the message sent on behalf of a chat can be received through getMessageAuthor CanGetAuthor bool `json:"can_get_author"` // True, if code for message embedding can be received using getMessageEmbeddingCode @@ -42854,7 +43783,7 @@ func (*PremiumFeatureMessagePrivacy) PremiumFeatureType() string { return TypePremiumFeatureMessagePrivacy } -// The ability to view last seen and read times of other users even they can't view last seen or read time for the current user +// The ability to view last seen and read times of other users even if they can't view last seen or read time for the current user type PremiumFeatureLastSeenTimes struct{ meta } @@ -50661,6 +51590,31 @@ func (*InternalLinkTypeMyStars) InternalLinkTypeType() string { return TypeInternalLinkTypeMyStars } +// The link is a link to the screen with information about Toncoin balance and transactions of the current user +type InternalLinkTypeMyToncoins struct{ + meta +} + +func (entity *InternalLinkTypeMyToncoins) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeMyToncoins + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeMyToncoins) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeMyToncoins) GetType() string { + return TypeInternalLinkTypeMyToncoins +} + +func (*InternalLinkTypeMyToncoins) InternalLinkTypeType() string { + return TypeInternalLinkTypeMyToncoins +} + // The link contains a request of Telegram passport data. Call getPassportAuthorizationForm with the given parameters to process the link if the link was received from outside of the application; otherwise, ignore it type InternalLinkTypePassportDataRequest struct { meta @@ -54970,8 +55924,33 @@ func (*RevenueWithdrawalStateFailed) RevenueWithdrawalStateType() string { return TypeRevenueWithdrawalStateFailed } +// Describes an unsupported transaction +type ChatRevenueTransactionTypeUnsupported struct{ + meta +} + +func (entity *ChatRevenueTransactionTypeUnsupported) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatRevenueTransactionTypeUnsupported + + return json.Marshal((*stub)(entity)) +} + +func (*ChatRevenueTransactionTypeUnsupported) GetClass() string { + return ClassChatRevenueTransactionType +} + +func (*ChatRevenueTransactionTypeUnsupported) GetType() string { + return TypeChatRevenueTransactionTypeUnsupported +} + +func (*ChatRevenueTransactionTypeUnsupported) ChatRevenueTransactionTypeType() string { + return TypeChatRevenueTransactionTypeUnsupported +} + // Describes earnings from sponsored messages in a chat in some time frame -type ChatRevenueTransactionTypeEarnings struct { +type ChatRevenueTransactionTypeSponsoredMessageEarnings struct { meta // Point in time (Unix timestamp) when the earnings started StartDate int32 `json:"start_date"` @@ -54979,61 +55958,85 @@ type ChatRevenueTransactionTypeEarnings struct { EndDate int32 `json:"end_date"` } -func (entity *ChatRevenueTransactionTypeEarnings) MarshalJSON() ([]byte, error) { +func (entity *ChatRevenueTransactionTypeSponsoredMessageEarnings) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ChatRevenueTransactionTypeEarnings + type stub ChatRevenueTransactionTypeSponsoredMessageEarnings return json.Marshal((*stub)(entity)) } -func (*ChatRevenueTransactionTypeEarnings) GetClass() string { +func (*ChatRevenueTransactionTypeSponsoredMessageEarnings) GetClass() string { return ClassChatRevenueTransactionType } -func (*ChatRevenueTransactionTypeEarnings) GetType() string { - return TypeChatRevenueTransactionTypeEarnings +func (*ChatRevenueTransactionTypeSponsoredMessageEarnings) GetType() string { + return TypeChatRevenueTransactionTypeSponsoredMessageEarnings } -func (*ChatRevenueTransactionTypeEarnings) ChatRevenueTransactionTypeType() string { - return TypeChatRevenueTransactionTypeEarnings +func (*ChatRevenueTransactionTypeSponsoredMessageEarnings) ChatRevenueTransactionTypeType() string { + return TypeChatRevenueTransactionTypeSponsoredMessageEarnings } -// Describes a withdrawal of earnings -type ChatRevenueTransactionTypeWithdrawal struct { +// Describes earnings from a published suggested post +type ChatRevenueTransactionTypeSuggestedPostEarnings struct { + meta + // Identifier of the user that paid for the suggested post + UserId int64 `json:"user_id"` +} + +func (entity *ChatRevenueTransactionTypeSuggestedPostEarnings) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatRevenueTransactionTypeSuggestedPostEarnings + + return json.Marshal((*stub)(entity)) +} + +func (*ChatRevenueTransactionTypeSuggestedPostEarnings) GetClass() string { + return ClassChatRevenueTransactionType +} + +func (*ChatRevenueTransactionTypeSuggestedPostEarnings) GetType() string { + return TypeChatRevenueTransactionTypeSuggestedPostEarnings +} + +func (*ChatRevenueTransactionTypeSuggestedPostEarnings) ChatRevenueTransactionTypeType() string { + return TypeChatRevenueTransactionTypeSuggestedPostEarnings +} + +// Describes a withdrawal of earnings through Fragment +type ChatRevenueTransactionTypeFragmentWithdrawal struct { meta // Point in time (Unix timestamp) when the earnings withdrawal started WithdrawalDate int32 `json:"withdrawal_date"` - // Name of the payment provider - Provider string `json:"provider"` // State of the withdrawal State RevenueWithdrawalState `json:"state"` } -func (entity *ChatRevenueTransactionTypeWithdrawal) MarshalJSON() ([]byte, error) { +func (entity *ChatRevenueTransactionTypeFragmentWithdrawal) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ChatRevenueTransactionTypeWithdrawal + type stub ChatRevenueTransactionTypeFragmentWithdrawal return json.Marshal((*stub)(entity)) } -func (*ChatRevenueTransactionTypeWithdrawal) GetClass() string { +func (*ChatRevenueTransactionTypeFragmentWithdrawal) GetClass() string { return ClassChatRevenueTransactionType } -func (*ChatRevenueTransactionTypeWithdrawal) GetType() string { - return TypeChatRevenueTransactionTypeWithdrawal +func (*ChatRevenueTransactionTypeFragmentWithdrawal) GetType() string { + return TypeChatRevenueTransactionTypeFragmentWithdrawal } -func (*ChatRevenueTransactionTypeWithdrawal) ChatRevenueTransactionTypeType() string { - return TypeChatRevenueTransactionTypeWithdrawal +func (*ChatRevenueTransactionTypeFragmentWithdrawal) ChatRevenueTransactionTypeType() string { + return TypeChatRevenueTransactionTypeFragmentWithdrawal } -func (chatRevenueTransactionTypeWithdrawal *ChatRevenueTransactionTypeWithdrawal) UnmarshalJSON(data []byte) error { +func (chatRevenueTransactionTypeFragmentWithdrawal *ChatRevenueTransactionTypeFragmentWithdrawal) UnmarshalJSON(data []byte) error { var tmp struct { WithdrawalDate int32 `json:"withdrawal_date"` - Provider string `json:"provider"` State json.RawMessage `json:"state"` } @@ -55042,42 +56045,39 @@ func (chatRevenueTransactionTypeWithdrawal *ChatRevenueTransactionTypeWithdrawal return err } - chatRevenueTransactionTypeWithdrawal.WithdrawalDate = tmp.WithdrawalDate - chatRevenueTransactionTypeWithdrawal.Provider = tmp.Provider + chatRevenueTransactionTypeFragmentWithdrawal.WithdrawalDate = tmp.WithdrawalDate fieldState, _ := UnmarshalRevenueWithdrawalState(tmp.State) - chatRevenueTransactionTypeWithdrawal.State = fieldState + chatRevenueTransactionTypeFragmentWithdrawal.State = fieldState return nil } -// Describes a refund for failed withdrawal of earnings -type ChatRevenueTransactionTypeRefund struct { +// Describes a refund for failed withdrawal of earnings through Fragment +type ChatRevenueTransactionTypeFragmentRefund struct { meta // Point in time (Unix timestamp) when the transaction was refunded RefundDate int32 `json:"refund_date"` - // Name of the payment provider - Provider string `json:"provider"` } -func (entity *ChatRevenueTransactionTypeRefund) MarshalJSON() ([]byte, error) { +func (entity *ChatRevenueTransactionTypeFragmentRefund) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ChatRevenueTransactionTypeRefund + type stub ChatRevenueTransactionTypeFragmentRefund return json.Marshal((*stub)(entity)) } -func (*ChatRevenueTransactionTypeRefund) GetClass() string { +func (*ChatRevenueTransactionTypeFragmentRefund) GetClass() string { return ClassChatRevenueTransactionType } -func (*ChatRevenueTransactionTypeRefund) GetType() string { - return TypeChatRevenueTransactionTypeRefund +func (*ChatRevenueTransactionTypeFragmentRefund) GetType() string { + return TypeChatRevenueTransactionTypeFragmentRefund } -func (*ChatRevenueTransactionTypeRefund) ChatRevenueTransactionTypeType() string { - return TypeChatRevenueTransactionTypeRefund +func (*ChatRevenueTransactionTypeFragmentRefund) ChatRevenueTransactionTypeType() string { + return TypeChatRevenueTransactionTypeFragmentRefund } // Contains a chat revenue transactions @@ -55131,10 +56131,12 @@ func (chatRevenueTransaction *ChatRevenueTransaction) UnmarshalJSON(data []byte) // Contains a list of chat revenue transactions type ChatRevenueTransactions struct { meta - // Total number of transactions - TotalCount int32 `json:"total_count"` + // The amount of owned Toncoins; in the smallest units of the cryptocurrency + TonAmount int64 `json:"ton_amount"` // List of transactions Transactions []*ChatRevenueTransaction `json:"transactions"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` } func (entity *ChatRevenueTransactions) MarshalJSON() ([]byte, error) { @@ -56028,6 +57030,37 @@ func (*UpdateMessageFactCheck) UpdateType() string { return TypeUpdateMessageFactCheck } +// Information about suggested post of a message was changed +type UpdateMessageSuggestedPostInfo struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // Message identifier + MessageId int64 `json:"message_id"` + // The new information about the suggested post + SuggestedPostInfo *SuggestedPostInfo `json:"suggested_post_info"` +} + +func (entity *UpdateMessageSuggestedPostInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateMessageSuggestedPostInfo + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateMessageSuggestedPostInfo) GetClass() string { + return ClassUpdate +} + +func (*UpdateMessageSuggestedPostInfo) GetType() string { + return TypeUpdateMessageSuggestedPostInfo +} + +func (*UpdateMessageSuggestedPostInfo) UpdateType() string { + return TypeUpdateMessageSuggestedPostInfo +} + // A message with a live location was viewed. When the update is received, the application is expected to update the live location type UpdateMessageLiveLocationViewed struct { meta @@ -58511,7 +59544,7 @@ type UpdateGroupCallParticipants struct { meta // Identifier of the group call GroupCallId int32 `json:"group_call_id"` - // New list of group call participant user identifiers. The identifiers may be invalid or the corresponding users may be unknown. The participants must be shown in the list of group call participants even there is no information about them + // New list of group call participant user identifiers. The identifiers may be invalid or the corresponding users may be unknown. The participants must be shown in the list of group call participants even if there is no information about them ParticipantUserIds []JsonInt64 `json:"participant_user_ids"` } @@ -59837,6 +60870,33 @@ func (*UpdateOwnedStarCount) UpdateType() string { return TypeUpdateOwnedStarCount } +// The number of Toncoins owned by the current user has changed +type UpdateOwnedTonCount struct { + meta + // The new amount of owned Toncoins; in the smallest units of the cryptocurrency + TonAmount int64 `json:"ton_amount"` +} + +func (entity *UpdateOwnedTonCount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateOwnedTonCount + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateOwnedTonCount) GetClass() string { + return ClassUpdate +} + +func (*UpdateOwnedTonCount) GetType() string { + return TypeUpdateOwnedTonCount +} + +func (*UpdateOwnedTonCount) UpdateType() string { + return TypeUpdateOwnedTonCount +} + // The revenue earned from sponsored messages in a chat has changed. If chat revenue screen is opened, then getChatRevenueTransactions may be called to fetch new transactions type UpdateChatRevenueAmount struct { meta diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 5991657..829ea95 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -662,6 +662,111 @@ func UnmarshalListOfInputChatPhoto(dataList []json.RawMessage) ([]InputChatPhoto return list, nil } +func UnmarshalSuggestedPostPrice(data json.RawMessage) (SuggestedPostPrice, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeSuggestedPostPriceStar: + return UnmarshalSuggestedPostPriceStar(data) + + case TypeSuggestedPostPriceTon: + return UnmarshalSuggestedPostPriceTon(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfSuggestedPostPrice(dataList []json.RawMessage) ([]SuggestedPostPrice, error) { + list := []SuggestedPostPrice{} + + for _, data := range dataList { + entity, err := UnmarshalSuggestedPostPrice(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalSuggestedPostState(data json.RawMessage) (SuggestedPostState, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeSuggestedPostStatePending: + return UnmarshalSuggestedPostStatePending(data) + + case TypeSuggestedPostStateApproved: + return UnmarshalSuggestedPostStateApproved(data) + + case TypeSuggestedPostStateDeclined: + return UnmarshalSuggestedPostStateDeclined(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfSuggestedPostState(dataList []json.RawMessage) ([]SuggestedPostState, error) { + list := []SuggestedPostState{} + + for _, data := range dataList { + entity, err := UnmarshalSuggestedPostState(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalSuggestedPostRefundReason(data json.RawMessage) (SuggestedPostRefundReason, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeSuggestedPostRefundReasonPostDeleted: + return UnmarshalSuggestedPostRefundReasonPostDeleted(data) + + case TypeSuggestedPostRefundReasonPaymentRefunded: + return UnmarshalSuggestedPostRefundReasonPaymentRefunded(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfSuggestedPostRefundReason(dataList []json.RawMessage) ([]SuggestedPostRefundReason, error) { + list := []SuggestedPostRefundReason{} + + for _, data := range dataList { + entity, err := UnmarshalSuggestedPostRefundReason(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalStarSubscriptionType(data json.RawMessage) (StarSubscriptionType, error) { var meta meta @@ -770,6 +875,43 @@ func UnmarshalListOfAffiliateProgramSortOrder(dataList []json.RawMessage) ([]Aff return list, nil } +func UnmarshalUpgradedGiftOrigin(data json.RawMessage) (UpgradedGiftOrigin, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeUpgradedGiftOriginUpgrade: + return UnmarshalUpgradedGiftOriginUpgrade(data) + + case TypeUpgradedGiftOriginTransfer: + return UnmarshalUpgradedGiftOriginTransfer(data) + + case TypeUpgradedGiftOriginResale: + return UnmarshalUpgradedGiftOriginResale(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfUpgradedGiftOrigin(dataList []json.RawMessage) ([]UpgradedGiftOrigin, error) { + list := []UpgradedGiftOrigin{} + + for _, data := range dataList { + entity, err := UnmarshalUpgradedGiftOrigin(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalUpgradedGiftAttributeId(data json.RawMessage) (UpgradedGiftAttributeId, error) { var meta meta @@ -878,7 +1020,7 @@ func UnmarshalListOfSentGift(dataList []json.RawMessage) ([]SentGift, error) { return list, nil } -func UnmarshalStarTransactionDirection(data json.RawMessage) (StarTransactionDirection, error) { +func UnmarshalTransactionDirection(data json.RawMessage) (TransactionDirection, error) { var meta meta err := json.Unmarshal(data, &meta) @@ -887,22 +1029,22 @@ func UnmarshalStarTransactionDirection(data json.RawMessage) (StarTransactionDir } switch meta.Type { - case TypeStarTransactionDirectionIncoming: - return UnmarshalStarTransactionDirectionIncoming(data) + case TypeTransactionDirectionIncoming: + return UnmarshalTransactionDirectionIncoming(data) - case TypeStarTransactionDirectionOutgoing: - return UnmarshalStarTransactionDirectionOutgoing(data) + case TypeTransactionDirectionOutgoing: + return UnmarshalTransactionDirectionOutgoing(data) default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } } -func UnmarshalListOfStarTransactionDirection(dataList []json.RawMessage) ([]StarTransactionDirection, error) { - list := []StarTransactionDirection{} +func UnmarshalListOfTransactionDirection(dataList []json.RawMessage) ([]TransactionDirection, error) { + list := []TransactionDirection{} for _, data := range dataList { - entity, err := UnmarshalStarTransactionDirection(data) + entity, err := UnmarshalTransactionDirection(data) if err != nil { return nil, err } @@ -1011,6 +1153,12 @@ func UnmarshalStarTransactionType(data json.RawMessage) (StarTransactionType, er case TypeStarTransactionTypePaidMessageReceive: return UnmarshalStarTransactionTypePaidMessageReceive(data) + case TypeStarTransactionTypeSuggestedPostPaymentSend: + return UnmarshalStarTransactionTypeSuggestedPostPaymentSend(data) + + case TypeStarTransactionTypeSuggestedPostPaymentReceive: + return UnmarshalStarTransactionTypeSuggestedPostPaymentReceive(data) + case TypeStarTransactionTypePremiumPurchase: return UnmarshalStarTransactionTypePremiumPurchase(data) @@ -1042,6 +1190,43 @@ func UnmarshalListOfStarTransactionType(dataList []json.RawMessage) ([]StarTrans return list, nil } +func UnmarshalTonTransactionType(data json.RawMessage) (TonTransactionType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeTonTransactionTypeFragmentDeposit: + return UnmarshalTonTransactionTypeFragmentDeposit(data) + + case TypeTonTransactionTypeSuggestedPostPayment: + return UnmarshalTonTransactionTypeSuggestedPostPayment(data) + + case TypeTonTransactionTypeUnsupported: + return UnmarshalTonTransactionTypeUnsupported(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfTonTransactionType(dataList []json.RawMessage) ([]TonTransactionType, error) { + list := []TonTransactionType{} + + for _, data := range dataList { + entity, err := UnmarshalTonTransactionType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalGiveawayParticipantStatus(data json.RawMessage) (GiveawayParticipantStatus, error) { var meta meta @@ -3633,6 +3818,9 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessageGiftedStars: return UnmarshalMessageGiftedStars(data) + case TypeMessageGiftedTon: + return UnmarshalMessageGiftedTon(data) + case TypeMessageGiveawayPrizeStars: return UnmarshalMessageGiveawayPrizeStars(data) @@ -3660,6 +3848,21 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessageChecklistTasksAdded: return UnmarshalMessageChecklistTasksAdded(data) + case TypeMessageSuggestedPostApprovalFailed: + return UnmarshalMessageSuggestedPostApprovalFailed(data) + + case TypeMessageSuggestedPostApproved: + return UnmarshalMessageSuggestedPostApproved(data) + + case TypeMessageSuggestedPostDeclined: + return UnmarshalMessageSuggestedPostDeclined(data) + + case TypeMessageSuggestedPostPaid: + return UnmarshalMessageSuggestedPostPaid(data) + + case TypeMessageSuggestedPostRefunded: + return UnmarshalMessageSuggestedPostRefunded(data) + case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) @@ -7384,6 +7587,9 @@ func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { case TypeInternalLinkTypeMyStars: return UnmarshalInternalLinkTypeMyStars(data) + case TypeInternalLinkTypeMyToncoins: + return UnmarshalInternalLinkTypeMyToncoins(data) + case TypeInternalLinkTypePassportDataRequest: return UnmarshalInternalLinkTypePassportDataRequest(data) @@ -8147,14 +8353,20 @@ func UnmarshalChatRevenueTransactionType(data json.RawMessage) (ChatRevenueTrans } switch meta.Type { - case TypeChatRevenueTransactionTypeEarnings: - return UnmarshalChatRevenueTransactionTypeEarnings(data) + case TypeChatRevenueTransactionTypeUnsupported: + return UnmarshalChatRevenueTransactionTypeUnsupported(data) - case TypeChatRevenueTransactionTypeWithdrawal: - return UnmarshalChatRevenueTransactionTypeWithdrawal(data) + case TypeChatRevenueTransactionTypeSponsoredMessageEarnings: + return UnmarshalChatRevenueTransactionTypeSponsoredMessageEarnings(data) - case TypeChatRevenueTransactionTypeRefund: - return UnmarshalChatRevenueTransactionTypeRefund(data) + case TypeChatRevenueTransactionTypeSuggestedPostEarnings: + return UnmarshalChatRevenueTransactionTypeSuggestedPostEarnings(data) + + case TypeChatRevenueTransactionTypeFragmentWithdrawal: + return UnmarshalChatRevenueTransactionTypeFragmentWithdrawal(data) + + case TypeChatRevenueTransactionTypeFragmentRefund: + return UnmarshalChatRevenueTransactionTypeFragmentRefund(data) default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) @@ -8343,6 +8555,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateMessageFactCheck: return UnmarshalUpdateMessageFactCheck(data) + case TypeUpdateMessageSuggestedPostInfo: + return UnmarshalUpdateMessageSuggestedPostInfo(data) + case TypeUpdateMessageLiveLocationViewed: return UnmarshalUpdateMessageLiveLocationViewed(data) @@ -8688,6 +8903,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateOwnedStarCount: return UnmarshalUpdateOwnedStarCount(data) + case TypeUpdateOwnedTonCount: + return UnmarshalUpdateOwnedTonCount(data) + case TypeUpdateChatRevenueAmount: return UnmarshalUpdateChatRevenueAmount(data) @@ -10005,6 +10223,78 @@ func UnmarshalChatAdministratorRights(data json.RawMessage) (*ChatAdministratorR return &resp, err } +func UnmarshalSuggestedPostPriceStar(data json.RawMessage) (*SuggestedPostPriceStar, error) { + var resp SuggestedPostPriceStar + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSuggestedPostPriceTon(data json.RawMessage) (*SuggestedPostPriceTon, error) { + var resp SuggestedPostPriceTon + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSuggestedPostStatePending(data json.RawMessage) (*SuggestedPostStatePending, error) { + var resp SuggestedPostStatePending + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSuggestedPostStateApproved(data json.RawMessage) (*SuggestedPostStateApproved, error) { + var resp SuggestedPostStateApproved + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSuggestedPostStateDeclined(data json.RawMessage) (*SuggestedPostStateDeclined, error) { + var resp SuggestedPostStateDeclined + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSuggestedPostInfo(data json.RawMessage) (*SuggestedPostInfo, error) { + var resp SuggestedPostInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputSuggestedPostInfo(data json.RawMessage) (*InputSuggestedPostInfo, error) { + var resp InputSuggestedPostInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSuggestedPostRefundReasonPostDeleted(data json.RawMessage) (*SuggestedPostRefundReasonPostDeleted, error) { + var resp SuggestedPostRefundReasonPostDeleted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSuggestedPostRefundReasonPaymentRefunded(data json.RawMessage) (*SuggestedPostRefundReasonPaymentRefunded, error) { + var resp SuggestedPostRefundReasonPaymentRefunded + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarAmount(data json.RawMessage) (*StarAmount, error) { var resp StarAmount @@ -10277,6 +10567,30 @@ func UnmarshalGiftSettings(data json.RawMessage) (*GiftSettings, error) { return &resp, err } +func UnmarshalUpgradedGiftOriginUpgrade(data json.RawMessage) (*UpgradedGiftOriginUpgrade, error) { + var resp UpgradedGiftOriginUpgrade + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftOriginTransfer(data json.RawMessage) (*UpgradedGiftOriginTransfer, error) { + var resp UpgradedGiftOriginTransfer + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftOriginResale(data json.RawMessage) (*UpgradedGiftOriginResale, error) { + var resp UpgradedGiftOriginResale + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpgradedGiftModel(data json.RawMessage) (*UpgradedGiftModel, error) { var resp UpgradedGiftModel @@ -10485,16 +10799,16 @@ func UnmarshalGiftUpgradePreview(data json.RawMessage) (*GiftUpgradePreview, err return &resp, err } -func UnmarshalStarTransactionDirectionIncoming(data json.RawMessage) (*StarTransactionDirectionIncoming, error) { - var resp StarTransactionDirectionIncoming +func UnmarshalTransactionDirectionIncoming(data json.RawMessage) (*TransactionDirectionIncoming, error) { + var resp TransactionDirectionIncoming err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionDirectionOutgoing(data json.RawMessage) (*StarTransactionDirectionOutgoing, error) { - var resp StarTransactionDirectionOutgoing +func UnmarshalTransactionDirectionOutgoing(data json.RawMessage) (*TransactionDirectionOutgoing, error) { + var resp TransactionDirectionOutgoing err := json.Unmarshal(data, &resp) @@ -10741,6 +11055,22 @@ func UnmarshalStarTransactionTypePaidMessageReceive(data json.RawMessage) (*Star return &resp, err } +func UnmarshalStarTransactionTypeSuggestedPostPaymentSend(data json.RawMessage) (*StarTransactionTypeSuggestedPostPaymentSend, error) { + var resp StarTransactionTypeSuggestedPostPaymentSend + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeSuggestedPostPaymentReceive(data json.RawMessage) (*StarTransactionTypeSuggestedPostPaymentReceive, error) { + var resp StarTransactionTypeSuggestedPostPaymentReceive + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarTransactionTypePremiumPurchase(data json.RawMessage) (*StarTransactionTypePremiumPurchase, error) { var resp StarTransactionTypePremiumPurchase @@ -10789,6 +11119,46 @@ func UnmarshalStarTransactions(data json.RawMessage) (*StarTransactions, error) return &resp, err } +func UnmarshalTonTransactionTypeFragmentDeposit(data json.RawMessage) (*TonTransactionTypeFragmentDeposit, error) { + var resp TonTransactionTypeFragmentDeposit + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTonTransactionTypeSuggestedPostPayment(data json.RawMessage) (*TonTransactionTypeSuggestedPostPayment, error) { + var resp TonTransactionTypeSuggestedPostPayment + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTonTransactionTypeUnsupported(data json.RawMessage) (*TonTransactionTypeUnsupported, error) { + var resp TonTransactionTypeUnsupported + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTonTransaction(data json.RawMessage) (*TonTransaction, error) { + var resp TonTransaction + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTonTransactions(data json.RawMessage) (*TonTransactions, error) { + var resp TonTransactions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalGiveawayParticipantStatusEligible(data json.RawMessage) (*GiveawayParticipantStatusEligible, error) { var resp GiveawayParticipantStatusEligible @@ -14965,6 +15335,14 @@ func UnmarshalMessageGiftedStars(data json.RawMessage) (*MessageGiftedStars, err return &resp, err } +func UnmarshalMessageGiftedTon(data json.RawMessage) (*MessageGiftedTon, error) { + var resp MessageGiftedTon + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageGiveawayPrizeStars(data json.RawMessage) (*MessageGiveawayPrizeStars, error) { var resp MessageGiveawayPrizeStars @@ -15037,6 +15415,46 @@ func UnmarshalMessageChecklistTasksAdded(data json.RawMessage) (*MessageChecklis return &resp, err } +func UnmarshalMessageSuggestedPostApprovalFailed(data json.RawMessage) (*MessageSuggestedPostApprovalFailed, error) { + var resp MessageSuggestedPostApprovalFailed + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageSuggestedPostApproved(data json.RawMessage) (*MessageSuggestedPostApproved, error) { + var resp MessageSuggestedPostApproved + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageSuggestedPostDeclined(data json.RawMessage) (*MessageSuggestedPostDeclined, error) { + var resp MessageSuggestedPostDeclined + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageSuggestedPostPaid(data json.RawMessage) (*MessageSuggestedPostPaid, error) { + var resp MessageSuggestedPostPaid + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageSuggestedPostRefunded(data json.RawMessage) (*MessageSuggestedPostRefunded, error) { + var resp MessageSuggestedPostRefunded + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageContactRegistered(data json.RawMessage) (*MessageContactRegistered, error) { var resp MessageContactRegistered @@ -20461,6 +20879,14 @@ func UnmarshalInternalLinkTypeMyStars(data json.RawMessage) (*InternalLinkTypeMy return &resp, err } +func UnmarshalInternalLinkTypeMyToncoins(data json.RawMessage) (*InternalLinkTypeMyToncoins, error) { + var resp InternalLinkTypeMyToncoins + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInternalLinkTypePassportDataRequest(data json.RawMessage) (*InternalLinkTypePassportDataRequest, error) { var resp InternalLinkTypePassportDataRequest @@ -21613,24 +22039,40 @@ func UnmarshalRevenueWithdrawalStateFailed(data json.RawMessage) (*RevenueWithdr return &resp, err } -func UnmarshalChatRevenueTransactionTypeEarnings(data json.RawMessage) (*ChatRevenueTransactionTypeEarnings, error) { - var resp ChatRevenueTransactionTypeEarnings +func UnmarshalChatRevenueTransactionTypeUnsupported(data json.RawMessage) (*ChatRevenueTransactionTypeUnsupported, error) { + var resp ChatRevenueTransactionTypeUnsupported err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalChatRevenueTransactionTypeWithdrawal(data json.RawMessage) (*ChatRevenueTransactionTypeWithdrawal, error) { - var resp ChatRevenueTransactionTypeWithdrawal +func UnmarshalChatRevenueTransactionTypeSponsoredMessageEarnings(data json.RawMessage) (*ChatRevenueTransactionTypeSponsoredMessageEarnings, error) { + var resp ChatRevenueTransactionTypeSponsoredMessageEarnings err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalChatRevenueTransactionTypeRefund(data json.RawMessage) (*ChatRevenueTransactionTypeRefund, error) { - var resp ChatRevenueTransactionTypeRefund +func UnmarshalChatRevenueTransactionTypeSuggestedPostEarnings(data json.RawMessage) (*ChatRevenueTransactionTypeSuggestedPostEarnings, error) { + var resp ChatRevenueTransactionTypeSuggestedPostEarnings + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatRevenueTransactionTypeFragmentWithdrawal(data json.RawMessage) (*ChatRevenueTransactionTypeFragmentWithdrawal, error) { + var resp ChatRevenueTransactionTypeFragmentWithdrawal + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatRevenueTransactionTypeFragmentRefund(data json.RawMessage) (*ChatRevenueTransactionTypeFragmentRefund, error) { + var resp ChatRevenueTransactionTypeFragmentRefund err := json.Unmarshal(data, &resp) @@ -21877,6 +22319,14 @@ func UnmarshalUpdateMessageFactCheck(data json.RawMessage) (*UpdateMessageFactCh return &resp, err } +func UnmarshalUpdateMessageSuggestedPostInfo(data json.RawMessage) (*UpdateMessageSuggestedPostInfo, error) { + var resp UpdateMessageSuggestedPostInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateMessageLiveLocationViewed(data json.RawMessage) (*UpdateMessageLiveLocationViewed, error) { var resp UpdateMessageLiveLocationViewed @@ -22797,6 +23247,14 @@ func UnmarshalUpdateOwnedStarCount(data json.RawMessage) (*UpdateOwnedStarCount, return &resp, err } +func UnmarshalUpdateOwnedTonCount(data json.RawMessage) (*UpdateOwnedTonCount, error) { + var resp UpdateOwnedTonCount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateChatRevenueAmount(data json.RawMessage) (*UpdateChatRevenueAmount, error) { var resp UpdateChatRevenueAmount @@ -23604,6 +24062,33 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatAdministratorRights: return UnmarshalChatAdministratorRights(data) + case TypeSuggestedPostPriceStar: + return UnmarshalSuggestedPostPriceStar(data) + + case TypeSuggestedPostPriceTon: + return UnmarshalSuggestedPostPriceTon(data) + + case TypeSuggestedPostStatePending: + return UnmarshalSuggestedPostStatePending(data) + + case TypeSuggestedPostStateApproved: + return UnmarshalSuggestedPostStateApproved(data) + + case TypeSuggestedPostStateDeclined: + return UnmarshalSuggestedPostStateDeclined(data) + + case TypeSuggestedPostInfo: + return UnmarshalSuggestedPostInfo(data) + + case TypeInputSuggestedPostInfo: + return UnmarshalInputSuggestedPostInfo(data) + + case TypeSuggestedPostRefundReasonPostDeleted: + return UnmarshalSuggestedPostRefundReasonPostDeleted(data) + + case TypeSuggestedPostRefundReasonPaymentRefunded: + return UnmarshalSuggestedPostRefundReasonPaymentRefunded(data) + case TypeStarAmount: return UnmarshalStarAmount(data) @@ -23706,6 +24191,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeGiftSettings: return UnmarshalGiftSettings(data) + case TypeUpgradedGiftOriginUpgrade: + return UnmarshalUpgradedGiftOriginUpgrade(data) + + case TypeUpgradedGiftOriginTransfer: + return UnmarshalUpgradedGiftOriginTransfer(data) + + case TypeUpgradedGiftOriginResale: + return UnmarshalUpgradedGiftOriginResale(data) + case TypeUpgradedGiftModel: return UnmarshalUpgradedGiftModel(data) @@ -23784,11 +24278,11 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeGiftUpgradePreview: return UnmarshalGiftUpgradePreview(data) - case TypeStarTransactionDirectionIncoming: - return UnmarshalStarTransactionDirectionIncoming(data) + case TypeTransactionDirectionIncoming: + return UnmarshalTransactionDirectionIncoming(data) - case TypeStarTransactionDirectionOutgoing: - return UnmarshalStarTransactionDirectionOutgoing(data) + case TypeTransactionDirectionOutgoing: + return UnmarshalTransactionDirectionOutgoing(data) case TypeStarTransactionTypePremiumBotDeposit: return UnmarshalStarTransactionTypePremiumBotDeposit(data) @@ -23880,6 +24374,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarTransactionTypePaidMessageReceive: return UnmarshalStarTransactionTypePaidMessageReceive(data) + case TypeStarTransactionTypeSuggestedPostPaymentSend: + return UnmarshalStarTransactionTypeSuggestedPostPaymentSend(data) + + case TypeStarTransactionTypeSuggestedPostPaymentReceive: + return UnmarshalStarTransactionTypeSuggestedPostPaymentReceive(data) + case TypeStarTransactionTypePremiumPurchase: return UnmarshalStarTransactionTypePremiumPurchase(data) @@ -23898,6 +24398,21 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarTransactions: return UnmarshalStarTransactions(data) + case TypeTonTransactionTypeFragmentDeposit: + return UnmarshalTonTransactionTypeFragmentDeposit(data) + + case TypeTonTransactionTypeSuggestedPostPayment: + return UnmarshalTonTransactionTypeSuggestedPostPayment(data) + + case TypeTonTransactionTypeUnsupported: + return UnmarshalTonTransactionTypeUnsupported(data) + + case TypeTonTransaction: + return UnmarshalTonTransaction(data) + + case TypeTonTransactions: + return UnmarshalTonTransactions(data) + case TypeGiveawayParticipantStatusEligible: return UnmarshalGiveawayParticipantStatusEligible(data) @@ -25464,6 +25979,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageGiftedStars: return UnmarshalMessageGiftedStars(data) + case TypeMessageGiftedTon: + return UnmarshalMessageGiftedTon(data) + case TypeMessageGiveawayPrizeStars: return UnmarshalMessageGiveawayPrizeStars(data) @@ -25491,6 +26009,21 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageChecklistTasksAdded: return UnmarshalMessageChecklistTasksAdded(data) + case TypeMessageSuggestedPostApprovalFailed: + return UnmarshalMessageSuggestedPostApprovalFailed(data) + + case TypeMessageSuggestedPostApproved: + return UnmarshalMessageSuggestedPostApproved(data) + + case TypeMessageSuggestedPostDeclined: + return UnmarshalMessageSuggestedPostDeclined(data) + + case TypeMessageSuggestedPostPaid: + return UnmarshalMessageSuggestedPostPaid(data) + + case TypeMessageSuggestedPostRefunded: + return UnmarshalMessageSuggestedPostRefunded(data) + case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) @@ -27525,6 +28058,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInternalLinkTypeMyStars: return UnmarshalInternalLinkTypeMyStars(data) + case TypeInternalLinkTypeMyToncoins: + return UnmarshalInternalLinkTypeMyToncoins(data) + case TypeInternalLinkTypePassportDataRequest: return UnmarshalInternalLinkTypePassportDataRequest(data) @@ -27957,14 +28493,20 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeRevenueWithdrawalStateFailed: return UnmarshalRevenueWithdrawalStateFailed(data) - case TypeChatRevenueTransactionTypeEarnings: - return UnmarshalChatRevenueTransactionTypeEarnings(data) + case TypeChatRevenueTransactionTypeUnsupported: + return UnmarshalChatRevenueTransactionTypeUnsupported(data) - case TypeChatRevenueTransactionTypeWithdrawal: - return UnmarshalChatRevenueTransactionTypeWithdrawal(data) + case TypeChatRevenueTransactionTypeSponsoredMessageEarnings: + return UnmarshalChatRevenueTransactionTypeSponsoredMessageEarnings(data) - case TypeChatRevenueTransactionTypeRefund: - return UnmarshalChatRevenueTransactionTypeRefund(data) + case TypeChatRevenueTransactionTypeSuggestedPostEarnings: + return UnmarshalChatRevenueTransactionTypeSuggestedPostEarnings(data) + + case TypeChatRevenueTransactionTypeFragmentWithdrawal: + return UnmarshalChatRevenueTransactionTypeFragmentWithdrawal(data) + + case TypeChatRevenueTransactionTypeFragmentRefund: + return UnmarshalChatRevenueTransactionTypeFragmentRefund(data) case TypeChatRevenueTransaction: return UnmarshalChatRevenueTransaction(data) @@ -28056,6 +28598,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateMessageFactCheck: return UnmarshalUpdateMessageFactCheck(data) + case TypeUpdateMessageSuggestedPostInfo: + return UnmarshalUpdateMessageSuggestedPostInfo(data) + case TypeUpdateMessageLiveLocationViewed: return UnmarshalUpdateMessageLiveLocationViewed(data) @@ -28401,6 +28946,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateOwnedStarCount: return UnmarshalUpdateOwnedStarCount(data) + case TypeUpdateOwnedTonCount: + return UnmarshalUpdateOwnedTonCount(data) + case TypeUpdateChatRevenueAmount: return UnmarshalUpdateChatRevenueAmount(data) diff --git a/data/td_api.tl b/data/td_api.tl index 29d016b..deb1b8f 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -828,7 +828,7 @@ animatedChatPhoto length:int32 file:file main_frame_timestamp:double = AnimatedC //@minithumbnail Photo minithumbnail; may be null //@sizes Available variants of the photo in JPEG format, in different size //@animation A big (up to 1280x1280) animated variant of the photo in MPEG4 format; may be null -//@small_animation A small (160x160) animated variant of the photo in MPEG4 format; may be null even the big animation is available +//@small_animation A small (160x160) animated variant of the photo in MPEG4 format; may be null even if the big animation is available //@sticker Sticker-based version of the chat photo; may be null chatPhoto id:int64 added_date:int32 minithumbnail:minithumbnail sizes:vector animation:animatedChatPhoto small_animation:animatedChatPhoto sticker:chatPhotoSticker = ChatPhoto; @@ -877,7 +877,7 @@ chatPermissions can_send_basic_messages:Bool can_send_audios:Bool can_send_docum //@can_manage_chat True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report supergroup spam messages, //-ignore slow mode, and send messages to the chat without paying Telegram Stars. Implied by any other privilege; applicable to supergroups and channels only //@can_change_info True, if the administrator can change the chat title, photo, and other settings -//@can_post_messages True, if the administrator can create channel posts, answer to channel direct messages, or view channel statistics; applicable to channels only +//@can_post_messages True, if the administrator can create channel posts, approve suggested channel posts, or view channel statistics; applicable to channels only //@can_edit_messages True, if the administrator can edit messages of other users and pin messages; applicable to channels only //@can_delete_messages True, if the administrator can delete messages of other users //@can_invite_users True, if the administrator can invite new users to the chat @@ -889,8 +889,58 @@ chatPermissions can_send_basic_messages:Bool can_send_audios:Bool can_send_docum //@can_post_stories True, if the administrator can create new chat stories, or edit and delete posted stories; applicable to supergroups and channels only //@can_edit_stories True, if the administrator can edit stories posted by other users, post stories to the chat page, pin chat stories, and access story archive; applicable to supergroups and channels only //@can_delete_stories True, if the administrator can delete stories posted by other users; applicable to supergroups and channels only +//@can_manage_direct_messages True, if the administrator can answer to channel direct messages; applicable to channels only //@is_anonymous True, if the administrator isn't shown in the chat member list and sends messages anonymously; applicable to supergroups only -chatAdministratorRights can_manage_chat:Bool can_change_info:Bool can_post_messages:Bool can_edit_messages:Bool can_delete_messages:Bool can_invite_users:Bool can_restrict_members:Bool can_pin_messages:Bool can_manage_topics:Bool can_promote_members:Bool can_manage_video_chats:Bool can_post_stories:Bool can_edit_stories:Bool can_delete_stories:Bool is_anonymous:Bool = ChatAdministratorRights; +chatAdministratorRights can_manage_chat:Bool can_change_info:Bool can_post_messages:Bool can_edit_messages:Bool can_delete_messages:Bool can_invite_users:Bool can_restrict_members:Bool can_pin_messages:Bool can_manage_topics:Bool can_promote_members:Bool can_manage_video_chats:Bool can_post_stories:Bool can_edit_stories:Bool can_delete_stories:Bool can_manage_direct_messages:Bool is_anonymous:Bool = ChatAdministratorRights; + + +//@class SuggestedPostPrice @description Describes price of a suggested post + +//@description Describes price of a suggested post in Telegram Stars +//@star_count The amount of Telegram Stars agreed to pay for the post; getOption("suggested_post_star_count_min")-getOption("suggested_post_star_count_max") +suggestedPostPriceStar star_count:int53 = SuggestedPostPrice; + +//@description Describes price of a suggested post in Toncoins +//@toncoin_cent_count The amount of 1/100 of Toncoin agreed to pay for the post; getOption("suggested_post_toncoin_cent_count_min")-getOption("suggested_post_toncoin_cent_count_max") +suggestedPostPriceTon toncoin_cent_count:int53 = SuggestedPostPrice; + + +//@class SuggestedPostState @description Describes state of a suggested post + +//@description The post must be approved or declined +suggestedPostStatePending = SuggestedPostState; + +//@description The post was approved +suggestedPostStateApproved = SuggestedPostState; + +//@description The post was declined +suggestedPostStateDeclined = SuggestedPostState; + + +//@description Contains information about a suggested post. If the post can be approved or declined, then changes to the post can be also suggested. Use sendMessage with reply to the message +//-and suggested post information to suggest message changes. Use addOffer to suggest price or time changes +//@price Price of the suggested post; may be null if the post is non-paid +//@send_date Point in time (Unix timestamp) when the post is expected to be published; 0 if the specific date isn't set yet +//@state State of the post +//@can_be_approved True, if the suggested post can be approved by the current user using approveSuggestedPost; updates aren't sent when value of this field changes +//@can_be_declined True, if the suggested post can be declined by the current user using declineSuggestedPost; updates aren't sent when value of this field changes +suggestedPostInfo price:SuggestedPostPrice send_date:int32 state:SuggestedPostState can_be_approved:Bool can_be_declined:Bool = SuggestedPostInfo; + +//@description Contains information about a post to suggest +//@price Price of the suggested post; pass null to suggest a post without payment. If the current user isn't an administrator of the channel direct messages chat +//-and has no enough funds to pay for the post, then the error "BALANCE_TOO_LOW" will be returned immediately +//@send_date Point in time (Unix timestamp) when the post is expected to be published; pass 0 if the date isn't restricted. If specified, +//-then the date must be getOption("suggested_post_send_delay_min")-getOption("suggested_post_send_delay_max") seconds in the future +inputSuggestedPostInfo price:SuggestedPostPrice send_date:int32 = InputSuggestedPostInfo; + + +//@class SuggestedPostRefundReason @description Describes reason for refund of the payment for a suggested post + +//@description The post was refunded, because it was deleted by channel administrators in less than getOption("suggested_post_lifetime_min") seconds +suggestedPostRefundReasonPostDeleted = SuggestedPostRefundReason; + +//@description The post was refunded, because the payment for the post was refunded +suggestedPostRefundReasonPaymentRefunded = SuggestedPostRefundReason; //@description Describes a possibly non-integer amount of Telegram Stars @@ -1110,6 +1160,20 @@ acceptedGiftTypes unlimited_gifts:Bool limited_gifts:Bool upgraded_gifts:Bool pr //@accepted_gift_types Types of gifts accepted by the user; for Telegram Premium users only giftSettings show_gift_button:Bool accepted_gift_types:acceptedGiftTypes = GiftSettings; + +//@class UpgradedGiftOrigin @description Describes origin from which the upgraded gift was obtained + +//@description The gift was obtained by upgrading of a previously received gift +//@gift_message_id Identifier of the message with the regular gift that was upgraded; can be 0 or an identifier of a deleted message +upgradedGiftOriginUpgrade gift_message_id:int53 = UpgradedGiftOrigin; + +//@description The gift was transferred from another owner +upgradedGiftOriginTransfer = UpgradedGiftOrigin; + +//@description The gift was bought from another user @star_count Number of Telegram Stars that were paid by the sender for the gift +upgradedGiftOriginResale star_count:int53 = UpgradedGiftOrigin; + + //@description Describes a model of an upgraded gift //@name Name of the model //@sticker The sticker representing the upgraded gift @@ -1145,6 +1209,7 @@ upgradedGiftOriginalDetails sender_id:MessageSender receiver_id:MessageSender te //@description Describes a gift that can be sent to another user or channel chat //@id Unique identifier of the gift +//@publisher_chat_id Identifier of the chat that published the gift; 0 if none //@sticker The sticker representing the gift //@star_count Number of Telegram Stars that must be paid for the gift //@default_sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the regular gift by default. If the gift was paid with just bought Telegram Stars, then full value can be claimed @@ -1154,10 +1219,11 @@ upgradedGiftOriginalDetails sender_id:MessageSender receiver_id:MessageSender te //@total_count Number of total times the gift can be purchased; 0 if not limited //@first_send_date Point in time (Unix timestamp) when the gift was send for the first time; for sold out gifts only //@last_send_date Point in time (Unix timestamp) when the gift was send for the last time; for sold out gifts only -gift id:int64 sticker:sticker star_count:int53 default_sell_star_count:int53 upgrade_star_count:int53 is_for_birthday:Bool remaining_count:int32 total_count:int32 first_send_date:int32 last_send_date:int32 = Gift; +gift id:int64 publisher_chat_id:int53 sticker:sticker star_count:int53 default_sell_star_count:int53 upgrade_star_count:int53 is_for_birthday:Bool remaining_count:int32 total_count:int32 first_send_date:int32 last_send_date:int32 = Gift; //@description Describes an upgraded gift that can be transferred to another owner or transferred to the TON blockchain as an NFT //@id Unique identifier of the gift +//@publisher_chat_id Identifier of the chat that published the gift; 0 if none //@title The title of the upgraded gift //@name Unique name of the upgraded gift that can be used with internalLinkTypeUpgradedGift or sendResoldGift //@number Unique number of the upgraded gift among gifts upgraded from the same gift @@ -1172,7 +1238,7 @@ gift id:int64 sticker:sticker star_count:int53 default_sell_star_count:int53 upg //@backdrop Backdrop of the upgraded gift //@original_details Information about the originally sent gift; may be null if unknown //@resale_star_count Number of Telegram Stars that must be paid to buy the gift and send it to someone else; 0 if resale isn't possible -upgradedGift id:int64 title:string name:string number:int32 total_upgraded_count:int32 max_upgraded_count:int32 owner_id:MessageSender owner_address:string owner_name:string gift_address:string model:upgradedGiftModel symbol:upgradedGiftSymbol backdrop:upgradedGiftBackdrop original_details:upgradedGiftOriginalDetails resale_star_count:int53 = UpgradedGift; +upgradedGift id:int64 publisher_chat_id:int53 title:string name:string number:int32 total_upgraded_count:int32 max_upgraded_count:int32 owner_id:MessageSender owner_address:string owner_name:string gift_address:string model:upgradedGiftModel symbol:upgradedGiftSymbol backdrop:upgradedGiftBackdrop original_details:upgradedGiftOriginalDetails resale_star_count:int53 = UpgradedGift; //@description Contains result of gift upgrading //@gift The upgraded gift @@ -1288,13 +1354,13 @@ receivedGifts total_count:int32 gifts:vector are_notifications_ena giftUpgradePreview models:vector symbols:vector backdrops:vector = GiftUpgradePreview; -//@class StarTransactionDirection @description Describes direction of a transaction with Telegram Stars +//@class TransactionDirection @description Describes direction of transactions in a transaction list -//@description The transaction is incoming and increases the number of owned Telegram Stars -starTransactionDirectionIncoming = StarTransactionDirection; +//@description The transaction is incoming and increases the amount of owned currency +transactionDirectionIncoming = TransactionDirection; -//@description The transaction is outgoing and decreases the number of owned Telegram Stars -starTransactionDirectionOutgoing = StarTransactionDirection; +//@description The transaction is outgoing and decreases the amount of owned currency +transactionDirectionOutgoing = TransactionDirection; //@class StarTransactionType @description Describes type of transaction with Telegram Stars @@ -1437,6 +1503,14 @@ starTransactionTypePaidMessageSend chat_id:int53 message_count:int32 = StarTrans //@commission_star_amount The amount of Telegram Stars that were received by Telegram; can be negative for refunds starTransactionTypePaidMessageReceive sender_id:MessageSender message_count:int32 commission_per_mille:int32 commission_star_amount:starAmount = StarTransactionType; +//@description The transaction is a payment for a suggested post; for regular users only +//@chat_id Identifier of the channel chat that posted the post +starTransactionTypeSuggestedPostPaymentSend chat_id:int53 = StarTransactionType; + +//@description The transaction is a receiving of a payment for a suggested post by the channel chat; for channel chats only +//@user_id Identifier of the user that paid for the suggested post +starTransactionTypeSuggestedPostPaymentReceive user_id:int53 = StarTransactionType; + //@description The transaction is a purchase of Telegram Premium subscription; for regular users and bots only //@user_id Identifier of the user that received the Telegram Premium subscription //@month_count Number of months the Telegram Premium subscription will be active @@ -1468,6 +1542,35 @@ starTransaction id:string star_amount:starAmount is_refund:Bool date:int32 type: starTransactions star_amount:starAmount transactions:vector next_offset:string = StarTransactions; +//@class TonTransactionType @description Describes type of transaction with Toncoins + +//@description The transaction is a deposit of Toncoins from Fragment +//@is_gift True, if the transaction is a gift from another user +//@sticker The sticker to be shown in the transaction information; may be null if unknown +tonTransactionTypeFragmentDeposit is_gift:Bool sticker:sticker = TonTransactionType; + +//@description The transaction is a payment for a suggested post @chat_id Identifier of the channel chat that posted the post +tonTransactionTypeSuggestedPostPayment chat_id:int53 = TonTransactionType; + +//@description The transaction is a transaction of an unsupported type +tonTransactionTypeUnsupported = TonTransactionType; + + +//@description Represents a transaction changing the amount of owned Toncoins +//@id Unique identifier of the transaction +//@ton_amount The amount of added owned Toncoins; negative for outgoing transactions +//@is_refund True, if the transaction is a refund of a previous transaction +//@date Point in time (Unix timestamp) when the transaction was completed +//@type Type of the transaction +tonTransaction id:string ton_amount:int53 is_refund:Bool date:int32 type:TonTransactionType = TonTransaction; + +//@description Represents a list of Toncoin transactions +//@ton_amount The total amount of owned Toncoins +//@transactions List of Toncoin transactions +//@next_offset The offset for the next request. If empty, then there are no more results +tonTransactions ton_amount:int53 transactions:vector next_offset:string = TonTransactions; + + //@class GiveawayParticipantStatus @description Contains information about status of a user in a giveaway //@description The user is eligible for the giveaway @@ -1892,7 +1995,7 @@ basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int53 memb //@has_location True, if the supergroup is connected to a location, i.e. the supergroup is a location-based supergroup //@sign_messages True, if messages sent to the channel contains name of the sender. This field is only applicable to channels //@show_message_sender True, if messages sent to the channel have information about the sender user. This field is only applicable to channels -//@join_to_send_messages True, if users need to join the supergroup before they can send messages. Always true for channels and non-discussion supergroups +//@join_to_send_messages True, if users need to join the supergroup before they can send messages. May be false only for discussion supergroups and channel direct messages groups //@join_by_request True, if all users directly joining the supergroup need to be approved by supergroup administrators. Always false for channels and supergroups without username, location, or a linked chat //@is_slow_mode_enabled True, if the slow mode is enabled in the supergroup //@is_channel True, if the supergroup is a channel @@ -2198,13 +2301,14 @@ inputTextQuote text:formattedText position:int32 = InputTextQuote; //@chat_id The identifier of the chat to which the message belongs; may be 0 if the replied message is in unknown chat //@message_id The identifier of the message; may be 0 if the replied message is in unknown chat //@quote Chosen quote from the replied message; may be null if none +//@checklist_task_id Identifier of the checklist task in the original message that was replied; 0 if none //@origin Information about origin of the message if the message was from another chat or topic; may be null for messages from the same chat //@origin_send_date Point in time (Unix timestamp) when the message was sent if the message was from another chat or topic; 0 for messages from the same chat //@content Media content of the message if the message was from another chat or topic; may be null for messages from the same chat and messages without media. //-Can be only one of the following types: messageAnimation, messageAudio, messageChecklist, messageContact, messageDice, messageDocument, messageGame, //-messageGiveaway, messageGiveawayWinners, messageInvoice, messageLocation, messagePaidMedia, messagePhoto, messagePoll, messageSticker, messageStory, //-messageText (for link preview), messageVenue, messageVideo, messageVideoNote, or messageVoiceNote -messageReplyToMessage chat_id:int53 message_id:int53 quote:textQuote origin:MessageOrigin origin_send_date:int32 content:MessageContent = MessageReplyTo; +messageReplyToMessage chat_id:int53 message_id:int53 quote:textQuote checklist_task_id:int32 origin:MessageOrigin origin_send_date:int32 content:MessageContent = MessageReplyTo; //@description Describes a story replied by a given message @story_poster_chat_id The identifier of the poster of the story @story_id The identifier of the story messageReplyToStory story_poster_chat_id:int53 story_id:int32 = MessageReplyTo; @@ -2215,13 +2319,15 @@ messageReplyToStory story_poster_chat_id:int53 story_id:int32 = MessageReplyTo; //@description Describes a message to be replied in the same chat and forum topic //@message_id The identifier of the message to be replied in the same chat and forum topic. A message can be replied in the same chat and forum topic only if messageProperties.can_be_replied //@quote Quote from the message to be replied; pass null if none. Must always be null for replies in secret chats -inputMessageReplyToMessage message_id:int53 quote:inputTextQuote = InputMessageReplyTo; +//@checklist_task_id Identifier of the checklist task in the message to be replied; pass 0 to reply to the whole message +inputMessageReplyToMessage message_id:int53 quote:inputTextQuote checklist_task_id:int32 = InputMessageReplyTo; //@description Describes a message to be replied that is from a different chat or a forum topic; not supported in secret chats //@chat_id The identifier of the chat to which the message to be replied belongs //@message_id The identifier of the message to be replied in the specified chat. A message can be replied in another chat or forum topic only if messageProperties.can_be_replied_in_another_chat //@quote Quote from the message to be replied; pass null if none -inputMessageReplyToExternalMessage chat_id:int53 message_id:int53 quote:inputTextQuote = InputMessageReplyTo; +//@checklist_task_id Identifier of the checklist task in the message to be replied; pass 0 to reply to the whole message +inputMessageReplyToExternalMessage chat_id:int53 message_id:int53 quote:inputTextQuote checklist_task_id:int32 = InputMessageReplyTo; //@description Describes a story to be replied //@story_poster_chat_id The identifier of the poster of the story. Currently, stories can be replied only in the chat that posted the story; channel stories can't be replied @@ -2247,6 +2353,8 @@ factCheck text:formattedText country_code:string = FactCheck; //@can_be_saved True, if content of the message can be saved locally //@has_timestamped_media True, if media timestamp entities refers to a media in this message as opposed to a media in the replied message //@is_channel_post True, if the message is a channel post. All messages to channels are channel posts, all other messages are not channel posts +//@is_paid_star_suggested_post True, if the message is a suggested channel post which was paid in Telegram Stars; a warning must be shown if the message is deleted in less than getOption("suggested_post_lifetime_min") seconds after sending +//@is_paid_ton_suggested_post True, if the message is a suggested channel post which was paid in Toncoins; a warning must be shown if the message is deleted in less than getOption("suggested_post_lifetime_min") seconds after sending //@contains_unread_mention True, if the message contains an unread mention for the current user //@date Point in time (Unix timestamp) when the message was sent; 0 for scheduled messages //@edit_date Point in time (Unix timestamp) when the message was last edited; 0 for scheduled messages @@ -2255,6 +2363,7 @@ factCheck text:formattedText country_code:string = FactCheck; //@interaction_info Information about interactions with the message; may be null if none //@unread_reactions Information about unread reactions added to the message //@fact_check Information about fact-check added to the message; may be null if none +//@suggested_post_info Information about the suggested post; may be null if the message isn't a suggested post //@reply_to Information about the message or the story this message is replying to; may be null if none //@message_thread_id If non-zero, the identifier of the message thread the message belongs to; unique within the chat to which the message belongs //@topic_id Identifier of the topic within the chat to which the message belongs; may be null if none @@ -2272,7 +2381,7 @@ factCheck text:formattedText country_code:string = FactCheck; //@restriction_reason If non-empty, contains a human-readable description of the reason why access to this message must be restricted //@content Content of the message //@reply_markup Reply markup for the message; may be null if none -message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool is_from_offline:Bool can_be_saved:Bool has_timestamped_media:Bool is_channel_post:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector fact_check:factCheck reply_to:MessageReplyTo message_thread_id:int53 topic_id:MessageTopic self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 sender_business_bot_user_id:int53 sender_boost_count:int32 paid_message_star_count:int53 author_signature:string media_album_id:int64 effect_id:int64 has_sensitive_content:Bool restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; +message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool is_from_offline:Bool can_be_saved:Bool has_timestamped_media:Bool is_channel_post:Bool is_paid_star_suggested_post:Bool is_paid_ton_suggested_post:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector fact_check:factCheck suggested_post_info:suggestedPostInfo reply_to:MessageReplyTo message_thread_id:int53 topic_id:MessageTopic self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 sender_business_bot_user_id:int53 sender_boost_count:int32 paid_message_star_count:int53 author_signature:string media_album_id:int64 effect_id:int64 has_sensitive_content:Bool restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; //@description Contains a list of messages @total_count Approximate total number of messages found @messages List of messages; messages may be null @@ -2375,8 +2484,8 @@ sponsoredChats chats:vector = SponsoredChats; //@description Describes an advertisent to be shown while a video from a message is watched //@unique_id Unique identifier of this result //@text Text of the advertisement -//@min_display_duration The minimum amount of time the advertisement must be dispalyed before it can be hidden by the user, in seconds -//@max_display_duration The maximum amount of time the advertisement must be dispalyed before it must be automatically hidden, in seconds +//@min_display_duration The minimum amount of time the advertisement must be displayed before it can be hidden by the user, in seconds +//@max_display_duration The maximum amount of time the advertisement must be displayed before it must be automatically hidden, in seconds //@can_be_reported True, if the advertisement can be reported to Telegram moderators through reportVideoMessageAdvertisement //@sponsor Information about the sponsor of the advertisement //@title Title of the sponsored message @@ -2502,7 +2611,8 @@ reactionNotificationSettings message_reaction_source:ReactionNotificationSource //@date Point in time (Unix timestamp) when the draft was created //@input_message_text Content of the message draft; must be of the type inputMessageText, inputMessageVideoNote, or inputMessageVoiceNote //@effect_id Identifier of the effect to apply to the message when it is sent; 0 if none -draftMessage reply_to:InputMessageReplyTo date:int32 input_message_text:InputMessageContent effect_id:int64 = DraftMessage; +//@suggested_post_info Information about the suggested post; may be null if none +draftMessage reply_to:InputMessageReplyTo date:int32 input_message_text:InputMessageContent effect_id:int64 suggested_post_info:inputSuggestedPostInfo = DraftMessage; //@class ChatType @description Describes the type of chat @@ -2663,7 +2773,7 @@ videoChat group_call_id:int32 has_participants:Bool default_participant_id:Messa //@permissions Actions that non-administrator chat members are allowed to take in the chat //@last_message Last message in the chat; may be null if none or unknown //@positions Positions of the chat in chat lists -//@chat_lists 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 +//@chat_lists Chat lists to which the chat belongs. A chat can have a non-zero position in a chat list even if it doesn't belong to the chat list and have no position in a chat list even if it belongs to the chat list //@message_sender_id 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 //@block_list Block list to which the chat is added; may be null if none //@has_protected_content True, if chat content can't be saved locally, forwarded, or copied @@ -2995,7 +3105,7 @@ forumTopicIcon color:int32 custom_emoji_id:int64 = ForumTopicIcon; //@creator_id Identifier of the creator of the topic //@is_general True, if the topic is the General topic list //@is_outgoing True, if the topic was created by the current user -//@is_closed True, if the topic is closed +//@is_closed True, if the topic is closed. If the topic is closed, then the user must have can_manage_topics administrator right in the supergroup or must be the creator of the topic to send messages there //@is_hidden True, if the topic is hidden above the topic list and closed; for General topic only forumTopicInfo chat_id:int53 forum_topic_id:int53 message_thread_id:int53 name:string icon:forumTopicIcon creation_date:int32 creator_id:MessageSender is_general:Bool is_outgoing:Bool is_closed:Bool is_hidden:Bool = ForumTopicInfo; @@ -3447,7 +3557,8 @@ linkPreviewTypeVideo video:video cover:photo start_timestamp:int32 = LinkPreview //@description The link is a link to a video chat //@photo Photo of the chat with the video chat; may be null if none //@is_live_stream True, if the video chat is expected to be a live stream in a channel or a broadcast group -linkPreviewTypeVideoChat photo:chatPhoto is_live_stream:Bool = LinkPreviewType; +//@joins_as_speaker True, if the user can use the link to join the video chat without being muted by administrators +linkPreviewTypeVideoChat photo:chatPhoto is_live_stream:Bool joins_as_speaker:Bool = LinkPreviewType; //@description The link is a link to a video note message @video_note The video note linkPreviewTypeVideoNote video_note:videoNote = LinkPreviewType; @@ -3708,7 +3819,7 @@ paidMediaUnsupported = PaidMedia; //@description Describes parameters of a giveaway //@boosted_chat_id Identifier of the supergroup or channel chat, which will be automatically boosted by the winners of the giveaway for duration of the Telegram Premium subscription, -//-or for the specified time. If the chat is a channel, then can_post_messages right is required in the channel, otherwise, the user must be an administrator in the supergroup +//-or for the specified time. If the chat is a channel, then can_post_messages administrator right is required in the channel, otherwise, the user must be an administrator in the supergroup //@additional_chat_ids Identifiers of other supergroup or channel chats that must be subscribed by the users to be eligible for the giveaway. There can be up to getOption("giveaway_additional_chat_count_max") additional chats //@winners_selection_date Point in time (Unix timestamp) when the giveaway is expected to be performed; must be 60-getOption("giveaway_duration_max") seconds in the future in scheduled giveaways //@only_new_members True, if only new members of the chats will be eligible for the giveaway @@ -4327,6 +4438,14 @@ messageGiveawayWinners boosted_chat_id:int53 giveaway_message_id:int53 additiona //@sticker A sticker to be shown in the message; may be null if unknown messageGiftedStars gifter_user_id:int53 receiver_user_id:int53 currency:string amount:int53 cryptocurrency:string cryptocurrency_amount:int64 star_count:int53 transaction_id:string sticker:sticker = MessageContent; +//@description Toncoins were gifted to a user +//@gifter_user_id The identifier of a user that gifted Toncoins; 0 if the gift was anonymous or is outgoing +//@receiver_user_id The identifier of a user that received Toncoins; 0 if the gift is incoming +//@ton_amount The received amount of Toncoins, in the smallest units of the cryptocurrency +//@transaction_id Identifier of the transaction for Toncoin credit; for receiver only +//@sticker A sticker to be shown in the message; may be null if unknown +messageGiftedTon gifter_user_id:int53 receiver_user_id:int53 ton_amount:int53 transaction_id:string sticker:sticker = MessageContent; + //@description A Telegram Stars were received by the current user from a giveaway //@star_count Number of Telegram Stars that were received //@transaction_id Identifier of the transaction for Telegram Stars credit @@ -4357,17 +4476,16 @@ messageGift gift:gift sender_id:MessageSender receiver_id:MessageSender received //@gift The gift //@sender_id Sender of the gift; may be null for anonymous gifts //@receiver_id Receiver of the gift +//@origin Origin of the upgraded gift //@received_gift_id Unique identifier of the received gift for the current user; only for the receiver of the gift -//@is_upgrade True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift //@is_saved True, if the gift is displayed on the user's or the channel's profile page; only for the receiver of the gift //@can_be_transferred True, if the gift can be transferred to another owner; only for the receiver of the gift -//@was_transferred True, if the gift was transferred to another owner; only for the receiver of the gift -//@last_resale_star_count Number of Telegram Stars that were paid by the sender for the gift; 0 if the gift was upgraded or transferred +//@was_transferred True, if the gift has already been transferred to another owner; only for the receiver of the gift //@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift //@next_transfer_date Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift //@next_resale_date Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift //@export_date Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift -messageUpgradedGift gift:upgradedGift sender_id:MessageSender receiver_id:MessageSender received_gift_id:string is_upgrade:Bool is_saved:Bool can_be_transferred:Bool was_transferred:Bool last_resale_star_count:int53 transfer_star_count:int53 next_transfer_date:int32 next_resale_date:int32 export_date:int32 = MessageContent; +messageUpgradedGift gift:upgradedGift sender_id:MessageSender receiver_id:MessageSender origin:UpgradedGiftOrigin received_gift_id:string is_saved:Bool can_be_transferred:Bool was_transferred:Bool transfer_star_count:int53 next_transfer_date:int32 next_resale_date:int32 export_date:int32 = MessageContent; //@description A gift which purchase, upgrade or transfer were refunded //@gift The gift @@ -4399,6 +4517,33 @@ messageChecklistTasksDone checklist_message_id:int53 marked_as_done_task_ids:vec //@tasks List of tasks added to the checklist messageChecklistTasksAdded checklist_message_id:int53 tasks:vector = MessageContent; +//@description Approval of suggested post has failed, because the user which proposed the post had no enough funds +//@suggested_post_message_id Identifier of the message with the suggested post; can be 0 if the message was deleted +//@price Price of the suggested post +messageSuggestedPostApprovalFailed suggested_post_message_id:int53 price:SuggestedPostPrice = MessageContent; + +//@description A suggested post was approved +//@suggested_post_message_id Identifier of the message with the suggested post; can be 0 if the message was deleted +//@price Price of the suggested post; may be null if the post is non-paid +//@send_date Point in time (Unix timestamp) when the post is expected to be published +messageSuggestedPostApproved suggested_post_message_id:int53 price:SuggestedPostPrice send_date:int32 = MessageContent; + +//@description A suggested post was declined +//@suggested_post_message_id Identifier of the message with the suggested post; can be 0 if the message was deleted +//@comment Comment added by administrator of the channel when the post was declined +messageSuggestedPostDeclined suggested_post_message_id:int53 comment:string = MessageContent; + +//@description A suggested post was published for getOption("suggested_post_lifetime_min") seconds and payment for the post was received +//@suggested_post_message_id Identifier of the message with the suggested post; can be 0 if the message was deleted +//@star_amount The amount of received Telegram Stars +//@ton_amount The amount of received Toncoins; in the smallest units of the cryptocurrency +messageSuggestedPostPaid suggested_post_message_id:int53 star_amount:starAmount ton_amount:int53 = MessageContent; + +//@description A suggested post was refunded +//@suggested_post_message_id Identifier of the message with the suggested post; can be 0 if the message was deleted +//@reason Reason of the refund +messageSuggestedPostRefunded suggested_post_message_id:int53 reason:SuggestedPostRefundReason = MessageContent; + //@description A contact has registered with Telegram messageContactRegistered = MessageContent; @@ -4553,6 +4698,7 @@ messageSelfDestructTypeImmediately = MessageSelfDestructType; //@description Options to be used when a message is sent //@direct_messages_chat_topic_id Unique identifier of the topic in a channel direct messages chat administered by the current user; pass 0 if the chat isn't a channel direct messages chat administered by the current user +//@suggested_post_info Information about the suggested post; pass null if none. For messages to channel direct messages chat only. Applicable only to sendMessage and addOffer //@disable_notification Pass true to disable notification for the message //@from_background Pass true if the message is sent from the background //@protect_content Pass true if the content of the message must be protected from forwarding and saving; for bots only @@ -4564,7 +4710,7 @@ messageSelfDestructTypeImmediately = MessageSelfDestructType; //@effect_id Identifier of the effect to apply to the message; pass 0 if none; applicable only to sendMessage and sendMessageAlbum in private chats //@sending_id Non-persistent identifier, which will be returned back in messageSendingStatePending object and can be used to match sent messages and corresponding updateNewMessage updates //@only_preview Pass true to get a fake message instead of actually sending them -messageSendOptions direct_messages_chat_topic_id:int53 disable_notification:Bool from_background:Bool protect_content:Bool allow_paid_broadcast:Bool paid_message_star_count:int53 update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState effect_id:int64 sending_id:int32 only_preview:Bool = MessageSendOptions; +messageSendOptions direct_messages_chat_topic_id:int53 suggested_post_info:inputSuggestedPostInfo disable_notification:Bool from_background:Bool protect_content:Bool allow_paid_broadcast:Bool paid_message_star_count:int53 update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState effect_id:int64 sending_id:int32 only_preview:Bool = MessageSendOptions; //@description Options to be used when a message content is copied without reference to the original sender. Service messages, messages with messageInvoice, messagePaidMedia, messageGiveaway, or messageGiveawayWinners content can't be copied //@send_copy True, if content of the message needs to be copied without reference to the original sender. Always true if the message is forwarded to a secret chat or is local. @@ -4737,9 +4883,12 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool rep //@description Contains properties of a message and describes actions that can be done with the message right now +//@can_add_offer True, if an offer can be added to the message using addOffer //@can_add_tasks True, if tasks can be added to the message's checklist using addChecklistTasks if the current user has Telegram Premium subscription +//@can_be_approved True, if the message is a suggested post that can be approved by the user using approveSuggestedPost //@can_be_copied True, if content of the message can be copied using inputMessageForwarded or forwardMessages with copy options //@can_be_copied_to_secret_chat True, if content of the message can be copied to a secret chat using inputMessageForwarded or forwardMessages with copy options +//@can_be_declined True, if the message is a suggested post that can be declined by the user using declineSuggestedPost //@can_be_deleted_only_for_self True, if the message can be deleted only for the current user while other users will continue to see it using the method deleteMessages with revoke == false //@can_be_deleted_for_all_users True, if the message can be deleted for all users using the method deleteMessages with revoke == true //@can_be_edited True, if the message can be edited using the methods editMessageText, editMessageCaption, or editMessageReplyMarkup. @@ -4753,6 +4902,7 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool rep //@can_be_shared_in_story True, if the message can be shared in a story using inputStoryAreaTypeMessage //@can_edit_media True, if the message can be edited using the method editMessageMedia //@can_edit_scheduling_state True, if scheduling state of the message can be edited +//@can_edit_suggested_post_info True, if another price or post send time can be suggested using addOffer //@can_get_author True, if author of the message sent on behalf of a chat can be received through getMessageAuthor //@can_get_embedding_code True, if code for message embedding can be received using getMessageEmbeddingCode //@can_get_link True, if a link can be generated for the message using getMessageLink @@ -4769,7 +4919,7 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool rep //@can_report_supergroup_spam True, if the message can be reported using reportSupergroupSpam //@can_set_fact_check True, if fact check for the message can be changed through setMessageFactCheck //@need_show_statistics True, if message statistics must be available from context menu of the message -messageProperties can_add_tasks:Bool can_be_copied:Bool can_be_copied_to_secret_chat:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_paid:Bool can_be_pinned:Bool can_be_replied:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_shared_in_story:Bool can_edit_media:Bool can_edit_scheduling_state:Bool can_get_author:Bool can_get_embedding_code:Bool can_get_link:Bool can_get_media_timestamp_links:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_statistics:Bool can_get_video_advertisements:Bool can_get_viewers:Bool can_mark_tasks_as_done:Bool can_recognize_speech:Bool can_report_chat:Bool can_report_reactions:Bool can_report_supergroup_spam:Bool can_set_fact_check:Bool need_show_statistics:Bool = MessageProperties; +messageProperties can_add_offer:Bool can_add_tasks:Bool can_be_approved:Bool can_be_copied:Bool can_be_copied_to_secret_chat:Bool can_be_declined:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_paid:Bool can_be_pinned:Bool can_be_replied:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_shared_in_story:Bool can_edit_media:Bool can_edit_scheduling_state:Bool can_edit_suggested_post_info:Bool can_get_author:Bool can_get_embedding_code:Bool can_get_link:Bool can_get_media_timestamp_links:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_statistics:Bool can_get_video_advertisements:Bool can_get_viewers:Bool can_mark_tasks_as_done:Bool can_recognize_speech:Bool can_report_chat:Bool can_report_reactions:Bool can_report_supergroup_spam:Bool can_set_fact_check:Bool need_show_statistics:Bool = MessageProperties; //@class SearchMessagesFilter @description Represents a filter for message search results @@ -6513,7 +6663,7 @@ premiumFeatureSavedMessagesTags = PremiumFeature; //-and to restrict incoming messages from non-contacts using setNewChatPrivacySettings premiumFeatureMessagePrivacy = PremiumFeature; -//@description The ability to view last seen and read times of other users even they can't view last seen or read time for the current user +//@description The ability to view last seen and read times of other users even if they can't view last seen or read time for the current user premiumFeatureLastSeenTimes = PremiumFeature; //@description The ability to use Business features @@ -7663,6 +7813,9 @@ internalLinkTypeMessageDraft text:formattedText contains_link:Bool = InternalLin //@description The link is a link to the screen with information about Telegram Star balance and transactions of the current user internalLinkTypeMyStars = InternalLinkType; +//@description The link is a link to the screen with information about Toncoin balance and transactions of the current user +internalLinkTypeMyToncoins = InternalLinkType; + //@description The link contains a request of Telegram passport data. Call getPassportAuthorizationForm with the given parameters to process the link if the link was received from outside of the application; otherwise, ignore it //@bot_user_id User identifier of the service's bot; the corresponding user may be unknown yet //@scope Telegram Passport element types requested by the service @@ -8339,21 +8492,26 @@ revenueWithdrawalStateFailed = RevenueWithdrawalState; //@class ChatRevenueTransactionType @description Describes type of transaction for revenue earned from sponsored messages in a chat +//@description Describes an unsupported transaction +chatRevenueTransactionTypeUnsupported = ChatRevenueTransactionType; + //@description Describes earnings from sponsored messages in a chat in some time frame //@start_date Point in time (Unix timestamp) when the earnings started //@end_date Point in time (Unix timestamp) when the earnings ended -chatRevenueTransactionTypeEarnings start_date:int32 end_date:int32 = ChatRevenueTransactionType; +chatRevenueTransactionTypeSponsoredMessageEarnings start_date:int32 end_date:int32 = ChatRevenueTransactionType; -//@description Describes a withdrawal of earnings +//@description Describes earnings from a published suggested post @user_id Identifier of the user that paid for the suggested post +chatRevenueTransactionTypeSuggestedPostEarnings user_id:int53 = ChatRevenueTransactionType; + +//@description Describes a withdrawal of earnings through Fragment //@withdrawal_date Point in time (Unix timestamp) when the earnings withdrawal started -//@provider Name of the payment provider //@state State of the withdrawal -chatRevenueTransactionTypeWithdrawal withdrawal_date:int32 provider:string state:RevenueWithdrawalState = ChatRevenueTransactionType; +chatRevenueTransactionTypeFragmentWithdrawal withdrawal_date:int32 state:RevenueWithdrawalState = ChatRevenueTransactionType; -//@description Describes a refund for failed withdrawal of earnings +//@description Describes a refund for failed withdrawal of earnings through Fragment //@refund_date Point in time (Unix timestamp) when the transaction was refunded -//@provider Name of the payment provider -chatRevenueTransactionTypeRefund refund_date:int32 provider:string = ChatRevenueTransactionType; +chatRevenueTransactionTypeFragmentRefund refund_date:int32 = ChatRevenueTransactionType; + //@description Contains a chat revenue transactions //@cryptocurrency Cryptocurrency in which revenue is calculated @@ -8361,8 +8519,11 @@ chatRevenueTransactionTypeRefund refund_date:int32 provider:string = ChatRevenue //@type Type of the transaction chatRevenueTransaction cryptocurrency:string cryptocurrency_amount:int64 type:ChatRevenueTransactionType = ChatRevenueTransaction; -//@description Contains a list of chat revenue transactions @total_count Total number of transactions @transactions List of transactions -chatRevenueTransactions total_count:int32 transactions:vector = ChatRevenueTransactions; +//@description Contains a list of chat revenue transactions +//@ton_amount The amount of owned Toncoins; in the smallest units of the cryptocurrency +//@transactions List of transactions +//@next_offset The offset for the next request. If empty, then there are no more results +chatRevenueTransactions ton_amount:int53 transactions:vector next_offset:string = ChatRevenueTransactions; //@description Contains information about Telegram Stars earned by a bot or a chat @@ -8491,6 +8652,12 @@ updateMessageUnreadReactions chat_id:int53 message_id:int53 unread_reactions:vec //@fact_check The new fact-check updateMessageFactCheck chat_id:int53 message_id:int53 fact_check:factCheck = Update; +//@description Information about suggested post of a message was changed +//@chat_id Chat identifier +//@message_id Message identifier +//@suggested_post_info The new information about the suggested post +updateMessageSuggestedPostInfo chat_id:int53 message_id:int53 suggested_post_info:suggestedPostInfo = Update; + //@description A message with a live location was viewed. When the update is received, the application is expected to update the live location //@chat_id Identifier of the chat with the live location message //@message_id Identifier of the message with live location @@ -8809,7 +8976,7 @@ updateGroupCallParticipant group_call_id:int32 participant:groupCallParticipant //@description The list of group call participants that can send and receive encrypted call data has changed; for group calls not bound to a chat only //@group_call_id Identifier of the group call //@participant_user_ids New list of group call participant user identifiers. The identifiers may be invalid or the corresponding users may be unknown. -//-The participants must be shown in the list of group call participants even there is no information about them +//-The participants must be shown in the list of group call participants even if there is no information about them updateGroupCallParticipants group_call_id:int32 participant_user_ids:vector = Update; //@description The verification state of an encrypted group call has changed; for group calls not bound to a chat only @@ -8958,6 +9125,9 @@ updateActiveLiveLocationMessages messages:vector = Update; //@description The number of Telegram Stars owned by the current user has changed @star_amount The new amount of owned Telegram Stars updateOwnedStarCount star_amount:starAmount = Update; +//@description The number of Toncoins owned by the current user has changed @ton_amount The new amount of owned Toncoins; in the smallest units of the cryptocurrency +updateOwnedTonCount ton_amount:int53 = Update; + //@description The revenue earned from sponsored messages in a chat has changed. If chat revenue screen is opened, then getChatRevenueTransactions may be called to fetch new transactions //@chat_id Identifier of the chat //@revenue_amount New amount of earned revenue @@ -9403,10 +9573,12 @@ getMessage chat_id:int53 message_id:int53 = Message; //@message_id Identifier of the message to get getMessageLocally chat_id:int53 message_id:int53 = Message; -//@description Returns information about a non-bundled message that is replied by a given message. Also, returns the pinned message, the game message, the invoice message, -//-the message with a previously set same background, the giveaway message, the checklist message, and the topic creation message for messages of the types -//-messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground, messageGiveawayCompleted, messageChecklistTasksDone and messageChecklistTasksAdded, and topic messages without non-bundled replied message respectively. -//-Returns a 404 error if the message doesn't exist +//@description Returns information about a non-bundled message that is replied by a given message. Also, returns the pinned message for messagePinMessage, +//-the game message for messageGameScore, the invoice message for messagePaymentSuccessful, the message with a previously set same background for messageChatSetBackground, +//-the giveaway message for messageGiveawayCompleted, the checklist message for messageChecklistTasksDone, messageChecklistTasksAdded, the message with suggested post information +//-for messageSuggestedPostApprovalFailed, messageSuggestedPostApproved, messageSuggestedPostDeclined, messageSuggestedPostPaid, messageSuggestedPostRefunded, +//-the message with the regular gift that was upgraded for messageUpgradedGift with origin of the type upgradedGiftOriginUpgrade, +//-and the topic creation message for topic messages without non-bundled replied message. Returns a 404 error if the message doesn't exist //@chat_id Identifier of the chat the message belongs to //@message_id Identifier of the reply message getRepliedMessage chat_id:int53 message_id:int53 = Message; @@ -9563,8 +9735,8 @@ getDirectMessagesChatTopic chat_id:int53 topic_id:int53 = DirectMessagesChatTopi //@chat_id Chat identifier of the channel direct messages chat //@topic_id Identifier of the topic which messages will be fetched //@from_message_id Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message -//@offset Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages -//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. +//@offset Specify 0 to get results from exactly the message from_message_id or a negative number from -99 to -1 to get additionally -offset newer messages +//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than or equal to -offset. //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit getDirectMessagesChatTopicHistory chat_id:int53 topic_id:int53 from_message_id:int53 offset:int32 limit:int32 = Messages; @@ -9628,8 +9800,8 @@ loadSavedMessagesTopics limit:int32 = Ok; //@description Returns messages in a Saved Messages topic. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id) //@saved_messages_topic_id Identifier of Saved Messages topic which messages will be fetched //@from_message_id Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message -//@offset Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages -//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. +//@offset Specify 0 to get results from exactly the message from_message_id or a negative number from -99 to -1 to get additionally -offset newer messages +//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than or equal to -offset. //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit getSavedMessagesTopicHistory saved_messages_topic_id:int53 from_message_id:int53 offset:int32 limit:int32 = Messages; @@ -9667,8 +9839,8 @@ getGroupsInCommon user_id:int53 offset_chat_id:int53 limit:int32 = Chats; //-For optimal performance, the number of returned messages is chosen by TDLib. This is an offline method if only_local is true //@chat_id Chat identifier //@from_message_id Identifier of the message starting from which history must be fetched; use 0 to get results from the last message -//@offset Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages -//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. +//@offset Specify 0 to get results from exactly the message from_message_id or a negative number from -99 to -1 to get additionally -offset newer messages +//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than or equal to -offset. //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit //@only_local Pass true to get only messages that are available without sending network requests getChatHistory chat_id:int53 from_message_id:int53 offset:int32 limit:int32 only_local:Bool = Messages; @@ -9678,8 +9850,8 @@ getChatHistory chat_id:int53 from_message_id:int53 offset:int32 limit:int32 only //@chat_id Chat identifier //@message_id Message identifier, which thread history needs to be returned //@from_message_id Identifier of the message starting from which history must be fetched; use 0 to get results from the last message -//@offset Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages -//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. +//@offset Specify 0 to get results from exactly the message from_message_id or a negative number from -99 to -1 to get additionally -offset newer messages +//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than or equal to -offset. //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit getMessageThreadHistory chat_id:int53 message_id:int53 from_message_id:int53 offset:int32 limit:int32 = Messages; @@ -9702,8 +9874,8 @@ deleteChat chat_id:int53 = Ok; //@query Query to search for //@sender_id Identifier of the sender of messages to search for; pass null to search for messages from any sender. Not supported in secret chats //@from_message_id Identifier of the message starting from which history must be fetched; use 0 to get results from the last message -//@offset Specify 0 to get results from exactly the message from_message_id or a negative offset to get the specified message and some newer messages -//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than -offset. +//@offset Specify 0 to get results from exactly the message from_message_id or a negative number to get the specified message and some newer messages +//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than -offset. //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit //@filter Additional filter for messages to search; pass null to search for all messages searchChatMessages chat_id:int53 topic_id:MessageTopic query:string sender_id:MessageSender from_message_id:int53 offset:int32 limit:int32 filter:SearchMessagesFilter = FoundChatMessages; @@ -9735,8 +9907,8 @@ searchSecretMessages chat_id:int53 query:string offset:string limit:int32 filter //@tag Tag to search for; pass null to return all suitable messages //@query Query to search for //@from_message_id Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message -//@offset Specify 0 to get results from exactly the message from_message_id or a negative offset to get the specified message and some newer messages -//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than -offset. +//@offset Specify 0 to get results from exactly the message from_message_id or a negative number to get the specified message and some newer messages +//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than -offset. //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit searchSavedMessages saved_messages_topic_id:int53 tag:ReactionType query:string from_message_id:int53 offset:int32 limit:int32 = FoundChatMessages; @@ -10247,7 +10419,7 @@ setBusinessAccountBio business_connection_id:string bio:string = Ok; //@description Changes a profile photo of a business account; for bots only //@business_connection_id Unique identifier of business connection //@photo Profile photo to set; pass null to remove the photo -//@is_public Pass true to set the public photo, which will be visible even the main photo is hidden by privacy settings +//@is_public Pass true to set the public photo, which will be visible even if the main photo is hidden by privacy settings setBusinessAccountProfilePhoto business_connection_id:string photo:InputChatPhoto is_public:Bool = Ok; //@description Changes the editable username of a business account; for bots only @@ -10340,7 +10512,7 @@ getForumTopicDefaultIcons = Stickers; //@icon Icon of the topic. Icon color must be one of 0x6FB9F0, 0xFFD67E, 0xCB86DB, 0x8EEE98, 0xFF93B2, or 0xFB6F5F. Telegram Premium users can use any custom emoji as topic icon, other users can use only a custom emoji returned by getForumTopicDefaultIcons createForumTopic chat_id:int53 name:string icon:forumTopicIcon = ForumTopicInfo; -//@description Edits title and icon of a topic in a forum supergroup chat; requires can_manage_topics right in the supergroup unless the user is creator of the topic +//@description Edits title and icon of a topic in a forum supergroup chat; requires can_manage_topics administrator right in the supergroup unless the user is creator of the topic //@chat_id Identifier of the chat //@message_thread_id Message thread identifier of the forum topic //@name New name of the topic; 0-128 characters. If empty, the previous topic name is kept @@ -10369,24 +10541,24 @@ getForumTopics chat_id:int53 query:string offset_date:int32 offset_message_id:in //@notification_settings New notification settings for the forum topic. If the topic is muted for more than 366 days, it is considered to be muted forever setForumTopicNotificationSettings chat_id:int53 message_thread_id:int53 notification_settings:chatNotificationSettings = Ok; -//@description Toggles whether a topic is closed in a forum supergroup chat; requires can_manage_topics right in the supergroup unless the user is creator of the topic +//@description Toggles whether a topic is closed in a forum supergroup chat; requires can_manage_topics administrator right in the supergroup unless the user is creator of the topic //@chat_id Identifier of the chat //@message_thread_id Message thread identifier of the forum topic //@is_closed Pass true to close the topic; pass false to reopen it toggleForumTopicIsClosed chat_id:int53 message_thread_id:int53 is_closed:Bool = Ok; -//@description Toggles whether a General topic is hidden in a forum supergroup chat; requires can_manage_topics right in the supergroup +//@description Toggles whether a General topic is hidden in a forum supergroup chat; requires can_manage_topics administrator right in the supergroup //@chat_id Identifier of the chat //@is_hidden Pass true to hide and close the General topic; pass false to unhide it toggleGeneralForumTopicIsHidden chat_id:int53 is_hidden:Bool = Ok; -//@description Changes the pinned state of a forum topic; requires can_manage_topics right in the supergroup. There can be up to getOption("pinned_forum_topic_count_max") pinned forum topics +//@description Changes the pinned state of a forum topic; requires can_manage_topics administrator right in the supergroup. There can be up to getOption("pinned_forum_topic_count_max") pinned forum topics //@chat_id Chat identifier //@message_thread_id Message thread identifier of the forum topic //@is_pinned Pass true to pin the topic; pass false to unpin it toggleForumTopicIsPinned chat_id:int53 message_thread_id:int53 is_pinned:Bool = Ok; -//@description Changes the order of pinned forum topics; requires can_manage_topics right in the supergroup @chat_id Chat identifier @message_thread_ids The new list of pinned forum topics +//@description Changes the order of pinned forum topics; requires can_manage_topics administrator right in the supergroup @chat_id Chat identifier @message_thread_ids The new list of pinned forum topics setPinnedForumTopics chat_id:int53 message_thread_ids:vector = Ok; //@description Deletes all messages in a forum topic; requires can_delete_messages administrator right in the supergroup unless the user is creator of the topic, the topic has no messages from other users and has at most 11 messages @@ -10773,7 +10945,7 @@ closeChat chat_id:int53 = Ok; //@chat_id Chat identifier //@message_ids The identifiers of the messages being viewed //@source Source of the message view; pass null to guess the source based on chat open state -//@force_read Pass true to mark as read the specified messages even the chat is closed +//@force_read Pass true to mark as read the specified messages even if the chat is closed viewMessages chat_id:int53 message_ids:vector source:MessageSource force_read:Bool = Ok; //@description Informs TDLib that the message content has been opened (e.g., the user has opened a photo, video, document, location or venue, or has listened to an audio file or voice note message). @@ -11041,7 +11213,7 @@ setChatDirectMessagesGroup chat_id:int53 is_enabled:Bool paid_message_star_count //@description Changes the location of a chat. Available only for some location-based supergroups, use supergroupFullInfo.can_set_location to check whether the method is allowed to use @chat_id Chat identifier @location New location for the chat; must be valid and not null setChatLocation chat_id:int53 location:chatLocation = Ok; -//@description Changes the slow mode delay of a chat. Available only for supergroups; requires can_restrict_members right @chat_id Chat identifier @slow_mode_delay New slow mode delay for the chat, in seconds; must be one of 0, 10, 30, 60, 300, 900, 3600 +//@description Changes the slow mode delay of a chat. Available only for supergroups; requires can_restrict_members administrator right @chat_id Chat identifier @slow_mode_delay New slow mode delay for the chat, in seconds; must be one of 0, 10, 30, 60, 300, 900, 3600 setChatSlowModeDelay chat_id:int53 slow_mode_delay:int32 = Ok; //@description Pins a message in a chat. A message can be pinned only if messageProperties.can_be_pinned @@ -11180,11 +11352,11 @@ getStory story_poster_chat_id:int53 story_id:int32 only_local:Bool = Story; //@description Returns supergroup and channel chats in which the current user has the right to post stories. The chats must be rechecked with canPostStory before actually trying to post a story there getChatsToPostStories = Chats; -//@description Checks whether the current user can post a story on behalf of a chat; requires can_post_stories right for supergroup and channel chats +//@description Checks whether the current user can post a story on behalf of a chat; requires can_post_stories administrator right for supergroup and channel chats //@chat_id Chat identifier. Pass Saved Messages chat identifier when posting a story on behalf of the current user canPostStory chat_id:int53 = CanPostStoryResult; -//@description Posts a new story on behalf of a chat; requires can_post_stories right for supergroup and channel chats. Returns a temporary story +//@description Posts a new story on behalf of a chat; requires can_post_stories administrator right for supergroup and channel chats. Returns a temporary story //@chat_id Identifier of the chat that will post the story. Pass Saved Messages chat identifier when posting a story on behalf of the current user //@content Content of the story //@areas Clickable rectangle areas to be shown on the story media; pass null if none @@ -11248,7 +11420,7 @@ getChatActiveStories chat_id:int53 = ChatActiveStories; //-For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit getChatPostedToChatPageStories chat_id:int53 from_story_id:int32 limit:int32 = Stories; -//@description Returns the list of all stories posted by the given chat; requires can_edit_stories right in the chat. +//@description Returns the list of all stories posted by the given chat; requires can_edit_stories administrator right in the chat. //-The stories are returned in reverse chronological order (i.e., in order of decreasing story_id). For optimal performance, the number of returned stories is chosen by TDLib //@chat_id Chat identifier //@from_story_id Identifier of the story starting from which stories must be returned; use 0 to get results from the last story @@ -11256,7 +11428,7 @@ getChatPostedToChatPageStories chat_id:int53 from_story_id:int32 limit:int32 = S //-For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit getChatArchivedStories chat_id:int53 from_story_id:int32 limit:int32 = Stories; -//@description Changes the list of pinned stories on a chat page; requires can_edit_stories right in the chat +//@description Changes the list of pinned stories on a chat page; requires can_edit_stories administrator right in the chat //@chat_id Identifier of the chat that posted the stories //@story_ids New list of pinned stories. All stories must be posted to the chat page first. There can be up to getOption("pinned_story_count_max") pinned stories on a chat page setChatPinnedStories chat_id:int53 story_ids:vector = Ok; @@ -11391,7 +11563,7 @@ getThemedChatEmojiStatuses = EmojiStatusCustomEmojis; //@description Returns default emoji statuses for chats getDefaultChatEmojiStatuses = EmojiStatusCustomEmojis; -//@description Returns the list of emoji statuses, which can't be used as chat emoji status, even they are from a sticker set with is_allowed_as_chat_emoji_status == true +//@description Returns the list of emoji statuses, which can't be used as chat emoji status, even if they are from a sticker set with is_allowed_as_chat_emoji_status == true getDisallowedChatEmojiStatuses = EmojiStatusCustomEmojis; @@ -11602,6 +11774,28 @@ processChatJoinRequest chat_id:int53 user_id:int53 approve:Bool = Ok; processChatJoinRequests chat_id:int53 invite_link:string approve:Bool = Ok; +//@description Approves a suggested post in a channel direct messages chat +//@chat_id Chat identifier of the channel direct messages chat +//@message_id Identifier of the message with the suggested post. Use messageProperties.can_be_approved to check whether the suggested post can be approved +//@send_date Point in time (Unix timestamp) when the post is expected to be published; pass 0 if the date has already been chosen. If specified, +//-then the date must be in the future, but at most getOption("suggested_post_send_delay_max") seconds in the future +approveSuggestedPost chat_id:int53 message_id:int53 send_date:int32 = Ok; + +//@description Declines a suggested post in a channel direct messages chat +//@chat_id Chat identifier of the channel direct messages chat +//@message_id Identifier of the message with the suggested post. Use messageProperties.can_be_declined to check whether the suggested post can be declined +//@comment Comment for the creator of the suggested post; 0-128 characters +declineSuggestedPost chat_id:int53 message_id:int53 comment:string = Ok; + +//@description Sent a suggested post based on a previously sent message in a channel direct messages chat. Can be also used to suggest price or time change for an existing suggested post. +//-Returns the sent message +//@chat_id Identifier of the channel direct messages chat +//@message_id Identifier of the message in the chat which will be sent as suggested post. Use messageProperties.can_add_offer to check whether an offer can be added +//-or messageProperties.can_edit_suggested_post_info to check whether price or time of sending of the post can be changed +//@options Options to be used to send the message. New information about the suggested post must always be specified +addOffer chat_id:int53 message_id:int53 options:messageSendOptions = Message; + + //@description Creates a new call //@user_id Identifier of the user to be called //@protocol The call protocols supported by the application @@ -12078,7 +12272,7 @@ getWebPageInstantView url:string only_local:Bool = WebPageInstantView; //@description Changes a profile photo for the current user //@photo Profile photo to set -//@is_public Pass true to set the public photo, which will be visible even the main photo is hidden by privacy settings +//@is_public Pass true to set the public photo, which will be visible even if the main photo is hidden by privacy settings setProfilePhoto photo:InputChatPhoto is_public:Bool = Ok; //@description Deletes a profile photo @profile_photo_id Identifier of the profile photo to delete @@ -12541,7 +12735,7 @@ getAvailableGifts = AvailableGifts; //@pay_for_upgrade Pass true to additionally pay for the gift upgrade and allow the receiver to upgrade it for free sendGift gift_id:int64 owner_id:MessageSender text:formattedText is_private:Bool pay_for_upgrade:Bool = Ok; -//@description Sells a gift for Telegram Stars +//@description Sells a gift for Telegram Stars; requires owner privileges for gifts owned by a chat //@business_connection_id Unique identifier of business connection on behalf of which to send the request; for bots only //@received_gift_id Identifier of the gift sellGift business_connection_id:string received_gift_id:string = Ok; @@ -12615,7 +12809,7 @@ getUpgradedGiftWithdrawalUrl received_gift_id:string password:string = HttpUrl; //-The current user will receive getOption("gift_resale_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for the gift setGiftResalePrice received_gift_id:string resale_star_count:int53 = Ok; -//@description Returns upgraded gifts that can be bought from other owners +//@description Returns upgraded gifts that can be bought from other owners using sendResoldGift //@gift_id Identifier of the regular gift that was upgraded to a unique gift //@order Order in which the results will be sorted //@attributes Attributes used to filter received gifts. If multiple attributes of the same type are specified, then all of them are allowed. @@ -12823,9 +13017,15 @@ getChatRevenueWithdrawalUrl chat_id:int53 password:string = HttpUrl; //@description Returns the list of revenue transactions for a chat. Currently, this method can be used only //-for channels if supergroupFullInfo.can_get_revenue_statistics == true or bots if userFullInfo.bot_info.can_get_revenue_statistics == true //@chat_id Chat identifier -//@offset Number of transactions to skip -//@limit The maximum number of transactions to be returned; up to 200 -getChatRevenueTransactions chat_id:int53 offset:int32 limit:int32 = ChatRevenueTransactions; +//@offset Offset of the first transaction to return as received from the previous request; use empty string to get the first chunk of results +//@limit The maximum number of transactions to be returned; up to 100 +getChatRevenueTransactions chat_id:int53 offset:string limit:int32 = ChatRevenueTransactions; + +//@description Returns the list of Toncoin transactions of the current user +//@direction Direction of the transactions to receive; pass null to get all transactions +//@offset Offset of the first transaction to return as received from the previous request; use empty string to get the first chunk of results +//@limit The maximum number of transactions to return +getTonTransactions direction:TransactionDirection offset:string limit:int32 = TonTransactions; //@description Returns detailed Telegram Star revenue statistics @@ -12835,7 +13035,7 @@ getStarRevenueStatistics owner_id:MessageSender is_dark:Bool = StarRevenueStatis //@description Returns a URL for Telegram Star withdrawal //@owner_id Identifier of the owner of the Telegram Stars; can be identifier of the current user, an owned bot, or an owned supergroup or channel chat -//@star_count The number of Telegram Stars to withdraw. Must be at least getOption("star_withdrawal_count_min") +//@star_count The number of Telegram Stars to withdraw; must be between getOption("star_withdrawal_count_min") and getOption("star_withdrawal_count_max") //@password The 2-step verification password of the current user getStarWithdrawalUrl owner_id:MessageSender star_count:int53 password:string = HttpUrl; @@ -13138,7 +13338,7 @@ getStarGiveawayPaymentOptions = StarGiveawayPaymentOptions; //@direction Direction of the transactions to receive; pass null to get all transactions //@offset Offset of the first transaction to return as received from the previous request; use empty string to get the first chunk of results //@limit The maximum number of transactions to return -getStarTransactions owner_id:MessageSender subscription_id:string direction:StarTransactionDirection offset:string limit:int32 = StarTransactions; +getStarTransactions owner_id:MessageSender subscription_id:string direction:TransactionDirection offset:string limit:int32 = StarTransactions; //@description Returns the list of Telegram Star subscriptions for the current user //@only_expiring Pass true to receive only expiring subscriptions for which there are no enough Telegram Stars to extend From 9b94728dda1bfb84c99c68a27ddab439f42318d1 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Fri, 19 Sep 2025 19:09:58 +0800 Subject: [PATCH 49/54] Update to TDLib 1.8.54 --- data/td_api.tl | 396 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 350 insertions(+), 46 deletions(-) diff --git a/data/td_api.tl b/data/td_api.tl index deb1b8f..60c5f4f 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -894,14 +894,27 @@ chatPermissions can_send_basic_messages:Bool can_send_audios:Bool can_send_docum chatAdministratorRights can_manage_chat:Bool can_change_info:Bool can_post_messages:Bool can_edit_messages:Bool can_delete_messages:Bool can_invite_users:Bool can_restrict_members:Bool can_pin_messages:Bool can_manage_topics:Bool can_promote_members:Bool can_manage_video_chats:Bool can_post_stories:Bool can_edit_stories:Bool can_delete_stories:Bool can_manage_direct_messages:Bool is_anonymous:Bool = ChatAdministratorRights; +//@class GiftResalePrice @description Describes price of a resold gift + +//@description Describes price of a resold gift in Telegram Stars +//@star_count The amount of Telegram Stars expected to be paid for the gift. Must be in range +//-getOption("gift_resale_star_count_min")-getOption("gift_resale_star_count_max") for gifts put for resale +giftResalePriceStar star_count:int53 = GiftResalePrice; + +//@description Describes price of a resold gift in Toncoins +//@toncoin_cent_count The amount of 1/100 of Toncoin expected to be paid for the gift. Must be in range +//-getOption("gift_resale_toncoin_cent_count_min")-getOption("gift_resale_toncoin_cent_count_max") +giftResalePriceTon toncoin_cent_count:int53 = GiftResalePrice; + + //@class SuggestedPostPrice @description Describes price of a suggested post //@description Describes price of a suggested post in Telegram Stars -//@star_count The amount of Telegram Stars agreed to pay for the post; getOption("suggested_post_star_count_min")-getOption("suggested_post_star_count_max") +//@star_count The amount of Telegram Stars expected to be paid for the post; getOption("suggested_post_star_count_min")-getOption("suggested_post_star_count_max") suggestedPostPriceStar star_count:int53 = SuggestedPostPrice; //@description Describes price of a suggested post in Toncoins -//@toncoin_cent_count The amount of 1/100 of Toncoin agreed to pay for the post; getOption("suggested_post_toncoin_cent_count_min")-getOption("suggested_post_toncoin_cent_count_max") +//@toncoin_cent_count The amount of 1/100 of Toncoin expected to be paid for the post; getOption("suggested_post_toncoin_cent_count_min")-getOption("suggested_post_toncoin_cent_count_max") suggestedPostPriceTon toncoin_cent_count:int53 = SuggestedPostPrice; @@ -1161,6 +1174,28 @@ acceptedGiftTypes unlimited_gifts:Bool limited_gifts:Bool upgraded_gifts:Bool pr giftSettings show_gift_button:Bool accepted_gift_types:acceptedGiftTypes = GiftSettings; +//@description Describes the maximum number of times that a specific gift can be purchased +//@total_count The maximum number of times the gifts can be purchased +//@remaining_count Number of remaining times the gift can be purchased +giftPurchaseLimits total_count:int32 remaining_count:int32 = GiftPurchaseLimits; + +//@description Describes parameters of a unique gift available for resale +//@star_count Resale price of the gift in Telegram Stars +//@toncoin_cent_count Resale price of the gift in 1/100 of Toncoin +//@toncoin_only True, if the gift can be bought only using Toncoins +giftResaleParameters star_count:int53 toncoin_cent_count:int53 toncoin_only:Bool = GiftResaleParameters; + +//@description Describes collection of gifts +//@id Unique identifier of the collection +//@name Name of the collection +//@icon Icon of the collection; may be null if none +//@gift_count Total number of gifts in the collection +giftCollection id:int32 name:string icon:sticker gift_count:int32 = GiftCollection; + +//@description Contains a list of gift collections @collections List of gift collections +giftCollections collections:vector = GiftCollections; + + //@class UpgradedGiftOrigin @description Describes origin from which the upgraded gift was obtained //@description The gift was obtained by upgrading of a previously received gift @@ -1170,8 +1205,11 @@ upgradedGiftOriginUpgrade gift_message_id:int53 = UpgradedGiftOrigin; //@description The gift was transferred from another owner upgradedGiftOriginTransfer = UpgradedGiftOrigin; -//@description The gift was bought from another user @star_count Number of Telegram Stars that were paid by the sender for the gift -upgradedGiftOriginResale star_count:int53 = UpgradedGiftOrigin; +//@description The gift was bought from another user @price Price paid by the sender for the gift +upgradedGiftOriginResale price:GiftResalePrice = UpgradedGiftOrigin; + +//@description The sender or receiver of the message has paid for upgraid of the gift, which has been completed +upgradedGiftOriginPrepaidUpgrade = UpgradedGiftOrigin; //@description Describes a model of an upgraded gift @@ -1215,20 +1253,23 @@ upgradedGiftOriginalDetails sender_id:MessageSender receiver_id:MessageSender te //@default_sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the regular gift by default. If the gift was paid with just bought Telegram Stars, then full value can be claimed //@upgrade_star_count Number of Telegram Stars that must be paid to upgrade the gift; 0 if upgrade isn't possible //@is_for_birthday True, if the gift is a birthday gift -//@remaining_count Number of remaining times the gift can be purchased; 0 if not limited or the gift was sold out -//@total_count Number of total times the gift can be purchased; 0 if not limited +//@is_premium True, if the gift can be bought only by Telegram Premium subscribers +//@user_limits Number of times the gift can be purchased by the current user; may be null if not limited +//@overall_limits Number of times the gift can be purchased all users; may be null if not limited //@first_send_date Point in time (Unix timestamp) when the gift was send for the first time; for sold out gifts only //@last_send_date Point in time (Unix timestamp) when the gift was send for the last time; for sold out gifts only -gift id:int64 publisher_chat_id:int53 sticker:sticker star_count:int53 default_sell_star_count:int53 upgrade_star_count:int53 is_for_birthday:Bool remaining_count:int32 total_count:int32 first_send_date:int32 last_send_date:int32 = Gift; +gift id:int64 publisher_chat_id:int53 sticker:sticker star_count:int53 default_sell_star_count:int53 upgrade_star_count:int53 is_for_birthday:Bool is_premium:Bool user_limits:giftPurchaseLimits overall_limits:giftPurchaseLimits first_send_date:int32 last_send_date:int32 = Gift; //@description Describes an upgraded gift that can be transferred to another owner or transferred to the TON blockchain as an NFT //@id Unique identifier of the gift +//@regular_gift_id Unique identifier of the regular gift from which the gift was upgraded; may be 0 for short period of time for old gifts from database //@publisher_chat_id Identifier of the chat that published the gift; 0 if none //@title The title of the upgraded gift //@name Unique name of the upgraded gift that can be used with internalLinkTypeUpgradedGift or sendResoldGift //@number Unique number of the upgraded gift among gifts upgraded from the same gift //@total_upgraded_count Total number of gifts that were upgraded from the same gift //@max_upgraded_count The maximum number of gifts that can be upgraded from the same gift +//@is_premium True, if the original gift could have been bought only by Telegram Premium subscribers //@owner_id Identifier of the user or the chat that owns the upgraded gift; may be null if none or unknown //@owner_address Address of the gift NFT owner in TON blockchain; may be empty if none. Append the address to getOption("ton_blockchain_explorer_url") to get a link with information about the address //@owner_name Name of the owner for the case when owner identifier and address aren't known @@ -1237,8 +1278,27 @@ gift id:int64 publisher_chat_id:int53 sticker:sticker star_count:int53 default_s //@symbol Symbol of the upgraded gift //@backdrop Backdrop of the upgraded gift //@original_details Information about the originally sent gift; may be null if unknown -//@resale_star_count Number of Telegram Stars that must be paid to buy the gift and send it to someone else; 0 if resale isn't possible -upgradedGift id:int64 publisher_chat_id:int53 title:string name:string number:int32 total_upgraded_count:int32 max_upgraded_count:int32 owner_id:MessageSender owner_address:string owner_name:string gift_address:string model:upgradedGiftModel symbol:upgradedGiftSymbol backdrop:upgradedGiftBackdrop original_details:upgradedGiftOriginalDetails resale_star_count:int53 = UpgradedGift; +//@resale_parameters Resale parameters of the gift; may be null if resale isn't possible +//@value_currency ISO 4217 currency code of the currency in which value of the gift is represented; may be empty if unavailable +//@value_amount Estimated value of the gift; in the smallest units of the currency; 0 if unavailable +upgradedGift id:int64 regular_gift_id:int64 publisher_chat_id:int53 title:string name:string number:int32 total_upgraded_count:int32 max_upgraded_count:int32 is_premium:Bool owner_id:MessageSender owner_address:string owner_name:string gift_address:string model:upgradedGiftModel symbol:upgradedGiftSymbol backdrop:upgradedGiftBackdrop original_details:upgradedGiftOriginalDetails resale_parameters:giftResaleParameters value_currency:string value_amount:int53 = UpgradedGift; + +//@description Contains information about value of an upgraded gift +//@currency ISO 4217 currency code of the currency in which the prices are represented +//@value Estimated value of the gift; in the smallest units of the currency +//@is_value_average True, if the value is calculated as average value of similar sold gifts. Otherwise, it is based on the sale price of the gift +//@initial_sale_date Point in time (Unix timestamp) when the corresponding regular gift was originally purchased +//@initial_sale_star_count Amount of Telegram Stars that were paid for the gift +//@initial_sale_price Initial price of the gift; in the smallest units of the currency +//@last_sale_date Point in time (Unix timestamp) when the upgraded gift was purchased last time; 0 if never +//@last_sale_price Last purchase price of the gift; in the smallest units of the currency; 0 if the gift has never been resold +//@is_last_sale_on_fragment True, if the last sale was completed on Fragment +//@minimum_price The current minimum price of gifts upgraded from the same gift; in the smallest units of the currency; 0 if there are no such gifts +//@average_sale_price The average sale price in the last month of gifts upgraded from the same gift; in the smallest units of the currency; 0 if there were no such sales +//@telegram_listed_gift_count Number of gifts upgraded from the same gift being resold on Telegram +//@fragment_listed_gift_count Number of gifts upgraded from the same gift being resold on Fragment +//@fragment_url The HTTPS link to the Fragment for the gift; may be empty if there are no such gifts being sold on Fragment +upgradedGiftValueInfo currency:string value:int53 is_value_average:Bool initial_sale_date:int32 initial_sale_star_count:int53 initial_sale_price:int53 last_sale_date:int32 last_sale_price:int53 is_last_sale_on_fragment:Bool minimum_price:int53 average_sale_price:int53 telegram_listed_gift_count:int32 fragment_listed_gift_count:int32 fragment_url:string = UpgradedGiftValueInfo; //@description Contains result of gift upgrading //@gift The upgraded gift @@ -1246,15 +1306,15 @@ upgradedGift id:int64 publisher_chat_id:int53 title:string name:string number:in //@is_saved True, if the gift is displayed on the user's or the channel's profile page //@can_be_transferred True, if the gift can be transferred to another owner //@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift -//@next_transfer_date Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible -//@next_resale_date Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift -//@export_date Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT +//@next_transfer_date Point in time (Unix timestamp) when the gift can be transferred to another owner; can be in the past; 0 if the gift can be transferred immediately or transfer isn't possible +//@next_resale_date Point in time (Unix timestamp) when the gift can be resold to another user; can be in the past; 0 if the gift can't be resold; only for the receiver of the gift +//@export_date Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT; can be in the past upgradeGiftResult gift:upgradedGift received_gift_id:string is_saved:Bool can_be_transferred:Bool transfer_star_count:int53 next_transfer_date:int32 next_resale_date:int32 export_date:int32 = UpgradeGiftResult; //@description Describes a gift that is available for purchase //@gift The gift //@resale_count Number of gifts that are available for resale -//@min_resale_star_count The minimum price for the gifts available for resale; 0 if there are no such gifts +//@min_resale_star_count The minimum price for the gifts available for resale in Telegram Star equivalent; 0 if there are no such gifts //@title The title of the upgraded gift; empty if the gift isn't available for resale availableGift gift:gift resale_count:int32 min_resale_star_count:int53 title:string = AvailableGift; @@ -1311,6 +1371,15 @@ giftForResale gift:upgradedGift received_gift_id:string = GiftForResale; giftsForResale total_count:int32 gifts:vector models:vector symbols:vector backdrops:vector next_offset:string = GiftsForResale; +//@class GiftResaleResult @description Describes result of sending a resold gift + +//@description Operation was successfully completed +giftResaleResultOk = GiftResaleResult; + +//@description Operation has failed, because price has increased. If the price has decreased, then the buying will succeed anyway @price New price for the gift +giftResaleResultPriceIncreased price:GiftResalePrice = GiftResaleResult; + + //@class SentGift @description Represents content of a gift received by a user or a channel chat //@description Regular gift @gift The gift @@ -1332,13 +1401,15 @@ sentGiftUpgraded gift:upgradedGift = SentGift; //@was_refunded True, if the gift was refunded and isn't available anymore //@date Point in time (Unix timestamp) when the gift was sent //@gift The gift +//@collection_ids Identifiers of collections to which the gift is added; only for the receiver of the gift //@sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the regular gift; 0 if the gift can't be sold by the current user //@prepaid_upgrade_star_count Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift //@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift -//@next_transfer_date Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift -//@next_resale_date Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift -//@export_date Point in time (Unix timestamp) when the upgraded gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift -receivedGift received_gift_id:string sender_id:MessageSender text:formattedText is_private:Bool is_saved:Bool is_pinned:Bool can_be_upgraded:Bool can_be_transferred:Bool was_refunded:Bool date:int32 gift:SentGift sell_star_count:int53 prepaid_upgrade_star_count:int53 transfer_star_count:int53 next_transfer_date:int32 next_resale_date:int32 export_date:int32 = ReceivedGift; +//@next_transfer_date Point in time (Unix timestamp) when the gift can be transferred to another owner; can be in the past; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift +//@next_resale_date Point in time (Unix timestamp) when the gift can be resold to another user; can be in the past; 0 if the gift can't be resold; only for the receiver of the gift +//@export_date Point in time (Unix timestamp) when the upgraded gift can be transferred to the TON blockchain as an NFT; can be in the past; 0 if NFT export isn't possible; only for the receiver of the gift +//@prepaid_upgrade_hash If non-empty, then the user can pay for an upgrade of the gift using buyGiftUpgrade +receivedGift received_gift_id:string sender_id:MessageSender text:formattedText is_private:Bool is_saved:Bool is_pinned:Bool can_be_upgraded:Bool can_be_transferred:Bool was_refunded:Bool date:int32 gift:SentGift collection_ids:vector sell_star_count:int53 prepaid_upgrade_star_count:int53 transfer_star_count:int53 next_transfer_date:int32 next_resale_date:int32 export_date:int32 prepaid_upgrade_hash:string = ReceivedGift; //@description Represents a list of gifts received by a user or a chat //@total_count The total number of received gifts @@ -1469,14 +1540,18 @@ starTransactionTypeGiftSale user_id:int53 gift:gift = StarTransactionType; //@description The transaction is an upgrade of a gift; for regular users only @user_id Identifier of the user that initially sent the gift @gift The upgraded gift starTransactionTypeGiftUpgrade user_id:int53 gift:upgradedGift = StarTransactionType; +//@description The transaction is a purchase of an upgrade of a gift owned by another user or channel; for regular users only @owner_id Owner of the upgraded gift @gift The gift +starTransactionTypeGiftUpgradePurchase owner_id:MessageSender gift:gift = StarTransactionType; + //@description The transaction is a purchase of an upgraded gift for some user or channel; for regular users only @user_id Identifier of the user that sold the gift @gift The gift starTransactionTypeUpgradedGiftPurchase user_id:int53 gift:upgradedGift = StarTransactionType; //@description The transaction is a sale of an upgraded gift; for regular users only //@user_id Identifier of the user that bought the gift //@gift The gift -//@affiliate Information about commission received by Telegram from the transaction -starTransactionTypeUpgradedGiftSale user_id:int53 gift:upgradedGift affiliate:affiliateInfo = StarTransactionType; +//@commission_per_mille The number of Telegram Stars received by the Telegram for each 1000 Telegram Stars received by the seller of the gift +//@commission_star_amount The amount of Telegram Stars that were received by Telegram; can be negative for refunds +starTransactionTypeUpgradedGiftSale user_id:int53 gift:upgradedGift commission_per_mille:int32 commission_star_amount:starAmount = StarTransactionType; //@description The transaction is a sending of a paid reaction to a message in a channel chat by the current user; for regular users only //@chat_id Identifier of the channel chat @@ -1523,6 +1598,9 @@ starTransactionTypeBusinessBotTransferSend user_id:int53 = StarTransactionType; //@description The transaction is a transfer of Telegram Stars from a business account; for bots only @user_id Identifier of the user that sent Telegram Stars starTransactionTypeBusinessBotTransferReceive user_id:int53 = StarTransactionType; +//@description The transaction is a payment for search of posts in public Telegram channels; for regular users only +starTransactionTypePublicPostSearch = StarTransactionType; + //@description The transaction is a transaction of an unsupported type starTransactionTypeUnsupported = StarTransactionType; @@ -1552,6 +1630,16 @@ tonTransactionTypeFragmentDeposit is_gift:Bool sticker:sticker = TonTransactionT //@description The transaction is a payment for a suggested post @chat_id Identifier of the channel chat that posted the post tonTransactionTypeSuggestedPostPayment chat_id:int53 = TonTransactionType; +//@description The transaction is a purchase of an upgraded gift for some user or channel; for regular users only @user_id Identifier of the user that sold the gift @gift The gift +tonTransactionTypeUpgradedGiftPurchase user_id:int53 gift:upgradedGift = TonTransactionType; + +//@description The transaction is a sale of an upgraded gift; for regular users only +//@user_id Identifier of the user that bought the gift +//@gift The gift +//@commission_per_mille The number of Toncoins received by the Telegram for each 1000 Toncoins received by the seller of the gift +//@commission_toncoin_amount The amount of Toncoins that were received by the Telegram; in the smallest units of the currency +tonTransactionTypeUpgradedGiftSale user_id:int53 gift:upgradedGift commission_per_mille:int32 commission_toncoin_amount:int53 = TonTransactionType; + //@description The transaction is a transaction of an unsupported type tonTransactionTypeUnsupported = TonTransactionType; @@ -1642,6 +1730,24 @@ profileAccentColors palette_colors:vector background_colors:vector profileAccentColor id:int32 light_theme_colors:profileAccentColors dark_theme_colors:profileAccentColors min_supergroup_chat_boost_level:int32 min_channel_chat_boost_level:int32 = ProfileAccentColor; +//@description Contains description of user rating +//@level The level of the user; may be negative +//@is_maximum_level_reached True, if the maximum level is reached +//@rating Numerical value of the rating +//@current_level_rating The rating required for the current level +//@next_level_rating The rating required for the next level; 0 if the maximum level is reached +userRating level:int32 is_maximum_level_reached:Bool rating:int53 current_level_rating:int53 next_level_rating:int53 = UserRating; + +//@description Contains information about restrictions that must be applied to a chat or a message +//@restriction_reason A human-readable description of the reason why access to the content must be restricted. If empty, then the content can be accessed, +//-but may be covered by hidden with 18+ spoiler anyway +//@has_sensitive_content True, if media content of the messages must be hidden with 18+ spoiler. +//-Use value of the option "can_ignore_sensitive_content_restrictions" to check whether the current user can ignore the restriction. +//-If age verification parameters were received in updateAgeVerificationParameters, then the user must complete age verification to ignore the restriction. +//-Set the option "ignore_sensitive_content_restrictions" to true if the user passes age verification +restrictionInfo restriction_reason:string has_sensitive_content:Bool = RestrictionInfo; + + //@class EmojiStatusType @description Describes type of emoji status //@description A custom emoji set as emoji status @custom_emoji_id Identifier of the custom emoji in stickerFormatTgs format @@ -1696,7 +1802,7 @@ usernames active_usernames:vector disabled_usernames:vector edit //@verification_status Information about verification status of the user; may be null if none //@is_premium True, if the user is a Telegram Premium user //@is_support True, if the user is Telegram support account -//@restriction_reason If non-empty, it contains a human-readable description of the reason why access to this user must be restricted +//@restriction_info Information about restrictions that must be applied to the corresponding private chat; may be null if none //@has_active_stories True, if the user has non-expired stories available to the current user //@has_unread_active_stories True, if the user has unread non-expired stories available to the current user //@restricts_new_chats True, if the user may restrict new chats with non-contacts. Use canSendMessageToUser to check whether the current user can message the user or try to create a chat with them @@ -1705,7 +1811,7 @@ usernames active_usernames:vector disabled_usernames:vector edit //@type Type of the user //@language_code IETF language tag of the user's language; only available to bots //@added_to_attachment_menu True, if the user added the current bot to attachment menu; only available to bots -user id:int53 access_hash:int64 first_name:string last_name:string usernames:usernames phone_number:string status:UserStatus profile_photo:profilePhoto accent_color_id:int32 background_custom_emoji_id:int64 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 emoji_status:emojiStatus is_contact:Bool is_mutual_contact:Bool is_close_friend:Bool verification_status:verificationStatus is_premium:Bool is_support:Bool restriction_reason:string has_active_stories:Bool has_unread_active_stories:Bool restricts_new_chats:Bool paid_message_star_count:int53 have_access:Bool type:UserType language_code:string added_to_attachment_menu:Bool = User; +user id:int53 access_hash:int64 first_name:string last_name:string usernames:usernames phone_number:string status:UserStatus profile_photo:profilePhoto accent_color_id:int32 background_custom_emoji_id:int64 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 emoji_status:emojiStatus is_contact:Bool is_mutual_contact:Bool is_close_friend:Bool verification_status:verificationStatus is_premium:Bool is_support:Bool restriction_info:restrictionInfo has_active_stories:Bool has_unread_active_stories:Bool restricts_new_chats:Bool paid_message_star_count:int53 have_access:Bool type:UserType language_code:string added_to_attachment_menu:Bool = User; //@description Contains information about a bot @@ -1759,9 +1865,12 @@ botInfo short_description:string description:string photo:photo animation:animat //@outgoing_paid_message_star_count Number of Telegram Stars that must be paid by the current user for each sent message to the user //@gift_settings Settings for gift receiving for the user //@bot_verification Information about verification status of the user provided by a bot; may be null if none or unknown +//@rating The current rating of the user; may be null if none +//@pending_rating The rating of the user after the next change; may be null if the user isn't the current user or there are no pending rating changes +//@pending_rating_date Unix timestamp when rating of the user will change to pending_rating; 0 if the user isn't the current user or there are no pending rating changes //@business_info Information about business settings for Telegram Business accounts; may be null if none //@bot_info For bots, information about the bot; may be null if the user isn't a bot -userFullInfo personal_photo:chatPhoto photo:chatPhoto public_photo:chatPhoto block_list:BlockList can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool has_private_forwards:Bool has_restricted_voice_and_video_note_messages:Bool has_posted_to_profile_stories:Bool has_sponsored_messages_enabled:Bool need_phone_number_privacy_exception:Bool set_chat_background:Bool bio:formattedText birthdate:birthdate personal_chat_id:int53 gift_count:int32 group_in_common_count:int32 incoming_paid_message_star_count:int53 outgoing_paid_message_star_count:int53 gift_settings:giftSettings bot_verification:botVerification business_info:businessInfo bot_info:botInfo = UserFullInfo; +userFullInfo personal_photo:chatPhoto photo:chatPhoto public_photo:chatPhoto block_list:BlockList can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool has_private_forwards:Bool has_restricted_voice_and_video_note_messages:Bool has_posted_to_profile_stories:Bool has_sponsored_messages_enabled:Bool need_phone_number_privacy_exception:Bool set_chat_background:Bool bio:formattedText birthdate:birthdate personal_chat_id:int53 gift_count:int32 group_in_common_count:int32 incoming_paid_message_star_count:int53 outgoing_paid_message_star_count:int53 gift_settings:giftSettings bot_verification:botVerification rating:userRating pending_rating:userRating pending_rating_date:int32 business_info:businessInfo bot_info:botInfo = UserFullInfo; //@description Represents a list of users @total_count Approximate total number of users found @user_ids A list of user identifiers users total_count:int32 user_ids:vector = Users; @@ -2006,12 +2115,11 @@ basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int53 memb //@verification_status Information about verification status of the supergroup or channel; may be null if none //@has_direct_messages_group True, if the channel has direct messages group //@has_forum_tabs True, if the supergroup is a forum, which topics are shown in the same way as in channel direct messages groups -//@has_sensitive_content True, if content of media messages in the supergroup or channel chat must be hidden with 18+ spoiler -//@restriction_reason If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted +//@restriction_info Information about the restrictions that must be applied to the corresponding supergroup or channel chat; may be null if none //@paid_message_star_count Number of Telegram Stars that must be paid by non-administrator users of the supergroup chat for each sent message //@has_active_stories True, if the supergroup or channel has non-expired stories available to the current user //@has_unread_active_stories True, if the supergroup or channel has unread non-expired stories available to the current user -supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 boost_level:int32 has_automatic_translation:Bool has_linked_chat:Bool has_location:Bool sign_messages:Bool show_message_sender:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool is_direct_messages_group:Bool is_administered_direct_messages_group:Bool verification_status:verificationStatus has_direct_messages_group:Bool has_forum_tabs:Bool has_sensitive_content:Bool restriction_reason:string paid_message_star_count:int53 has_active_stories:Bool has_unread_active_stories:Bool = Supergroup; +supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 boost_level:int32 has_automatic_translation:Bool has_linked_chat:Bool has_location:Bool sign_messages:Bool show_message_sender:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool is_direct_messages_group:Bool is_administered_direct_messages_group:Bool verification_status:verificationStatus has_direct_messages_group:Bool has_forum_tabs:Bool restriction_info:restrictionInfo paid_message_star_count:int53 has_active_stories:Bool has_unread_active_stories:Bool = Supergroup; //@description Contains full information about a supergroup or channel //@photo Chat photo; may be null if empty or unknown. If non-null, then it is the same photo as in chat.photo @@ -2081,6 +2189,15 @@ secretChatStateClosed = SecretChatState; secretChat id:int32 user_id:int53 state:SecretChatState is_outbound:Bool key_hash:bytes layer:int32 = SecretChat; +//@description Contains information about public post search limits +//@daily_free_query_count Number of queries that can be sent daily for free +//@remaining_free_query_count Number of remaining free queries today +//@next_free_query_in Amount of time till the next free query can be sent; 0 if it can be sent now +//@star_count Number of Telegram Stars that must be paid for each non-free query +//@is_current_query_free True, if the search for the specified query isn't charged +publicPostSearchLimits daily_free_query_count:int32 remaining_free_query_count:int32 next_free_query_in:int32 star_count:int64 is_current_query_free:Bool = PublicPostSearchLimits; + + //@class MessageSender @description Contains information about the sender of a message //@description The message was sent by a known user @user_id Identifier of the user that sent the message @@ -2377,11 +2494,10 @@ factCheck text:formattedText country_code:string = FactCheck; //@author_signature For channel posts and anonymous group messages, optional author signature //@media_album_id Unique identifier of an album this message belongs to; 0 if none. Only audios, documents, photos and videos can be grouped together in albums //@effect_id Unique identifier of the effect added to the message; 0 if none -//@has_sensitive_content True, if media content of the message must be hidden with 18+ spoiler -//@restriction_reason If non-empty, contains a human-readable description of the reason why access to this message must be restricted +//@restriction_info Information about the restrictions that must be applied to the message content; may be null if none //@content Content of the message //@reply_markup Reply markup for the message; may be null if none -message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool is_from_offline:Bool can_be_saved:Bool has_timestamped_media:Bool is_channel_post:Bool is_paid_star_suggested_post:Bool is_paid_ton_suggested_post:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector fact_check:factCheck suggested_post_info:suggestedPostInfo reply_to:MessageReplyTo message_thread_id:int53 topic_id:MessageTopic self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 sender_business_bot_user_id:int53 sender_boost_count:int32 paid_message_star_count:int53 author_signature:string media_album_id:int64 effect_id:int64 has_sensitive_content:Bool restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; +message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool is_from_offline:Bool can_be_saved:Bool has_timestamped_media:Bool is_channel_post:Bool is_paid_star_suggested_post:Bool is_paid_ton_suggested_post:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector fact_check:factCheck suggested_post_info:suggestedPostInfo reply_to:MessageReplyTo message_thread_id:int53 topic_id:MessageTopic self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 sender_business_bot_user_id:int53 sender_boost_count:int32 paid_message_star_count:int53 author_signature:string media_album_id:int64 effect_id:int64 restriction_info:restrictionInfo content:MessageContent reply_markup:ReplyMarkup = Message; //@description Contains a list of messages @total_count Approximate total number of messages found @messages List of messages; messages may be null @@ -2393,6 +2509,13 @@ foundMessages total_count:int32 messages:vector next_offset:string = Fo //@description Contains a list of messages found by a search in a given chat @total_count Approximate total number of messages found; -1 if unknown @messages List of messages @next_from_message_id The offset for the next request. If 0, there are no more results foundChatMessages total_count:int32 messages:vector next_from_message_id:int53 = FoundChatMessages; +//@description Contains a list of messages found by a public post search +//@messages List of found public posts +//@next_offset The offset for the next request. If empty, then there are no more results +//@search_limits Updated public post search limits after the query; repeated requests with the same query will be free; may be null if they didn't change +//@are_limits_exceeded True, if the query has failed because search limits are exceeded. In this case search_limits.daily_free_query_count will be equal to 0 +foundPublicPosts messages:vector next_offset:string search_limits:publicPostSearchLimits are_limits_exceeded:Bool = FoundPublicPosts; + //@description Contains information about a message in a specific position @position 0-based message position in the full list of suitable messages @message_id Message identifier @date Point in time (Unix timestamp) when the message was sent messagePosition position:int32 message_id:int53 date:int32 = MessagePosition; @@ -3465,6 +3588,10 @@ linkPreviewTypeChannelBoost photo:chatPhoto = LinkPreviewType; //@creates_join_request True, if the link only creates join request linkPreviewTypeChat type:InviteLinkChatType photo:chatPhoto creates_join_request:Bool = LinkPreviewType; +//@description The link is a link to a direct messages chat of a channel +//@photo Photo of the channel chat; may be null +linkPreviewTypeDirectMessagesChat photo:chatPhoto = LinkPreviewType; + //@description The link is a link to a general file @document The document description linkPreviewTypeDocument document:document = LinkPreviewType; @@ -3506,6 +3633,9 @@ linkPreviewTypeExternalAudio url:string mime_type:string duration:int32 = LinkPr //@duration Duration of the video, in seconds; 0 if unknown linkPreviewTypeExternalVideo url:string mime_type:string width:int32 height:int32 duration:int32 = LinkPreviewType; +//@description The link is a link to a gift collection @icons Icons for some gifts from the collection; may be empty +linkPreviewTypeGiftCollection icons:vector = LinkPreviewType; + //@description The link is a link to a group call that isn't bound to a chat linkPreviewTypeGroupCall = LinkPreviewType; @@ -3533,6 +3663,11 @@ linkPreviewTypeStickerSet stickers:vector = LinkPreviewType; //@description The link is a link to a story. Link preview description is unavailable @story_poster_chat_id The identifier of the chat that posted the story @story_id Story identifier linkPreviewTypeStory story_poster_chat_id:int53 story_id:int32 = LinkPreviewType; +//@description The link is a link to an album of stories +//@photo_icon Icon of the album; may be null if none +//@video_icon Video icon of the album; may be null if none +linkPreviewTypeStoryAlbum photo_icon:photo video_icon:video = LinkPreviewType; + //@description The link is a link to boost a supergroup chat @photo Photo of the chat; may be null linkPreviewTypeSupergroupBoost photo:chatPhoto = LinkPreviewType; @@ -4457,7 +4592,7 @@ messageGiveawayPrizeStars star_count:int53 transaction_id:string boosted_chat_id //@description A regular gift was received or sent by the current user, or the current user was notified about a channel gift //@gift The gift -//@sender_id Sender of the gift +//@sender_id Sender of the gift; may be null for outgoing messages about prepaid upgrade of gifts from unknown users //@receiver_id Receiver of the gift //@received_gift_id Unique identifier of the received gift for the current user; only for the receiver of the gift //@text Message added to the gift @@ -4465,12 +4600,14 @@ messageGiveawayPrizeStars star_count:int53 transaction_id:string boosted_chat_id //@prepaid_upgrade_star_count Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift //@is_private True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone will be able to see them //@is_saved True, if the gift is displayed on the user's or the channel's profile page; only for the receiver of the gift +//@is_prepaid_upgrade True, if the message is about prepaid upgrade of the gift by another user //@can_be_upgraded True, if the gift can be upgraded to a unique gift; only for the receiver of the gift //@was_converted True, if the gift was converted to Telegram Stars; only for the receiver of the gift //@was_upgraded True, if the gift was upgraded to a unique gift //@was_refunded True, if the gift was refunded and isn't available anymore //@upgraded_received_gift_id Identifier of the corresponding upgraded gift; may be empty if unknown. Use getReceivedGift to get information about the gift -messageGift gift:gift sender_id:MessageSender receiver_id:MessageSender received_gift_id:string text:formattedText sell_star_count:int53 prepaid_upgrade_star_count:int53 is_private:Bool is_saved:Bool can_be_upgraded:Bool was_converted:Bool was_upgraded:Bool was_refunded:Bool upgraded_received_gift_id:string = MessageContent; +//@prepaid_upgrade_hash If non-empty, then the user can pay for an upgrade of the gift using buyGiftUpgrade +messageGift gift:gift sender_id:MessageSender receiver_id:MessageSender received_gift_id:string text:formattedText sell_star_count:int53 prepaid_upgrade_star_count:int53 is_private:Bool is_saved:Bool is_prepaid_upgrade:Bool can_be_upgraded:Bool was_converted:Bool was_upgraded:Bool was_refunded:Bool upgraded_received_gift_id:string prepaid_upgrade_hash:string = MessageContent; //@description An upgraded gift was received or sent by the current user, or the current user was notified about a channel gift //@gift The gift @@ -4482,9 +4619,9 @@ messageGift gift:gift sender_id:MessageSender receiver_id:MessageSender received //@can_be_transferred True, if the gift can be transferred to another owner; only for the receiver of the gift //@was_transferred True, if the gift has already been transferred to another owner; only for the receiver of the gift //@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift -//@next_transfer_date Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift -//@next_resale_date Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift -//@export_date Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift +//@next_transfer_date Point in time (Unix timestamp) when the gift can be transferred to another owner; can be in the past; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift +//@next_resale_date Point in time (Unix timestamp) when the gift can be resold to another user; can be in the past; 0 if the gift can't be resold; only for the receiver of the gift +//@export_date Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT; can be in the past; 0 if NFT export isn't possible; only for the receiver of the gift messageUpgradedGift gift:upgradedGift sender_id:MessageSender receiver_id:MessageSender origin:UpgradedGiftOrigin received_gift_id:string is_saved:Bool can_be_transferred:Bool was_transferred:Bool transfer_star_count:int53 next_transfer_date:int32 next_resale_date:int32 export_date:int32 = MessageContent; //@description A gift which purchase, upgrade or transfer were refunded @@ -5336,6 +5473,7 @@ storyInteractionInfo view_count:int32 forward_count:int32 reaction_count:int32 r //@is_edited True, if the story was edited //@is_posted_to_chat_page True, if the story is saved in the profile of the chat that posted it and will be available there after expiration //@is_visible_only_for_self True, if the story is visible only for the current user +//@can_be_added_to_album True, if the story can be added to an album //@can_be_deleted True, if the story can be deleted //@can_be_edited True, if the story can be edited //@can_be_forwarded True, if the story can be forwarded as a message. Otherwise, screenshots and saving of the story content must be also forbidden @@ -5351,7 +5489,8 @@ storyInteractionInfo view_count:int32 forward_count:int32 reaction_count:int32 r //@content Content of the story //@areas Clickable areas to be shown on the story content //@caption Caption of the story -story id:int32 poster_chat_id:int53 poster_id:MessageSender date:int32 is_being_posted:Bool is_being_edited:Bool is_edited:Bool is_posted_to_chat_page:Bool is_visible_only_for_self:Bool can_be_deleted:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied:Bool can_toggle_is_posted_to_chat_page:Bool can_get_statistics:Bool can_get_interactions:Bool has_expired_viewers:Bool repost_info:storyRepostInfo interaction_info:storyInteractionInfo chosen_reaction_type:ReactionType privacy_settings:StoryPrivacySettings content:StoryContent areas:vector caption:formattedText = Story; +//@album_ids Identifiers of story albums to which the story is added; only for manageable stories +story id:int32 poster_chat_id:int53 poster_id:MessageSender date:int32 is_being_posted:Bool is_being_edited:Bool is_edited:Bool is_posted_to_chat_page:Bool is_visible_only_for_self:Bool can_be_added_to_album:Bool can_be_deleted:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied:Bool can_toggle_is_posted_to_chat_page:Bool can_get_statistics:Bool can_get_interactions:Bool has_expired_viewers:Bool repost_info:storyRepostInfo interaction_info:storyInteractionInfo chosen_reaction_type:ReactionType privacy_settings:StoryPrivacySettings content:StoryContent areas:vector caption:formattedText album_ids:vector = Story; //@description Represents a list of stories //@total_count Approximate total number of stories found @@ -5362,6 +5501,16 @@ stories total_count:int32 stories:vector pinned_story_ids:vector = //@description Contains a list of stories found by a search @total_count Approximate total number of stories found @stories List of stories @next_offset The offset for the next request. If empty, then there are no more results foundStories total_count:int32 stories:vector next_offset:string = FoundStories; +//@description Describes album of stories +//@id Unique identifier of the album +//@name Name of the album +//@photo_icon Icon of the album; may be null if none +//@video_icon Video icon of the album; may be null if none +storyAlbum id:int32 name:string photo_icon:photo video_icon:video = StoryAlbum; + +//@description Represents a list of story albums @albums List of story albums +storyAlbums albums:vector = StoryAlbums; + //@description Contains identifier of a story along with identifier of the chat that posted it //@poster_chat_id Identifier of the chat that posted the story //@story_id Unique story identifier among stories of the chat @@ -5377,9 +5526,11 @@ storyInfo story_id:int32 date:int32 is_for_close_friends:Bool = StoryInfo; //@chat_id Identifier of the chat that posted the stories //@list Identifier of the story list in which the stories are shown; may be null if the stories aren't shown in a story list //@order A parameter used to determine order of the stories in the story list; 0 if the stories doesn't need to be shown in the story list. Stories must be sorted by the pair (order, story_poster_chat_id) in descending order +//@can_be_archived True, if the stories are shown in the main story list and can be archived; otherwise, the stories can be hidden from the main story list +//-only by calling removeTopChat with topChatCategoryUsers and the chat_id. Stories of the current user can't be archived nor hidden using removeTopChat //@max_read_story_id Identifier of the last read active story //@stories Basic information about the stories; use getStory to get full information about the stories. The stories are in chronological order (i.e., in order of increasing story identifiers) -chatActiveStories chat_id:int53 list:StoryList order:int53 max_read_story_id:int32 stories:vector = ChatActiveStories; +chatActiveStories chat_id:int53 list:StoryList order:int53 can_be_archived:Bool max_read_story_id:int32 stories:vector = ChatActiveStories; //@class StoryInteractionType @description Describes type of interaction with a story @@ -7759,6 +7910,11 @@ internalLinkTypeChatInvite invite_link:string = InternalLinkType; //@description The link is a link to the default message auto-delete timer settings section of the application settings internalLinkTypeDefaultMessageAutoDeleteTimerSettings = InternalLinkType; +//@description The link is a link to a channel direct messages chat by username of the channel. Call searchPublicChat with the given chat username to process the link. +//-If the chat is found and is channel, open the direct messages chat of the channel +//@channel_username Username of the channel +internalLinkTypeDirectMessagesChat channel_username:string = InternalLinkType; + //@description The link is a link to the edit profile section of the application settings internalLinkTypeEditProfileSettings = InternalLinkType; @@ -7768,6 +7924,12 @@ internalLinkTypeEditProfileSettings = InternalLinkType; //@game_short_name Short name of the game internalLinkTypeGame bot_username:string game_short_name:string = InternalLinkType; +//@description The link is a link to a gift collection. Call searchPublicChat with the given username, then call getReceivedGifts with the received gift owner identifier +//-and the given collection identifier, then show the collection if received +//@gift_owner_username Username of the owner of the gift collection +//@collection_id Gift collection identifier +internalLinkTypeGiftCollection gift_owner_username:string collection_id:int32 = InternalLinkType; + //@description The link is a link to a group call that isn't bound to a chat. Use getGroupCallParticipants to get the list of group call participants and show them on the join group call screen. //-Call joinGroupCall with the given invite_link to join the call //@invite_link Internal representation of the invite link @@ -7882,6 +8044,12 @@ internalLinkTypeStickerSet sticker_set_name:string expect_custom_emoji:Bool = In //@story_id Story identifier internalLinkTypeStory story_poster_username:string story_id:int32 = InternalLinkType; +//@description The link is a link to an album of stories. Call searchPublicChat with the given username, then call getStoryAlbumStories with the received chat identifier +//-and the given story album identifier, then show the story album if received +//@story_album_owner_username Username of the owner of the story album +//@story_album_id Story album identifier +internalLinkTypeStoryAlbum story_album_owner_username:string story_album_id:int32 = InternalLinkType; + //@description The link is a link to a cloud theme. TDLib has no theme support yet @theme_name Name of the theme internalLinkTypeTheme theme_name:string = InternalLinkType; @@ -8171,6 +8339,13 @@ connectionStateUpdating = ConnectionState; connectionStateReady = ConnectionState; +//@description Describes parameters for age verification of the current user +//@min_age The minimum age required to view restricted content +//@verification_bot_username Username of the bot which main Web App may be used to verify age of the user +//@country Unique name for the country or region, which legislation required age verification. May be used to get the corresponding localization key +ageVerificationParameters min_age:int32 verification_bot_username:string country:string = AgeVerificationParameters; + + //@class TopChatCategory @description Represents the categories of chats for which a list of frequently used chats can be retrieved //@description A category containing frequently used private chats with non-bot users @@ -8810,7 +8985,7 @@ updateDirectMessagesChatTopic topic:directMessagesChatTopic = Update; //@description Number of messages in a topic has changed; for Saved Messages and channel direct messages chat topics only //@chat_id Identifier of the chat in topic of which the number of messages has changed //@topic_id Identifier of the topic -//@message_count Approximate number of messages in the topics +//@message_count Approximate number of messages in the topic updateTopicMessageCount chat_id:int53 topic_id:MessageTopic message_count:int32 = Update; //@description Basic information about a quick reply shortcut has changed. This update is guaranteed to come before the quick shortcut name is returned to the application @@ -9087,6 +9262,10 @@ updateConnectionState state:ConnectionState = Update; //@appeal_link The link to open to send an appeal to unfreeze the account updateFreezeState is_frozen:Bool freezing_date:int32 deletion_date:int32 appeal_link:string = Update; +//@description The parameters for age verification of the current user's account has changed +//@parameters Parameters for the age verification; may be null if age verification isn't needed +updateAgeVerificationParameters parameters:ageVerificationParameters = Update; + //@description New terms of service must be accepted by the user. If the terms of service are declined, then the deleteAccount method must be called with the reason "Decline ToS update" @terms_of_service_id Identifier of the terms of service @terms_of_service The new terms of service updateTermsOfService terms_of_service_id:string terms_of_service:termsOfService = Update; @@ -9923,6 +10102,16 @@ searchCallMessages offset:string limit:int32 only_missed:Bool = FoundMessages; //@limit The maximum number of messages to be returned; up to 100 searchOutgoingDocumentMessages query:string limit:int32 = FoundMessages; +//@description Checks public post search limits without actually performing the search @query Query that will be searched for +getPublicPostSearchLimits query:string = PublicPostSearchLimits; + +//@description Searches for public channel posts using the given query. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit +//@query Query to search for +//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results +//@limit The maximum number of messages to be returned; up to 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit +//@star_count The amount of Telegram Stars the user agreed to pay for the search; pass 0 for free searches +searchPublicPosts query:string offset:string limit:int32 star_count:int53 = FoundPublicPosts; + //@description Searches for public channel posts containing the given hashtag or cashtag. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit //@tag Hashtag or cashtag to search for //@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results @@ -11362,11 +11551,12 @@ canPostStory chat_id:int53 = CanPostStoryResult; //@areas Clickable rectangle areas to be shown on the story media; pass null if none //@caption Story caption; pass null to use an empty caption; 0-getOption("story_caption_length_max") characters; can have entities only if getOption("can_use_text_entities_in_story_caption") //@privacy_settings The privacy settings for the story; ignored for stories posted on behalf of supergroup and channel chats +//@album_ids Identifiers of story albums to which the story will be added upon posting. An album can have up to getOption("story_album_story_count_max") //@active_period Period after which the story is moved to archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400 for Telegram Premium users, and 86400 otherwise //@from_story_full_id Full identifier of the original story, which content was used to create the story; pass null if the story isn't repost of another story //@is_posted_to_chat_page Pass true to keep the story accessible after expiration //@protect_content Pass true if the content of the story must be protected from forwarding and screenshotting -postStory chat_id:int53 content:InputStoryContent areas:inputStoryAreas caption:formattedText privacy_settings:StoryPrivacySettings active_period:int32 from_story_full_id:storyFullId is_posted_to_chat_page:Bool protect_content:Bool = Story; +postStory chat_id:int53 content:InputStoryContent areas:inputStoryAreas caption:formattedText privacy_settings:StoryPrivacySettings album_ids:vector active_period:int32 from_story_full_id:storyFullId is_posted_to_chat_page:Bool protect_content:Bool = Story; //@description Changes content and caption of a story. Can be called only if story.can_be_edited == true //@story_poster_chat_id Identifier of the chat that posted the story @@ -11491,6 +11681,60 @@ activateStoryStealthMode = Ok; //@limit The maximum number of messages and stories to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned objects is chosen by TDLib and can be smaller than the specified limit getStoryPublicForwards story_poster_chat_id:int53 story_id:int32 offset:string limit:int32 = PublicForwards; +//@description Returns the list of story albums owned by the given chat @chat_id Chat identifier +getChatStoryAlbums chat_id:int53 = StoryAlbums; + +//@description Returns the list of stories added to the given story album. For optimal performance, the number of returned stories is chosen by TDLib +//@chat_id Chat identifier +//@story_album_id Story album identifier +//@offset Offset of the first entry to return; use 0 to get results from the first album story +//@limit The maximum number of stories to be returned. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit +getStoryAlbumStories chat_id:int53 story_album_id:int32 offset:int32 limit:int32 = Stories; + +//@description Creates an album of stories; requires can_edit_stories administrator right for supergroup and channel chats +//@story_poster_chat_id Identifier of the chat that posted the stories +//@name Name of the album; 1-12 characters +//@story_ids Identifiers of stories to add to the album; 0-getOption("story_album_story_count_max") identifiers +createStoryAlbum story_poster_chat_id:int53 name:string story_ids:vector = StoryAlbum; + +//@description Changes order of story albums. If the albums are owned by a supergroup or a channel chat, then requires can_edit_stories administrator right in the chat +//@chat_id Identifier of the chat that owns the stories +//@story_album_ids New order of story albums +reorderStoryAlbums chat_id:int53 story_album_ids:vector = Ok; + +//@description Deletes a story album. If the album is owned by a supergroup or a channel chat, then requires can_edit_stories administrator right in the chat +//@chat_id Identifier of the chat that owns the stories +//@story_album_id Identifier of the story album +deleteStoryAlbum chat_id:int53 story_album_id:int32 = Ok; + +//@description Changes name of an album of stories. If the album is owned by a supergroup or a channel chat, then requires can_edit_stories administrator right in the chat. Returns the changed album +//@chat_id Identifier of the chat that owns the stories +//@story_album_id Identifier of the story album +//@name New name of the album; 1-12 characters +setStoryAlbumName chat_id:int53 story_album_id:int32 name:string = StoryAlbum; + +//@description Adds stories to the beginning of a previously created story album. If the album is owned by a supergroup or a channel chat, then +//-requires can_edit_stories administrator right in the chat. Returns the changed album +//@chat_id Identifier of the chat that owns the stories +//@story_album_id Identifier of the story album +//@story_ids Identifier of the stories to add to the album; 1-getOption("story_album_story_count_max") identifiers. +//-If after addition the album has more than getOption("story_album_story_count_max") stories, then the last one are removed from the album +addStoryAlbumStories chat_id:int53 story_album_id:int32 story_ids:vector = StoryAlbum; + +//@description Removes stories from an album. If the album is owned by a supergroup or a channel chat, then +//-requires can_edit_stories administrator right in the chat. Returns the changed album +//@chat_id Identifier of the chat that owns the stories +//@story_album_id Identifier of the story album +//@story_ids Identifier of the stories to remove from the album +removeStoryAlbumStories chat_id:int53 story_album_id:int32 story_ids:vector = StoryAlbum; + +//@description Changes order of stories in an album. If the album is owned by a supergroup or a channel chat, then +//-requires can_edit_stories administrator right in the chat. Returns the changed album +//@chat_id Identifier of the chat that owns the stories +//@story_album_id Identifier of the story album +//@story_ids Identifier of the stories to move to the beginning of the album. All other stories are placed in the current order after the specified stories +reorderStoryAlbumStories chat_id:int53 story_album_id:int32 story_ids:vector = StoryAlbum; + //@description Returns the list of features available on the specific chat boost level. This is an offline method //@is_channel Pass true to get the list of features for channels; pass false to get the list of features for supergroups @@ -12728,7 +12972,7 @@ getAvailableGifts = AvailableGifts; //@description Sends a gift to another user or channel chat. May return an error with a message "STARGIFT_USAGE_LIMITED" if the gift was sold out //@gift_id Identifier of the gift to send -//@owner_id Identifier of the user or the channel chat that will receive the gift +//@owner_id Identifier of the user or the channel chat that will receive the gift; limited gifts can't be sent to channel chats //@text Text to show along with the gift; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed. //-Must be empty if the receiver enabled paid messages //@is_private Pass true to show gift text and sender only to the gift receiver; otherwise, everyone will be able to see them @@ -12765,7 +13009,13 @@ getGiftUpgradePreview gift_id:int64 = GiftUpgradePreview; //@star_count The amount of Telegram Stars required to pay for the upgrade. It the gift has prepaid_upgrade_star_count > 0, then pass 0, otherwise, pass gift.upgrade_star_count upgradeGift business_connection_id:string received_gift_id:string keep_original_details:Bool star_count:int53 = UpgradeGiftResult; -//@description Sends an upgraded gift to another user or a channel chat +//@description Pays for upgrade of a regular gift that is owned by another user or channel chat +//@owner_id Identifier of the user or the channel chat that owns the gift +//@prepaid_upgrade_hash Prepaid upgrade hash as received along with the gift +//@star_count The amount of Telegram Stars the user agreed to pay for the upgrade; must be equal to gift.upgrade_star_count +buyGiftUpgrade owner_id:MessageSender prepaid_upgrade_hash:string star_count:int53 = Ok; + +//@description Sends an upgraded gift to another user or channel chat //@business_connection_id Unique identifier of business connection on behalf of which to send the request; for bots only //@received_gift_id Identifier of the gift //@new_owner_id Identifier of the user or the channel chat that will receive the gift @@ -12776,21 +13026,23 @@ transferGift business_connection_id:string received_gift_id:string new_owner_id: //-must be transferred using transferGift and can't be passed to the method //@gift_name Name of the upgraded gift to send //@owner_id Identifier of the user or the channel chat that will receive the gift -//@star_count The amount of Telegram Stars required to pay for the gift -sendResoldGift gift_name:string owner_id:MessageSender star_count:int53 = Ok; +//@price The price that the user agreed to pay for the gift +sendResoldGift gift_name:string owner_id:MessageSender price:GiftResalePrice = GiftResaleResult; //@description Returns gifts received by the given user or chat //@business_connection_id Unique identifier of business connection on behalf of which to send the request; for bots only //@owner_id Identifier of the gift receiver +//@collection_id Pass collection identifier to get gifts only from the specified collection; pass 0 to get gifts regardless of collections //@exclude_unsaved Pass true to exclude gifts that aren't saved to the chat's profile page. Always true for gifts received by other users and channel chats without can_post_messages administrator right //@exclude_saved Pass true to exclude gifts that are saved to the chat's profile page. Always false for gifts received by other users and channel chats without can_post_messages administrator right //@exclude_unlimited Pass true to exclude gifts that can be purchased unlimited number of times -//@exclude_limited Pass true to exclude gifts that can be purchased limited number of times +//@exclude_upgradable Pass true to exclude gifts that can be purchased limited number of times and can be upgraded +//@exclude_non_upgradable Pass true to exclude gifts that can be purchased limited number of times and can't be upgraded //@exclude_upgraded Pass true to exclude upgraded gifts //@sort_by_price Pass true to sort results by gift price instead of send date //@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results //@limit The maximum number of gifts to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned objects is chosen by TDLib and can be smaller than the specified limit -getReceivedGifts business_connection_id:string owner_id:MessageSender exclude_unsaved:Bool exclude_saved:Bool exclude_unlimited:Bool exclude_limited:Bool exclude_upgraded:Bool sort_by_price:Bool offset:string limit:int32 = ReceivedGifts; +getReceivedGifts business_connection_id:string owner_id:MessageSender collection_id:int32 exclude_unsaved:Bool exclude_saved:Bool exclude_unlimited:Bool exclude_upgradable:Bool exclude_non_upgradable:Bool exclude_upgraded:Bool sort_by_price:Bool offset:string limit:int32 = ReceivedGifts; //@description Returns information about a received gift @received_gift_id Identifier of the gift getReceivedGift received_gift_id:string = ReceivedGift; @@ -12798,6 +13050,9 @@ getReceivedGift received_gift_id:string = ReceivedGift; //@description Returns information about an upgraded gift by its name @name Unique name of the upgraded gift getUpgradedGift name:string = UpgradedGift; +//@description Returns information about value of an upgraded gift by its name @name Unique name of the upgraded gift +getUpgradedGiftValueInfo name:string = UpgradedGiftValueInfo; + //@description Returns a URL for upgraded gift withdrawal in the TON blockchain as an NFT; requires owner privileges for gifts owned by a chat //@received_gift_id Identifier of the gift //@password The 2-step verification password of the current user @@ -12805,9 +13060,10 @@ getUpgradedGiftWithdrawalUrl received_gift_id:string password:string = HttpUrl; //@description Changes resale price of a unique gift owned by the current user //@received_gift_id Identifier of the unique gift -//@resale_star_count The new price for the unique gift; 0 or getOption("gift_resale_star_count_min")-getOption("gift_resale_star_count_max"). Pass 0 to disallow gift resale. -//-The current user will receive getOption("gift_resale_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for the gift -setGiftResalePrice received_gift_id:string resale_star_count:int53 = Ok; +//@price The new price for the unique gift; pass null to disallow gift resale. The current user will receive +//-getOption("gift_resale_star_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for the gift if the gift price is in Telegram Stars or +//-getOption("gift_resale_ton_earnings_per_mille") Toncoins for each 1000 Toncoins paid for the gift if the gift price is in Toncoins +setGiftResalePrice received_gift_id:string price:GiftResalePrice = Ok; //@description Returns upgraded gifts that can be bought from other owners using sendResoldGift //@gift_id Identifier of the regular gift that was upgraded to a unique gift @@ -12818,6 +13074,54 @@ setGiftResalePrice received_gift_id:string resale_star_count:int53 = Ok; //@limit The maximum number of gifts to return searchGiftsForResale gift_id:int64 order:GiftForResaleOrder attributes:vector offset:string limit:int32 = GiftsForResale; + +//@description Returns collections of gifts owned by the given user or chat +//@owner_id Identifier of the user or the channel chat that received the gifts +getGiftCollections owner_id:MessageSender = GiftCollections; + +//@description Creates a collection from gifts on the current user's or a channel's profile page; requires can_post_messages administrator right in the channel chat. +//-An owner can have up to getOption("gift_collection_count_max") gift collections. The new collection will be added to the end of the gift collection list of the owner. Returns the created collection +//@owner_id Identifier of the user or the channel chat that received the gifts +//@name Name of the collection; 1-12 characters +//@received_gift_ids Identifier of the gifts to add to the collection; 0-getOption("gift_collection_gift_count_max") identifiers +createGiftCollection owner_id:MessageSender name:string received_gift_ids:vector = GiftCollection; + +//@description Changes order of gift collections. If the collections are owned by a channel chat, then requires can_post_messages administrator right in the channel chat +//@owner_id Identifier of the user or the channel chat that owns the collection +//@collection_ids New order of gift collections +reorderGiftCollections owner_id:MessageSender collection_ids:vector = Ok; + +//@description Deletes a gift collection. If the collection is owned by a channel chat, then requires can_post_messages administrator right in the channel chat +//@owner_id Identifier of the user or the channel chat that owns the collection +//@collection_id Identifier of the gift collection +deleteGiftCollection owner_id:MessageSender collection_id:int32 = Ok; + +//@description Changes name of a gift collection. If the collection is owned by a channel chat, then requires can_post_messages administrator right in the channel chat. Returns the changed collection +//@owner_id Identifier of the user or the channel chat that owns the collection +//@collection_id Identifier of the gift collection +//@name New name of the collection; 1-12 characters +setGiftCollectionName owner_id:MessageSender collection_id:int32 name:string = GiftCollection; + +//@description Adds gifts to the beginning of a previously created collection. If the collection is owned by a channel chat, then requires can_post_messages administrator right in the channel chat. Returns the changed collection +//@owner_id Identifier of the user or the channel chat that owns the collection +//@collection_id Identifier of the gift collection +//@received_gift_ids Identifier of the gifts to add to the collection; 1-getOption("gift_collection_gift_count_max") identifiers. +//-If after addition the collection has more than getOption("gift_collection_gift_count_max") gifts, then the last one are removed from the collection +addGiftCollectionGifts owner_id:MessageSender collection_id:int32 received_gift_ids:vector = GiftCollection; + +//@description Removes gifts from a collection. If the collection is owned by a channel chat, then requires can_post_messages administrator right in the channel chat. Returns the changed collection +//@owner_id Identifier of the user or the channel chat that owns the collection +//@collection_id Identifier of the gift collection +//@received_gift_ids Identifier of the gifts to remove from the collection +removeGiftCollectionGifts owner_id:MessageSender collection_id:int32 received_gift_ids:vector = GiftCollection; + +//@description Changes order of gifts in a collection. If the collection is owned by a channel chat, then requires can_post_messages administrator right in the channel chat. Returns the changed collection +//@owner_id Identifier of the user or the channel chat that owns the collection +//@collection_id Identifier of the gift collection +//@received_gift_ids Identifier of the gifts to move to the beginning of the collection. All other gifts are placed in the current order after the specified gifts +reorderGiftCollectionGifts owner_id:MessageSender collection_id:int32 received_gift_ids:vector = GiftCollection; + + //@description Creates a link for the given invoice; for bots only //@business_connection_id Unique identifier of business connection on behalf of which to send the request //@invoice Information about the invoice of the type inputMessageInvoice From 926224f7076b1aa73b8c217c70894feb11094b92 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Sun, 28 Sep 2025 17:55:16 +0800 Subject: [PATCH 50/54] Update to TDLib 1.8.55 --- client/function.go | 1021 ++++++++++++++++++++- client/type.go | 2033 +++++++++++++++++++++++++++++++++++++++-- client/unmarshaler.go | 907 +++++++++++++++++- data/td_api.tl | 250 ++++- 4 files changed, 4055 insertions(+), 156 deletions(-) diff --git a/client/function.go b/client/function.go index 63ba51e..46bce98 100755 --- a/client/function.go +++ b/client/function.go @@ -3435,6 +3435,67 @@ func (client *Client) SearchOutgoingDocumentMessages(req *SearchOutgoingDocument return UnmarshalFoundMessages(result.Data) } +type GetPublicPostSearchLimitsRequest struct { + // Query that will be searched for + Query string `json:"query"` +} + +// Checks public post search limits without actually performing the search +func (client *Client) GetPublicPostSearchLimits(req *GetPublicPostSearchLimitsRequest) (*PublicPostSearchLimits, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getPublicPostSearchLimits", + }, + Data: map[string]interface{}{ + "query": req.Query, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPublicPostSearchLimits(result.Data) +} + +type SearchPublicPostsRequest struct { + // Query to search for + Query string `json:"query"` + // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results + Offset string `json:"offset"` + // The maximum number of messages to be returned; up to 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit + Limit int32 `json:"limit"` + // The amount of Telegram Stars the user agreed to pay for the search; pass 0 for free searches + StarCount int64 `json:"star_count"` +} + +// Searches for public channel posts using the given query. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit +func (client *Client) SearchPublicPosts(req *SearchPublicPostsRequest) (*FoundPublicPosts, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchPublicPosts", + }, + Data: map[string]interface{}{ + "query": req.Query, + "offset": req.Offset, + "limit": req.Limit, + "star_count": req.StarCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFoundPublicPosts(result.Data) +} + type SearchPublicMessagesByTagRequest struct { // Hashtag or cashtag to search for Tag string `json:"tag"` @@ -9350,12 +9411,18 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeDefaultMessageAutoDeleteTimerSettings: return UnmarshalInternalLinkTypeDefaultMessageAutoDeleteTimerSettings(result.Data) + case TypeInternalLinkTypeDirectMessagesChat: + return UnmarshalInternalLinkTypeDirectMessagesChat(result.Data) + case TypeInternalLinkTypeEditProfileSettings: return UnmarshalInternalLinkTypeEditProfileSettings(result.Data) case TypeInternalLinkTypeGame: return UnmarshalInternalLinkTypeGame(result.Data) + case TypeInternalLinkTypeGiftCollection: + return UnmarshalInternalLinkTypeGiftCollection(result.Data) + case TypeInternalLinkTypeGroupCall: return UnmarshalInternalLinkTypeGroupCall(result.Data) @@ -9425,6 +9492,9 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeStory: return UnmarshalInternalLinkTypeStory(result.Data) + case TypeInternalLinkTypeStoryAlbum: + return UnmarshalInternalLinkTypeStoryAlbum(result.Data) + case TypeInternalLinkTypeTheme: return UnmarshalInternalLinkTypeTheme(result.Data) @@ -10773,11 +10843,40 @@ func (client *Client) DeleteChatBackground(req *DeleteChatBackgroundRequest) (*O return UnmarshalOk(result.Data) } +type GetGiftChatThemesRequest struct { + // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results + Offset string `json:"offset"` + // The maximum number of chat themes to return + Limit int32 `json:"limit"` +} + +// Returns available to the current user gift chat themes +func (client *Client) GetGiftChatThemes(req *GetGiftChatThemesRequest) (*GiftChatThemes, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getGiftChatThemes", + }, + Data: map[string]interface{}{ + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGiftChatThemes(result.Data) +} + type SetChatThemeRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` - // Name of the new chat theme; pass an empty string to return the default theme - ThemeName string `json:"theme_name"` + // New chat theme; pass null to return the default theme + Theme InputChatTheme `json:"theme"` } // Changes the chat theme. Supported only in private and secret chats @@ -10788,7 +10887,7 @@ func (client *Client) SetChatTheme(req *SetChatThemeRequest) (*Ok, error) { }, Data: map[string]interface{}{ "chat_id": req.ChatId, - "theme_name": req.ThemeName, + "theme": req.Theme, }, }) if err != nil { @@ -12143,6 +12242,8 @@ type PostStoryRequest struct { Caption *FormattedText `json:"caption"` // The privacy settings for the story; ignored for stories posted on behalf of supergroup and channel chats PrivacySettings StoryPrivacySettings `json:"privacy_settings"` + // Identifiers of story albums to which the story will be added upon posting. An album can have up to getOption("story_album_story_count_max") + AlbumIds []int32 `json:"album_ids"` // Period after which the story is moved to archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400 for Telegram Premium users, and 86400 otherwise ActivePeriod int32 `json:"active_period"` // Full identifier of the original story, which content was used to create the story; pass null if the story isn't repost of another story @@ -12165,6 +12266,7 @@ func (client *Client) PostStory(req *PostStoryRequest) (*Story, error) { "areas": req.Areas, "caption": req.Caption, "privacy_settings": req.PrivacySettings, + "album_ids": req.AlbumIds, "active_period": req.ActivePeriod, "from_story_full_id": req.FromStoryFullId, "is_posted_to_chat_page": req.IsPostedToChatPage, @@ -12840,6 +12942,285 @@ func (client *Client) GetStoryPublicForwards(req *GetStoryPublicForwardsRequest) return UnmarshalPublicForwards(result.Data) } +type GetChatStoryAlbumsRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` +} + +// Returns the list of story albums owned by the given chat +func (client *Client) GetChatStoryAlbums(req *GetChatStoryAlbumsRequest) (*StoryAlbums, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatStoryAlbums", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStoryAlbums(result.Data) +} + +type GetStoryAlbumStoriesRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Story album identifier + StoryAlbumId int32 `json:"story_album_id"` + // Offset of the first entry to return; use 0 to get results from the first album story + Offset int32 `json:"offset"` + // The maximum number of stories to be returned. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit + Limit int32 `json:"limit"` +} + +// Returns the list of stories added to the given story album. For optimal performance, the number of returned stories is chosen by TDLib +func (client *Client) GetStoryAlbumStories(req *GetStoryAlbumStoriesRequest) (*Stories, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getStoryAlbumStories", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "story_album_id": req.StoryAlbumId, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStories(result.Data) +} + +type CreateStoryAlbumRequest struct { + // Identifier of the chat that posted the stories + StoryPosterChatId int64 `json:"story_poster_chat_id"` + // Name of the album; 1-12 characters + Name string `json:"name"` + // Identifiers of stories to add to the album; 0-getOption("story_album_story_count_max") identifiers + StoryIds []int32 `json:"story_ids"` +} + +// Creates an album of stories; requires can_edit_stories administrator right for supergroup and channel chats +func (client *Client) CreateStoryAlbum(req *CreateStoryAlbumRequest) (*StoryAlbum, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "createStoryAlbum", + }, + Data: map[string]interface{}{ + "story_poster_chat_id": req.StoryPosterChatId, + "name": req.Name, + "story_ids": req.StoryIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStoryAlbum(result.Data) +} + +type ReorderStoryAlbumsRequest struct { + // Identifier of the chat that owns the stories + ChatId int64 `json:"chat_id"` + // New order of story albums + StoryAlbumIds []int32 `json:"story_album_ids"` +} + +// Changes order of story albums. If the albums are owned by a supergroup or a channel chat, then requires can_edit_stories administrator right in the chat +func (client *Client) ReorderStoryAlbums(req *ReorderStoryAlbumsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reorderStoryAlbums", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "story_album_ids": req.StoryAlbumIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DeleteStoryAlbumRequest struct { + // Identifier of the chat that owns the stories + ChatId int64 `json:"chat_id"` + // Identifier of the story album + StoryAlbumId int32 `json:"story_album_id"` +} + +// Deletes a story album. If the album is owned by a supergroup or a channel chat, then requires can_edit_stories administrator right in the chat +func (client *Client) DeleteStoryAlbum(req *DeleteStoryAlbumRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteStoryAlbum", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "story_album_id": req.StoryAlbumId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetStoryAlbumNameRequest struct { + // Identifier of the chat that owns the stories + ChatId int64 `json:"chat_id"` + // Identifier of the story album + StoryAlbumId int32 `json:"story_album_id"` + // New name of the album; 1-12 characters + Name string `json:"name"` +} + +// Changes name of an album of stories. If the album is owned by a supergroup or a channel chat, then requires can_edit_stories administrator right in the chat. Returns the changed album +func (client *Client) SetStoryAlbumName(req *SetStoryAlbumNameRequest) (*StoryAlbum, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setStoryAlbumName", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "story_album_id": req.StoryAlbumId, + "name": req.Name, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStoryAlbum(result.Data) +} + +type AddStoryAlbumStoriesRequest struct { + // Identifier of the chat that owns the stories + ChatId int64 `json:"chat_id"` + // Identifier of the story album + StoryAlbumId int32 `json:"story_album_id"` + // Identifier of the stories to add to the album; 1-getOption("story_album_story_count_max") identifiers. If after addition the album has more than getOption("story_album_story_count_max") stories, then the last one are removed from the album + StoryIds []int32 `json:"story_ids"` +} + +// Adds stories to the beginning of a previously created story album. If the album is owned by a supergroup or a channel chat, then requires can_edit_stories administrator right in the chat. Returns the changed album +func (client *Client) AddStoryAlbumStories(req *AddStoryAlbumStoriesRequest) (*StoryAlbum, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addStoryAlbumStories", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "story_album_id": req.StoryAlbumId, + "story_ids": req.StoryIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStoryAlbum(result.Data) +} + +type RemoveStoryAlbumStoriesRequest struct { + // Identifier of the chat that owns the stories + ChatId int64 `json:"chat_id"` + // Identifier of the story album + StoryAlbumId int32 `json:"story_album_id"` + // Identifier of the stories to remove from the album + StoryIds []int32 `json:"story_ids"` +} + +// Removes stories from an album. If the album is owned by a supergroup or a channel chat, then requires can_edit_stories administrator right in the chat. Returns the changed album +func (client *Client) RemoveStoryAlbumStories(req *RemoveStoryAlbumStoriesRequest) (*StoryAlbum, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removeStoryAlbumStories", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "story_album_id": req.StoryAlbumId, + "story_ids": req.StoryIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStoryAlbum(result.Data) +} + +type ReorderStoryAlbumStoriesRequest struct { + // Identifier of the chat that owns the stories + ChatId int64 `json:"chat_id"` + // Identifier of the story album + StoryAlbumId int32 `json:"story_album_id"` + // Identifier of the stories to move to the beginning of the album. All other stories are placed in the current order after the specified stories + StoryIds []int32 `json:"story_ids"` +} + +// Changes order of stories in an album. If the album is owned by a supergroup or a channel chat, then requires can_edit_stories administrator right in the chat. Returns the changed album +func (client *Client) ReorderStoryAlbumStories(req *ReorderStoryAlbumStoriesRequest) (*StoryAlbum, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reorderStoryAlbumStories", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "story_album_id": req.StoryAlbumId, + "story_ids": req.StoryIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStoryAlbum(result.Data) +} + type GetChatBoostLevelFeaturesRequest struct { // Pass true to get the list of features for channels; pass false to get the list of features for supergroups IsChannel bool `json:"is_channel"` @@ -16491,6 +16872,145 @@ func (client *Client) GetUserProfilePhotos(req *GetUserProfilePhotosRequest) (*C return UnmarshalChatPhotos(result.Data) } +type GetUserProfileAudiosRequest struct { + // User identifier + UserId int64 `json:"user_id"` + // The number of audio files to skip; must be non-negative + Offset int32 `json:"offset"` + // The maximum number of audio files to be returned; up to 100 + Limit int32 `json:"limit"` +} + +// Returns the list of profile audio files of a user +func (client *Client) GetUserProfileAudios(req *GetUserProfileAudiosRequest) (*Audios, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getUserProfileAudios", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalAudios(result.Data) +} + +type IsProfileAudioRequest struct { + // Identifier of the audio file to check + FileId int32 `json:"file_id"` +} + +// Checks whether a file is in the profile audio files of the current user. Returns a 404 error if it isn't +func (client *Client) IsProfileAudio(req *IsProfileAudioRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "isProfileAudio", + }, + Data: map[string]interface{}{ + "file_id": req.FileId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type AddProfileAudioRequest struct { + // Identifier of the audio file to be added. The file must have been uploaded to the server + FileId int32 `json:"file_id"` +} + +// Adds an audio file to the beginning of the profile audio files of the current user +func (client *Client) AddProfileAudio(req *AddProfileAudioRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addProfileAudio", + }, + Data: map[string]interface{}{ + "file_id": req.FileId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetProfileAudioPositionRequest struct { + // Identifier of the file from profile audio files, which position will be changed + FileId int32 `json:"file_id"` + // Identifier of the file from profile audio files after which the file will be positioned; pass 0 to move the file to the beginning of the list + AfterFileId int32 `json:"after_file_id"` +} + +// Changes position of an audio file in the profile audio files of the current user +func (client *Client) SetProfileAudioPosition(req *SetProfileAudioPositionRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setProfileAudioPosition", + }, + Data: map[string]interface{}{ + "file_id": req.FileId, + "after_file_id": req.AfterFileId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type RemoveProfileAudioRequest struct { + // Identifier of the audio file to be removed + FileId int32 `json:"file_id"` +} + +// Removes an audio file from the profile audio files of the current user +func (client *Client) RemoveProfileAudio(req *RemoveProfileAudioRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removeProfileAudio", + }, + Data: map[string]interface{}{ + "file_id": req.FileId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type GetStickerOutlineRequest struct { // File identifier of the sticker StickerFileId int32 `json:"sticker_file_id"` @@ -17947,6 +18467,32 @@ func (client *Client) SetBirthdate(req *SetBirthdateRequest) (*Ok, error) { return UnmarshalOk(result.Data) } +type SetMainProfileTabRequest struct { + // The new value of the main profile tab + MainProfileTab ProfileTab `json:"main_profile_tab"` +} + +// Changes the main profile tab of the current user +func (client *Client) SetMainProfileTab(req *SetMainProfileTabRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setMainProfileTab", + }, + Data: map[string]interface{}{ + "main_profile_tab": req.MainProfileTab, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type SetPersonalChatRequest struct { // Identifier of the new personal chat; pass 0 to remove the chat. Use getSuitablePersonalChats to get suitable chats ChatId int64 `json:"chat_id"` @@ -19830,6 +20376,35 @@ func (client *Client) SetSupergroupUnrestrictBoostCount(req *SetSupergroupUnrest return UnmarshalOk(result.Data) } +type SetSupergroupMainProfileTabRequest struct { + // Identifier of the channel + SupergroupId int64 `json:"supergroup_id"` + // The new value of the main profile tab + MainProfileTab ProfileTab `json:"main_profile_tab"` +} + +// Changes the main profile tab of the channel; requires can_change_info administrator right +func (client *Client) SetSupergroupMainProfileTab(req *SetSupergroupMainProfileTabRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setSupergroupMainProfileTab", + }, + Data: map[string]interface{}{ + "supergroup_id": req.SupergroupId, + "main_profile_tab": req.MainProfileTab, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type ToggleSupergroupSignMessagesRequest struct { // Identifier of the channel SupergroupId int64 `json:"supergroup_id"` @@ -20535,10 +21110,45 @@ func (client *Client) GetAvailableGifts() (*AvailableGifts, error) { return UnmarshalAvailableGifts(result.Data) } +type CanSendGiftRequest struct { + // Identifier of the gift to send + GiftId JsonInt64 `json:"gift_id"` +} + +// Checks whether a gift with next_send_date in the future can be sent already +func (client *Client) CanSendGift(req *CanSendGiftRequest) (CanSendGiftResult, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "canSendGift", + }, + Data: map[string]interface{}{ + "gift_id": req.GiftId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypeCanSendGiftResultOk: + return UnmarshalCanSendGiftResultOk(result.Data) + + case TypeCanSendGiftResultFail: + return UnmarshalCanSendGiftResultFail(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + type SendGiftRequest struct { // Identifier of the gift to send GiftId JsonInt64 `json:"gift_id"` - // Identifier of the user or the channel chat that will receive the gift + // Identifier of the user or the channel chat that will receive the gift; limited gifts can't be sent to channel chats OwnerId MessageSender `json:"owner_id"` // Text to show along with the gift; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed. Must be empty if the receiver enabled paid messages Text *FormattedText `json:"text"` @@ -20750,6 +21360,38 @@ func (client *Client) UpgradeGift(req *UpgradeGiftRequest) (*UpgradeGiftResult, return UnmarshalUpgradeGiftResult(result.Data) } +type BuyGiftUpgradeRequest struct { + // Identifier of the user or the channel chat that owns the gift + OwnerId MessageSender `json:"owner_id"` + // Prepaid upgrade hash as received along with the gift + PrepaidUpgradeHash string `json:"prepaid_upgrade_hash"` + // The amount of Telegram Stars the user agreed to pay for the upgrade; must be equal to gift.upgrade_star_count + StarCount int64 `json:"star_count"` +} + +// Pays for upgrade of a regular gift that is owned by another user or channel chat +func (client *Client) BuyGiftUpgrade(req *BuyGiftUpgradeRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "buyGiftUpgrade", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "prepaid_upgrade_hash": req.PrepaidUpgradeHash, + "star_count": req.StarCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type TransferGiftRequest struct { // Unique identifier of business connection on behalf of which to send the request; for bots only BusinessConnectionId string `json:"business_connection_id"` @@ -20761,7 +21403,7 @@ type TransferGiftRequest struct { StarCount int64 `json:"star_count"` } -// Sends an upgraded gift to another user or a channel chat +// Sends an upgraded gift to another user or channel chat func (client *Client) TransferGift(req *TransferGiftRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -20790,12 +21432,12 @@ type SendResoldGiftRequest struct { GiftName string `json:"gift_name"` // Identifier of the user or the channel chat that will receive the gift OwnerId MessageSender `json:"owner_id"` - // The amount of Telegram Stars required to pay for the gift - StarCount int64 `json:"star_count"` + // The price that the user agreed to pay for the gift + Price GiftResalePrice `json:"price"` } // Sends an upgraded gift that is available for resale to another user or channel chat; gifts already owned by the current user must be transferred using transferGift and can't be passed to the method -func (client *Client) SendResoldGift(req *SendResoldGiftRequest) (*Ok, error) { +func (client *Client) SendResoldGift(req *SendResoldGiftRequest) (GiftResaleResult, error) { result, err := client.Send(Request{ meta: meta{ Type: "sendResoldGift", @@ -20803,7 +21445,7 @@ func (client *Client) SendResoldGift(req *SendResoldGiftRequest) (*Ok, error) { Data: map[string]interface{}{ "gift_name": req.GiftName, "owner_id": req.OwnerId, - "star_count": req.StarCount, + "price": req.Price, }, }) if err != nil { @@ -20814,7 +21456,16 @@ func (client *Client) SendResoldGift(req *SendResoldGiftRequest) (*Ok, error) { return nil, buildResponseError(result.Data) } - return UnmarshalOk(result.Data) + switch result.Type { + case TypeGiftResaleResultOk: + return UnmarshalGiftResaleResultOk(result.Data) + + case TypeGiftResaleResultPriceIncreased: + return UnmarshalGiftResaleResultPriceIncreased(result.Data) + + default: + return nil, errors.New("invalid type") + } } type GetReceivedGiftsRequest struct { @@ -20822,14 +21473,18 @@ type GetReceivedGiftsRequest struct { BusinessConnectionId string `json:"business_connection_id"` // Identifier of the gift receiver OwnerId MessageSender `json:"owner_id"` + // Pass collection identifier to get gifts only from the specified collection; pass 0 to get gifts regardless of collections + CollectionId int32 `json:"collection_id"` // Pass true to exclude gifts that aren't saved to the chat's profile page. Always true for gifts received by other users and channel chats without can_post_messages administrator right ExcludeUnsaved bool `json:"exclude_unsaved"` // Pass true to exclude gifts that are saved to the chat's profile page. Always false for gifts received by other users and channel chats without can_post_messages administrator right ExcludeSaved bool `json:"exclude_saved"` // Pass true to exclude gifts that can be purchased unlimited number of times ExcludeUnlimited bool `json:"exclude_unlimited"` - // Pass true to exclude gifts that can be purchased limited number of times - ExcludeLimited bool `json:"exclude_limited"` + // Pass true to exclude gifts that can be purchased limited number of times and can be upgraded + ExcludeUpgradable bool `json:"exclude_upgradable"` + // Pass true to exclude gifts that can be purchased limited number of times and can't be upgraded + ExcludeNonUpgradable bool `json:"exclude_non_upgradable"` // Pass true to exclude upgraded gifts ExcludeUpgraded bool `json:"exclude_upgraded"` // Pass true to sort results by gift price instead of send date @@ -20849,10 +21504,12 @@ func (client *Client) GetReceivedGifts(req *GetReceivedGiftsRequest) (*ReceivedG Data: map[string]interface{}{ "business_connection_id": req.BusinessConnectionId, "owner_id": req.OwnerId, + "collection_id": req.CollectionId, "exclude_unsaved": req.ExcludeUnsaved, "exclude_saved": req.ExcludeSaved, "exclude_unlimited": req.ExcludeUnlimited, - "exclude_limited": req.ExcludeLimited, + "exclude_upgradable": req.ExcludeUpgradable, + "exclude_non_upgradable": req.ExcludeNonUpgradable, "exclude_upgraded": req.ExcludeUpgraded, "sort_by_price": req.SortByPrice, "offset": req.Offset, @@ -20922,6 +21579,32 @@ func (client *Client) GetUpgradedGift(req *GetUpgradedGiftRequest) (*UpgradedGif return UnmarshalUpgradedGift(result.Data) } +type GetUpgradedGiftValueInfoRequest struct { + // Unique name of the upgraded gift + Name string `json:"name"` +} + +// Returns information about value of an upgraded gift by its name +func (client *Client) GetUpgradedGiftValueInfo(req *GetUpgradedGiftValueInfoRequest) (*UpgradedGiftValueInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getUpgradedGiftValueInfo", + }, + Data: map[string]interface{}{ + "name": req.Name, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalUpgradedGiftValueInfo(result.Data) +} + type GetUpgradedGiftWithdrawalUrlRequest struct { // Identifier of the gift ReceivedGiftId string `json:"received_gift_id"` @@ -20954,8 +21637,8 @@ func (client *Client) GetUpgradedGiftWithdrawalUrl(req *GetUpgradedGiftWithdrawa type SetGiftResalePriceRequest struct { // Identifier of the unique gift ReceivedGiftId string `json:"received_gift_id"` - // The new price for the unique gift; 0 or getOption("gift_resale_star_count_min")-getOption("gift_resale_star_count_max"). Pass 0 to disallow gift resale. The current user will receive getOption("gift_resale_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for the gift - ResaleStarCount int64 `json:"resale_star_count"` + // The new price for the unique gift; pass null to disallow gift resale. The current user will receive getOption("gift_resale_star_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for the gift if the gift price is in Telegram Stars or getOption("gift_resale_ton_earnings_per_mille") Toncoins for each 1000 Toncoins paid for the gift if the gift price is in Toncoins + Price GiftResalePrice `json:"price"` } // Changes resale price of a unique gift owned by the current user @@ -20966,7 +21649,7 @@ func (client *Client) SetGiftResalePrice(req *SetGiftResalePriceRequest) (*Ok, e }, Data: map[string]interface{}{ "received_gift_id": req.ReceivedGiftId, - "resale_star_count": req.ResaleStarCount, + "price": req.Price, }, }) if err != nil { @@ -21018,6 +21701,250 @@ func (client *Client) SearchGiftsForResale(req *SearchGiftsForResaleRequest) (*G return UnmarshalGiftsForResale(result.Data) } +type GetGiftCollectionsRequest struct { + // Identifier of the user or the channel chat that received the gifts + OwnerId MessageSender `json:"owner_id"` +} + +// Returns collections of gifts owned by the given user or chat +func (client *Client) GetGiftCollections(req *GetGiftCollectionsRequest) (*GiftCollections, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getGiftCollections", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGiftCollections(result.Data) +} + +type CreateGiftCollectionRequest struct { + // Identifier of the user or the channel chat that received the gifts + OwnerId MessageSender `json:"owner_id"` + // Name of the collection; 1-12 characters + Name string `json:"name"` + // Identifier of the gifts to add to the collection; 0-getOption("gift_collection_gift_count_max") identifiers + ReceivedGiftIds []string `json:"received_gift_ids"` +} + +// Creates a collection from gifts on the current user's or a channel's profile page; requires can_post_messages administrator right in the channel chat. An owner can have up to getOption("gift_collection_count_max") gift collections. The new collection will be added to the end of the gift collection list of the owner. Returns the created collection +func (client *Client) CreateGiftCollection(req *CreateGiftCollectionRequest) (*GiftCollection, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "createGiftCollection", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "name": req.Name, + "received_gift_ids": req.ReceivedGiftIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGiftCollection(result.Data) +} + +type ReorderGiftCollectionsRequest struct { + // Identifier of the user or the channel chat that owns the collection + OwnerId MessageSender `json:"owner_id"` + // New order of gift collections + CollectionIds []int32 `json:"collection_ids"` +} + +// Changes order of gift collections. If the collections are owned by a channel chat, then requires can_post_messages administrator right in the channel chat +func (client *Client) ReorderGiftCollections(req *ReorderGiftCollectionsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reorderGiftCollections", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "collection_ids": req.CollectionIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DeleteGiftCollectionRequest struct { + // Identifier of the user or the channel chat that owns the collection + OwnerId MessageSender `json:"owner_id"` + // Identifier of the gift collection + CollectionId int32 `json:"collection_id"` +} + +// Deletes a gift collection. If the collection is owned by a channel chat, then requires can_post_messages administrator right in the channel chat +func (client *Client) DeleteGiftCollection(req *DeleteGiftCollectionRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteGiftCollection", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "collection_id": req.CollectionId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetGiftCollectionNameRequest struct { + // Identifier of the user or the channel chat that owns the collection + OwnerId MessageSender `json:"owner_id"` + // Identifier of the gift collection + CollectionId int32 `json:"collection_id"` + // New name of the collection; 1-12 characters + Name string `json:"name"` +} + +// Changes name of a gift collection. If the collection is owned by a channel chat, then requires can_post_messages administrator right in the channel chat. Returns the changed collection +func (client *Client) SetGiftCollectionName(req *SetGiftCollectionNameRequest) (*GiftCollection, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setGiftCollectionName", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "collection_id": req.CollectionId, + "name": req.Name, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGiftCollection(result.Data) +} + +type AddGiftCollectionGiftsRequest struct { + // Identifier of the user or the channel chat that owns the collection + OwnerId MessageSender `json:"owner_id"` + // Identifier of the gift collection + CollectionId int32 `json:"collection_id"` + // Identifier of the gifts to add to the collection; 1-getOption("gift_collection_gift_count_max") identifiers. If after addition the collection has more than getOption("gift_collection_gift_count_max") gifts, then the last one are removed from the collection + ReceivedGiftIds []string `json:"received_gift_ids"` +} + +// Adds gifts to the beginning of a previously created collection. If the collection is owned by a channel chat, then requires can_post_messages administrator right in the channel chat. Returns the changed collection +func (client *Client) AddGiftCollectionGifts(req *AddGiftCollectionGiftsRequest) (*GiftCollection, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addGiftCollectionGifts", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "collection_id": req.CollectionId, + "received_gift_ids": req.ReceivedGiftIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGiftCollection(result.Data) +} + +type RemoveGiftCollectionGiftsRequest struct { + // Identifier of the user or the channel chat that owns the collection + OwnerId MessageSender `json:"owner_id"` + // Identifier of the gift collection + CollectionId int32 `json:"collection_id"` + // Identifier of the gifts to remove from the collection + ReceivedGiftIds []string `json:"received_gift_ids"` +} + +// Removes gifts from a collection. If the collection is owned by a channel chat, then requires can_post_messages administrator right in the channel chat. Returns the changed collection +func (client *Client) RemoveGiftCollectionGifts(req *RemoveGiftCollectionGiftsRequest) (*GiftCollection, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removeGiftCollectionGifts", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "collection_id": req.CollectionId, + "received_gift_ids": req.ReceivedGiftIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGiftCollection(result.Data) +} + +type ReorderGiftCollectionGiftsRequest struct { + // Identifier of the user or the channel chat that owns the collection + OwnerId MessageSender `json:"owner_id"` + // Identifier of the gift collection + CollectionId int32 `json:"collection_id"` + // Identifier of the gifts to move to the beginning of the collection. All other gifts are placed in the current order after the specified gifts + ReceivedGiftIds []string `json:"received_gift_ids"` +} + +// Changes order of gifts in a collection. If the collection is owned by a channel chat, then requires can_post_messages administrator right in the channel chat. Returns the changed collection +func (client *Client) ReorderGiftCollectionGifts(req *ReorderGiftCollectionGiftsRequest) (*GiftCollection, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reorderGiftCollectionGifts", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "collection_id": req.CollectionId, + "received_gift_ids": req.ReceivedGiftIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGiftCollection(result.Data) +} + type CreateInvoiceLinkRequest struct { // Unique identifier of business connection on behalf of which to send the request BusinessConnectionId string `json:"business_connection_id"` @@ -22453,6 +23380,58 @@ func (client *Client) GetStarAdAccountUrl(req *GetStarAdAccountUrlRequest) (*Htt return UnmarshalHttpUrl(result.Data) } +type GetTonRevenueStatisticsRequest struct { + // Pass true if a dark theme is used by the application + IsDark bool `json:"is_dark"` +} + +// Returns detailed Toncoin revenue statistics of the current user +func (client *Client) GetTonRevenueStatistics(req *GetTonRevenueStatisticsRequest) (*TonRevenueStatistics, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getTonRevenueStatistics", + }, + Data: map[string]interface{}{ + "is_dark": req.IsDark, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalTonRevenueStatistics(result.Data) +} + +type GetTonWithdrawalUrlRequest struct { + // The 2-step verification password of the current user + Password string `json:"password"` +} + +// Returns a URL for Toncoin withdrawal from the current user's account. The user must have at least 10 toncoins to withdraw and can withdraw up to 100000 Toncoins in one transaction +func (client *Client) GetTonWithdrawalUrl(req *GetTonWithdrawalUrlRequest) (*HttpUrl, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getTonWithdrawalUrl", + }, + Data: map[string]interface{}{ + "password": req.Password, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalHttpUrl(result.Data) +} + type GetChatStatisticsRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -26398,8 +27377,8 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateDefaultBackground: return UnmarshalUpdateDefaultBackground(result.Data) - case TypeUpdateChatThemes: - return UnmarshalUpdateChatThemes(result.Data) + case TypeUpdateEmojiChatThemes: + return UnmarshalUpdateEmojiChatThemes(result.Data) case TypeUpdateAccentColors: return UnmarshalUpdateAccentColors(result.Data) @@ -26416,6 +27395,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateFreezeState: return UnmarshalUpdateFreezeState(result.Data) + case TypeUpdateAgeVerificationParameters: + return UnmarshalUpdateAgeVerificationParameters(result.Data) + case TypeUpdateTermsOfService: return UnmarshalUpdateTermsOfService(result.Data) @@ -26458,6 +27440,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateStarRevenueStatus: return UnmarshalUpdateStarRevenueStatus(result.Data) + case TypeUpdateTonRevenueStatus: + return UnmarshalUpdateTonRevenueStatus(result.Data) + case TypeUpdateSpeechRecognitionTrial: return UnmarshalUpdateSpeechRecognitionTrial(result.Data) diff --git a/client/type.go b/client/type.go index a98e665..6490a7a 100755 --- a/client/type.go +++ b/client/type.go @@ -19,19 +19,23 @@ const ( ClassStickerType = "StickerType" ClassStickerFullType = "StickerFullType" ClassPollType = "PollType" + ClassProfileTab = "ProfileTab" ClassUserType = "UserType" ClassBusinessAwayMessageSchedule = "BusinessAwayMessageSchedule" ClassChatPhotoStickerType = "ChatPhotoStickerType" ClassInputChatPhoto = "InputChatPhoto" + ClassGiftResalePrice = "GiftResalePrice" ClassSuggestedPostPrice = "SuggestedPostPrice" ClassSuggestedPostState = "SuggestedPostState" ClassSuggestedPostRefundReason = "SuggestedPostRefundReason" ClassStarSubscriptionType = "StarSubscriptionType" ClassAffiliateType = "AffiliateType" ClassAffiliateProgramSortOrder = "AffiliateProgramSortOrder" + ClassCanSendGiftResult = "CanSendGiftResult" ClassUpgradedGiftOrigin = "UpgradedGiftOrigin" ClassUpgradedGiftAttributeId = "UpgradedGiftAttributeId" ClassGiftForResaleOrder = "GiftForResaleOrder" + ClassGiftResaleResult = "GiftResaleResult" ClassSentGift = "SentGift" ClassTransactionDirection = "TransactionDirection" ClassStarTransactionType = "StarTransactionType" @@ -71,6 +75,7 @@ const ( ClassLoginUrlInfo = "LoginUrlInfo" ClassWebAppOpenMode = "WebAppOpenMode" ClassSavedMessagesTopicType = "SavedMessagesTopicType" + ClassBuiltInTheme = "BuiltInTheme" ClassRichText = "RichText" ClassPageBlockHorizontalAlignment = "PageBlockHorizontalAlignment" ClassPageBlockVerticalAlignment = "PageBlockVerticalAlignment" @@ -143,6 +148,8 @@ const ( ClassBackgroundFill = "BackgroundFill" ClassBackgroundType = "BackgroundType" ClassInputBackground = "InputBackground" + ClassChatTheme = "ChatTheme" + ClassInputChatTheme = "InputChatTheme" ClassCanPostStoryResult = "CanPostStoryResult" ClassCanTransferOwnershipResult = "CanTransferOwnershipResult" ClassCheckChatUsernameResult = "CheckChatUsernameResult" @@ -211,6 +218,7 @@ const ( ClassInputChecklist = "InputChecklist" ClassAnimation = "Animation" ClassAudio = "Audio" + ClassAudios = "Audios" ClassDocument = "Document" ClassPhoto = "Photo" ClassSticker = "Sticker" @@ -289,6 +297,10 @@ const ( ClassStarGiveawayPaymentOptions = "StarGiveawayPaymentOptions" ClassAcceptedGiftTypes = "AcceptedGiftTypes" ClassGiftSettings = "GiftSettings" + ClassGiftPurchaseLimits = "GiftPurchaseLimits" + ClassGiftResaleParameters = "GiftResaleParameters" + ClassGiftCollection = "GiftCollection" + ClassGiftCollections = "GiftCollections" ClassUpgradedGiftModel = "UpgradedGiftModel" ClassUpgradedGiftSymbol = "UpgradedGiftSymbol" ClassUpgradedGiftBackdropColors = "UpgradedGiftBackdropColors" @@ -296,6 +308,7 @@ const ( ClassUpgradedGiftOriginalDetails = "UpgradedGiftOriginalDetails" ClassGift = "Gift" ClassUpgradedGift = "UpgradedGift" + ClassUpgradedGiftValueInfo = "UpgradedGiftValueInfo" ClassUpgradeGiftResult = "UpgradeGiftResult" ClassAvailableGift = "AvailableGift" ClassAvailableGifts = "AvailableGifts" @@ -314,6 +327,8 @@ const ( ClassAccentColor = "AccentColor" ClassProfileAccentColors = "ProfileAccentColors" ClassProfileAccentColor = "ProfileAccentColor" + ClassUserRating = "UserRating" + ClassRestrictionInfo = "RestrictionInfo" ClassEmojiStatus = "EmojiStatus" ClassEmojiStatuses = "EmojiStatuses" ClassEmojiStatusCustomEmojis = "EmojiStatusCustomEmojis" @@ -343,6 +358,7 @@ const ( ClassSupergroup = "Supergroup" ClassSupergroupFullInfo = "SupergroupFullInfo" ClassSecretChat = "SecretChat" + ClassPublicPostSearchLimits = "PublicPostSearchLimits" ClassMessageSenders = "MessageSenders" ClassChatMessageSender = "ChatMessageSender" ClassChatMessageSenders = "ChatMessageSenders" @@ -365,6 +381,7 @@ const ( ClassMessages = "Messages" ClassFoundMessages = "FoundMessages" ClassFoundChatMessages = "FoundChatMessages" + ClassFoundPublicPosts = "FoundPublicPosts" ClassMessagePosition = "MessagePosition" ClassMessagePositions = "MessagePositions" ClassMessageCalendarDay = "MessageCalendarDay" @@ -493,6 +510,8 @@ const ( ClassStory = "Story" ClassStories = "Stories" ClassFoundStories = "FoundStories" + ClassStoryAlbum = "StoryAlbum" + ClassStoryAlbums = "StoryAlbums" ClassStoryFullId = "StoryFullId" ClassStoryInfo = "StoryInfo" ClassChatActiveStories = "ChatActiveStories" @@ -566,7 +585,9 @@ const ( ClassBusinessFeaturePromotionAnimation = "BusinessFeaturePromotionAnimation" ClassPremiumState = "PremiumState" ClassPushReceiverId = "PushReceiverId" - ClassChatTheme = "ChatTheme" + ClassEmojiChatTheme = "EmojiChatTheme" + ClassGiftChatTheme = "GiftChatTheme" + ClassGiftChatThemes = "GiftChatThemes" ClassTimeZone = "TimeZone" ClassTimeZones = "TimeZones" ClassHashtags = "Hashtags" @@ -600,6 +621,7 @@ const ( ClassScopeAutosaveSettings = "ScopeAutosaveSettings" ClassAutosaveSettingsException = "AutosaveSettingsException" ClassAutosaveSettings = "AutosaveSettings" + ClassAgeVerificationParameters = "AgeVerificationParameters" ClassFoundPosition = "FoundPosition" ClassFoundPositions = "FoundPositions" ClassTMeUrl = "TMeUrl" @@ -628,6 +650,8 @@ const ( ClassChatRevenueTransactions = "ChatRevenueTransactions" ClassStarRevenueStatus = "StarRevenueStatus" ClassStarRevenueStatistics = "StarRevenueStatistics" + ClassTonRevenueStatus = "TonRevenueStatus" + ClassTonRevenueStatistics = "TonRevenueStatistics" ClassPoint = "Point" ClassUpdates = "Updates" ClassLogVerbosityLevel = "LogVerbosityLevel" @@ -726,6 +750,7 @@ const ( TypeInputChecklist = "inputChecklist" TypeAnimation = "animation" TypeAudio = "audio" + TypeAudios = "audios" TypeDocument = "document" TypePhoto = "photo" TypeSticker = "sticker" @@ -746,6 +771,14 @@ const ( TypeChatBackground = "chatBackground" TypeProfilePhoto = "profilePhoto" TypeChatPhotoInfo = "chatPhotoInfo" + TypeProfileTabPosts = "profileTabPosts" + TypeProfileTabGifts = "profileTabGifts" + TypeProfileTabMedia = "profileTabMedia" + TypeProfileTabFiles = "profileTabFiles" + TypeProfileTabLinks = "profileTabLinks" + TypeProfileTabMusic = "profileTabMusic" + TypeProfileTabVoice = "profileTabVoice" + TypeProfileTabGifs = "profileTabGifs" TypeUserTypeRegular = "userTypeRegular" TypeUserTypeDeleted = "userTypeDeleted" TypeUserTypeBot = "userTypeBot" @@ -789,6 +822,8 @@ const ( TypeInputChatPhotoSticker = "inputChatPhotoSticker" TypeChatPermissions = "chatPermissions" TypeChatAdministratorRights = "chatAdministratorRights" + TypeGiftResalePriceStar = "giftResalePriceStar" + TypeGiftResalePriceTon = "giftResalePriceTon" TypeSuggestedPostPriceStar = "suggestedPostPriceStar" TypeSuggestedPostPriceTon = "suggestedPostPriceTon" TypeSuggestedPostStatePending = "suggestedPostStatePending" @@ -832,9 +867,16 @@ const ( TypeStarGiveawayPaymentOptions = "starGiveawayPaymentOptions" TypeAcceptedGiftTypes = "acceptedGiftTypes" TypeGiftSettings = "giftSettings" + TypeGiftPurchaseLimits = "giftPurchaseLimits" + TypeGiftResaleParameters = "giftResaleParameters" + TypeGiftCollection = "giftCollection" + TypeGiftCollections = "giftCollections" + TypeCanSendGiftResultOk = "canSendGiftResultOk" + TypeCanSendGiftResultFail = "canSendGiftResultFail" TypeUpgradedGiftOriginUpgrade = "upgradedGiftOriginUpgrade" TypeUpgradedGiftOriginTransfer = "upgradedGiftOriginTransfer" TypeUpgradedGiftOriginResale = "upgradedGiftOriginResale" + TypeUpgradedGiftOriginPrepaidUpgrade = "upgradedGiftOriginPrepaidUpgrade" TypeUpgradedGiftModel = "upgradedGiftModel" TypeUpgradedGiftSymbol = "upgradedGiftSymbol" TypeUpgradedGiftBackdropColors = "upgradedGiftBackdropColors" @@ -842,6 +884,7 @@ const ( TypeUpgradedGiftOriginalDetails = "upgradedGiftOriginalDetails" TypeGift = "gift" TypeUpgradedGift = "upgradedGift" + TypeUpgradedGiftValueInfo = "upgradedGiftValueInfo" TypeUpgradeGiftResult = "upgradeGiftResult" TypeAvailableGift = "availableGift" TypeAvailableGifts = "availableGifts" @@ -856,6 +899,8 @@ const ( TypeGiftForResaleOrderNumber = "giftForResaleOrderNumber" TypeGiftForResale = "giftForResale" TypeGiftsForResale = "giftsForResale" + TypeGiftResaleResultOk = "giftResaleResultOk" + TypeGiftResaleResultPriceIncreased = "giftResaleResultPriceIncreased" TypeSentGiftRegular = "sentGiftRegular" TypeSentGiftUpgraded = "sentGiftUpgraded" TypeReceivedGift = "receivedGift" @@ -886,6 +931,7 @@ const ( TypeStarTransactionTypeGiftTransfer = "starTransactionTypeGiftTransfer" TypeStarTransactionTypeGiftSale = "starTransactionTypeGiftSale" TypeStarTransactionTypeGiftUpgrade = "starTransactionTypeGiftUpgrade" + TypeStarTransactionTypeGiftUpgradePurchase = "starTransactionTypeGiftUpgradePurchase" TypeStarTransactionTypeUpgradedGiftPurchase = "starTransactionTypeUpgradedGiftPurchase" TypeStarTransactionTypeUpgradedGiftSale = "starTransactionTypeUpgradedGiftSale" TypeStarTransactionTypeChannelPaidReactionSend = "starTransactionTypeChannelPaidReactionSend" @@ -898,11 +944,14 @@ const ( TypeStarTransactionTypePremiumPurchase = "starTransactionTypePremiumPurchase" TypeStarTransactionTypeBusinessBotTransferSend = "starTransactionTypeBusinessBotTransferSend" TypeStarTransactionTypeBusinessBotTransferReceive = "starTransactionTypeBusinessBotTransferReceive" + TypeStarTransactionTypePublicPostSearch = "starTransactionTypePublicPostSearch" TypeStarTransactionTypeUnsupported = "starTransactionTypeUnsupported" TypeStarTransaction = "starTransaction" TypeStarTransactions = "starTransactions" TypeTonTransactionTypeFragmentDeposit = "tonTransactionTypeFragmentDeposit" TypeTonTransactionTypeSuggestedPostPayment = "tonTransactionTypeSuggestedPostPayment" + TypeTonTransactionTypeUpgradedGiftPurchase = "tonTransactionTypeUpgradedGiftPurchase" + TypeTonTransactionTypeUpgradedGiftSale = "tonTransactionTypeUpgradedGiftSale" TypeTonTransactionTypeUnsupported = "tonTransactionTypeUnsupported" TypeTonTransaction = "tonTransaction" TypeTonTransactions = "tonTransactions" @@ -918,6 +967,8 @@ const ( TypeAccentColor = "accentColor" TypeProfileAccentColors = "profileAccentColors" TypeProfileAccentColor = "profileAccentColor" + TypeUserRating = "userRating" + TypeRestrictionInfo = "restrictionInfo" TypeEmojiStatusTypeCustomEmoji = "emojiStatusTypeCustomEmoji" TypeEmojiStatusTypeUpgradedGift = "emojiStatusTypeUpgradedGift" TypeEmojiStatus = "emojiStatus" @@ -976,6 +1027,7 @@ const ( TypeSecretChatStateReady = "secretChatStateReady" TypeSecretChatStateClosed = "secretChatStateClosed" TypeSecretChat = "secretChat" + TypePublicPostSearchLimits = "publicPostSearchLimits" TypeMessageSenderUser = "messageSenderUser" TypeMessageSenderChat = "messageSenderChat" TypeMessageSenders = "messageSenders" @@ -1027,6 +1079,7 @@ const ( TypeMessages = "messages" TypeFoundMessages = "foundMessages" TypeFoundChatMessages = "foundChatMessages" + TypeFoundPublicPosts = "foundPublicPosts" TypeMessagePosition = "messagePosition" TypeMessagePositions = "messagePositions" TypeMessageCalendarDay = "messageCalendarDay" @@ -1157,6 +1210,11 @@ const ( TypeLinkPreviewOptions = "linkPreviewOptions" TypeSharedUser = "sharedUser" TypeSharedChat = "sharedChat" + TypeBuiltInThemeClassic = "builtInThemeClassic" + TypeBuiltInThemeDay = "builtInThemeDay" + TypeBuiltInThemeNight = "builtInThemeNight" + TypeBuiltInThemeTinted = "builtInThemeTinted" + TypeBuiltInThemeArctic = "builtInThemeArctic" TypeThemeSettings = "themeSettings" TypeRichTextPlain = "richTextPlain" TypeRichTextBold = "richTextBold" @@ -1225,12 +1283,14 @@ const ( TypeLinkPreviewTypeBackground = "linkPreviewTypeBackground" TypeLinkPreviewTypeChannelBoost = "linkPreviewTypeChannelBoost" TypeLinkPreviewTypeChat = "linkPreviewTypeChat" + TypeLinkPreviewTypeDirectMessagesChat = "linkPreviewTypeDirectMessagesChat" TypeLinkPreviewTypeDocument = "linkPreviewTypeDocument" TypeLinkPreviewTypeEmbeddedAnimationPlayer = "linkPreviewTypeEmbeddedAnimationPlayer" TypeLinkPreviewTypeEmbeddedAudioPlayer = "linkPreviewTypeEmbeddedAudioPlayer" TypeLinkPreviewTypeEmbeddedVideoPlayer = "linkPreviewTypeEmbeddedVideoPlayer" TypeLinkPreviewTypeExternalAudio = "linkPreviewTypeExternalAudio" TypeLinkPreviewTypeExternalVideo = "linkPreviewTypeExternalVideo" + TypeLinkPreviewTypeGiftCollection = "linkPreviewTypeGiftCollection" TypeLinkPreviewTypeGroupCall = "linkPreviewTypeGroupCall" TypeLinkPreviewTypeInvoice = "linkPreviewTypeInvoice" TypeLinkPreviewTypeMessage = "linkPreviewTypeMessage" @@ -1240,6 +1300,7 @@ const ( TypeLinkPreviewTypeSticker = "linkPreviewTypeSticker" TypeLinkPreviewTypeStickerSet = "linkPreviewTypeStickerSet" TypeLinkPreviewTypeStory = "linkPreviewTypeStory" + TypeLinkPreviewTypeStoryAlbum = "linkPreviewTypeStoryAlbum" TypeLinkPreviewTypeSupergroupBoost = "linkPreviewTypeSupergroupBoost" TypeLinkPreviewTypeTheme = "linkPreviewTypeTheme" TypeLinkPreviewTypeUnsupported = "linkPreviewTypeUnsupported" @@ -1599,6 +1660,8 @@ const ( TypeStory = "story" TypeStories = "stories" TypeFoundStories = "foundStories" + TypeStoryAlbum = "storyAlbum" + TypeStoryAlbums = "storyAlbums" TypeStoryFullId = "storyFullId" TypeStoryInfo = "storyInfo" TypeChatActiveStories = "chatActiveStories" @@ -1922,7 +1985,13 @@ const ( TypeInputBackgroundLocal = "inputBackgroundLocal" TypeInputBackgroundRemote = "inputBackgroundRemote" TypeInputBackgroundPrevious = "inputBackgroundPrevious" - TypeChatTheme = "chatTheme" + TypeEmojiChatTheme = "emojiChatTheme" + TypeGiftChatTheme = "giftChatTheme" + TypeGiftChatThemes = "giftChatThemes" + TypeChatThemeEmoji = "chatThemeEmoji" + TypeChatThemeGift = "chatThemeGift" + TypeInputChatThemeEmoji = "inputChatThemeEmoji" + TypeInputChatThemeGift = "inputChatThemeGift" TypeTimeZone = "timeZone" TypeTimeZones = "timeZones" TypeHashtags = "hashtags" @@ -2110,8 +2179,10 @@ const ( TypeInternalLinkTypeChatFolderSettings = "internalLinkTypeChatFolderSettings" TypeInternalLinkTypeChatInvite = "internalLinkTypeChatInvite" TypeInternalLinkTypeDefaultMessageAutoDeleteTimerSettings = "internalLinkTypeDefaultMessageAutoDeleteTimerSettings" + TypeInternalLinkTypeDirectMessagesChat = "internalLinkTypeDirectMessagesChat" TypeInternalLinkTypeEditProfileSettings = "internalLinkTypeEditProfileSettings" TypeInternalLinkTypeGame = "internalLinkTypeGame" + TypeInternalLinkTypeGiftCollection = "internalLinkTypeGiftCollection" TypeInternalLinkTypeGroupCall = "internalLinkTypeGroupCall" TypeInternalLinkTypeInstantView = "internalLinkTypeInstantView" TypeInternalLinkTypeInvoice = "internalLinkTypeInvoice" @@ -2135,6 +2206,7 @@ const ( TypeInternalLinkTypeSettings = "internalLinkTypeSettings" TypeInternalLinkTypeStickerSet = "internalLinkTypeStickerSet" TypeInternalLinkTypeStory = "internalLinkTypeStory" + TypeInternalLinkTypeStoryAlbum = "internalLinkTypeStoryAlbum" TypeInternalLinkTypeTheme = "internalLinkTypeTheme" TypeInternalLinkTypeThemeSettings = "internalLinkTypeThemeSettings" TypeInternalLinkTypeUnknownDeepLink = "internalLinkTypeUnknownDeepLink" @@ -2200,6 +2272,7 @@ const ( TypeConnectionStateConnecting = "connectionStateConnecting" TypeConnectionStateUpdating = "connectionStateUpdating" TypeConnectionStateReady = "connectionStateReady" + TypeAgeVerificationParameters = "ageVerificationParameters" TypeTopChatCategoryUsers = "topChatCategoryUsers" TypeTopChatCategoryBots = "topChatCategoryBots" TypeTopChatCategoryGroups = "topChatCategoryGroups" @@ -2275,6 +2348,8 @@ const ( TypeChatRevenueTransactions = "chatRevenueTransactions" TypeStarRevenueStatus = "starRevenueStatus" TypeStarRevenueStatistics = "starRevenueStatistics" + TypeTonRevenueStatus = "tonRevenueStatus" + TypeTonRevenueStatistics = "tonRevenueStatistics" TypePoint = "point" TypeVectorPathCommandLine = "vectorPathCommandLine" TypeVectorPathCommandCubicBezierCurve = "vectorPathCommandCubicBezierCurve" @@ -2400,12 +2475,13 @@ const ( TypeUpdateSavedAnimations = "updateSavedAnimations" TypeUpdateSavedNotificationSounds = "updateSavedNotificationSounds" TypeUpdateDefaultBackground = "updateDefaultBackground" - TypeUpdateChatThemes = "updateChatThemes" + TypeUpdateEmojiChatThemes = "updateEmojiChatThemes" TypeUpdateAccentColors = "updateAccentColors" TypeUpdateProfileAccentColors = "updateProfileAccentColors" TypeUpdateLanguagePackStrings = "updateLanguagePackStrings" TypeUpdateConnectionState = "updateConnectionState" TypeUpdateFreezeState = "updateFreezeState" + TypeUpdateAgeVerificationParameters = "updateAgeVerificationParameters" TypeUpdateTermsOfService = "updateTermsOfService" TypeUpdateUnconfirmedSession = "updateUnconfirmedSession" TypeUpdateAttachmentMenuBots = "updateAttachmentMenuBots" @@ -2420,6 +2496,7 @@ const ( TypeUpdateOwnedTonCount = "updateOwnedTonCount" TypeUpdateChatRevenueAmount = "updateChatRevenueAmount" TypeUpdateStarRevenueStatus = "updateStarRevenueStatus" + TypeUpdateTonRevenueStatus = "updateTonRevenueStatus" TypeUpdateSpeechRecognitionTrial = "updateSpeechRecognitionTrial" TypeUpdateDiceEmojis = "updateDiceEmojis" TypeUpdateAnimatedEmojiMessageClicked = "updateAnimatedEmojiMessageClicked" @@ -2525,6 +2602,11 @@ type PollType interface { PollTypeType() string } +// Describes a tab shown in a user or a chat profile +type ProfileTab interface { + ProfileTabType() string +} + // Represents the type of user. The following types are possible: regular users, deleted users and bots type UserType interface { UserTypeType() string @@ -2545,6 +2627,11 @@ type InputChatPhoto interface { InputChatPhotoType() string } +// Describes price of a resold gift +type GiftResalePrice interface { + GiftResalePriceType() string +} + // Describes price of a suggested post type SuggestedPostPrice interface { SuggestedPostPriceType() string @@ -2575,6 +2662,11 @@ type AffiliateProgramSortOrder interface { AffiliateProgramSortOrderType() string } +// Describes whether a gift can be sent now by the current user +type CanSendGiftResult interface { + CanSendGiftResultType() string +} + // Describes origin from which the upgraded gift was obtained type UpgradedGiftOrigin interface { UpgradedGiftOriginType() string @@ -2590,6 +2682,11 @@ type GiftForResaleOrder interface { GiftForResaleOrderType() string } +// Describes result of sending a resold gift +type GiftResaleResult interface { + GiftResaleResultType() string +} + // Represents content of a gift received by a user or a channel chat type SentGift interface { SentGiftType() string @@ -2785,6 +2882,11 @@ type SavedMessagesTopicType interface { SavedMessagesTopicTypeType() string } +// Describes a built-in theme of an official app +type BuiltInTheme interface { + BuiltInThemeType() string +} + // Describes a formatted text object type RichText interface { RichTextType() string @@ -3145,6 +3247,16 @@ type InputBackground interface { InputBackgroundType() string } +// Describes a chat theme +type ChatTheme interface { + ChatThemeType() string +} + +// Describes a chat theme to set +type InputChatTheme interface { + InputChatThemeType() string +} + // Represents result of checking whether the current user can post a story on behalf of the specific chat type CanPostStoryResult interface { CanPostStoryResultType() string @@ -4087,6 +4199,10 @@ type AuthorizationStateWaitPremiumPurchase struct { meta // Identifier of the store product that must be bought StoreProductId string `json:"store_product_id"` + // Email address to use for support if the user has issues with Telegram Premium purchase + SupportEmailAddress string `json:"support_email_address"` + // Subject for the email sent to the support email address + SupportEmailSubject string `json:"support_email_subject"` } func (entity *AuthorizationStateWaitPremiumPurchase) MarshalJSON() ([]byte, error) { @@ -5773,6 +5889,31 @@ func (*Audio) GetType() string { return TypeAudio } +// Contains a list of audio files +type Audios struct { + meta + // Approximate total number of audio files found + TotalCount int32 `json:"total_count"` + // List of audio files + Audios []*Audio `json:"audios"` +} + +func (entity *Audios) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Audios + + return json.Marshal((*stub)(entity)) +} + +func (*Audios) GetClass() string { + return ClassAudios +} + +func (*Audios) GetType() string { + return TypeAudios +} + // Describes a document of any type type Document struct { meta @@ -6566,6 +6707,206 @@ func (*ChatPhotoInfo) GetType() string { return TypeChatPhotoInfo } +// A tab with stories posted by the user or the channel chat and saved to profile +type ProfileTabPosts struct{ + meta +} + +func (entity *ProfileTabPosts) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProfileTabPosts + + return json.Marshal((*stub)(entity)) +} + +func (*ProfileTabPosts) GetClass() string { + return ClassProfileTab +} + +func (*ProfileTabPosts) GetType() string { + return TypeProfileTabPosts +} + +func (*ProfileTabPosts) ProfileTabType() string { + return TypeProfileTabPosts +} + +// A tab with gifts received by the user or the channel chat +type ProfileTabGifts struct{ + meta +} + +func (entity *ProfileTabGifts) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProfileTabGifts + + return json.Marshal((*stub)(entity)) +} + +func (*ProfileTabGifts) GetClass() string { + return ClassProfileTab +} + +func (*ProfileTabGifts) GetType() string { + return TypeProfileTabGifts +} + +func (*ProfileTabGifts) ProfileTabType() string { + return TypeProfileTabGifts +} + +// A tab with photos and videos posted by the channel +type ProfileTabMedia struct{ + meta +} + +func (entity *ProfileTabMedia) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProfileTabMedia + + return json.Marshal((*stub)(entity)) +} + +func (*ProfileTabMedia) GetClass() string { + return ClassProfileTab +} + +func (*ProfileTabMedia) GetType() string { + return TypeProfileTabMedia +} + +func (*ProfileTabMedia) ProfileTabType() string { + return TypeProfileTabMedia +} + +// A tab with documents posted by the channel +type ProfileTabFiles struct{ + meta +} + +func (entity *ProfileTabFiles) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProfileTabFiles + + return json.Marshal((*stub)(entity)) +} + +func (*ProfileTabFiles) GetClass() string { + return ClassProfileTab +} + +func (*ProfileTabFiles) GetType() string { + return TypeProfileTabFiles +} + +func (*ProfileTabFiles) ProfileTabType() string { + return TypeProfileTabFiles +} + +// A tab with messages posted by the channel and containing links +type ProfileTabLinks struct{ + meta +} + +func (entity *ProfileTabLinks) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProfileTabLinks + + return json.Marshal((*stub)(entity)) +} + +func (*ProfileTabLinks) GetClass() string { + return ClassProfileTab +} + +func (*ProfileTabLinks) GetType() string { + return TypeProfileTabLinks +} + +func (*ProfileTabLinks) ProfileTabType() string { + return TypeProfileTabLinks +} + +// A tab with audio messages posted by the channel +type ProfileTabMusic struct{ + meta +} + +func (entity *ProfileTabMusic) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProfileTabMusic + + return json.Marshal((*stub)(entity)) +} + +func (*ProfileTabMusic) GetClass() string { + return ClassProfileTab +} + +func (*ProfileTabMusic) GetType() string { + return TypeProfileTabMusic +} + +func (*ProfileTabMusic) ProfileTabType() string { + return TypeProfileTabMusic +} + +// A tab with voice notes posted by the channel +type ProfileTabVoice struct{ + meta +} + +func (entity *ProfileTabVoice) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProfileTabVoice + + return json.Marshal((*stub)(entity)) +} + +func (*ProfileTabVoice) GetClass() string { + return ClassProfileTab +} + +func (*ProfileTabVoice) GetType() string { + return TypeProfileTabVoice +} + +func (*ProfileTabVoice) ProfileTabType() string { + return TypeProfileTabVoice +} + +// A tab with animations posted by the channel +type ProfileTabGifs struct{ + meta +} + +func (entity *ProfileTabGifs) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProfileTabGifs + + return json.Marshal((*stub)(entity)) +} + +func (*ProfileTabGifs) GetClass() string { + return ClassProfileTab +} + +func (*ProfileTabGifs) GetType() string { + return TypeProfileTabGifs +} + +func (*ProfileTabGifs) ProfileTabType() string { + return TypeProfileTabGifs +} + // A regular user type UserTypeRegular struct{ meta @@ -7922,10 +8263,64 @@ func (*ChatAdministratorRights) GetType() string { return TypeChatAdministratorRights } +// Describes price of a resold gift in Telegram Stars +type GiftResalePriceStar struct { + meta + // The amount of Telegram Stars expected to be paid for the gift. Must be in range getOption("gift_resale_star_count_min")-getOption("gift_resale_star_count_max") for gifts put for resale + StarCount int64 `json:"star_count"` +} + +func (entity *GiftResalePriceStar) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftResalePriceStar + + return json.Marshal((*stub)(entity)) +} + +func (*GiftResalePriceStar) GetClass() string { + return ClassGiftResalePrice +} + +func (*GiftResalePriceStar) GetType() string { + return TypeGiftResalePriceStar +} + +func (*GiftResalePriceStar) GiftResalePriceType() string { + return TypeGiftResalePriceStar +} + +// Describes price of a resold gift in Toncoins +type GiftResalePriceTon struct { + meta + // The amount of 1/100 of Toncoin expected to be paid for the gift. Must be in range getOption("gift_resale_toncoin_cent_count_min")-getOption("gift_resale_toncoin_cent_count_max") + ToncoinCentCount int64 `json:"toncoin_cent_count"` +} + +func (entity *GiftResalePriceTon) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftResalePriceTon + + return json.Marshal((*stub)(entity)) +} + +func (*GiftResalePriceTon) GetClass() string { + return ClassGiftResalePrice +} + +func (*GiftResalePriceTon) GetType() string { + return TypeGiftResalePriceTon +} + +func (*GiftResalePriceTon) GiftResalePriceType() string { + return TypeGiftResalePriceTon +} + // Describes price of a suggested post in Telegram Stars type SuggestedPostPriceStar struct { meta - // The amount of Telegram Stars agreed to pay for the post; getOption("suggested_post_star_count_min")-getOption("suggested_post_star_count_max") + // The amount of Telegram Stars expected to be paid for the post; getOption("suggested_post_star_count_min")-getOption("suggested_post_star_count_max") StarCount int64 `json:"star_count"` } @@ -7952,7 +8347,7 @@ func (*SuggestedPostPriceStar) SuggestedPostPriceType() string { // Describes price of a suggested post in Toncoins type SuggestedPostPriceTon struct { meta - // The amount of 1/100 of Toncoin agreed to pay for the post; getOption("suggested_post_toncoin_cent_count_min")-getOption("suggested_post_toncoin_cent_count_max") + // The amount of 1/100 of Toncoin expected to be paid for the post; getOption("suggested_post_toncoin_cent_count_min")-getOption("suggested_post_toncoin_cent_count_max") ToncoinCentCount int64 `json:"toncoin_cent_count"` } @@ -9244,6 +9639,162 @@ func (*GiftSettings) GetType() string { return TypeGiftSettings } +// Describes the maximum number of times that a specific gift can be purchased +type GiftPurchaseLimits struct { + meta + // The maximum number of times the gifts can be purchased + TotalCount int32 `json:"total_count"` + // Number of remaining times the gift can be purchased + RemainingCount int32 `json:"remaining_count"` +} + +func (entity *GiftPurchaseLimits) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftPurchaseLimits + + return json.Marshal((*stub)(entity)) +} + +func (*GiftPurchaseLimits) GetClass() string { + return ClassGiftPurchaseLimits +} + +func (*GiftPurchaseLimits) GetType() string { + return TypeGiftPurchaseLimits +} + +// Describes parameters of a unique gift available for resale +type GiftResaleParameters struct { + meta + // Resale price of the gift in Telegram Stars + StarCount int64 `json:"star_count"` + // Resale price of the gift in 1/100 of Toncoin + ToncoinCentCount int64 `json:"toncoin_cent_count"` + // True, if the gift can be bought only using Toncoins + ToncoinOnly bool `json:"toncoin_only"` +} + +func (entity *GiftResaleParameters) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftResaleParameters + + return json.Marshal((*stub)(entity)) +} + +func (*GiftResaleParameters) GetClass() string { + return ClassGiftResaleParameters +} + +func (*GiftResaleParameters) GetType() string { + return TypeGiftResaleParameters +} + +// Describes collection of gifts +type GiftCollection struct { + meta + // Unique identifier of the collection + Id int32 `json:"id"` + // Name of the collection + Name string `json:"name"` + // Icon of the collection; may be null if none + Icon *Sticker `json:"icon"` + // Total number of gifts in the collection + GiftCount int32 `json:"gift_count"` +} + +func (entity *GiftCollection) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftCollection + + return json.Marshal((*stub)(entity)) +} + +func (*GiftCollection) GetClass() string { + return ClassGiftCollection +} + +func (*GiftCollection) GetType() string { + return TypeGiftCollection +} + +// Contains a list of gift collections +type GiftCollections struct { + meta + // List of gift collections + Collections []*GiftCollection `json:"collections"` +} + +func (entity *GiftCollections) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftCollections + + return json.Marshal((*stub)(entity)) +} + +func (*GiftCollections) GetClass() string { + return ClassGiftCollections +} + +func (*GiftCollections) GetType() string { + return TypeGiftCollections +} + +// The gift can be sent now by the current user +type CanSendGiftResultOk struct{ + meta +} + +func (entity *CanSendGiftResultOk) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CanSendGiftResultOk + + return json.Marshal((*stub)(entity)) +} + +func (*CanSendGiftResultOk) GetClass() string { + return ClassCanSendGiftResult +} + +func (*CanSendGiftResultOk) GetType() string { + return TypeCanSendGiftResultOk +} + +func (*CanSendGiftResultOk) CanSendGiftResultType() string { + return TypeCanSendGiftResultOk +} + +// The gift can't be sent now by the current user +type CanSendGiftResultFail struct { + meta + // Reason to be shown to the user + Reason *FormattedText `json:"reason"` +} + +func (entity *CanSendGiftResultFail) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CanSendGiftResultFail + + return json.Marshal((*stub)(entity)) +} + +func (*CanSendGiftResultFail) GetClass() string { + return ClassCanSendGiftResult +} + +func (*CanSendGiftResultFail) GetType() string { + return TypeCanSendGiftResultFail +} + +func (*CanSendGiftResultFail) CanSendGiftResultType() string { + return TypeCanSendGiftResultFail +} + // The gift was obtained by upgrading of a previously received gift type UpgradedGiftOriginUpgrade struct { meta @@ -9299,8 +9850,8 @@ func (*UpgradedGiftOriginTransfer) UpgradedGiftOriginType() string { // The gift was bought from another user type UpgradedGiftOriginResale struct { meta - // Number of Telegram Stars that were paid by the sender for the gift - StarCount int64 `json:"star_count"` + // Price paid by the sender for the gift + Price GiftResalePrice `json:"price"` } func (entity *UpgradedGiftOriginResale) MarshalJSON() ([]byte, error) { @@ -9323,6 +9874,47 @@ func (*UpgradedGiftOriginResale) UpgradedGiftOriginType() string { return TypeUpgradedGiftOriginResale } +func (upgradedGiftOriginResale *UpgradedGiftOriginResale) UnmarshalJSON(data []byte) error { + var tmp struct { + Price json.RawMessage `json:"price"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldPrice, _ := UnmarshalGiftResalePrice(tmp.Price) + upgradedGiftOriginResale.Price = fieldPrice + + return nil +} + +// The sender or receiver of the message has paid for upgraid of the gift, which has been completed +type UpgradedGiftOriginPrepaidUpgrade struct{ + meta +} + +func (entity *UpgradedGiftOriginPrepaidUpgrade) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftOriginPrepaidUpgrade + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftOriginPrepaidUpgrade) GetClass() string { + return ClassUpgradedGiftOrigin +} + +func (*UpgradedGiftOriginPrepaidUpgrade) GetType() string { + return TypeUpgradedGiftOriginPrepaidUpgrade +} + +func (*UpgradedGiftOriginPrepaidUpgrade) UpgradedGiftOriginType() string { + return TypeUpgradedGiftOriginPrepaidUpgrade +} + // Describes a model of an upgraded gift type UpgradedGiftModel struct { meta @@ -9506,10 +10098,14 @@ type Gift struct { UpgradeStarCount int64 `json:"upgrade_star_count"` // True, if the gift is a birthday gift IsForBirthday bool `json:"is_for_birthday"` - // Number of remaining times the gift can be purchased; 0 if not limited or the gift was sold out - RemainingCount int32 `json:"remaining_count"` - // Number of total times the gift can be purchased; 0 if not limited - TotalCount int32 `json:"total_count"` + // True, if the gift can be bought only by Telegram Premium subscribers + IsPremium bool `json:"is_premium"` + // Point in time (Unix timestamp) when the gift can be sent next time by the current user; can be 0 or a date in the past. If the date is in the future, then call canSendGift to get the reason, why the gift can't be sent now + NextSendDate int32 `json:"next_send_date"` + // Number of times the gift can be purchased by the current user; may be null if not limited + UserLimits *GiftPurchaseLimits `json:"user_limits"` + // Number of times the gift can be purchased all users; may be null if not limited + OverallLimits *GiftPurchaseLimits `json:"overall_limits"` // Point in time (Unix timestamp) when the gift was send for the first time; for sold out gifts only FirstSendDate int32 `json:"first_send_date"` // Point in time (Unix timestamp) when the gift was send for the last time; for sold out gifts only @@ -9537,6 +10133,8 @@ type UpgradedGift struct { meta // Unique identifier of the gift Id JsonInt64 `json:"id"` + // Unique identifier of the regular gift from which the gift was upgraded; may be 0 for short period of time for old gifts from database + RegularGiftId JsonInt64 `json:"regular_gift_id"` // Identifier of the chat that published the gift; 0 if none PublisherChatId int64 `json:"publisher_chat_id"` // The title of the upgraded gift @@ -9549,6 +10147,12 @@ type UpgradedGift struct { TotalUpgradedCount int32 `json:"total_upgraded_count"` // The maximum number of gifts that can be upgraded from the same gift MaxUpgradedCount int32 `json:"max_upgraded_count"` + // True, if the original gift could have been bought only by Telegram Premium subscribers + IsPremium bool `json:"is_premium"` + // True, if the gift can be used to set a theme in a chat + IsThemeAvailable bool `json:"is_theme_available"` + // Identifier of the chat for which the gift is used to set a theme; 0 if none or the gift isn't owned by the current user + UsedThemeChatId int64 `json:"used_theme_chat_id"` // Identifier of the user or the chat that owns the upgraded gift; may be null if none or unknown OwnerId MessageSender `json:"owner_id"` // Address of the gift NFT owner in TON blockchain; may be empty if none. Append the address to getOption("ton_blockchain_explorer_url") to get a link with information about the address @@ -9565,8 +10169,12 @@ type UpgradedGift struct { Backdrop *UpgradedGiftBackdrop `json:"backdrop"` // Information about the originally sent gift; may be null if unknown OriginalDetails *UpgradedGiftOriginalDetails `json:"original_details"` - // Number of Telegram Stars that must be paid to buy the gift and send it to someone else; 0 if resale isn't possible - ResaleStarCount int64 `json:"resale_star_count"` + // Resale parameters of the gift; may be null if resale isn't possible + ResaleParameters *GiftResaleParameters `json:"resale_parameters"` + // ISO 4217 currency code of the currency in which value of the gift is represented; may be empty if unavailable + ValueCurrency string `json:"value_currency"` + // Estimated value of the gift; in the smallest units of the currency; 0 if unavailable + ValueAmount int64 `json:"value_amount"` } func (entity *UpgradedGift) MarshalJSON() ([]byte, error) { @@ -9588,12 +10196,16 @@ func (*UpgradedGift) GetType() string { func (upgradedGift *UpgradedGift) UnmarshalJSON(data []byte) error { var tmp struct { Id JsonInt64 `json:"id"` + RegularGiftId JsonInt64 `json:"regular_gift_id"` PublisherChatId int64 `json:"publisher_chat_id"` Title string `json:"title"` Name string `json:"name"` Number int32 `json:"number"` TotalUpgradedCount int32 `json:"total_upgraded_count"` MaxUpgradedCount int32 `json:"max_upgraded_count"` + IsPremium bool `json:"is_premium"` + IsThemeAvailable bool `json:"is_theme_available"` + UsedThemeChatId int64 `json:"used_theme_chat_id"` OwnerId json.RawMessage `json:"owner_id"` OwnerAddress string `json:"owner_address"` OwnerName string `json:"owner_name"` @@ -9602,7 +10214,9 @@ func (upgradedGift *UpgradedGift) UnmarshalJSON(data []byte) error { Symbol *UpgradedGiftSymbol `json:"symbol"` Backdrop *UpgradedGiftBackdrop `json:"backdrop"` OriginalDetails *UpgradedGiftOriginalDetails `json:"original_details"` - ResaleStarCount int64 `json:"resale_star_count"` + ResaleParameters *GiftResaleParameters `json:"resale_parameters"` + ValueCurrency string `json:"value_currency"` + ValueAmount int64 `json:"value_amount"` } err := json.Unmarshal(data, &tmp) @@ -9611,12 +10225,16 @@ func (upgradedGift *UpgradedGift) UnmarshalJSON(data []byte) error { } upgradedGift.Id = tmp.Id + upgradedGift.RegularGiftId = tmp.RegularGiftId upgradedGift.PublisherChatId = tmp.PublisherChatId upgradedGift.Title = tmp.Title upgradedGift.Name = tmp.Name upgradedGift.Number = tmp.Number upgradedGift.TotalUpgradedCount = tmp.TotalUpgradedCount upgradedGift.MaxUpgradedCount = tmp.MaxUpgradedCount + upgradedGift.IsPremium = tmp.IsPremium + upgradedGift.IsThemeAvailable = tmp.IsThemeAvailable + upgradedGift.UsedThemeChatId = tmp.UsedThemeChatId upgradedGift.OwnerAddress = tmp.OwnerAddress upgradedGift.OwnerName = tmp.OwnerName upgradedGift.GiftAddress = tmp.GiftAddress @@ -9624,7 +10242,9 @@ func (upgradedGift *UpgradedGift) UnmarshalJSON(data []byte) error { upgradedGift.Symbol = tmp.Symbol upgradedGift.Backdrop = tmp.Backdrop upgradedGift.OriginalDetails = tmp.OriginalDetails - upgradedGift.ResaleStarCount = tmp.ResaleStarCount + upgradedGift.ResaleParameters = tmp.ResaleParameters + upgradedGift.ValueCurrency = tmp.ValueCurrency + upgradedGift.ValueAmount = tmp.ValueAmount fieldOwnerId, _ := UnmarshalMessageSender(tmp.OwnerId) upgradedGift.OwnerId = fieldOwnerId @@ -9632,6 +10252,55 @@ func (upgradedGift *UpgradedGift) UnmarshalJSON(data []byte) error { return nil } +// Contains information about value of an upgraded gift +type UpgradedGiftValueInfo struct { + meta + // ISO 4217 currency code of the currency in which the prices are represented + Currency string `json:"currency"` + // Estimated value of the gift; in the smallest units of the currency + Value int64 `json:"value"` + // True, if the value is calculated as average value of similar sold gifts. Otherwise, it is based on the sale price of the gift + IsValueAverage bool `json:"is_value_average"` + // Point in time (Unix timestamp) when the corresponding regular gift was originally purchased + InitialSaleDate int32 `json:"initial_sale_date"` + // Amount of Telegram Stars that were paid for the gift + InitialSaleStarCount int64 `json:"initial_sale_star_count"` + // Initial price of the gift; in the smallest units of the currency + InitialSalePrice int64 `json:"initial_sale_price"` + // Point in time (Unix timestamp) when the upgraded gift was purchased last time; 0 if never + LastSaleDate int32 `json:"last_sale_date"` + // Last purchase price of the gift; in the smallest units of the currency; 0 if the gift has never been resold + LastSalePrice int64 `json:"last_sale_price"` + // True, if the last sale was completed on Fragment + IsLastSaleOnFragment bool `json:"is_last_sale_on_fragment"` + // The current minimum price of gifts upgraded from the same gift; in the smallest units of the currency; 0 if there are no such gifts + MinimumPrice int64 `json:"minimum_price"` + // The average sale price in the last month of gifts upgraded from the same gift; in the smallest units of the currency; 0 if there were no such sales + AverageSalePrice int64 `json:"average_sale_price"` + // Number of gifts upgraded from the same gift being resold on Telegram + TelegramListedGiftCount int32 `json:"telegram_listed_gift_count"` + // Number of gifts upgraded from the same gift being resold on Fragment + FragmentListedGiftCount int32 `json:"fragment_listed_gift_count"` + // The HTTPS link to the Fragment for the gift; may be empty if there are no such gifts being sold on Fragment + FragmentUrl string `json:"fragment_url"` +} + +func (entity *UpgradedGiftValueInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftValueInfo + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftValueInfo) GetClass() string { + return ClassUpgradedGiftValueInfo +} + +func (*UpgradedGiftValueInfo) GetType() string { + return TypeUpgradedGiftValueInfo +} + // Contains result of gift upgrading type UpgradeGiftResult struct { meta @@ -9645,11 +10314,11 @@ type UpgradeGiftResult struct { CanBeTransferred bool `json:"can_be_transferred"` // Number of Telegram Stars that must be paid to transfer the upgraded gift TransferStarCount int64 `json:"transfer_star_count"` - // Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible + // Point in time (Unix timestamp) when the gift can be transferred to another owner; can be in the past; 0 if the gift can be transferred immediately or transfer isn't possible NextTransferDate int32 `json:"next_transfer_date"` - // Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift + // Point in time (Unix timestamp) when the gift can be resold to another user; can be in the past; 0 if the gift can't be resold; only for the receiver of the gift NextResaleDate int32 `json:"next_resale_date"` - // Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT + // Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT; can be in the past ExportDate int32 `json:"export_date"` } @@ -9676,7 +10345,7 @@ type AvailableGift struct { Gift *Gift `json:"gift"` // Number of gifts that are available for resale ResaleCount int32 `json:"resale_count"` - // The minimum price for the gifts available for resale; 0 if there are no such gifts + // The minimum price for the gifts available for resale in Telegram Star equivalent; 0 if there are no such gifts MinResaleStarCount int64 `json:"min_resale_star_count"` // The title of the upgraded gift; empty if the gift isn't available for resale Title string `json:"title"` @@ -10010,6 +10679,74 @@ func (*GiftsForResale) GetType() string { return TypeGiftsForResale } +// Operation was successfully completed +type GiftResaleResultOk struct{ + meta +} + +func (entity *GiftResaleResultOk) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftResaleResultOk + + return json.Marshal((*stub)(entity)) +} + +func (*GiftResaleResultOk) GetClass() string { + return ClassGiftResaleResult +} + +func (*GiftResaleResultOk) GetType() string { + return TypeGiftResaleResultOk +} + +func (*GiftResaleResultOk) GiftResaleResultType() string { + return TypeGiftResaleResultOk +} + +// Operation has failed, because price has increased. If the price has decreased, then the buying will succeed anyway +type GiftResaleResultPriceIncreased struct { + meta + // New price for the gift + Price GiftResalePrice `json:"price"` +} + +func (entity *GiftResaleResultPriceIncreased) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftResaleResultPriceIncreased + + return json.Marshal((*stub)(entity)) +} + +func (*GiftResaleResultPriceIncreased) GetClass() string { + return ClassGiftResaleResult +} + +func (*GiftResaleResultPriceIncreased) GetType() string { + return TypeGiftResaleResultPriceIncreased +} + +func (*GiftResaleResultPriceIncreased) GiftResaleResultType() string { + return TypeGiftResaleResultPriceIncreased +} + +func (giftResaleResultPriceIncreased *GiftResaleResultPriceIncreased) UnmarshalJSON(data []byte) error { + var tmp struct { + Price json.RawMessage `json:"price"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldPrice, _ := UnmarshalGiftResalePrice(tmp.Price) + giftResaleResultPriceIncreased.Price = fieldPrice + + return nil +} + // Regular gift type SentGiftRegular struct { meta @@ -10089,18 +10826,24 @@ type ReceivedGift struct { Date int32 `json:"date"` // The gift Gift SentGift `json:"gift"` + // Identifiers of collections to which the gift is added; only for the receiver of the gift + CollectionIds []int32 `json:"collection_ids"` // Number of Telegram Stars that can be claimed by the receiver instead of the regular gift; 0 if the gift can't be sold by the current user SellStarCount int64 `json:"sell_star_count"` // Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift PrepaidUpgradeStarCount int64 `json:"prepaid_upgrade_star_count"` + // True, if the upgrade was bought after the gift was sent. In this case, prepaid upgrade cost must not be added to the gift cost + IsUpgradeSeparate bool `json:"is_upgrade_separate"` // Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift TransferStarCount int64 `json:"transfer_star_count"` - // Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift + // Point in time (Unix timestamp) when the gift can be transferred to another owner; can be in the past; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift NextTransferDate int32 `json:"next_transfer_date"` - // Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift + // Point in time (Unix timestamp) when the gift can be resold to another user; can be in the past; 0 if the gift can't be resold; only for the receiver of the gift NextResaleDate int32 `json:"next_resale_date"` - // Point in time (Unix timestamp) when the upgraded gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift + // Point in time (Unix timestamp) when the upgraded gift can be transferred to the TON blockchain as an NFT; can be in the past; 0 if NFT export isn't possible; only for the receiver of the gift ExportDate int32 `json:"export_date"` + // If non-empty, then the user can pay for an upgrade of the gift using buyGiftUpgrade + PrepaidUpgradeHash string `json:"prepaid_upgrade_hash"` } func (entity *ReceivedGift) MarshalJSON() ([]byte, error) { @@ -10132,12 +10875,15 @@ func (receivedGift *ReceivedGift) UnmarshalJSON(data []byte) error { WasRefunded bool `json:"was_refunded"` Date int32 `json:"date"` Gift json.RawMessage `json:"gift"` + CollectionIds []int32 `json:"collection_ids"` SellStarCount int64 `json:"sell_star_count"` PrepaidUpgradeStarCount int64 `json:"prepaid_upgrade_star_count"` + IsUpgradeSeparate bool `json:"is_upgrade_separate"` TransferStarCount int64 `json:"transfer_star_count"` NextTransferDate int32 `json:"next_transfer_date"` NextResaleDate int32 `json:"next_resale_date"` ExportDate int32 `json:"export_date"` + PrepaidUpgradeHash string `json:"prepaid_upgrade_hash"` } err := json.Unmarshal(data, &tmp) @@ -10154,12 +10900,15 @@ func (receivedGift *ReceivedGift) UnmarshalJSON(data []byte) error { receivedGift.CanBeTransferred = tmp.CanBeTransferred receivedGift.WasRefunded = tmp.WasRefunded receivedGift.Date = tmp.Date + receivedGift.CollectionIds = tmp.CollectionIds receivedGift.SellStarCount = tmp.SellStarCount receivedGift.PrepaidUpgradeStarCount = tmp.PrepaidUpgradeStarCount + receivedGift.IsUpgradeSeparate = tmp.IsUpgradeSeparate receivedGift.TransferStarCount = tmp.TransferStarCount receivedGift.NextTransferDate = tmp.NextTransferDate receivedGift.NextResaleDate = tmp.NextResaleDate receivedGift.ExportDate = tmp.ExportDate + receivedGift.PrepaidUpgradeHash = tmp.PrepaidUpgradeHash fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) receivedGift.SenderId = fieldSenderId @@ -11077,6 +11826,54 @@ func (*StarTransactionTypeGiftUpgrade) StarTransactionTypeType() string { return TypeStarTransactionTypeGiftUpgrade } +// The transaction is a purchase of an upgrade of a gift owned by another user or channel; for regular users only +type StarTransactionTypeGiftUpgradePurchase struct { + meta + // Owner of the upgraded gift + OwnerId MessageSender `json:"owner_id"` + // The gift + Gift *Gift `json:"gift"` +} + +func (entity *StarTransactionTypeGiftUpgradePurchase) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeGiftUpgradePurchase + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeGiftUpgradePurchase) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeGiftUpgradePurchase) GetType() string { + return TypeStarTransactionTypeGiftUpgradePurchase +} + +func (*StarTransactionTypeGiftUpgradePurchase) StarTransactionTypeType() string { + return TypeStarTransactionTypeGiftUpgradePurchase +} + +func (starTransactionTypeGiftUpgradePurchase *StarTransactionTypeGiftUpgradePurchase) UnmarshalJSON(data []byte) error { + var tmp struct { + OwnerId json.RawMessage `json:"owner_id"` + Gift *Gift `json:"gift"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + starTransactionTypeGiftUpgradePurchase.Gift = tmp.Gift + + fieldOwnerId, _ := UnmarshalMessageSender(tmp.OwnerId) + starTransactionTypeGiftUpgradePurchase.OwnerId = fieldOwnerId + + return nil +} + // The transaction is a purchase of an upgraded gift for some user or channel; for regular users only type StarTransactionTypeUpgradedGiftPurchase struct { meta @@ -11113,8 +11910,10 @@ type StarTransactionTypeUpgradedGiftSale struct { UserId int64 `json:"user_id"` // The gift Gift *UpgradedGift `json:"gift"` - // Information about commission received by Telegram from the transaction - Affiliate *AffiliateInfo `json:"affiliate"` + // The number of Telegram Stars received by the Telegram for each 1000 Telegram Stars received by the seller of the gift + CommissionPerMille int32 `json:"commission_per_mille"` + // The amount of Telegram Stars that were received by Telegram; can be negative for refunds + CommissionStarAmount *StarAmount `json:"commission_star_amount"` } func (entity *StarTransactionTypeUpgradedGiftSale) MarshalJSON() ([]byte, error) { @@ -11448,6 +12247,31 @@ func (*StarTransactionTypeBusinessBotTransferReceive) StarTransactionTypeType() return TypeStarTransactionTypeBusinessBotTransferReceive } +// The transaction is a payment for search of posts in public Telegram channels; for regular users only +type StarTransactionTypePublicPostSearch struct{ + meta +} + +func (entity *StarTransactionTypePublicPostSearch) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypePublicPostSearch + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypePublicPostSearch) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypePublicPostSearch) GetType() string { + return TypeStarTransactionTypePublicPostSearch +} + +func (*StarTransactionTypePublicPostSearch) StarTransactionTypeType() string { + return TypeStarTransactionTypePublicPostSearch +} + // The transaction is a transaction of an unsupported type type StarTransactionTypeUnsupported struct{ meta @@ -11612,6 +12436,68 @@ func (*TonTransactionTypeSuggestedPostPayment) TonTransactionTypeType() string { return TypeTonTransactionTypeSuggestedPostPayment } +// The transaction is a purchase of an upgraded gift for some user or channel; for regular users only +type TonTransactionTypeUpgradedGiftPurchase struct { + meta + // Identifier of the user that sold the gift + UserId int64 `json:"user_id"` + // The gift + Gift *UpgradedGift `json:"gift"` +} + +func (entity *TonTransactionTypeUpgradedGiftPurchase) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TonTransactionTypeUpgradedGiftPurchase + + return json.Marshal((*stub)(entity)) +} + +func (*TonTransactionTypeUpgradedGiftPurchase) GetClass() string { + return ClassTonTransactionType +} + +func (*TonTransactionTypeUpgradedGiftPurchase) GetType() string { + return TypeTonTransactionTypeUpgradedGiftPurchase +} + +func (*TonTransactionTypeUpgradedGiftPurchase) TonTransactionTypeType() string { + return TypeTonTransactionTypeUpgradedGiftPurchase +} + +// The transaction is a sale of an upgraded gift; for regular users only +type TonTransactionTypeUpgradedGiftSale struct { + meta + // Identifier of the user that bought the gift + UserId int64 `json:"user_id"` + // The gift + Gift *UpgradedGift `json:"gift"` + // The number of Toncoins received by the Telegram for each 1000 Toncoins received by the seller of the gift + CommissionPerMille int32 `json:"commission_per_mille"` + // The amount of Toncoins that were received by the Telegram; in the smallest units of the currency + CommissionToncoinAmount int64 `json:"commission_toncoin_amount"` +} + +func (entity *TonTransactionTypeUpgradedGiftSale) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TonTransactionTypeUpgradedGiftSale + + return json.Marshal((*stub)(entity)) +} + +func (*TonTransactionTypeUpgradedGiftSale) GetClass() string { + return ClassTonTransactionType +} + +func (*TonTransactionTypeUpgradedGiftSale) GetType() string { + return TypeTonTransactionTypeUpgradedGiftSale +} + +func (*TonTransactionTypeUpgradedGiftSale) TonTransactionTypeType() string { + return TypeTonTransactionTypeUpgradedGiftSale +} + // The transaction is a transaction of an unsupported type type TonTransactionTypeUnsupported struct{ meta @@ -12087,6 +12973,62 @@ func (*ProfileAccentColor) GetType() string { return TypeProfileAccentColor } +// Contains description of user rating +type UserRating struct { + meta + // The level of the user; may be negative + Level int32 `json:"level"` + // True, if the maximum level is reached + IsMaximumLevelReached bool `json:"is_maximum_level_reached"` + // Numerical value of the rating + Rating int64 `json:"rating"` + // The rating required for the current level + CurrentLevelRating int64 `json:"current_level_rating"` + // The rating required for the next level; 0 if the maximum level is reached + NextLevelRating int64 `json:"next_level_rating"` +} + +func (entity *UserRating) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserRating + + return json.Marshal((*stub)(entity)) +} + +func (*UserRating) GetClass() string { + return ClassUserRating +} + +func (*UserRating) GetType() string { + return TypeUserRating +} + +// Contains information about restrictions that must be applied to a chat or a message +type RestrictionInfo struct { + meta + // A human-readable description of the reason why access to the content must be restricted. If empty, then the content can be accessed, but may be covered by hidden with 18+ spoiler anyway + RestrictionReason string `json:"restriction_reason"` + // True, if media content of the messages must be hidden with 18+ spoiler. Use value of the option "can_ignore_sensitive_content_restrictions" to check whether the current user can ignore the restriction. If age verification parameters were received in updateAgeVerificationParameters, then the user must complete age verification to ignore the restriction. Set the option "ignore_sensitive_content_restrictions" to true if the user passes age verification + HasSensitiveContent bool `json:"has_sensitive_content"` +} + +func (entity *RestrictionInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub RestrictionInfo + + return json.Marshal((*stub)(entity)) +} + +func (*RestrictionInfo) GetClass() string { + return ClassRestrictionInfo +} + +func (*RestrictionInfo) GetType() string { + return TypeRestrictionInfo +} + // A custom emoji set as emoji status type EmojiStatusTypeCustomEmoji struct { meta @@ -12309,8 +13251,8 @@ type User struct { IsPremium bool `json:"is_premium"` // True, if the user is Telegram support account IsSupport bool `json:"is_support"` - // If non-empty, it contains a human-readable description of the reason why access to this user must be restricted - RestrictionReason string `json:"restriction_reason"` + // Information about restrictions that must be applied to the corresponding private chat; may be null if none + RestrictionInfo *RestrictionInfo `json:"restriction_info"` // True, if the user has non-expired stories available to the current user HasActiveStories bool `json:"has_active_stories"` // True, if the user has unread non-expired stories available to the current user @@ -12366,7 +13308,7 @@ func (user *User) UnmarshalJSON(data []byte) error { VerificationStatus *VerificationStatus `json:"verification_status"` IsPremium bool `json:"is_premium"` IsSupport bool `json:"is_support"` - RestrictionReason string `json:"restriction_reason"` + RestrictionInfo *RestrictionInfo `json:"restriction_info"` HasActiveStories bool `json:"has_active_stories"` HasUnreadActiveStories bool `json:"has_unread_active_stories"` RestrictsNewChats bool `json:"restricts_new_chats"` @@ -12400,7 +13342,7 @@ func (user *User) UnmarshalJSON(data []byte) error { user.VerificationStatus = tmp.VerificationStatus user.IsPremium = tmp.IsPremium user.IsSupport = tmp.IsSupport - user.RestrictionReason = tmp.RestrictionReason + user.RestrictionInfo = tmp.RestrictionInfo user.HasActiveStories = tmp.HasActiveStories user.HasUnreadActiveStories = tmp.HasUnreadActiveStories user.RestrictsNewChats = tmp.RestrictsNewChats @@ -12595,6 +13537,16 @@ type UserFullInfo struct { GiftSettings *GiftSettings `json:"gift_settings"` // Information about verification status of the user provided by a bot; may be null if none or unknown BotVerification *BotVerification `json:"bot_verification"` + // The main tab chosen by the user; may be null if not chosen manually + MainProfileTab ProfileTab `json:"main_profile_tab"` + // The first audio file added to the user's profile; may be null if none + FirstProfileAudio *Audio `json:"first_profile_audio"` + // The current rating of the user; may be null if none + Rating *UserRating `json:"rating"` + // The rating of the user after the next change; may be null if the user isn't the current user or there are no pending rating changes + PendingRating *UserRating `json:"pending_rating"` + // Unix timestamp when rating of the user will change to pending_rating; 0 if the user isn't the current user or there are no pending rating changes + PendingRatingDate int32 `json:"pending_rating_date"` // Information about business settings for Telegram Business accounts; may be null if none BusinessInfo *BusinessInfo `json:"business_info"` // For bots, information about the bot; may be null if the user isn't a bot @@ -12641,6 +13593,11 @@ func (userFullInfo *UserFullInfo) UnmarshalJSON(data []byte) error { OutgoingPaidMessageStarCount int64 `json:"outgoing_paid_message_star_count"` GiftSettings *GiftSettings `json:"gift_settings"` BotVerification *BotVerification `json:"bot_verification"` + MainProfileTab json.RawMessage `json:"main_profile_tab"` + FirstProfileAudio *Audio `json:"first_profile_audio"` + Rating *UserRating `json:"rating"` + PendingRating *UserRating `json:"pending_rating"` + PendingRatingDate int32 `json:"pending_rating_date"` BusinessInfo *BusinessInfo `json:"business_info"` BotInfo *BotInfo `json:"bot_info"` } @@ -12671,12 +13628,19 @@ func (userFullInfo *UserFullInfo) UnmarshalJSON(data []byte) error { userFullInfo.OutgoingPaidMessageStarCount = tmp.OutgoingPaidMessageStarCount userFullInfo.GiftSettings = tmp.GiftSettings userFullInfo.BotVerification = tmp.BotVerification + userFullInfo.FirstProfileAudio = tmp.FirstProfileAudio + userFullInfo.Rating = tmp.Rating + userFullInfo.PendingRating = tmp.PendingRating + userFullInfo.PendingRatingDate = tmp.PendingRatingDate userFullInfo.BusinessInfo = tmp.BusinessInfo userFullInfo.BotInfo = tmp.BotInfo fieldBlockList, _ := UnmarshalBlockList(tmp.BlockList) userFullInfo.BlockList = fieldBlockList + fieldMainProfileTab, _ := UnmarshalProfileTab(tmp.MainProfileTab) + userFullInfo.MainProfileTab = fieldMainProfileTab + return nil } @@ -14007,10 +14971,8 @@ type Supergroup struct { HasDirectMessagesGroup bool `json:"has_direct_messages_group"` // True, if the supergroup is a forum, which topics are shown in the same way as in channel direct messages groups HasForumTabs bool `json:"has_forum_tabs"` - // True, if content of media messages in the supergroup or channel chat must be hidden with 18+ spoiler - HasSensitiveContent bool `json:"has_sensitive_content"` - // If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted - RestrictionReason string `json:"restriction_reason"` + // Information about the restrictions that must be applied to the corresponding supergroup or channel chat; may be null if none + RestrictionInfo *RestrictionInfo `json:"restriction_info"` // Number of Telegram Stars that must be paid by non-administrator users of the supergroup chat for each sent message PaidMessageStarCount int64 `json:"paid_message_star_count"` // True, if the supergroup or channel has non-expired stories available to the current user @@ -14060,8 +15022,7 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { VerificationStatus *VerificationStatus `json:"verification_status"` HasDirectMessagesGroup bool `json:"has_direct_messages_group"` HasForumTabs bool `json:"has_forum_tabs"` - HasSensitiveContent bool `json:"has_sensitive_content"` - RestrictionReason string `json:"restriction_reason"` + RestrictionInfo *RestrictionInfo `json:"restriction_info"` PaidMessageStarCount int64 `json:"paid_message_star_count"` HasActiveStories bool `json:"has_active_stories"` HasUnreadActiveStories bool `json:"has_unread_active_stories"` @@ -14094,8 +15055,7 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { supergroup.VerificationStatus = tmp.VerificationStatus supergroup.HasDirectMessagesGroup = tmp.HasDirectMessagesGroup supergroup.HasForumTabs = tmp.HasForumTabs - supergroup.HasSensitiveContent = tmp.HasSensitiveContent - supergroup.RestrictionReason = tmp.RestrictionReason + supergroup.RestrictionInfo = tmp.RestrictionInfo supergroup.PaidMessageStarCount = tmp.PaidMessageStarCount supergroup.HasActiveStories = tmp.HasActiveStories supergroup.HasUnreadActiveStories = tmp.HasUnreadActiveStories @@ -14183,6 +15143,8 @@ type SupergroupFullInfo struct { BotCommands []*BotCommands `json:"bot_commands"` // Information about verification status of the supergroup or the channel provided by a bot; may be null if none or unknown BotVerification *BotVerification `json:"bot_verification"` + // The main tab chosen by the administrators of the channel; may be null if not chosen manually + MainProfileTab ProfileTab `json:"main_profile_tab"` // Identifier of the basic group from which supergroup was upgraded; 0 if none UpgradedFromBasicGroupId int64 `json:"upgraded_from_basic_group_id"` // Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none @@ -14205,6 +15167,101 @@ func (*SupergroupFullInfo) GetType() string { return TypeSupergroupFullInfo } +func (supergroupFullInfo *SupergroupFullInfo) UnmarshalJSON(data []byte) error { + var tmp struct { + Photo *ChatPhoto `json:"photo"` + Description string `json:"description"` + MemberCount int32 `json:"member_count"` + AdministratorCount int32 `json:"administrator_count"` + RestrictedCount int32 `json:"restricted_count"` + BannedCount int32 `json:"banned_count"` + LinkedChatId int64 `json:"linked_chat_id"` + DirectMessagesChatId int64 `json:"direct_messages_chat_id"` + SlowModeDelay int32 `json:"slow_mode_delay"` + SlowModeDelayExpiresIn float64 `json:"slow_mode_delay_expires_in"` + CanEnablePaidMessages bool `json:"can_enable_paid_messages"` + CanEnablePaidReaction bool `json:"can_enable_paid_reaction"` + CanGetMembers bool `json:"can_get_members"` + HasHiddenMembers bool `json:"has_hidden_members"` + CanHideMembers bool `json:"can_hide_members"` + CanSetStickerSet bool `json:"can_set_sticker_set"` + CanSetLocation bool `json:"can_set_location"` + CanGetStatistics bool `json:"can_get_statistics"` + CanGetRevenueStatistics bool `json:"can_get_revenue_statistics"` + CanGetStarRevenueStatistics bool `json:"can_get_star_revenue_statistics"` + CanSendGift bool `json:"can_send_gift"` + CanToggleAggressiveAntiSpam bool `json:"can_toggle_aggressive_anti_spam"` + IsAllHistoryAvailable bool `json:"is_all_history_available"` + CanHaveSponsoredMessages bool `json:"can_have_sponsored_messages"` + HasAggressiveAntiSpamEnabled bool `json:"has_aggressive_anti_spam_enabled"` + HasPaidMediaAllowed bool `json:"has_paid_media_allowed"` + HasPinnedStories bool `json:"has_pinned_stories"` + GiftCount int32 `json:"gift_count"` + MyBoostCount int32 `json:"my_boost_count"` + UnrestrictBoostCount int32 `json:"unrestrict_boost_count"` + OutgoingPaidMessageStarCount int64 `json:"outgoing_paid_message_star_count"` + StickerSetId JsonInt64 `json:"sticker_set_id"` + CustomEmojiStickerSetId JsonInt64 `json:"custom_emoji_sticker_set_id"` + Location *ChatLocation `json:"location"` + InviteLink *ChatInviteLink `json:"invite_link"` + BotCommands []*BotCommands `json:"bot_commands"` + BotVerification *BotVerification `json:"bot_verification"` + MainProfileTab json.RawMessage `json:"main_profile_tab"` + UpgradedFromBasicGroupId int64 `json:"upgraded_from_basic_group_id"` + UpgradedFromMaxMessageId int64 `json:"upgraded_from_max_message_id"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + supergroupFullInfo.Photo = tmp.Photo + supergroupFullInfo.Description = tmp.Description + supergroupFullInfo.MemberCount = tmp.MemberCount + supergroupFullInfo.AdministratorCount = tmp.AdministratorCount + supergroupFullInfo.RestrictedCount = tmp.RestrictedCount + supergroupFullInfo.BannedCount = tmp.BannedCount + supergroupFullInfo.LinkedChatId = tmp.LinkedChatId + supergroupFullInfo.DirectMessagesChatId = tmp.DirectMessagesChatId + supergroupFullInfo.SlowModeDelay = tmp.SlowModeDelay + supergroupFullInfo.SlowModeDelayExpiresIn = tmp.SlowModeDelayExpiresIn + supergroupFullInfo.CanEnablePaidMessages = tmp.CanEnablePaidMessages + supergroupFullInfo.CanEnablePaidReaction = tmp.CanEnablePaidReaction + supergroupFullInfo.CanGetMembers = tmp.CanGetMembers + supergroupFullInfo.HasHiddenMembers = tmp.HasHiddenMembers + supergroupFullInfo.CanHideMembers = tmp.CanHideMembers + supergroupFullInfo.CanSetStickerSet = tmp.CanSetStickerSet + supergroupFullInfo.CanSetLocation = tmp.CanSetLocation + supergroupFullInfo.CanGetStatistics = tmp.CanGetStatistics + supergroupFullInfo.CanGetRevenueStatistics = tmp.CanGetRevenueStatistics + supergroupFullInfo.CanGetStarRevenueStatistics = tmp.CanGetStarRevenueStatistics + supergroupFullInfo.CanSendGift = tmp.CanSendGift + supergroupFullInfo.CanToggleAggressiveAntiSpam = tmp.CanToggleAggressiveAntiSpam + supergroupFullInfo.IsAllHistoryAvailable = tmp.IsAllHistoryAvailable + supergroupFullInfo.CanHaveSponsoredMessages = tmp.CanHaveSponsoredMessages + supergroupFullInfo.HasAggressiveAntiSpamEnabled = tmp.HasAggressiveAntiSpamEnabled + supergroupFullInfo.HasPaidMediaAllowed = tmp.HasPaidMediaAllowed + supergroupFullInfo.HasPinnedStories = tmp.HasPinnedStories + supergroupFullInfo.GiftCount = tmp.GiftCount + supergroupFullInfo.MyBoostCount = tmp.MyBoostCount + supergroupFullInfo.UnrestrictBoostCount = tmp.UnrestrictBoostCount + supergroupFullInfo.OutgoingPaidMessageStarCount = tmp.OutgoingPaidMessageStarCount + supergroupFullInfo.StickerSetId = tmp.StickerSetId + supergroupFullInfo.CustomEmojiStickerSetId = tmp.CustomEmojiStickerSetId + supergroupFullInfo.Location = tmp.Location + supergroupFullInfo.InviteLink = tmp.InviteLink + supergroupFullInfo.BotCommands = tmp.BotCommands + supergroupFullInfo.BotVerification = tmp.BotVerification + supergroupFullInfo.UpgradedFromBasicGroupId = tmp.UpgradedFromBasicGroupId + supergroupFullInfo.UpgradedFromMaxMessageId = tmp.UpgradedFromMaxMessageId + + fieldMainProfileTab, _ := UnmarshalProfileTab(tmp.MainProfileTab) + supergroupFullInfo.MainProfileTab = fieldMainProfileTab + + return nil +} + // The secret chat is not yet created; waiting for the other user to get online type SecretChatStatePending struct{ meta @@ -14340,6 +15397,37 @@ func (secretChat *SecretChat) UnmarshalJSON(data []byte) error { return nil } +// Contains information about public post search limits +type PublicPostSearchLimits struct { + meta + // Number of queries that can be sent daily for free + DailyFreeQueryCount int32 `json:"daily_free_query_count"` + // Number of remaining free queries today + RemainingFreeQueryCount int32 `json:"remaining_free_query_count"` + // Amount of time till the next free query can be sent; 0 if it can be sent now + NextFreeQueryIn int32 `json:"next_free_query_in"` + // Number of Telegram Stars that must be paid for each non-free query + StarCount JsonInt64 `json:"star_count"` + // True, if the search for the specified query isn't charged + IsCurrentQueryFree bool `json:"is_current_query_free"` +} + +func (entity *PublicPostSearchLimits) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PublicPostSearchLimits + + return json.Marshal((*stub)(entity)) +} + +func (*PublicPostSearchLimits) GetClass() string { + return ClassPublicPostSearchLimits +} + +func (*PublicPostSearchLimits) GetType() string { + return TypePublicPostSearchLimits +} + // The message was sent by a known user type MessageSenderUser struct { meta @@ -15968,10 +17056,8 @@ type Message struct { MediaAlbumId JsonInt64 `json:"media_album_id"` // Unique identifier of the effect added to the message; 0 if none EffectId JsonInt64 `json:"effect_id"` - // True, if media content of the message must be hidden with 18+ spoiler - HasSensitiveContent bool `json:"has_sensitive_content"` - // If non-empty, contains a human-readable description of the reason why access to this message must be restricted - RestrictionReason string `json:"restriction_reason"` + // Information about the restrictions that must be applied to the message content; may be null if none + RestrictionInfo *RestrictionInfo `json:"restriction_info"` // Content of the message Content MessageContent `json:"content"` // Reply markup for the message; may be null if none @@ -16031,8 +17117,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { AuthorSignature string `json:"author_signature"` MediaAlbumId JsonInt64 `json:"media_album_id"` EffectId JsonInt64 `json:"effect_id"` - HasSensitiveContent bool `json:"has_sensitive_content"` - RestrictionReason string `json:"restriction_reason"` + RestrictionInfo *RestrictionInfo `json:"restriction_info"` Content json.RawMessage `json:"content"` ReplyMarkup json.RawMessage `json:"reply_markup"` } @@ -16071,8 +17156,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { message.AuthorSignature = tmp.AuthorSignature message.MediaAlbumId = tmp.MediaAlbumId message.EffectId = tmp.EffectId - message.HasSensitiveContent = tmp.HasSensitiveContent - message.RestrictionReason = tmp.RestrictionReason + message.RestrictionInfo = tmp.RestrictionInfo fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) message.SenderId = fieldSenderId @@ -16180,6 +17264,35 @@ func (*FoundChatMessages) GetType() string { return TypeFoundChatMessages } +// Contains a list of messages found by a public post search +type FoundPublicPosts struct { + meta + // List of found public posts + Messages []*Message `json:"messages"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` + // Updated public post search limits after the query; repeated requests with the same query will be free; may be null if they didn't change + SearchLimits *PublicPostSearchLimits `json:"search_limits"` + // True, if the query has failed because search limits are exceeded. In this case search_limits.daily_free_query_count will be equal to 0 + AreLimitsExceeded bool `json:"are_limits_exceeded"` +} + +func (entity *FoundPublicPosts) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FoundPublicPosts + + return json.Marshal((*stub)(entity)) +} + +func (*FoundPublicPosts) GetClass() string { + return ClassFoundPublicPosts +} + +func (*FoundPublicPosts) GetType() string { + return TypeFoundPublicPosts +} + // Contains information about a message in a specific position type MessagePosition struct { meta @@ -18354,8 +19467,8 @@ type Chat struct { EmojiStatus *EmojiStatus `json:"emoji_status"` // Background set for the chat; may be null if none Background *ChatBackground `json:"background"` - // If non-empty, name of a theme, set for the chat - ThemeName string `json:"theme_name"` + // Theme set for the chat; may be null if none + Theme ChatTheme `json:"theme"` // Information about actions which must be possible to do through the chat action bar; may be null if none ActionBar ChatActionBar `json:"action_bar"` // Information about bar for managing a business bot in the chat; may be null if none @@ -18423,7 +19536,7 @@ func (chat *Chat) UnmarshalJSON(data []byte) error { MessageAutoDeleteTime int32 `json:"message_auto_delete_time"` EmojiStatus *EmojiStatus `json:"emoji_status"` Background *ChatBackground `json:"background"` - ThemeName string `json:"theme_name"` + Theme json.RawMessage `json:"theme"` ActionBar json.RawMessage `json:"action_bar"` BusinessBotManageBar *BusinessBotManageBar `json:"business_bot_manage_bar"` VideoChat *VideoChat `json:"video_chat"` @@ -18466,7 +19579,6 @@ func (chat *Chat) UnmarshalJSON(data []byte) error { chat.MessageAutoDeleteTime = tmp.MessageAutoDeleteTime chat.EmojiStatus = tmp.EmojiStatus chat.Background = tmp.Background - chat.ThemeName = tmp.ThemeName chat.BusinessBotManageBar = tmp.BusinessBotManageBar chat.VideoChat = tmp.VideoChat chat.PendingJoinRequests = tmp.PendingJoinRequests @@ -18489,6 +19601,9 @@ func (chat *Chat) UnmarshalJSON(data []byte) error { fieldAvailableReactions, _ := UnmarshalChatAvailableReactions(tmp.AvailableReactions) chat.AvailableReactions = fieldAvailableReactions + fieldTheme, _ := UnmarshalChatTheme(tmp.Theme) + chat.Theme = fieldTheme + fieldActionBar, _ := UnmarshalChatActionBar(tmp.ActionBar) chat.ActionBar = fieldActionBar @@ -20418,14 +21533,141 @@ func (*SharedChat) GetType() string { return TypeSharedChat } +// Classic light theme +type BuiltInThemeClassic struct{ + meta +} + +func (entity *BuiltInThemeClassic) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BuiltInThemeClassic + + return json.Marshal((*stub)(entity)) +} + +func (*BuiltInThemeClassic) GetClass() string { + return ClassBuiltInTheme +} + +func (*BuiltInThemeClassic) GetType() string { + return TypeBuiltInThemeClassic +} + +func (*BuiltInThemeClassic) BuiltInThemeType() string { + return TypeBuiltInThemeClassic +} + +// Regular light theme +type BuiltInThemeDay struct{ + meta +} + +func (entity *BuiltInThemeDay) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BuiltInThemeDay + + return json.Marshal((*stub)(entity)) +} + +func (*BuiltInThemeDay) GetClass() string { + return ClassBuiltInTheme +} + +func (*BuiltInThemeDay) GetType() string { + return TypeBuiltInThemeDay +} + +func (*BuiltInThemeDay) BuiltInThemeType() string { + return TypeBuiltInThemeDay +} + +// Regular dark theme +type BuiltInThemeNight struct{ + meta +} + +func (entity *BuiltInThemeNight) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BuiltInThemeNight + + return json.Marshal((*stub)(entity)) +} + +func (*BuiltInThemeNight) GetClass() string { + return ClassBuiltInTheme +} + +func (*BuiltInThemeNight) GetType() string { + return TypeBuiltInThemeNight +} + +func (*BuiltInThemeNight) BuiltInThemeType() string { + return TypeBuiltInThemeNight +} + +// Tinted dark theme +type BuiltInThemeTinted struct{ + meta +} + +func (entity *BuiltInThemeTinted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BuiltInThemeTinted + + return json.Marshal((*stub)(entity)) +} + +func (*BuiltInThemeTinted) GetClass() string { + return ClassBuiltInTheme +} + +func (*BuiltInThemeTinted) GetType() string { + return TypeBuiltInThemeTinted +} + +func (*BuiltInThemeTinted) BuiltInThemeType() string { + return TypeBuiltInThemeTinted +} + +// Arctic light theme +type BuiltInThemeArctic struct{ + meta +} + +func (entity *BuiltInThemeArctic) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BuiltInThemeArctic + + return json.Marshal((*stub)(entity)) +} + +func (*BuiltInThemeArctic) GetClass() string { + return ClassBuiltInTheme +} + +func (*BuiltInThemeArctic) GetType() string { + return TypeBuiltInThemeArctic +} + +func (*BuiltInThemeArctic) BuiltInThemeType() string { + return TypeBuiltInThemeArctic +} + // Describes theme settings type ThemeSettings struct { meta + // Base theme for this theme + BaseTheme BuiltInTheme `json:"base_theme"` // Theme accent color in ARGB format AccentColor int32 `json:"accent_color"` // The background to be used in chats; may be null Background *Background `json:"background"` - // The fill to be used as a background for outgoing messages + // The fill to be used as a background for outgoing messages; may be null if the fill from the base theme must be used instead OutgoingMessageFill BackgroundFill `json:"outgoing_message_fill"` // If true, the freeform gradient fill needs to be animated on every sent message AnimateOutgoingMessageFill bool `json:"animate_outgoing_message_fill"` @@ -20451,6 +21693,7 @@ func (*ThemeSettings) GetType() string { func (themeSettings *ThemeSettings) UnmarshalJSON(data []byte) error { var tmp struct { + BaseTheme json.RawMessage `json:"base_theme"` AccentColor int32 `json:"accent_color"` Background *Background `json:"background"` OutgoingMessageFill json.RawMessage `json:"outgoing_message_fill"` @@ -20468,6 +21711,9 @@ func (themeSettings *ThemeSettings) UnmarshalJSON(data []byte) error { themeSettings.AnimateOutgoingMessageFill = tmp.AnimateOutgoingMessageFill themeSettings.OutgoingMessageAccentColor = tmp.OutgoingMessageAccentColor + fieldBaseTheme, _ := UnmarshalBuiltInTheme(tmp.BaseTheme) + themeSettings.BaseTheme = fieldBaseTheme + fieldOutgoingMessageFill, _ := UnmarshalBackgroundFill(tmp.OutgoingMessageFill) themeSettings.OutgoingMessageFill = fieldOutgoingMessageFill @@ -23130,6 +24376,33 @@ func (linkPreviewTypeChat *LinkPreviewTypeChat) UnmarshalJSON(data []byte) error return nil } +// The link is a link to a direct messages chat of a channel +type LinkPreviewTypeDirectMessagesChat struct { + meta + // Photo of the channel chat; may be null + Photo *ChatPhoto `json:"photo"` +} + +func (entity *LinkPreviewTypeDirectMessagesChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeDirectMessagesChat + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeDirectMessagesChat) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeDirectMessagesChat) GetType() string { + return TypeLinkPreviewTypeDirectMessagesChat +} + +func (*LinkPreviewTypeDirectMessagesChat) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeDirectMessagesChat +} + // The link is a link to a general file type LinkPreviewTypeDocument struct { meta @@ -23328,6 +24601,33 @@ func (*LinkPreviewTypeExternalVideo) LinkPreviewTypeType() string { return TypeLinkPreviewTypeExternalVideo } +// The link is a link to a gift collection +type LinkPreviewTypeGiftCollection struct { + meta + // Icons for some gifts from the collection; may be empty + Icons []*Sticker `json:"icons"` +} + +func (entity *LinkPreviewTypeGiftCollection) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeGiftCollection + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeGiftCollection) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeGiftCollection) GetType() string { + return TypeLinkPreviewTypeGiftCollection +} + +func (*LinkPreviewTypeGiftCollection) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeGiftCollection +} + // The link is a link to a group call that isn't bound to a chat type LinkPreviewTypeGroupCall struct{ meta @@ -23563,6 +24863,35 @@ func (*LinkPreviewTypeStory) LinkPreviewTypeType() string { return TypeLinkPreviewTypeStory } +// The link is a link to an album of stories +type LinkPreviewTypeStoryAlbum struct { + meta + // Icon of the album; may be null if none + PhotoIcon *Photo `json:"photo_icon"` + // Video icon of the album; may be null if none + VideoIcon *Video `json:"video_icon"` +} + +func (entity *LinkPreviewTypeStoryAlbum) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeStoryAlbum + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeStoryAlbum) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeStoryAlbum) GetType() string { + return TypeLinkPreviewTypeStoryAlbum +} + +func (*LinkPreviewTypeStoryAlbum) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeStoryAlbum +} + // The link is a link to boost a supergroup chat type LinkPreviewTypeSupergroupBoost struct { meta @@ -28761,8 +30090,8 @@ func (*MessageChatSetBackground) MessageContentType() string { // A theme in the chat has been changed type MessageChatSetTheme struct { meta - // If non-empty, name of a new theme, set for the chat. Otherwise, chat theme was reset to the default one - ThemeName string `json:"theme_name"` + // New theme for the chat; may be null if chat theme was reset to the default one + Theme ChatTheme `json:"theme"` } func (entity *MessageChatSetTheme) MarshalJSON() ([]byte, error) { @@ -28785,6 +30114,22 @@ func (*MessageChatSetTheme) MessageContentType() string { return TypeMessageChatSetTheme } +func (messageChatSetTheme *MessageChatSetTheme) UnmarshalJSON(data []byte) error { + var tmp struct { + Theme json.RawMessage `json:"theme"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldTheme, _ := UnmarshalChatTheme(tmp.Theme) + messageChatSetTheme.Theme = fieldTheme + + return nil +} + // The auto-delete or self-destruct timer for messages in the chat has been changed type MessageChatSetMessageAutoDeleteTime struct { meta @@ -29637,7 +30982,7 @@ type MessageGift struct { meta // The gift Gift *Gift `json:"gift"` - // Sender of the gift + // Sender of the gift; may be null for outgoing messages about prepaid upgrade of gifts from unknown users SenderId MessageSender `json:"sender_id"` // Receiver of the gift ReceiverId MessageSender `json:"receiver_id"` @@ -29649,10 +30994,14 @@ type MessageGift struct { SellStarCount int64 `json:"sell_star_count"` // Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift PrepaidUpgradeStarCount int64 `json:"prepaid_upgrade_star_count"` + // True, if the upgrade was bought after the gift was sent. In this case, prepaid upgrade cost must not be added to the gift cost + IsUpgradeSeparate bool `json:"is_upgrade_separate"` // True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone will be able to see them IsPrivate bool `json:"is_private"` // True, if the gift is displayed on the user's or the channel's profile page; only for the receiver of the gift IsSaved bool `json:"is_saved"` + // True, if the message is about prepaid upgrade of the gift by another user + IsPrepaidUpgrade bool `json:"is_prepaid_upgrade"` // True, if the gift can be upgraded to a unique gift; only for the receiver of the gift CanBeUpgraded bool `json:"can_be_upgraded"` // True, if the gift was converted to Telegram Stars; only for the receiver of the gift @@ -29663,6 +31012,8 @@ type MessageGift struct { WasRefunded bool `json:"was_refunded"` // Identifier of the corresponding upgraded gift; may be empty if unknown. Use getReceivedGift to get information about the gift UpgradedReceivedGiftId string `json:"upgraded_received_gift_id"` + // If non-empty, then the user can pay for an upgrade of the gift using buyGiftUpgrade + PrepaidUpgradeHash string `json:"prepaid_upgrade_hash"` } func (entity *MessageGift) MarshalJSON() ([]byte, error) { @@ -29694,13 +31045,16 @@ func (messageGift *MessageGift) UnmarshalJSON(data []byte) error { Text *FormattedText `json:"text"` SellStarCount int64 `json:"sell_star_count"` PrepaidUpgradeStarCount int64 `json:"prepaid_upgrade_star_count"` + IsUpgradeSeparate bool `json:"is_upgrade_separate"` IsPrivate bool `json:"is_private"` IsSaved bool `json:"is_saved"` + IsPrepaidUpgrade bool `json:"is_prepaid_upgrade"` CanBeUpgraded bool `json:"can_be_upgraded"` WasConverted bool `json:"was_converted"` WasUpgraded bool `json:"was_upgraded"` WasRefunded bool `json:"was_refunded"` UpgradedReceivedGiftId string `json:"upgraded_received_gift_id"` + PrepaidUpgradeHash string `json:"prepaid_upgrade_hash"` } err := json.Unmarshal(data, &tmp) @@ -29713,13 +31067,16 @@ func (messageGift *MessageGift) UnmarshalJSON(data []byte) error { messageGift.Text = tmp.Text messageGift.SellStarCount = tmp.SellStarCount messageGift.PrepaidUpgradeStarCount = tmp.PrepaidUpgradeStarCount + messageGift.IsUpgradeSeparate = tmp.IsUpgradeSeparate messageGift.IsPrivate = tmp.IsPrivate messageGift.IsSaved = tmp.IsSaved + messageGift.IsPrepaidUpgrade = tmp.IsPrepaidUpgrade messageGift.CanBeUpgraded = tmp.CanBeUpgraded messageGift.WasConverted = tmp.WasConverted messageGift.WasUpgraded = tmp.WasUpgraded messageGift.WasRefunded = tmp.WasRefunded messageGift.UpgradedReceivedGiftId = tmp.UpgradedReceivedGiftId + messageGift.PrepaidUpgradeHash = tmp.PrepaidUpgradeHash fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) messageGift.SenderId = fieldSenderId @@ -29751,11 +31108,11 @@ type MessageUpgradedGift struct { WasTransferred bool `json:"was_transferred"` // Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift TransferStarCount int64 `json:"transfer_star_count"` - // Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift + // Point in time (Unix timestamp) when the gift can be transferred to another owner; can be in the past; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift NextTransferDate int32 `json:"next_transfer_date"` - // Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift + // Point in time (Unix timestamp) when the gift can be resold to another user; can be in the past; 0 if the gift can't be resold; only for the receiver of the gift NextResaleDate int32 `json:"next_resale_date"` - // Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift + // Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT; can be in the past; 0 if NFT export isn't possible; only for the receiver of the gift ExportDate int32 `json:"export_date"` } @@ -29831,8 +31188,8 @@ type MessageRefundedUpgradedGift struct { SenderId MessageSender `json:"sender_id"` // Receiver of the gift ReceiverId MessageSender `json:"receiver_id"` - // True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift - IsUpgrade bool `json:"is_upgrade"` + // Origin of the upgraded gift + Origin UpgradedGiftOrigin `json:"origin"` } func (entity *MessageRefundedUpgradedGift) MarshalJSON() ([]byte, error) { @@ -29860,7 +31217,7 @@ func (messageRefundedUpgradedGift *MessageRefundedUpgradedGift) UnmarshalJSON(da Gift *Gift `json:"gift"` SenderId json.RawMessage `json:"sender_id"` ReceiverId json.RawMessage `json:"receiver_id"` - IsUpgrade bool `json:"is_upgrade"` + Origin json.RawMessage `json:"origin"` } err := json.Unmarshal(data, &tmp) @@ -29869,7 +31226,6 @@ func (messageRefundedUpgradedGift *MessageRefundedUpgradedGift) UnmarshalJSON(da } messageRefundedUpgradedGift.Gift = tmp.Gift - messageRefundedUpgradedGift.IsUpgrade = tmp.IsUpgrade fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) messageRefundedUpgradedGift.SenderId = fieldSenderId @@ -29877,6 +31233,9 @@ func (messageRefundedUpgradedGift *MessageRefundedUpgradedGift) UnmarshalJSON(da fieldReceiverId, _ := UnmarshalMessageSender(tmp.ReceiverId) messageRefundedUpgradedGift.ReceiverId = fieldReceiverId + fieldOrigin, _ := UnmarshalUpgradedGiftOrigin(tmp.Origin) + messageRefundedUpgradedGift.Origin = fieldOrigin + return nil } @@ -35319,6 +36678,8 @@ type Story struct { IsPostedToChatPage bool `json:"is_posted_to_chat_page"` // True, if the story is visible only for the current user IsVisibleOnlyForSelf bool `json:"is_visible_only_for_self"` + // True, if the story can be added to an album + CanBeAddedToAlbum bool `json:"can_be_added_to_album"` // True, if the story can be deleted CanBeDeleted bool `json:"can_be_deleted"` // True, if the story can be edited @@ -35349,6 +36710,8 @@ type Story struct { Areas []*StoryArea `json:"areas"` // Caption of the story Caption *FormattedText `json:"caption"` + // Identifiers of story albums to which the story is added; only for manageable stories + AlbumIds []int32 `json:"album_ids"` } func (entity *Story) MarshalJSON() ([]byte, error) { @@ -35378,6 +36741,7 @@ func (story *Story) UnmarshalJSON(data []byte) error { IsEdited bool `json:"is_edited"` IsPostedToChatPage bool `json:"is_posted_to_chat_page"` IsVisibleOnlyForSelf bool `json:"is_visible_only_for_self"` + CanBeAddedToAlbum bool `json:"can_be_added_to_album"` CanBeDeleted bool `json:"can_be_deleted"` CanBeEdited bool `json:"can_be_edited"` CanBeForwarded bool `json:"can_be_forwarded"` @@ -35393,6 +36757,7 @@ func (story *Story) UnmarshalJSON(data []byte) error { Content json.RawMessage `json:"content"` Areas []*StoryArea `json:"areas"` Caption *FormattedText `json:"caption"` + AlbumIds []int32 `json:"album_ids"` } err := json.Unmarshal(data, &tmp) @@ -35408,6 +36773,7 @@ func (story *Story) UnmarshalJSON(data []byte) error { story.IsEdited = tmp.IsEdited story.IsPostedToChatPage = tmp.IsPostedToChatPage story.IsVisibleOnlyForSelf = tmp.IsVisibleOnlyForSelf + story.CanBeAddedToAlbum = tmp.CanBeAddedToAlbum story.CanBeDeleted = tmp.CanBeDeleted story.CanBeEdited = tmp.CanBeEdited story.CanBeForwarded = tmp.CanBeForwarded @@ -35420,6 +36786,7 @@ func (story *Story) UnmarshalJSON(data []byte) error { story.InteractionInfo = tmp.InteractionInfo story.Areas = tmp.Areas story.Caption = tmp.Caption + story.AlbumIds = tmp.AlbumIds fieldPosterId, _ := UnmarshalMessageSender(tmp.PosterId) story.PosterId = fieldPosterId @@ -35490,6 +36857,58 @@ func (*FoundStories) GetType() string { return TypeFoundStories } +// Describes album of stories +type StoryAlbum struct { + meta + // Unique identifier of the album + Id int32 `json:"id"` + // Name of the album + Name string `json:"name"` + // Icon of the album; may be null if none + PhotoIcon *Photo `json:"photo_icon"` + // Video icon of the album; may be null if none + VideoIcon *Video `json:"video_icon"` +} + +func (entity *StoryAlbum) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryAlbum + + return json.Marshal((*stub)(entity)) +} + +func (*StoryAlbum) GetClass() string { + return ClassStoryAlbum +} + +func (*StoryAlbum) GetType() string { + return TypeStoryAlbum +} + +// Represents a list of story albums +type StoryAlbums struct { + meta + // List of story albums + Albums []*StoryAlbum `json:"albums"` +} + +func (entity *StoryAlbums) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryAlbums + + return json.Marshal((*stub)(entity)) +} + +func (*StoryAlbums) GetClass() string { + return ClassStoryAlbums +} + +func (*StoryAlbums) GetType() string { + return TypeStoryAlbums +} + // Contains identifier of a story along with identifier of the chat that posted it type StoryFullId struct { meta @@ -35551,6 +36970,8 @@ type ChatActiveStories struct { List StoryList `json:"list"` // A parameter used to determine order of the stories in the story list; 0 if the stories doesn't need to be shown in the story list. Stories must be sorted by the pair (order, story_poster_chat_id) in descending order Order int64 `json:"order"` + // True, if the stories are shown in the main story list and can be archived; otherwise, the stories can be hidden from the main story list only by calling removeTopChat with topChatCategoryUsers and the chat_id. Stories of the current user can't be archived nor hidden using removeTopChat + CanBeArchived bool `json:"can_be_archived"` // Identifier of the last read active story MaxReadStoryId int32 `json:"max_read_story_id"` // Basic information about the stories; use getStory to get full information about the stories. The stories are in chronological order (i.e., in order of increasing story identifiers) @@ -35578,6 +36999,7 @@ func (chatActiveStories *ChatActiveStories) UnmarshalJSON(data []byte) error { ChatId int64 `json:"chat_id"` List json.RawMessage `json:"list"` Order int64 `json:"order"` + CanBeArchived bool `json:"can_be_archived"` MaxReadStoryId int32 `json:"max_read_story_id"` Stories []*StoryInfo `json:"stories"` } @@ -35589,6 +37011,7 @@ func (chatActiveStories *ChatActiveStories) UnmarshalJSON(data []byte) error { chatActiveStories.ChatId = tmp.ChatId chatActiveStories.Order = tmp.Order + chatActiveStories.CanBeArchived = tmp.CanBeArchived chatActiveStories.MaxReadStoryId = tmp.MaxReadStoryId chatActiveStories.Stories = tmp.Stories @@ -44983,6 +46406,8 @@ type StorePaymentPurposeStars struct { Amount int64 `json:"amount"` // Number of bought Telegram Stars StarCount int64 `json:"star_count"` + // Identifier of the chat that is supposed to receive the Telegram Stars; pass 0 if none + ChatId int64 `json:"chat_id"` } func (entity *StorePaymentPurposeStars) MarshalJSON() ([]byte, error) { @@ -45212,6 +46637,8 @@ type TelegramPaymentPurposeStars struct { Amount int64 `json:"amount"` // Number of bought Telegram Stars StarCount int64 `json:"star_count"` + // Identifier of the chat that is supposed to receive the Telegram Stars; pass 0 if none + ChatId int64 `json:"chat_id"` } func (entity *TelegramPaymentPurposeStars) MarshalJSON() ([]byte, error) { @@ -45903,10 +47330,10 @@ func (backgroundTypeFill *BackgroundTypeFill) UnmarshalJSON(data []byte) error { return nil } -// A background from a chat theme; can be used only as a chat background in channels +// A background from a chat theme based on an emoji; can be used only as a chat background in channels type BackgroundTypeChatTheme struct { meta - // Name of the chat theme + // Name of the emoji chat theme ThemeName string `json:"theme_name"` } @@ -46027,8 +47454,8 @@ func (*InputBackgroundPrevious) InputBackgroundType() string { return TypeInputBackgroundPrevious } -// Describes a chat theme -type ChatTheme struct { +// Describes a chat theme based on an emoji +type EmojiChatTheme struct { meta // Theme name Name string `json:"name"` @@ -46038,20 +47465,180 @@ type ChatTheme struct { DarkSettings *ThemeSettings `json:"dark_settings"` } -func (entity *ChatTheme) MarshalJSON() ([]byte, error) { +func (entity *EmojiChatTheme) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ChatTheme + type stub EmojiChatTheme return json.Marshal((*stub)(entity)) } -func (*ChatTheme) GetClass() string { +func (*EmojiChatTheme) GetClass() string { + return ClassEmojiChatTheme +} + +func (*EmojiChatTheme) GetType() string { + return TypeEmojiChatTheme +} + +// Describes a chat theme based on an upgraded gift +type GiftChatTheme struct { + meta + // The gift + Gift *UpgradedGift `json:"gift"` + // Theme settings for a light chat theme + LightSettings *ThemeSettings `json:"light_settings"` + // Theme settings for a dark chat theme + DarkSettings *ThemeSettings `json:"dark_settings"` +} + +func (entity *GiftChatTheme) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftChatTheme + + return json.Marshal((*stub)(entity)) +} + +func (*GiftChatTheme) GetClass() string { + return ClassGiftChatTheme +} + +func (*GiftChatTheme) GetType() string { + return TypeGiftChatTheme +} + +// Contains a list of chat themes based on upgraded gifts +type GiftChatThemes struct { + meta + // A list of chat themes + Themes []*GiftChatTheme `json:"themes"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` +} + +func (entity *GiftChatThemes) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftChatThemes + + return json.Marshal((*stub)(entity)) +} + +func (*GiftChatThemes) GetClass() string { + return ClassGiftChatThemes +} + +func (*GiftChatThemes) GetType() string { + return TypeGiftChatThemes +} + +// A chat theme based on an emoji +type ChatThemeEmoji struct { + meta + // Name of the theme; full theme description is received through updateEmojiChatThemes + Name string `json:"name"` +} + +func (entity *ChatThemeEmoji) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatThemeEmoji + + return json.Marshal((*stub)(entity)) +} + +func (*ChatThemeEmoji) GetClass() string { return ClassChatTheme } -func (*ChatTheme) GetType() string { - return TypeChatTheme +func (*ChatThemeEmoji) GetType() string { + return TypeChatThemeEmoji +} + +func (*ChatThemeEmoji) ChatThemeType() string { + return TypeChatThemeEmoji +} + +// A chat theme based on an upgraded gift +type ChatThemeGift struct { + meta + // The chat theme + GiftTheme *GiftChatTheme `json:"gift_theme"` +} + +func (entity *ChatThemeGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatThemeGift + + return json.Marshal((*stub)(entity)) +} + +func (*ChatThemeGift) GetClass() string { + return ClassChatTheme +} + +func (*ChatThemeGift) GetType() string { + return TypeChatThemeGift +} + +func (*ChatThemeGift) ChatThemeType() string { + return TypeChatThemeGift +} + +// A theme based on an emoji +type InputChatThemeEmoji struct { + meta + // Name of the theme + Name string `json:"name"` +} + +func (entity *InputChatThemeEmoji) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputChatThemeEmoji + + return json.Marshal((*stub)(entity)) +} + +func (*InputChatThemeEmoji) GetClass() string { + return ClassInputChatTheme +} + +func (*InputChatThemeEmoji) GetType() string { + return TypeInputChatThemeEmoji +} + +func (*InputChatThemeEmoji) InputChatThemeType() string { + return TypeInputChatThemeEmoji +} + +// A theme based on an upgraded gift +type InputChatThemeGift struct { + meta + // Name of the upgraded gift. A gift can be used only in one chat in a time. When the same gift is used in another chat, theme in the previous chat is reset to default + Name string `json:"name"` +} + +func (entity *InputChatThemeGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputChatThemeGift + + return json.Marshal((*stub)(entity)) +} + +func (*InputChatThemeGift) GetClass() string { + return ClassInputChatTheme +} + +func (*InputChatThemeGift) GetType() string { + return TypeInputChatThemeGift +} + +func (*InputChatThemeGift) InputChatThemeType() string { + return TypeInputChatThemeGift } // Describes a time zone @@ -46887,8 +48474,10 @@ func (*PushMessageContentContact) PushMessageContentType() string { } // A contact has registered with Telegram -type PushMessageContentContactRegistered struct{ +type PushMessageContentContactRegistered struct { meta + // True, if the user joined Telegram as a Telegram Premium account + AsPremiumAccount bool `json:"as_premium_account"` } func (entity *PushMessageContentContactRegistered) MarshalJSON() ([]byte, error) { @@ -47235,6 +48824,8 @@ type PushMessageContentGift struct { meta // Number of Telegram Stars that sender paid for the gift StarCount int64 `json:"star_count"` + // True, if the message is about prepaid upgrade of the gift by another user instead of actual receiving of a new gift + IsPrepaidUpgrade bool `json:"is_prepaid_upgrade"` } func (entity *PushMessageContentGift) MarshalJSON() ([]byte, error) { @@ -47260,8 +48851,10 @@ func (*PushMessageContentGift) PushMessageContentType() string { // A message with an upgraded gift type PushMessageContentUpgradedGift struct { meta - // True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift + // True, if the gift was obtained by upgrading of a previously received gift; otherwise, if is_prepaid_upgrade == false, then this is a transferred or resold gift IsUpgrade bool `json:"is_upgrade"` + // True, if the message is about completion of prepaid upgrade of the gift instead of actual receiving of a new gift + IsPrepaidUpgrade bool `json:"is_prepaid_upgrade"` } func (entity *PushMessageContentUpgradedGift) MarshalJSON() ([]byte, error) { @@ -47733,8 +49326,8 @@ func (*PushMessageContentChatSetBackground) PushMessageContentType() string { // A chat theme was edited type PushMessageContentChatSetTheme struct { meta - // If non-empty, name of a new theme, set for the chat. Otherwise, the chat theme was reset to the default one - ThemeName string `json:"theme_name"` + // If non-empty, human-readable name of the new theme. Otherwise, the chat theme was reset to the default one + Name string `json:"name"` } func (entity *PushMessageContentChatSetTheme) MarshalJSON() ([]byte, error) { @@ -51268,6 +52861,33 @@ func (*InternalLinkTypeDefaultMessageAutoDeleteTimerSettings) InternalLinkTypeTy return TypeInternalLinkTypeDefaultMessageAutoDeleteTimerSettings } +// The link is a link to a channel direct messages chat by username of the channel. Call searchPublicChat with the given chat username to process the link. If the chat is found and is channel, open the direct messages chat of the channel +type InternalLinkTypeDirectMessagesChat struct { + meta + // Username of the channel + ChannelUsername string `json:"channel_username"` +} + +func (entity *InternalLinkTypeDirectMessagesChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeDirectMessagesChat + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeDirectMessagesChat) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeDirectMessagesChat) GetType() string { + return TypeInternalLinkTypeDirectMessagesChat +} + +func (*InternalLinkTypeDirectMessagesChat) InternalLinkTypeType() string { + return TypeInternalLinkTypeDirectMessagesChat +} + // The link is a link to the edit profile section of the application settings type InternalLinkTypeEditProfileSettings struct{ meta @@ -51322,6 +52942,35 @@ func (*InternalLinkTypeGame) InternalLinkTypeType() string { return TypeInternalLinkTypeGame } +// The link is a link to a gift collection. Call searchPublicChat with the given username, then call getReceivedGifts with the received gift owner identifier and the given collection identifier, then show the collection if received +type InternalLinkTypeGiftCollection struct { + meta + // Username of the owner of the gift collection + GiftOwnerUsername string `json:"gift_owner_username"` + // Gift collection identifier + CollectionId int32 `json:"collection_id"` +} + +func (entity *InternalLinkTypeGiftCollection) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeGiftCollection + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeGiftCollection) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeGiftCollection) GetType() string { + return TypeInternalLinkTypeGiftCollection +} + +func (*InternalLinkTypeGiftCollection) InternalLinkTypeType() string { + return TypeInternalLinkTypeGiftCollection +} + // The link is a link to a group call that isn't bound to a chat. Use getGroupCallParticipants to get the list of group call participants and show them on the join group call screen. Call joinGroupCall with the given invite_link to join the call type InternalLinkTypeGroupCall struct { meta @@ -52001,6 +53650,35 @@ func (*InternalLinkTypeStory) InternalLinkTypeType() string { return TypeInternalLinkTypeStory } +// The link is a link to an album of stories. Call searchPublicChat with the given username, then call getStoryAlbumStories with the received chat identifier and the given story album identifier, then show the story album if received +type InternalLinkTypeStoryAlbum struct { + meta + // Username of the owner of the story album + StoryAlbumOwnerUsername string `json:"story_album_owner_username"` + // Story album identifier + StoryAlbumId int32 `json:"story_album_id"` +} + +func (entity *InternalLinkTypeStoryAlbum) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeStoryAlbum + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeStoryAlbum) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeStoryAlbum) GetType() string { + return TypeInternalLinkTypeStoryAlbum +} + +func (*InternalLinkTypeStoryAlbum) InternalLinkTypeType() string { + return TypeInternalLinkTypeStoryAlbum +} + // The link is a link to a cloud theme. TDLib has no theme support yet type InternalLinkTypeTheme struct { meta @@ -53825,6 +55503,33 @@ func (*ConnectionStateReady) ConnectionStateType() string { return TypeConnectionStateReady } +// Describes parameters for age verification of the current user +type AgeVerificationParameters struct { + meta + // The minimum age required to view restricted content + MinAge int32 `json:"min_age"` + // Username of the bot which main Web App may be used to verify age of the user + VerificationBotUsername string `json:"verification_bot_username"` + // Unique name for the country or region, which legislation required age verification. May be used to get the corresponding localization key + Country string `json:"country"` +} + +func (entity *AgeVerificationParameters) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AgeVerificationParameters + + return json.Marshal((*stub)(entity)) +} + +func (*AgeVerificationParameters) GetClass() string { + return ClassAgeVerificationParameters +} + +func (*AgeVerificationParameters) GetType() string { + return TypeAgeVerificationParameters +} + // A category containing frequently used private chats with non-bot users type TopChatCategoryUsers struct{ meta @@ -56155,7 +57860,7 @@ func (*ChatRevenueTransactions) GetType() string { return TypeChatRevenueTransactions } -// Contains information about Telegram Stars earned by a bot or a chat +// Contains information about Telegram Stars earned by a user or a chat type StarRevenueStatus struct { meta // Total amount of Telegram Stars earned @@ -56186,7 +57891,7 @@ func (*StarRevenueStatus) GetType() string { return TypeStarRevenueStatus } -// A detailed statistics about Telegram Stars earned by a bot or a chat +// A detailed statistics about Telegram Stars earned by a user or a chat type StarRevenueStatistics struct { meta // A graph containing amount of revenue in a given day @@ -56234,6 +57939,83 @@ func (starRevenueStatistics *StarRevenueStatistics) UnmarshalJSON(data []byte) e return nil } +// Contains information about Toncoins earned by the current user +type TonRevenueStatus struct { + meta + // Total amount of Toncoins earned; in the smallest units of the cryptocurrency + TotalAmount JsonInt64 `json:"total_amount"` + // Amount of Toncoins that aren't withdrawn yet; in the smallest units of the cryptocurrency + BalanceAmount JsonInt64 `json:"balance_amount"` + // Amount of Toncoins that are available for withdrawal; in the smallest units of the cryptocurrency + AvailableAmount JsonInt64 `json:"available_amount"` + // True, if Toncoins can be withdrawn + WithdrawalEnabled bool `json:"withdrawal_enabled"` +} + +func (entity *TonRevenueStatus) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TonRevenueStatus + + return json.Marshal((*stub)(entity)) +} + +func (*TonRevenueStatus) GetClass() string { + return ClassTonRevenueStatus +} + +func (*TonRevenueStatus) GetType() string { + return TypeTonRevenueStatus +} + +// A detailed statistics about Toncoins earned by the current user +type TonRevenueStatistics struct { + meta + // A graph containing amount of revenue in a given day + RevenueByDayGraph StatisticalGraph `json:"revenue_by_day_graph"` + // Amount of earned revenue + Status *TonRevenueStatus `json:"status"` + // Current conversion rate of nanotoncoin to USD cents + UsdRate float64 `json:"usd_rate"` +} + +func (entity *TonRevenueStatistics) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TonRevenueStatistics + + return json.Marshal((*stub)(entity)) +} + +func (*TonRevenueStatistics) GetClass() string { + return ClassTonRevenueStatistics +} + +func (*TonRevenueStatistics) GetType() string { + return TypeTonRevenueStatistics +} + +func (tonRevenueStatistics *TonRevenueStatistics) UnmarshalJSON(data []byte) error { + var tmp struct { + RevenueByDayGraph json.RawMessage `json:"revenue_by_day_graph"` + Status *TonRevenueStatus `json:"status"` + UsdRate float64 `json:"usd_rate"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + tonRevenueStatistics.Status = tmp.Status + tonRevenueStatistics.UsdRate = tmp.UsdRate + + fieldRevenueByDayGraph, _ := UnmarshalStatisticalGraph(tmp.RevenueByDayGraph) + tonRevenueStatistics.RevenueByDayGraph = fieldRevenueByDayGraph + + return nil +} + // A point on a Cartesian plane type Point struct { meta @@ -57867,8 +59649,8 @@ type UpdateChatTheme struct { meta // Chat identifier ChatId int64 `json:"chat_id"` - // The new name of the chat theme; may be empty if theme was reset to default - ThemeName string `json:"theme_name"` + // The new theme of the chat; may be null if theme was reset to default + Theme ChatTheme `json:"theme"` } func (entity *UpdateChatTheme) MarshalJSON() ([]byte, error) { @@ -57891,6 +59673,25 @@ func (*UpdateChatTheme) UpdateType() string { return TypeUpdateChatTheme } +func (updateChatTheme *UpdateChatTheme) UnmarshalJSON(data []byte) error { + var tmp struct { + ChatId int64 `json:"chat_id"` + Theme json.RawMessage `json:"theme"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + updateChatTheme.ChatId = tmp.ChatId + + fieldTheme, _ := UnmarshalChatTheme(tmp.Theme) + updateChatTheme.Theme = fieldTheme + + return nil +} + // The chat unread_mention_count has changed type UpdateChatUnreadMentionCount struct { meta @@ -58348,7 +60149,7 @@ type UpdateTopicMessageCount struct { ChatId int64 `json:"chat_id"` // Identifier of the topic TopicId MessageTopic `json:"topic_id"` - // Approximate number of messages in the topics + // Approximate number of messages in the topic MessageCount int32 `json:"message_count"` } @@ -60343,31 +62144,31 @@ func (*UpdateDefaultBackground) UpdateType() string { return TypeUpdateDefaultBackground } -// The list of available chat themes has changed -type UpdateChatThemes struct { +// The list of available emoji chat themes has changed +type UpdateEmojiChatThemes struct { meta - // The new list of chat themes - ChatThemes []*ChatTheme `json:"chat_themes"` + // The new list of emoji chat themes + ChatThemes []*EmojiChatTheme `json:"chat_themes"` } -func (entity *UpdateChatThemes) MarshalJSON() ([]byte, error) { +func (entity *UpdateEmojiChatThemes) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub UpdateChatThemes + type stub UpdateEmojiChatThemes return json.Marshal((*stub)(entity)) } -func (*UpdateChatThemes) GetClass() string { +func (*UpdateEmojiChatThemes) GetClass() string { return ClassUpdate } -func (*UpdateChatThemes) GetType() string { - return TypeUpdateChatThemes +func (*UpdateEmojiChatThemes) GetType() string { + return TypeUpdateEmojiChatThemes } -func (*UpdateChatThemes) UpdateType() string { - return TypeUpdateChatThemes +func (*UpdateEmojiChatThemes) UpdateType() string { + return TypeUpdateEmojiChatThemes } // The list of supported accent colors has changed @@ -60535,6 +62336,33 @@ func (*UpdateFreezeState) UpdateType() string { return TypeUpdateFreezeState } +// The parameters for age verification of the current user's account has changed +type UpdateAgeVerificationParameters struct { + meta + // Parameters for the age verification; may be null if age verification isn't needed + Parameters *AgeVerificationParameters `json:"parameters"` +} + +func (entity *UpdateAgeVerificationParameters) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateAgeVerificationParameters + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateAgeVerificationParameters) GetClass() string { + return ClassUpdate +} + +func (*UpdateAgeVerificationParameters) GetType() string { + return TypeUpdateAgeVerificationParameters +} + +func (*UpdateAgeVerificationParameters) UpdateType() string { + return TypeUpdateAgeVerificationParameters +} + // New terms of service must be accepted by the user. If the terms of service are declined, then the deleteAccount method must be called with the reason "Decline ToS update" type UpdateTermsOfService struct { meta @@ -60926,7 +62754,7 @@ func (*UpdateChatRevenueAmount) UpdateType() string { return TypeUpdateChatRevenueAmount } -// The Telegram Star revenue earned by a bot or a chat has changed. If Telegram Star transaction screen of the chat is opened, then getStarTransactions may be called to fetch new transactions +// The Telegram Star revenue earned by a user or a chat has changed. If Telegram Star transaction screen of the chat is opened, then getStarTransactions may be called to fetch new transactions type UpdateStarRevenueStatus struct { meta // Identifier of the owner of the Telegram Stars @@ -60974,6 +62802,33 @@ func (updateStarRevenueStatus *UpdateStarRevenueStatus) UnmarshalJSON(data []byt return nil } +// The Toncoin revenue earned by the current user has changed. If Toncoin transaction screen of the chat is opened, then getTonTransactions may be called to fetch new transactions +type UpdateTonRevenueStatus struct { + meta + // New Toncoin revenue status + Status *TonRevenueStatus `json:"status"` +} + +func (entity *UpdateTonRevenueStatus) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateTonRevenueStatus + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateTonRevenueStatus) GetClass() string { + return ClassUpdate +} + +func (*UpdateTonRevenueStatus) GetType() string { + return TypeUpdateTonRevenueStatus +} + +func (*UpdateTonRevenueStatus) UpdateType() string { + return TypeUpdateTonRevenueStatus +} + // The parameters of speech recognition without Telegram Premium subscription has changed type UpdateSpeechRecognitionTrial struct { meta diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 829ea95..0fbe52e 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -511,6 +511,58 @@ func UnmarshalListOfPollType(dataList []json.RawMessage) ([]PollType, error) { return list, nil } +func UnmarshalProfileTab(data json.RawMessage) (ProfileTab, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeProfileTabPosts: + return UnmarshalProfileTabPosts(data) + + case TypeProfileTabGifts: + return UnmarshalProfileTabGifts(data) + + case TypeProfileTabMedia: + return UnmarshalProfileTabMedia(data) + + case TypeProfileTabFiles: + return UnmarshalProfileTabFiles(data) + + case TypeProfileTabLinks: + return UnmarshalProfileTabLinks(data) + + case TypeProfileTabMusic: + return UnmarshalProfileTabMusic(data) + + case TypeProfileTabVoice: + return UnmarshalProfileTabVoice(data) + + case TypeProfileTabGifs: + return UnmarshalProfileTabGifs(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfProfileTab(dataList []json.RawMessage) ([]ProfileTab, error) { + list := []ProfileTab{} + + for _, data := range dataList { + entity, err := UnmarshalProfileTab(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalUserType(data json.RawMessage) (UserType, error) { var meta meta @@ -662,6 +714,40 @@ func UnmarshalListOfInputChatPhoto(dataList []json.RawMessage) ([]InputChatPhoto return list, nil } +func UnmarshalGiftResalePrice(data json.RawMessage) (GiftResalePrice, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeGiftResalePriceStar: + return UnmarshalGiftResalePriceStar(data) + + case TypeGiftResalePriceTon: + return UnmarshalGiftResalePriceTon(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfGiftResalePrice(dataList []json.RawMessage) ([]GiftResalePrice, error) { + list := []GiftResalePrice{} + + for _, data := range dataList { + entity, err := UnmarshalGiftResalePrice(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalSuggestedPostPrice(data json.RawMessage) (SuggestedPostPrice, error) { var meta meta @@ -875,6 +961,40 @@ func UnmarshalListOfAffiliateProgramSortOrder(dataList []json.RawMessage) ([]Aff return list, nil } +func UnmarshalCanSendGiftResult(data json.RawMessage) (CanSendGiftResult, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeCanSendGiftResultOk: + return UnmarshalCanSendGiftResultOk(data) + + case TypeCanSendGiftResultFail: + return UnmarshalCanSendGiftResultFail(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfCanSendGiftResult(dataList []json.RawMessage) ([]CanSendGiftResult, error) { + list := []CanSendGiftResult{} + + for _, data := range dataList { + entity, err := UnmarshalCanSendGiftResult(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalUpgradedGiftOrigin(data json.RawMessage) (UpgradedGiftOrigin, error) { var meta meta @@ -893,6 +1013,9 @@ func UnmarshalUpgradedGiftOrigin(data json.RawMessage) (UpgradedGiftOrigin, erro case TypeUpgradedGiftOriginResale: return UnmarshalUpgradedGiftOriginResale(data) + case TypeUpgradedGiftOriginPrepaidUpgrade: + return UnmarshalUpgradedGiftOriginPrepaidUpgrade(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -986,6 +1109,40 @@ func UnmarshalListOfGiftForResaleOrder(dataList []json.RawMessage) ([]GiftForRes return list, nil } +func UnmarshalGiftResaleResult(data json.RawMessage) (GiftResaleResult, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeGiftResaleResultOk: + return UnmarshalGiftResaleResultOk(data) + + case TypeGiftResaleResultPriceIncreased: + return UnmarshalGiftResaleResultPriceIncreased(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfGiftResaleResult(dataList []json.RawMessage) ([]GiftResaleResult, error) { + list := []GiftResaleResult{} + + for _, data := range dataList { + entity, err := UnmarshalGiftResaleResult(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalSentGift(data json.RawMessage) (SentGift, error) { var meta meta @@ -1132,6 +1289,9 @@ func UnmarshalStarTransactionType(data json.RawMessage) (StarTransactionType, er case TypeStarTransactionTypeGiftUpgrade: return UnmarshalStarTransactionTypeGiftUpgrade(data) + case TypeStarTransactionTypeGiftUpgradePurchase: + return UnmarshalStarTransactionTypeGiftUpgradePurchase(data) + case TypeStarTransactionTypeUpgradedGiftPurchase: return UnmarshalStarTransactionTypeUpgradedGiftPurchase(data) @@ -1168,6 +1328,9 @@ func UnmarshalStarTransactionType(data json.RawMessage) (StarTransactionType, er case TypeStarTransactionTypeBusinessBotTransferReceive: return UnmarshalStarTransactionTypeBusinessBotTransferReceive(data) + case TypeStarTransactionTypePublicPostSearch: + return UnmarshalStarTransactionTypePublicPostSearch(data) + case TypeStarTransactionTypeUnsupported: return UnmarshalStarTransactionTypeUnsupported(data) @@ -1205,6 +1368,12 @@ func UnmarshalTonTransactionType(data json.RawMessage) (TonTransactionType, erro case TypeTonTransactionTypeSuggestedPostPayment: return UnmarshalTonTransactionTypeSuggestedPostPayment(data) + case TypeTonTransactionTypeUpgradedGiftPurchase: + return UnmarshalTonTransactionTypeUpgradedGiftPurchase(data) + + case TypeTonTransactionTypeUpgradedGiftSale: + return UnmarshalTonTransactionTypeUpgradedGiftSale(data) + case TypeTonTransactionTypeUnsupported: return UnmarshalTonTransactionTypeUnsupported(data) @@ -2618,6 +2787,49 @@ func UnmarshalListOfSavedMessagesTopicType(dataList []json.RawMessage) ([]SavedM return list, nil } +func UnmarshalBuiltInTheme(data json.RawMessage) (BuiltInTheme, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeBuiltInThemeClassic: + return UnmarshalBuiltInThemeClassic(data) + + case TypeBuiltInThemeDay: + return UnmarshalBuiltInThemeDay(data) + + case TypeBuiltInThemeNight: + return UnmarshalBuiltInThemeNight(data) + + case TypeBuiltInThemeTinted: + return UnmarshalBuiltInThemeTinted(data) + + case TypeBuiltInThemeArctic: + return UnmarshalBuiltInThemeArctic(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfBuiltInTheme(dataList []json.RawMessage) ([]BuiltInTheme, error) { + list := []BuiltInTheme{} + + for _, data := range dataList { + entity, err := UnmarshalBuiltInTheme(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalRichText(data json.RawMessage) (RichText, error) { var meta meta @@ -2953,6 +3165,9 @@ func UnmarshalLinkPreviewType(data json.RawMessage) (LinkPreviewType, error) { case TypeLinkPreviewTypeChat: return UnmarshalLinkPreviewTypeChat(data) + case TypeLinkPreviewTypeDirectMessagesChat: + return UnmarshalLinkPreviewTypeDirectMessagesChat(data) + case TypeLinkPreviewTypeDocument: return UnmarshalLinkPreviewTypeDocument(data) @@ -2971,6 +3186,9 @@ func UnmarshalLinkPreviewType(data json.RawMessage) (LinkPreviewType, error) { case TypeLinkPreviewTypeExternalVideo: return UnmarshalLinkPreviewTypeExternalVideo(data) + case TypeLinkPreviewTypeGiftCollection: + return UnmarshalLinkPreviewTypeGiftCollection(data) + case TypeLinkPreviewTypeGroupCall: return UnmarshalLinkPreviewTypeGroupCall(data) @@ -2998,6 +3216,9 @@ func UnmarshalLinkPreviewType(data json.RawMessage) (LinkPreviewType, error) { case TypeLinkPreviewTypeStory: return UnmarshalLinkPreviewTypeStory(data) + case TypeLinkPreviewTypeStoryAlbum: + return UnmarshalLinkPreviewTypeStoryAlbum(data) + case TypeLinkPreviewTypeSupergroupBoost: return UnmarshalLinkPreviewTypeSupergroupBoost(data) @@ -6506,6 +6727,74 @@ func UnmarshalListOfInputBackground(dataList []json.RawMessage) ([]InputBackgrou return list, nil } +func UnmarshalChatTheme(data json.RawMessage) (ChatTheme, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeChatThemeEmoji: + return UnmarshalChatThemeEmoji(data) + + case TypeChatThemeGift: + return UnmarshalChatThemeGift(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfChatTheme(dataList []json.RawMessage) ([]ChatTheme, error) { + list := []ChatTheme{} + + for _, data := range dataList { + entity, err := UnmarshalChatTheme(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalInputChatTheme(data json.RawMessage) (InputChatTheme, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeInputChatThemeEmoji: + return UnmarshalInputChatThemeEmoji(data) + + case TypeInputChatThemeGift: + return UnmarshalInputChatThemeGift(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfInputChatTheme(dataList []json.RawMessage) ([]InputChatTheme, error) { + list := []InputChatTheme{} + + for _, data := range dataList { + entity, err := UnmarshalInputChatTheme(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalCanPostStoryResult(data json.RawMessage) (CanPostStoryResult, error) { var meta meta @@ -7554,12 +7843,18 @@ func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { case TypeInternalLinkTypeDefaultMessageAutoDeleteTimerSettings: return UnmarshalInternalLinkTypeDefaultMessageAutoDeleteTimerSettings(data) + case TypeInternalLinkTypeDirectMessagesChat: + return UnmarshalInternalLinkTypeDirectMessagesChat(data) + case TypeInternalLinkTypeEditProfileSettings: return UnmarshalInternalLinkTypeEditProfileSettings(data) case TypeInternalLinkTypeGame: return UnmarshalInternalLinkTypeGame(data) + case TypeInternalLinkTypeGiftCollection: + return UnmarshalInternalLinkTypeGiftCollection(data) + case TypeInternalLinkTypeGroupCall: return UnmarshalInternalLinkTypeGroupCall(data) @@ -7629,6 +7924,9 @@ func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { case TypeInternalLinkTypeStory: return UnmarshalInternalLinkTypeStory(data) + case TypeInternalLinkTypeStoryAlbum: + return UnmarshalInternalLinkTypeStoryAlbum(data) + case TypeInternalLinkTypeTheme: return UnmarshalInternalLinkTypeTheme(data) @@ -8852,8 +9150,8 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateDefaultBackground: return UnmarshalUpdateDefaultBackground(data) - case TypeUpdateChatThemes: - return UnmarshalUpdateChatThemes(data) + case TypeUpdateEmojiChatThemes: + return UnmarshalUpdateEmojiChatThemes(data) case TypeUpdateAccentColors: return UnmarshalUpdateAccentColors(data) @@ -8870,6 +9168,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateFreezeState: return UnmarshalUpdateFreezeState(data) + case TypeUpdateAgeVerificationParameters: + return UnmarshalUpdateAgeVerificationParameters(data) + case TypeUpdateTermsOfService: return UnmarshalUpdateTermsOfService(data) @@ -8912,6 +9213,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateStarRevenueStatus: return UnmarshalUpdateStarRevenueStatus(data) + case TypeUpdateTonRevenueStatus: + return UnmarshalUpdateTonRevenueStatus(data) + case TypeUpdateSpeechRecognitionTrial: return UnmarshalUpdateSpeechRecognitionTrial(data) @@ -9719,6 +10023,14 @@ func UnmarshalAudio(data json.RawMessage) (*Audio, error) { return &resp, err } +func UnmarshalAudios(data json.RawMessage) (*Audios, error) { + var resp Audios + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalDocument(data json.RawMessage) (*Document, error) { var resp Document @@ -9879,6 +10191,70 @@ func UnmarshalChatPhotoInfo(data json.RawMessage) (*ChatPhotoInfo, error) { return &resp, err } +func UnmarshalProfileTabPosts(data json.RawMessage) (*ProfileTabPosts, error) { + var resp ProfileTabPosts + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalProfileTabGifts(data json.RawMessage) (*ProfileTabGifts, error) { + var resp ProfileTabGifts + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalProfileTabMedia(data json.RawMessage) (*ProfileTabMedia, error) { + var resp ProfileTabMedia + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalProfileTabFiles(data json.RawMessage) (*ProfileTabFiles, error) { + var resp ProfileTabFiles + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalProfileTabLinks(data json.RawMessage) (*ProfileTabLinks, error) { + var resp ProfileTabLinks + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalProfileTabMusic(data json.RawMessage) (*ProfileTabMusic, error) { + var resp ProfileTabMusic + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalProfileTabVoice(data json.RawMessage) (*ProfileTabVoice, error) { + var resp ProfileTabVoice + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalProfileTabGifs(data json.RawMessage) (*ProfileTabGifs, error) { + var resp ProfileTabGifs + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUserTypeRegular(data json.RawMessage) (*UserTypeRegular, error) { var resp UserTypeRegular @@ -10223,6 +10599,22 @@ func UnmarshalChatAdministratorRights(data json.RawMessage) (*ChatAdministratorR return &resp, err } +func UnmarshalGiftResalePriceStar(data json.RawMessage) (*GiftResalePriceStar, error) { + var resp GiftResalePriceStar + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftResalePriceTon(data json.RawMessage) (*GiftResalePriceTon, error) { + var resp GiftResalePriceTon + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalSuggestedPostPriceStar(data json.RawMessage) (*SuggestedPostPriceStar, error) { var resp SuggestedPostPriceStar @@ -10567,6 +10959,54 @@ func UnmarshalGiftSettings(data json.RawMessage) (*GiftSettings, error) { return &resp, err } +func UnmarshalGiftPurchaseLimits(data json.RawMessage) (*GiftPurchaseLimits, error) { + var resp GiftPurchaseLimits + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftResaleParameters(data json.RawMessage) (*GiftResaleParameters, error) { + var resp GiftResaleParameters + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftCollection(data json.RawMessage) (*GiftCollection, error) { + var resp GiftCollection + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftCollections(data json.RawMessage) (*GiftCollections, error) { + var resp GiftCollections + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCanSendGiftResultOk(data json.RawMessage) (*CanSendGiftResultOk, error) { + var resp CanSendGiftResultOk + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCanSendGiftResultFail(data json.RawMessage) (*CanSendGiftResultFail, error) { + var resp CanSendGiftResultFail + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpgradedGiftOriginUpgrade(data json.RawMessage) (*UpgradedGiftOriginUpgrade, error) { var resp UpgradedGiftOriginUpgrade @@ -10591,6 +11031,14 @@ func UnmarshalUpgradedGiftOriginResale(data json.RawMessage) (*UpgradedGiftOrigi return &resp, err } +func UnmarshalUpgradedGiftOriginPrepaidUpgrade(data json.RawMessage) (*UpgradedGiftOriginPrepaidUpgrade, error) { + var resp UpgradedGiftOriginPrepaidUpgrade + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpgradedGiftModel(data json.RawMessage) (*UpgradedGiftModel, error) { var resp UpgradedGiftModel @@ -10647,6 +11095,14 @@ func UnmarshalUpgradedGift(data json.RawMessage) (*UpgradedGift, error) { return &resp, err } +func UnmarshalUpgradedGiftValueInfo(data json.RawMessage) (*UpgradedGiftValueInfo, error) { + var resp UpgradedGiftValueInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpgradeGiftResult(data json.RawMessage) (*UpgradeGiftResult, error) { var resp UpgradeGiftResult @@ -10759,6 +11215,22 @@ func UnmarshalGiftsForResale(data json.RawMessage) (*GiftsForResale, error) { return &resp, err } +func UnmarshalGiftResaleResultOk(data json.RawMessage) (*GiftResaleResultOk, error) { + var resp GiftResaleResultOk + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftResaleResultPriceIncreased(data json.RawMessage) (*GiftResaleResultPriceIncreased, error) { + var resp GiftResaleResultPriceIncreased + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalSentGiftRegular(data json.RawMessage) (*SentGiftRegular, error) { var resp SentGiftRegular @@ -10999,6 +11471,14 @@ func UnmarshalStarTransactionTypeGiftUpgrade(data json.RawMessage) (*StarTransac return &resp, err } +func UnmarshalStarTransactionTypeGiftUpgradePurchase(data json.RawMessage) (*StarTransactionTypeGiftUpgradePurchase, error) { + var resp StarTransactionTypeGiftUpgradePurchase + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarTransactionTypeUpgradedGiftPurchase(data json.RawMessage) (*StarTransactionTypeUpgradedGiftPurchase, error) { var resp StarTransactionTypeUpgradedGiftPurchase @@ -11095,6 +11575,14 @@ func UnmarshalStarTransactionTypeBusinessBotTransferReceive(data json.RawMessage return &resp, err } +func UnmarshalStarTransactionTypePublicPostSearch(data json.RawMessage) (*StarTransactionTypePublicPostSearch, error) { + var resp StarTransactionTypePublicPostSearch + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarTransactionTypeUnsupported(data json.RawMessage) (*StarTransactionTypeUnsupported, error) { var resp StarTransactionTypeUnsupported @@ -11135,6 +11623,22 @@ func UnmarshalTonTransactionTypeSuggestedPostPayment(data json.RawMessage) (*Ton return &resp, err } +func UnmarshalTonTransactionTypeUpgradedGiftPurchase(data json.RawMessage) (*TonTransactionTypeUpgradedGiftPurchase, error) { + var resp TonTransactionTypeUpgradedGiftPurchase + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTonTransactionTypeUpgradedGiftSale(data json.RawMessage) (*TonTransactionTypeUpgradedGiftSale, error) { + var resp TonTransactionTypeUpgradedGiftSale + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalTonTransactionTypeUnsupported(data json.RawMessage) (*TonTransactionTypeUnsupported, error) { var resp TonTransactionTypeUnsupported @@ -11255,6 +11759,22 @@ func UnmarshalProfileAccentColor(data json.RawMessage) (*ProfileAccentColor, err return &resp, err } +func UnmarshalUserRating(data json.RawMessage) (*UserRating, error) { + var resp UserRating + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalRestrictionInfo(data json.RawMessage) (*RestrictionInfo, error) { + var resp RestrictionInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalEmojiStatusTypeCustomEmoji(data json.RawMessage) (*EmojiStatusTypeCustomEmoji, error) { var resp EmojiStatusTypeCustomEmoji @@ -11719,6 +12239,14 @@ func UnmarshalSecretChat(data json.RawMessage) (*SecretChat, error) { return &resp, err } +func UnmarshalPublicPostSearchLimits(data json.RawMessage) (*PublicPostSearchLimits, error) { + var resp PublicPostSearchLimits + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageSenderUser(data json.RawMessage) (*MessageSenderUser, error) { var resp MessageSenderUser @@ -12127,6 +12655,14 @@ func UnmarshalFoundChatMessages(data json.RawMessage) (*FoundChatMessages, error return &resp, err } +func UnmarshalFoundPublicPosts(data json.RawMessage) (*FoundPublicPosts, error) { + var resp FoundPublicPosts + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessagePosition(data json.RawMessage) (*MessagePosition, error) { var resp MessagePosition @@ -13167,6 +13703,46 @@ func UnmarshalSharedChat(data json.RawMessage) (*SharedChat, error) { return &resp, err } +func UnmarshalBuiltInThemeClassic(data json.RawMessage) (*BuiltInThemeClassic, error) { + var resp BuiltInThemeClassic + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBuiltInThemeDay(data json.RawMessage) (*BuiltInThemeDay, error) { + var resp BuiltInThemeDay + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBuiltInThemeNight(data json.RawMessage) (*BuiltInThemeNight, error) { + var resp BuiltInThemeNight + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBuiltInThemeTinted(data json.RawMessage) (*BuiltInThemeTinted, error) { + var resp BuiltInThemeTinted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBuiltInThemeArctic(data json.RawMessage) (*BuiltInThemeArctic, error) { + var resp BuiltInThemeArctic + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalThemeSettings(data json.RawMessage) (*ThemeSettings, error) { var resp ThemeSettings @@ -13711,6 +14287,14 @@ func UnmarshalLinkPreviewTypeChat(data json.RawMessage) (*LinkPreviewTypeChat, e return &resp, err } +func UnmarshalLinkPreviewTypeDirectMessagesChat(data json.RawMessage) (*LinkPreviewTypeDirectMessagesChat, error) { + var resp LinkPreviewTypeDirectMessagesChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalLinkPreviewTypeDocument(data json.RawMessage) (*LinkPreviewTypeDocument, error) { var resp LinkPreviewTypeDocument @@ -13759,6 +14343,14 @@ func UnmarshalLinkPreviewTypeExternalVideo(data json.RawMessage) (*LinkPreviewTy return &resp, err } +func UnmarshalLinkPreviewTypeGiftCollection(data json.RawMessage) (*LinkPreviewTypeGiftCollection, error) { + var resp LinkPreviewTypeGiftCollection + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalLinkPreviewTypeGroupCall(data json.RawMessage) (*LinkPreviewTypeGroupCall, error) { var resp LinkPreviewTypeGroupCall @@ -13831,6 +14423,14 @@ func UnmarshalLinkPreviewTypeStory(data json.RawMessage) (*LinkPreviewTypeStory, return &resp, err } +func UnmarshalLinkPreviewTypeStoryAlbum(data json.RawMessage) (*LinkPreviewTypeStoryAlbum, error) { + var resp LinkPreviewTypeStoryAlbum + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalLinkPreviewTypeSupergroupBoost(data json.RawMessage) (*LinkPreviewTypeSupergroupBoost, error) { var resp LinkPreviewTypeSupergroupBoost @@ -16703,6 +17303,22 @@ func UnmarshalFoundStories(data json.RawMessage) (*FoundStories, error) { return &resp, err } +func UnmarshalStoryAlbum(data json.RawMessage) (*StoryAlbum, error) { + var resp StoryAlbum + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryAlbums(data json.RawMessage) (*StoryAlbums, error) { + var resp StoryAlbums + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStoryFullId(data json.RawMessage) (*StoryFullId, error) { var resp StoryFullId @@ -19287,8 +19903,56 @@ func UnmarshalInputBackgroundPrevious(data json.RawMessage) (*InputBackgroundPre return &resp, err } -func UnmarshalChatTheme(data json.RawMessage) (*ChatTheme, error) { - var resp ChatTheme +func UnmarshalEmojiChatTheme(data json.RawMessage) (*EmojiChatTheme, error) { + var resp EmojiChatTheme + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftChatTheme(data json.RawMessage) (*GiftChatTheme, error) { + var resp GiftChatTheme + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftChatThemes(data json.RawMessage) (*GiftChatThemes, error) { + var resp GiftChatThemes + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatThemeEmoji(data json.RawMessage) (*ChatThemeEmoji, error) { + var resp ChatThemeEmoji + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatThemeGift(data json.RawMessage) (*ChatThemeGift, error) { + var resp ChatThemeGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputChatThemeEmoji(data json.RawMessage) (*InputChatThemeEmoji, error) { + var resp InputChatThemeEmoji + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputChatThemeGift(data json.RawMessage) (*InputChatThemeGift, error) { + var resp InputChatThemeGift err := json.Unmarshal(data, &resp) @@ -20791,6 +21455,14 @@ func UnmarshalInternalLinkTypeDefaultMessageAutoDeleteTimerSettings(data json.Ra return &resp, err } +func UnmarshalInternalLinkTypeDirectMessagesChat(data json.RawMessage) (*InternalLinkTypeDirectMessagesChat, error) { + var resp InternalLinkTypeDirectMessagesChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInternalLinkTypeEditProfileSettings(data json.RawMessage) (*InternalLinkTypeEditProfileSettings, error) { var resp InternalLinkTypeEditProfileSettings @@ -20807,6 +21479,14 @@ func UnmarshalInternalLinkTypeGame(data json.RawMessage) (*InternalLinkTypeGame, return &resp, err } +func UnmarshalInternalLinkTypeGiftCollection(data json.RawMessage) (*InternalLinkTypeGiftCollection, error) { + var resp InternalLinkTypeGiftCollection + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInternalLinkTypeGroupCall(data json.RawMessage) (*InternalLinkTypeGroupCall, error) { var resp InternalLinkTypeGroupCall @@ -20991,6 +21671,14 @@ func UnmarshalInternalLinkTypeStory(data json.RawMessage) (*InternalLinkTypeStor return &resp, err } +func UnmarshalInternalLinkTypeStoryAlbum(data json.RawMessage) (*InternalLinkTypeStoryAlbum, error) { + var resp InternalLinkTypeStoryAlbum + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInternalLinkTypeTheme(data json.RawMessage) (*InternalLinkTypeTheme, error) { var resp InternalLinkTypeTheme @@ -21511,6 +22199,14 @@ func UnmarshalConnectionStateReady(data json.RawMessage) (*ConnectionStateReady, return &resp, err } +func UnmarshalAgeVerificationParameters(data json.RawMessage) (*AgeVerificationParameters, error) { + var resp AgeVerificationParameters + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalTopChatCategoryUsers(data json.RawMessage) (*TopChatCategoryUsers, error) { var resp TopChatCategoryUsers @@ -22111,6 +22807,22 @@ func UnmarshalStarRevenueStatistics(data json.RawMessage) (*StarRevenueStatistic return &resp, err } +func UnmarshalTonRevenueStatus(data json.RawMessage) (*TonRevenueStatus, error) { + var resp TonRevenueStatus + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTonRevenueStatistics(data json.RawMessage) (*TonRevenueStatistics, error) { + var resp TonRevenueStatistics + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPoint(data json.RawMessage) (*Point, error) { var resp Point @@ -23111,8 +23823,8 @@ func UnmarshalUpdateDefaultBackground(data json.RawMessage) (*UpdateDefaultBackg return &resp, err } -func UnmarshalUpdateChatThemes(data json.RawMessage) (*UpdateChatThemes, error) { - var resp UpdateChatThemes +func UnmarshalUpdateEmojiChatThemes(data json.RawMessage) (*UpdateEmojiChatThemes, error) { + var resp UpdateEmojiChatThemes err := json.Unmarshal(data, &resp) @@ -23159,6 +23871,14 @@ func UnmarshalUpdateFreezeState(data json.RawMessage) (*UpdateFreezeState, error return &resp, err } +func UnmarshalUpdateAgeVerificationParameters(data json.RawMessage) (*UpdateAgeVerificationParameters, error) { + var resp UpdateAgeVerificationParameters + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateTermsOfService(data json.RawMessage) (*UpdateTermsOfService, error) { var resp UpdateTermsOfService @@ -23271,6 +23991,14 @@ func UnmarshalUpdateStarRevenueStatus(data json.RawMessage) (*UpdateStarRevenueS return &resp, err } +func UnmarshalUpdateTonRevenueStatus(data json.RawMessage) (*UpdateTonRevenueStatus, error) { + var resp UpdateTonRevenueStatus + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateSpeechRecognitionTrial(data json.RawMessage) (*UpdateSpeechRecognitionTrial, error) { var resp UpdateSpeechRecognitionTrial @@ -23873,6 +24601,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeAudio: return UnmarshalAudio(data) + case TypeAudios: + return UnmarshalAudios(data) + case TypeDocument: return UnmarshalDocument(data) @@ -23933,6 +24664,30 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatPhotoInfo: return UnmarshalChatPhotoInfo(data) + case TypeProfileTabPosts: + return UnmarshalProfileTabPosts(data) + + case TypeProfileTabGifts: + return UnmarshalProfileTabGifts(data) + + case TypeProfileTabMedia: + return UnmarshalProfileTabMedia(data) + + case TypeProfileTabFiles: + return UnmarshalProfileTabFiles(data) + + case TypeProfileTabLinks: + return UnmarshalProfileTabLinks(data) + + case TypeProfileTabMusic: + return UnmarshalProfileTabMusic(data) + + case TypeProfileTabVoice: + return UnmarshalProfileTabVoice(data) + + case TypeProfileTabGifs: + return UnmarshalProfileTabGifs(data) + case TypeUserTypeRegular: return UnmarshalUserTypeRegular(data) @@ -24062,6 +24817,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatAdministratorRights: return UnmarshalChatAdministratorRights(data) + case TypeGiftResalePriceStar: + return UnmarshalGiftResalePriceStar(data) + + case TypeGiftResalePriceTon: + return UnmarshalGiftResalePriceTon(data) + case TypeSuggestedPostPriceStar: return UnmarshalSuggestedPostPriceStar(data) @@ -24191,6 +24952,24 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeGiftSettings: return UnmarshalGiftSettings(data) + case TypeGiftPurchaseLimits: + return UnmarshalGiftPurchaseLimits(data) + + case TypeGiftResaleParameters: + return UnmarshalGiftResaleParameters(data) + + case TypeGiftCollection: + return UnmarshalGiftCollection(data) + + case TypeGiftCollections: + return UnmarshalGiftCollections(data) + + case TypeCanSendGiftResultOk: + return UnmarshalCanSendGiftResultOk(data) + + case TypeCanSendGiftResultFail: + return UnmarshalCanSendGiftResultFail(data) + case TypeUpgradedGiftOriginUpgrade: return UnmarshalUpgradedGiftOriginUpgrade(data) @@ -24200,6 +24979,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpgradedGiftOriginResale: return UnmarshalUpgradedGiftOriginResale(data) + case TypeUpgradedGiftOriginPrepaidUpgrade: + return UnmarshalUpgradedGiftOriginPrepaidUpgrade(data) + case TypeUpgradedGiftModel: return UnmarshalUpgradedGiftModel(data) @@ -24221,6 +25003,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpgradedGift: return UnmarshalUpgradedGift(data) + case TypeUpgradedGiftValueInfo: + return UnmarshalUpgradedGiftValueInfo(data) + case TypeUpgradeGiftResult: return UnmarshalUpgradeGiftResult(data) @@ -24263,6 +25048,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeGiftsForResale: return UnmarshalGiftsForResale(data) + case TypeGiftResaleResultOk: + return UnmarshalGiftResaleResultOk(data) + + case TypeGiftResaleResultPriceIncreased: + return UnmarshalGiftResaleResultPriceIncreased(data) + case TypeSentGiftRegular: return UnmarshalSentGiftRegular(data) @@ -24353,6 +25144,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarTransactionTypeGiftUpgrade: return UnmarshalStarTransactionTypeGiftUpgrade(data) + case TypeStarTransactionTypeGiftUpgradePurchase: + return UnmarshalStarTransactionTypeGiftUpgradePurchase(data) + case TypeStarTransactionTypeUpgradedGiftPurchase: return UnmarshalStarTransactionTypeUpgradedGiftPurchase(data) @@ -24389,6 +25183,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarTransactionTypeBusinessBotTransferReceive: return UnmarshalStarTransactionTypeBusinessBotTransferReceive(data) + case TypeStarTransactionTypePublicPostSearch: + return UnmarshalStarTransactionTypePublicPostSearch(data) + case TypeStarTransactionTypeUnsupported: return UnmarshalStarTransactionTypeUnsupported(data) @@ -24404,6 +25201,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeTonTransactionTypeSuggestedPostPayment: return UnmarshalTonTransactionTypeSuggestedPostPayment(data) + case TypeTonTransactionTypeUpgradedGiftPurchase: + return UnmarshalTonTransactionTypeUpgradedGiftPurchase(data) + + case TypeTonTransactionTypeUpgradedGiftSale: + return UnmarshalTonTransactionTypeUpgradedGiftSale(data) + case TypeTonTransactionTypeUnsupported: return UnmarshalTonTransactionTypeUnsupported(data) @@ -24449,6 +25252,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeProfileAccentColor: return UnmarshalProfileAccentColor(data) + case TypeUserRating: + return UnmarshalUserRating(data) + + case TypeRestrictionInfo: + return UnmarshalRestrictionInfo(data) + case TypeEmojiStatusTypeCustomEmoji: return UnmarshalEmojiStatusTypeCustomEmoji(data) @@ -24623,6 +25432,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSecretChat: return UnmarshalSecretChat(data) + case TypePublicPostSearchLimits: + return UnmarshalPublicPostSearchLimits(data) + case TypeMessageSenderUser: return UnmarshalMessageSenderUser(data) @@ -24776,6 +25588,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeFoundChatMessages: return UnmarshalFoundChatMessages(data) + case TypeFoundPublicPosts: + return UnmarshalFoundPublicPosts(data) + case TypeMessagePosition: return UnmarshalMessagePosition(data) @@ -25166,6 +25981,21 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSharedChat: return UnmarshalSharedChat(data) + case TypeBuiltInThemeClassic: + return UnmarshalBuiltInThemeClassic(data) + + case TypeBuiltInThemeDay: + return UnmarshalBuiltInThemeDay(data) + + case TypeBuiltInThemeNight: + return UnmarshalBuiltInThemeNight(data) + + case TypeBuiltInThemeTinted: + return UnmarshalBuiltInThemeTinted(data) + + case TypeBuiltInThemeArctic: + return UnmarshalBuiltInThemeArctic(data) + case TypeThemeSettings: return UnmarshalThemeSettings(data) @@ -25370,6 +26200,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeLinkPreviewTypeChat: return UnmarshalLinkPreviewTypeChat(data) + case TypeLinkPreviewTypeDirectMessagesChat: + return UnmarshalLinkPreviewTypeDirectMessagesChat(data) + case TypeLinkPreviewTypeDocument: return UnmarshalLinkPreviewTypeDocument(data) @@ -25388,6 +26221,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeLinkPreviewTypeExternalVideo: return UnmarshalLinkPreviewTypeExternalVideo(data) + case TypeLinkPreviewTypeGiftCollection: + return UnmarshalLinkPreviewTypeGiftCollection(data) + case TypeLinkPreviewTypeGroupCall: return UnmarshalLinkPreviewTypeGroupCall(data) @@ -25415,6 +26251,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeLinkPreviewTypeStory: return UnmarshalLinkPreviewTypeStory(data) + case TypeLinkPreviewTypeStoryAlbum: + return UnmarshalLinkPreviewTypeStoryAlbum(data) + case TypeLinkPreviewTypeSupergroupBoost: return UnmarshalLinkPreviewTypeSupergroupBoost(data) @@ -26492,6 +27331,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeFoundStories: return UnmarshalFoundStories(data) + case TypeStoryAlbum: + return UnmarshalStoryAlbum(data) + + case TypeStoryAlbums: + return UnmarshalStoryAlbums(data) + case TypeStoryFullId: return UnmarshalStoryFullId(data) @@ -27461,8 +28306,26 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInputBackgroundPrevious: return UnmarshalInputBackgroundPrevious(data) - case TypeChatTheme: - return UnmarshalChatTheme(data) + case TypeEmojiChatTheme: + return UnmarshalEmojiChatTheme(data) + + case TypeGiftChatTheme: + return UnmarshalGiftChatTheme(data) + + case TypeGiftChatThemes: + return UnmarshalGiftChatThemes(data) + + case TypeChatThemeEmoji: + return UnmarshalChatThemeEmoji(data) + + case TypeChatThemeGift: + return UnmarshalChatThemeGift(data) + + case TypeInputChatThemeEmoji: + return UnmarshalInputChatThemeEmoji(data) + + case TypeInputChatThemeGift: + return UnmarshalInputChatThemeGift(data) case TypeTimeZone: return UnmarshalTimeZone(data) @@ -28025,12 +28888,18 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInternalLinkTypeDefaultMessageAutoDeleteTimerSettings: return UnmarshalInternalLinkTypeDefaultMessageAutoDeleteTimerSettings(data) + case TypeInternalLinkTypeDirectMessagesChat: + return UnmarshalInternalLinkTypeDirectMessagesChat(data) + case TypeInternalLinkTypeEditProfileSettings: return UnmarshalInternalLinkTypeEditProfileSettings(data) case TypeInternalLinkTypeGame: return UnmarshalInternalLinkTypeGame(data) + case TypeInternalLinkTypeGiftCollection: + return UnmarshalInternalLinkTypeGiftCollection(data) + case TypeInternalLinkTypeGroupCall: return UnmarshalInternalLinkTypeGroupCall(data) @@ -28100,6 +28969,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInternalLinkTypeStory: return UnmarshalInternalLinkTypeStory(data) + case TypeInternalLinkTypeStoryAlbum: + return UnmarshalInternalLinkTypeStoryAlbum(data) + case TypeInternalLinkTypeTheme: return UnmarshalInternalLinkTypeTheme(data) @@ -28295,6 +29167,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeConnectionStateReady: return UnmarshalConnectionStateReady(data) + case TypeAgeVerificationParameters: + return UnmarshalAgeVerificationParameters(data) + case TypeTopChatCategoryUsers: return UnmarshalTopChatCategoryUsers(data) @@ -28520,6 +29395,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarRevenueStatistics: return UnmarshalStarRevenueStatistics(data) + case TypeTonRevenueStatus: + return UnmarshalTonRevenueStatus(data) + + case TypeTonRevenueStatistics: + return UnmarshalTonRevenueStatistics(data) + case TypePoint: return UnmarshalPoint(data) @@ -28895,8 +29776,8 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateDefaultBackground: return UnmarshalUpdateDefaultBackground(data) - case TypeUpdateChatThemes: - return UnmarshalUpdateChatThemes(data) + case TypeUpdateEmojiChatThemes: + return UnmarshalUpdateEmojiChatThemes(data) case TypeUpdateAccentColors: return UnmarshalUpdateAccentColors(data) @@ -28913,6 +29794,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateFreezeState: return UnmarshalUpdateFreezeState(data) + case TypeUpdateAgeVerificationParameters: + return UnmarshalUpdateAgeVerificationParameters(data) + case TypeUpdateTermsOfService: return UnmarshalUpdateTermsOfService(data) @@ -28955,6 +29839,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateStarRevenueStatus: return UnmarshalUpdateStarRevenueStatus(data) + case TypeUpdateTonRevenueStatus: + return UnmarshalUpdateTonRevenueStatus(data) + case TypeUpdateSpeechRecognitionTrial: return UnmarshalUpdateSpeechRecognitionTrial(data) diff --git a/data/td_api.tl b/data/td_api.tl index 60c5f4f..aec4e7c 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -131,7 +131,9 @@ authorizationStateWaitPhoneNumber = AuthorizationState; //@description The user must buy Telegram Premium as an in-store purchase to log in. Call checkAuthenticationPremiumPurchase and then setAuthenticationPremiumPurchaseTransaction //@store_product_id Identifier of the store product that must be bought -authorizationStateWaitPremiumPurchase store_product_id:string = AuthorizationState; +//@support_email_address Email address to use for support if the user has issues with Telegram Premium purchase +//@support_email_subject Subject for the email sent to the support email address +authorizationStateWaitPremiumPurchase store_product_id:string support_email_address:string support_email_subject:string = AuthorizationState; //@description TDLib needs the user's email address to authorize. Call setAuthenticationEmailAddress to provide the email address, or directly call checkAuthenticationEmailCode with Apple ID/Google ID token if allowed //@allow_apple_id True, if authorization through Apple ID is allowed @@ -441,6 +443,9 @@ animation duration:int32 width:int32 height:int32 file_name:string mime_type:str //@audio File containing the audio audio duration:int32 title:string performer:string file_name:string mime_type:string album_cover_minithumbnail:minithumbnail album_cover_thumbnail:thumbnail external_album_covers:vector audio:file = Audio; +//@description Contains a list of audio files @total_count Approximate total number of audio files found @audios List of audio files +audios total_count:int32 audios:vector