diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 2ffb3678d..8a2099950 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -388,6 +388,7 @@ document file_name:string mime_type:string minithumbnail:minithumbnail thumbnail photo has_stickers:Bool minithumbnail:minithumbnail sizes:vector = Photo; //@description Describes a sticker +//@id Unique sticker identifier within the set //@set_id The identifier of the sticker set to which the sticker belongs; 0 if none //@width Sticker width; as defined by the sender //@height Sticker height; as defined by the sender @@ -397,7 +398,7 @@ photo has_stickers:Bool minithumbnail:minithumbnail sizes:vector = Ph //@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 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 outline:vector thumbnail:thumbnail sticker:file = Sticker; //@description Describes a video file //@duration Duration of the video, in seconds; as defined by the sender diff --git a/td/telegram/InlineQueriesManager.cpp b/td/telegram/InlineQueriesManager.cpp index e6852561d..801b42671 100644 --- a/td/telegram/InlineQueriesManager.cpp +++ b/td/telegram/InlineQueriesManager.cpp @@ -1275,7 +1275,7 @@ tl_object_ptr copy(const td_api::photo &obj) { template <> tl_object_ptr copy(const td_api::sticker &obj) { - return td_api::make_object(obj.set_id_, obj.width_, obj.height_, obj.emoji_, copy(obj.format_), + return td_api::make_object(obj.id_, obj.set_id_, obj.width_, obj.height_, obj.emoji_, copy(obj.format_), copy(obj.full_type_), transform(obj.outline_, copy_closed_vector_path), copy(obj.thumbnail_), copy(obj.sticker_)); } diff --git a/td/telegram/StickersManager.cpp b/td/telegram/StickersManager.cpp index 8db41bab0..9b9662c07 100644 --- a/td/telegram/StickersManager.cpp +++ b/td/telegram/StickersManager.cpp @@ -1945,13 +1945,17 @@ bool StickersManager::is_premium_custom_emoji(CustomEmojiId custom_emoji_id, boo return s->is_premium_; } -CustomEmojiId StickersManager::get_custom_emoji_id(FileId sticker_id) const { +int64 StickersManager::get_sticker_id(FileId sticker_id) const { auto sticker_file_view = td_->file_manager_->get_file_view(sticker_id); if (sticker_file_view.is_encrypted() || !sticker_file_view.has_remote_location() || !sticker_file_view.remote_location().is_document()) { - return CustomEmojiId(); + return 0; } - return CustomEmojiId(sticker_file_view.remote_location().get_id()); + return sticker_file_view.remote_location().get_id(); +} + +CustomEmojiId StickersManager::get_custom_emoji_id(FileId sticker_id) const { + return CustomEmojiId(get_sticker_id(sticker_id)); } vector> StickersManager::get_sticker_minithumbnail( @@ -2262,8 +2266,12 @@ tl_object_ptr StickersManager::get_sticker_object(FileId file_i return nullptr; } }(); + int64 sticker_id = 0; + if (sticker->set_id_.is_valid()) { + sticker_id = get_sticker_id(file_id); + } return td_api::make_object( - sticker->set_id_.get(), width, height, sticker->alt_, get_sticker_format_object(sticker->format_), + sticker_id, sticker->set_id_.get(), width, height, sticker->alt_, get_sticker_format_object(sticker->format_), std::move(full_type), get_sticker_minithumbnail(sticker->minithumbnail_, sticker->set_id_, document_id, zoom), std::move(thumbnail_object), td_->file_manager_->get_file_object(file_id)); } diff --git a/td/telegram/StickersManager.h b/td/telegram/StickersManager.h index 593a28dc2..cf4b98fa9 100644 --- a/td/telegram/StickersManager.h +++ b/td/telegram/StickersManager.h @@ -605,6 +605,8 @@ class StickersManager final : public Actor { class UploadStickerFileCallback; + int64 get_sticker_id(FileId sticker_id) const; + CustomEmojiId get_custom_emoji_id(FileId sticker_id) const; static vector> get_sticker_minithumbnail(CSlice path,