mirror of
https://github.com/tdlight-team/tdlight-telegram-bot-api.git
synced 2024-11-27 06:06:47 +01:00
Update TDLib to 1.8.1.
This commit is contained in:
parent
208fd70d58
commit
1851ba7eb5
2
td
2
td
@ -1 +1 @@
|
||||
Subproject commit 14637caa64c2c992c1cde7c92cadb43a83d4435e
|
||||
Subproject commit 92c2a9c4e521df720abeaa9872e1c2b797d5c93f
|
@ -964,9 +964,14 @@ class Client::JsonSticker final : public Jsonable {
|
||||
if (!set_name.empty()) {
|
||||
object("set_name", set_name);
|
||||
}
|
||||
object("is_animated", td::JsonBool(sticker_->is_animated_));
|
||||
if (sticker_->mask_position_ != nullptr) {
|
||||
object("mask_position", JsonMaskPosition(sticker_->mask_position_.get()));
|
||||
auto type = sticker_->type_->get_id();
|
||||
object("is_animated", td::JsonBool(type == td_api::stickerTypeAnimated::ID));
|
||||
object("is_video", td::JsonBool(type == td_api::stickerTypeVideo::ID));
|
||||
if (type == td_api::stickerTypeMask::ID) {
|
||||
const auto &mask_position = static_cast<const td_api::stickerTypeMask *>(sticker_->type_.get())->mask_position_;
|
||||
if (mask_position != nullptr) {
|
||||
object("mask_position", JsonMaskPosition(mask_position.get()));
|
||||
}
|
||||
}
|
||||
client_->json_store_thumbnail(object, sticker_->thumbnail_.get());
|
||||
client_->json_store_file(object, sticker_->sticker_.get());
|
||||
@ -2489,8 +2494,10 @@ class Client::JsonStickerSet final : public Jsonable {
|
||||
if (sticker_set_->thumbnail_ != nullptr) {
|
||||
client_->json_store_thumbnail(object, sticker_set_->thumbnail_.get());
|
||||
}
|
||||
object("is_animated", td::JsonBool(sticker_set_->is_animated_));
|
||||
object("contains_masks", td::JsonBool(sticker_set_->is_masks_));
|
||||
auto type = sticker_set_->sticker_type_->get_id();
|
||||
object("is_animated", td::JsonBool(type == td_api::stickerTypeAnimated::ID));
|
||||
object("is_video", td::JsonBool(type == td_api::stickerTypeVideo::ID));
|
||||
object("contains_masks", td::JsonBool(type == td_api::stickerTypeMask::ID));
|
||||
object("stickers", JsonStickers(sticker_set_->stickers_, client_));
|
||||
}
|
||||
|
||||
@ -5767,28 +5774,41 @@ td::Result<td_api::object_ptr<td_api::maskPosition>> Client::get_mask_position(c
|
||||
return r_mask_position.move_as_ok();
|
||||
}
|
||||
|
||||
td::Result<td::vector<td_api::object_ptr<td_api::InputSticker>>> Client::get_input_stickers(const Query *query) const {
|
||||
td::Result<td::vector<td_api::object_ptr<td_api::inputSticker>>> Client::get_input_stickers(const Query *query,
|
||||
bool is_masks) const {
|
||||
auto emojis = query->arg("emojis");
|
||||
|
||||
td::vector<object_ptr<td_api::InputSticker>> stickers;
|
||||
auto sticker = get_input_file(query, "png_sticker");
|
||||
object_ptr<td_api::StickerType> sticker_type;
|
||||
if (sticker != nullptr) {
|
||||
TRY_RESULT(mask_position, get_mask_position(query, "mask_position"));
|
||||
stickers.push_back(
|
||||
make_object<td_api::inputStickerStatic>(std::move(sticker), emojis.str(), std::move(mask_position)));
|
||||
if (is_masks) {
|
||||
TRY_RESULT(mask_position, get_mask_position(query, "mask_position"));
|
||||
sticker_type = make_object<td_api::stickerTypeMask>(std::move(mask_position));
|
||||
} else {
|
||||
sticker_type = make_object<td_api::stickerTypeStatic>();
|
||||
}
|
||||
} else {
|
||||
sticker = get_input_file(query, "tgs_sticker", true);
|
||||
if (sticker == nullptr) {
|
||||
if (query->arg("tgs_sticker").empty()) {
|
||||
if (sticker != nullptr) {
|
||||
sticker_type = make_object<td_api::stickerTypeAnimated>();
|
||||
} else {
|
||||
sticker = get_input_file(query, "webm_sticker", true);
|
||||
if (sticker != nullptr) {
|
||||
sticker_type = make_object<td_api::stickerTypeVideo>();
|
||||
} else {
|
||||
if (!query->arg("tgs_sticker").empty()) {
|
||||
return Status::Error(400, "Bad Request: animated sticker must be uploaded as an InputFile");
|
||||
}
|
||||
if (!query->arg("webm_sticker").empty()) {
|
||||
return Status::Error(400, "Bad Request: video sticker must be uploaded as an InputFile");
|
||||
}
|
||||
return Status::Error(400, "Bad Request: there is no sticker file in the request");
|
||||
}
|
||||
return Status::Error(400, "Bad Request: TGS sticker must be uploaded as an InputFile");
|
||||
}
|
||||
|
||||
stickers.push_back(make_object<td_api::inputStickerAnimated>(std::move(sticker), emojis.str()));
|
||||
}
|
||||
CHECK(stickers.size() == 1);
|
||||
|
||||
td::vector<object_ptr<td_api::inputSticker>> stickers;
|
||||
stickers.push_back(make_object<td_api::inputSticker>(std::move(sticker), emojis.str(), std::move(sticker_type)));
|
||||
return std::move(stickers);
|
||||
}
|
||||
|
||||
@ -7783,7 +7803,8 @@ td::Status Client::process_upload_sticker_file_query(PromisedQueryPtr &query) {
|
||||
check_user(user_id, std::move(query),
|
||||
[this, user_id, png_sticker = std::move(png_sticker)](PromisedQueryPtr query) mutable {
|
||||
send_request(make_object<td_api::uploadStickerFile>(
|
||||
user_id, make_object<td_api::inputStickerStatic>(std::move(png_sticker), "", nullptr)),
|
||||
user_id, make_object<td_api::inputSticker>(std::move(png_sticker), "",
|
||||
make_object<td_api::stickerTypeStatic>())),
|
||||
std::make_unique<TdOnReturnFileCallback>(this, std::move(query)));
|
||||
});
|
||||
return Status::OK();
|
||||
@ -7794,11 +7815,11 @@ td::Status Client::process_create_new_sticker_set_query(PromisedQueryPtr &query)
|
||||
auto name = query->arg("name");
|
||||
auto title = query->arg("title");
|
||||
auto is_masks = to_bool(query->arg("contains_masks"));
|
||||
TRY_RESULT(stickers, get_input_stickers(query.get()));
|
||||
TRY_RESULT(stickers, get_input_stickers(query.get(), is_masks));
|
||||
|
||||
check_user(user_id, std::move(query),
|
||||
[this, user_id, title, name, is_masks, stickers = std::move(stickers)](PromisedQueryPtr query) mutable {
|
||||
send_request(make_object<td_api::createNewStickerSet>(user_id, title.str(), name.str(), is_masks,
|
||||
[this, user_id, title, name, stickers = std::move(stickers)](PromisedQueryPtr query) mutable {
|
||||
send_request(make_object<td_api::createNewStickerSet>(user_id, title.str(), name.str(),
|
||||
std::move(stickers), PSTRING() << "bot" << my_id_),
|
||||
std::make_unique<TdOnReturnStickerSetCallback>(this, false, std::move(query)));
|
||||
});
|
||||
@ -7808,7 +7829,7 @@ td::Status Client::process_create_new_sticker_set_query(PromisedQueryPtr &query)
|
||||
td::Status Client::process_add_sticker_to_set_query(PromisedQueryPtr &query) {
|
||||
TRY_RESULT(user_id, get_user_id(query.get()));
|
||||
auto name = query->arg("name");
|
||||
TRY_RESULT(stickers, get_input_stickers(query.get()));
|
||||
TRY_RESULT(stickers, get_input_stickers(query.get(), true));
|
||||
CHECK(!stickers.empty());
|
||||
|
||||
check_user(user_id, std::move(query),
|
||||
@ -8324,7 +8345,8 @@ void Client::do_get_updates(int32 offset, int32 limit, int32 timeout, PromisedQu
|
||||
}
|
||||
}
|
||||
|
||||
auto updates = mutable_span(parameters_->shared_data_->event_buffer_, SharedData::TQUEUE_EVENT_BUFFER_SIZE);
|
||||
td::MutableSpan<td::TQueue::Event> updates(parameters_->shared_data_->event_buffer_,
|
||||
SharedData::TQUEUE_EVENT_BUFFER_SIZE);
|
||||
updates.truncate(limit);
|
||||
td::TQueue::EventId from;
|
||||
size_t total_size = 0;
|
||||
|
@ -367,7 +367,7 @@ class Client final : public WebhookActor::Callback {
|
||||
|
||||
static object_ptr<td_api::MaskPoint> mask_index_to_point(int32 index);
|
||||
|
||||
td::Result<td::vector<object_ptr<td_api::InputSticker>>> get_input_stickers(const Query *query) const;
|
||||
td::Result<td::vector<object_ptr<td_api::inputSticker>>> get_input_stickers(const Query *query, bool is_masks) const;
|
||||
|
||||
static td::Result<td::string> get_passport_element_hash(Slice encoded_hash);
|
||||
|
||||
|
@ -356,7 +356,7 @@ void WebhookActor::load_updates() {
|
||||
|
||||
auto offset = tqueue_offset_;
|
||||
auto limit = td::min(SharedData::TQUEUE_EVENT_BUFFER_SIZE, max_loaded_updates_ - queue_updates_.size());
|
||||
auto updates = mutable_span(parameters_->shared_data_->event_buffer_, limit);
|
||||
td::MutableSpan<td::TQueue::Event> updates(parameters_->shared_data_->event_buffer_, limit);
|
||||
|
||||
auto now = td::Time::now();
|
||||
auto unix_time_now = parameters_->shared_data_->get_unix_time(now);
|
||||
|
Loading…
Reference in New Issue
Block a user