Add sticker.id.
This commit is contained in:
parent
0b07533506
commit
69c6a485ba
@ -388,6 +388,7 @@ document file_name:string mime_type:string minithumbnail:minithumbnail thumbnail
|
|||||||
photo has_stickers:Bool minithumbnail:minithumbnail sizes:vector<photoSize> = Photo;
|
photo has_stickers:Bool minithumbnail:minithumbnail sizes:vector<photoSize> = Photo;
|
||||||
|
|
||||||
//@description Describes a sticker
|
//@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
|
//@set_id The identifier of the sticker set to which the sticker belongs; 0 if none
|
||||||
//@width Sticker width; as defined by the sender
|
//@width Sticker width; as defined by the sender
|
||||||
//@height Sticker height; 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<photoSize> = 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
|
//@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
|
//@thumbnail Sticker thumbnail in WEBP or JPEG format; may be null
|
||||||
//@sticker File containing the sticker
|
//@sticker File containing the sticker
|
||||||
sticker set_id:int64 width:int32 height:int32 emoji:string format:StickerFormat full_type:StickerFullType outline:vector<closedVectorPath> thumbnail:thumbnail sticker:file = Sticker;
|
sticker id:int64 set_id:int64 width:int32 height:int32 emoji:string format:StickerFormat full_type:StickerFullType outline:vector<closedVectorPath> thumbnail:thumbnail sticker:file = Sticker;
|
||||||
|
|
||||||
//@description Describes a video file
|
//@description Describes a video file
|
||||||
//@duration Duration of the video, in seconds; as defined by the sender
|
//@duration Duration of the video, in seconds; as defined by the sender
|
||||||
|
@ -1275,7 +1275,7 @@ tl_object_ptr<td_api::photo> copy(const td_api::photo &obj) {
|
|||||||
|
|
||||||
template <>
|
template <>
|
||||||
tl_object_ptr<td_api::sticker> copy(const td_api::sticker &obj) {
|
tl_object_ptr<td_api::sticker> copy(const td_api::sticker &obj) {
|
||||||
return td_api::make_object<td_api::sticker>(obj.set_id_, obj.width_, obj.height_, obj.emoji_, copy(obj.format_),
|
return td_api::make_object<td_api::sticker>(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.full_type_), transform(obj.outline_, copy_closed_vector_path),
|
||||||
copy(obj.thumbnail_), copy(obj.sticker_));
|
copy(obj.thumbnail_), copy(obj.sticker_));
|
||||||
}
|
}
|
||||||
|
@ -1945,13 +1945,17 @@ bool StickersManager::is_premium_custom_emoji(CustomEmojiId custom_emoji_id, boo
|
|||||||
return s->is_premium_;
|
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);
|
auto sticker_file_view = td_->file_manager_->get_file_view(sticker_id);
|
||||||
if (sticker_file_view.is_encrypted() || !sticker_file_view.has_remote_location() ||
|
if (sticker_file_view.is_encrypted() || !sticker_file_view.has_remote_location() ||
|
||||||
!sticker_file_view.remote_location().is_document()) {
|
!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<td_api::object_ptr<td_api::closedVectorPath>> StickersManager::get_sticker_minithumbnail(
|
vector<td_api::object_ptr<td_api::closedVectorPath>> StickersManager::get_sticker_minithumbnail(
|
||||||
@ -2262,8 +2266,12 @@ tl_object_ptr<td_api::sticker> StickersManager::get_sticker_object(FileId file_i
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}();
|
}();
|
||||||
|
int64 sticker_id = 0;
|
||||||
|
if (sticker->set_id_.is_valid()) {
|
||||||
|
sticker_id = get_sticker_id(file_id);
|
||||||
|
}
|
||||||
return td_api::make_object<td_api::sticker>(
|
return td_api::make_object<td_api::sticker>(
|
||||||
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(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));
|
std::move(thumbnail_object), td_->file_manager_->get_file_object(file_id));
|
||||||
}
|
}
|
||||||
|
@ -605,6 +605,8 @@ class StickersManager final : public Actor {
|
|||||||
|
|
||||||
class UploadStickerFileCallback;
|
class UploadStickerFileCallback;
|
||||||
|
|
||||||
|
int64 get_sticker_id(FileId sticker_id) const;
|
||||||
|
|
||||||
CustomEmojiId get_custom_emoji_id(FileId sticker_id) const;
|
CustomEmojiId get_custom_emoji_id(FileId sticker_id) const;
|
||||||
|
|
||||||
static vector<td_api::object_ptr<td_api::closedVectorPath>> get_sticker_minithumbnail(CSlice path,
|
static vector<td_api::object_ptr<td_api::closedVectorPath>> get_sticker_minithumbnail(CSlice path,
|
||||||
|
Loading…
Reference in New Issue
Block a user