diff --git a/telegram-bot-api/Client.cpp b/telegram-bot-api/Client.cpp index 3871a4c..0dc2629 100644 --- a/telegram-bot-api/Client.cpp +++ b/telegram-bot-api/Client.cpp @@ -8138,8 +8138,11 @@ td::Result> Client::get_input_sticker(c return r_sticker.move_as_ok(); } - auto emojis = query->arg("emojis"); + return get_legacy_input_sticker(query); +} +td::Result> Client::get_legacy_input_sticker(const Query *query) const { + auto emojis = query->arg("emojis"); auto sticker = get_input_file(query, "png_sticker"); object_ptr sticker_format; object_ptr mask_position; @@ -8202,37 +8205,10 @@ td::Result>> Client::get_inp return std::move(input_stickers); } - auto emojis = query->arg("emojis"); - - auto sticker = get_input_file(query, "png_sticker"); - object_ptr sticker_format; - object_ptr mask_position; - if (sticker != nullptr) { - sticker_format = make_object(); - TRY_RESULT_ASSIGN(mask_position, get_mask_position(query, "mask_position")); - } else { - sticker = get_input_file(query, "tgs_sticker", true); - if (sticker != nullptr) { - sticker_format = make_object(); - } else { - sticker = get_input_file(query, "webm_sticker", true); - if (sticker != nullptr) { - sticker_format = make_object(); - } else { - if (!query->arg("tgs_sticker").empty()) { - return td::Status::Error(400, "Bad Request: animated sticker must be uploaded as an InputFile"); - } - if (!query->arg("webm_sticker").empty()) { - return td::Status::Error(400, "Bad Request: video sticker must be uploaded as an InputFile"); - } - return td::Status::Error(400, "Bad Request: there is no sticker file in the request"); - } - } - } + TRY_RESULT(input_sticker, get_legacy_input_sticker(query)); td::vector> stickers; - stickers.push_back(make_object(std::move(sticker), std::move(sticker_format), emojis.str(), - std::move(mask_position), td::vector())); + stickers.push_back(std::move(input_sticker)); return std::move(stickers); } diff --git a/telegram-bot-api/Client.h b/telegram-bot-api/Client.h index e4ceda8..252e79e 100644 --- a/telegram-bot-api/Client.h +++ b/telegram-bot-api/Client.h @@ -486,6 +486,8 @@ class Client final : public WebhookActor::Callback { static td::Result> get_sticker_format(td::Slice sticker_format); + td::Result> get_legacy_input_sticker(const Query *query) const; + td::Result> get_input_sticker(const Query *query) const; td::Result> get_input_sticker(const Query *query, td::JsonValue &&value,