Move mask_position out of stickerTypeMask.
This commit is contained in:
parent
7d5dc9fd16
commit
a896edcd14
@ -257,8 +257,8 @@ stickerFormatWebm = StickerFormat;
|
||||
//@description The sticker is a regular sticker
|
||||
stickerTypeRegular = StickerType;
|
||||
|
||||
//@description The sticker is a mask in WEBP format to be placed on photos or videos @mask_position Position where the mask is placed; may be null
|
||||
stickerTypeMask mask_position:maskPosition = StickerType;
|
||||
//@description The sticker is a mask in WEBP format to be placed on photos or videos
|
||||
stickerTypeMask = StickerType;
|
||||
|
||||
|
||||
//@description Represents a closed vector path. The path begins at the end point of the last command @commands List of vector path commands
|
||||
@ -301,9 +301,10 @@ 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 @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
|
||||
//@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
|
||||
//@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 @premium_animation Premium animation of the sticker; may be null. If present, only Premium users can send the sticker @sticker File containing the sticker
|
||||
sticker set_id:int64 width:int32 height:int32 emoji:string format:StickerFormat type:StickerType outline:vector<closedVectorPath> thumbnail:thumbnail premium_animation:file sticker:file = Sticker;
|
||||
sticker set_id:int64 width:int32 height:int32 emoji:string format:StickerFormat type:StickerType mask_position:maskPosition outline:vector<closedVectorPath> thumbnail:thumbnail 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
|
||||
@ -4004,7 +4005,8 @@ proxies proxies:vector<proxy> = Proxies;
|
||||
//@emojis Emojis corresponding to the sticker
|
||||
//@format Sticker format
|
||||
//@type Sticker type
|
||||
inputSticker sticker:InputFile emojis:string format:StickerFormat type:StickerType = InputSticker;
|
||||
//@mask_position Position where the mask is placed; pass null if not specified
|
||||
inputSticker sticker:InputFile emojis:string format:StickerFormat type:StickerType mask_position:maskPosition = 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
|
||||
|
@ -1167,10 +1167,8 @@ tl_object_ptr<td_api::StickerType> copy(const td_api::StickerType &obj) {
|
||||
switch (obj.get_id()) {
|
||||
case td_api::stickerTypeRegular::ID:
|
||||
return td_api::make_object<td_api::stickerTypeRegular>();
|
||||
case td_api::stickerTypeMask::ID: {
|
||||
auto &mask_position = static_cast<const td_api::stickerTypeMask &>(obj).mask_position_;
|
||||
return td_api::make_object<td_api::stickerTypeMask>(copy(mask_position));
|
||||
}
|
||||
case td_api::stickerTypeMask::ID:
|
||||
return td_api::make_object<td_api::stickerTypeMask>();
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
@ -1244,8 +1242,9 @@ 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_), transform(obj.outline_, copy_closed_vector_path),
|
||||
copy(obj.thumbnail_), copy(obj.premium_animation_), copy(obj.sticker_));
|
||||
copy(obj.type_), copy(obj.mask_position_),
|
||||
transform(obj.outline_, copy_closed_vector_path), copy(obj.thumbnail_),
|
||||
copy(obj.premium_animation_), copy(obj.sticker_));
|
||||
}
|
||||
|
||||
template <>
|
||||
|
@ -1898,7 +1898,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), nullptr,
|
||||
get_sticker_minithumbnail(sticker->minithumbnail, sticker->set_id, document_id, zoom),
|
||||
std::move(mask_position), get_sticker_minithumbnail(sticker->minithumbnail, sticker->set_id, document_id, zoom),
|
||||
std::move(thumbnail_object), std::move(premium_animation_object), td_->file_manager_->get_file_object(file_id));
|
||||
}
|
||||
|
||||
@ -5898,8 +5898,7 @@ tl_object_ptr<telegram_api::inputStickerSetItem> StickersManager::get_input_stic
|
||||
|
||||
tl_object_ptr<telegram_api::maskCoords> mask_coords;
|
||||
if (sticker->type_ != nullptr && sticker->type_->get_id() == td_api::stickerTypeMask::ID) {
|
||||
auto sticker_type = static_cast<const td_api::stickerTypeMask *>(sticker->type_.get());
|
||||
auto mask_position = sticker_type->mask_position_.get();
|
||||
auto mask_position = sticker->mask_position_.get();
|
||||
if (mask_position != nullptr && mask_position->point_ != nullptr) {
|
||||
auto point = [mask_point_id = mask_position->point_->get_id()] {
|
||||
switch (mask_point_id) {
|
||||
|
@ -548,13 +548,20 @@ class CliClient final : public Actor {
|
||||
|
||||
static td_api::object_ptr<td_api::StickerType> as_sticker_type(string sticker_type) {
|
||||
if (!sticker_type.empty() && sticker_type.back() == 'm') {
|
||||
auto position = td_api::make_object<td_api::maskPosition>(td_api::make_object<td_api::maskPointEyes>(),
|
||||
Random::fast(-5, 5), Random::fast(-5, 5), 1.0);
|
||||
return td_api::make_object<td_api::stickerTypeMask>(Random::fast_bool() ? nullptr : std::move(position));
|
||||
return td_api::make_object<td_api::stickerTypeMask>();
|
||||
}
|
||||
return Random::fast_bool() ? nullptr : td_api::make_object<td_api::stickerTypeRegular>();
|
||||
}
|
||||
|
||||
static td_api::object_ptr<td_api::maskPosition> as_mask_position(string sticker_type) {
|
||||
if (!sticker_type.empty() && sticker_type.back() == 'm') {
|
||||
auto position = td_api::make_object<td_api::maskPosition>(td_api::make_object<td_api::maskPointEyes>(),
|
||||
Random::fast(-5, 5), Random::fast(-5, 5), 1.0);
|
||||
return Random::fast_bool() ? nullptr : std::move(position);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static int32 as_limit(Slice str, int32 default_limit = 10) {
|
||||
if (str.empty()) {
|
||||
return default_limit;
|
||||
@ -2717,7 +2724,7 @@ class CliClient final : public Actor {
|
||||
} else if (op == "usf" || op == "usfa" || op == "usfv" || op == "usfm") {
|
||||
send_request(td_api::make_object<td_api::uploadStickerFile>(
|
||||
-1, td_api::make_object<td_api::inputSticker>(as_input_file(args), "😀", as_sticker_format(op),
|
||||
as_sticker_type(op))));
|
||||
as_sticker_type(op), as_mask_position(op))));
|
||||
} else if (op == "cnss" || op == "cnssa" || op == "cnssv" || op == "cnssm") {
|
||||
string title;
|
||||
string name;
|
||||
@ -2726,7 +2733,7 @@ class CliClient final : public Actor {
|
||||
auto input_stickers =
|
||||
transform(autosplit(stickers), [op](Slice sticker) -> td_api::object_ptr<td_api::inputSticker> {
|
||||
return td_api::make_object<td_api::inputSticker>(as_input_file(sticker), "😀", as_sticker_format(op),
|
||||
as_sticker_type(op));
|
||||
as_sticker_type(op), as_mask_position(op));
|
||||
});
|
||||
send_request(
|
||||
td_api::make_object<td_api::createNewStickerSet>(my_id_, title, name, std::move(input_stickers), "tg_cli"));
|
||||
|
Loading…
Reference in New Issue
Block a user