Add sticker.custom_emoji_id.

This commit is contained in:
levlam 2022-07-19 14:45:37 +03:00
parent eef3fe5932
commit 219d5ecf87
3 changed files with 14 additions and 6 deletions

View File

@ -260,7 +260,7 @@ stickerTypeRegular = StickerType;
//@description The sticker is a mask in WEBP format to be placed on photos or videos
stickerTypeMask = StickerType;
//@description The sticker is an emoji to be used inside message text and caption
//@description The sticker is a custom emoji to be used inside message text and caption
stickerTypeEmoji = StickerType;
@ -304,10 +304,11 @@ document file_name:string mime_type:string minithumbnail:minithumbnail thumbnail
photo has_stickers:Bool minithumbnail:minithumbnail sizes:vector<photoSize> = Photo;
//@description Describes a sticker @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
//@emoji Emoji corresponding to the sticker @format Sticker format @type Sticker type @mask_position Position where the mask is placed; may be null even sticker is a mask
//@emoji Emoji corresponding to the sticker @format Sticker format @type Sticker type @mask_position Position where the mask is placed; may be null even the sticker is a mask
//@custom_emoji_id Identifier of the emoji if the sticker is a custom emoji
//@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 @is_premium True, if only Premium users can use the sticker @premium_animation Premium animation of the sticker; may be null @sticker File containing the sticker
sticker set_id:int64 width:int32 height:int32 emoji:string format:StickerFormat type:StickerType mask_position:maskPosition outline:vector<closedVectorPath> thumbnail:thumbnail is_premium:Bool premium_animation:file sticker:file = Sticker;
sticker set_id:int64 width:int32 height:int32 emoji:string format:StickerFormat type:StickerType mask_position:maskPosition custom_emoji_id:int64 outline:vector<closedVectorPath> thumbnail:thumbnail is_premium:Bool premium_animation:file sticker:file = Sticker;
//@description Describes a video file @duration Duration of the video, in seconds; as defined by the sender @width Video width; as defined by the sender @height Video height; as defined by the sender
//@file_name Original name of the file; as defined by the sender @mime_type MIME type of the file; as defined by the sender

View File

@ -1244,7 +1244,7 @@ tl_object_ptr<td_api::photo> copy(const td_api::photo &obj) {
template <>
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_),
copy(obj.type_), copy(obj.mask_position_),
copy(obj.type_), copy(obj.mask_position_), obj.custom_emoji_id_,
transform(obj.outline_, copy_closed_vector_path), copy(obj.thumbnail_),
obj.is_premium_, copy(obj.premium_animation_), copy(obj.sticker_));
}

View File

@ -1916,7 +1916,8 @@ tl_object_ptr<td_api::sticker> StickersManager::get_sticker_object(FileId file_i
const PhotoSize &thumbnail = sticker->m_thumbnail.file_id.is_valid() ? sticker->m_thumbnail : sticker->s_thumbnail;
auto thumbnail_format = PhotoFormat::Webp;
int64 document_id = -1;
int64 document_id = 0;
int64 emoji_document_id = 0;
if (!sticker->set_id.is_valid()) {
auto sticker_file_view = td_->file_manager_->get_file_view(sticker->file_id);
if (sticker_file_view.is_encrypted()) {
@ -1934,6 +1935,12 @@ tl_object_ptr<td_api::sticker> StickersManager::get_sticker_object(FileId file_i
}
}
}
} else if (sticker->type == StickerType::Emoji) {
auto sticker_file_view = td_->file_manager_->get_file_view(sticker->file_id);
if (!sticker_file_view.is_encrypted() && sticker_file_view.has_remote_location() &&
sticker_file_view.remote_location().is_document()) {
emoji_document_id = sticker_file_view.remote_location().get_id();
}
}
auto thumbnail_object = get_thumbnail_object(td_->file_manager_.get(), thumbnail, thumbnail_format);
int32 width = sticker->dimensions.width;
@ -1949,7 +1956,7 @@ tl_object_ptr<td_api::sticker> StickersManager::get_sticker_object(FileId file_i
: nullptr;
return td_api::make_object<td_api::sticker>(
sticker->set_id.get(), width, height, sticker->alt, get_sticker_format_object(sticker->format),
get_sticker_type_object(sticker->type), std::move(mask_position),
get_sticker_type_object(sticker->type), std::move(mask_position), emoji_document_id,
get_sticker_minithumbnail(sticker->minithumbnail, sticker->set_id, document_id, zoom),
std::move(thumbnail_object), sticker->is_premium, std::move(premium_animation_object),
td_->file_manager_->get_file_object(file_id));