Add Client::on_get_sticker_set_name overload.

This commit is contained in:
levlam 2024-08-28 12:01:43 +03:00
parent c571a9ee5b
commit dfe0dc9881
2 changed files with 12 additions and 12 deletions

View File

@ -5216,9 +5216,7 @@ class Client::TdOnGetChatCustomEmojiStickerSetCallback final : public TdQueryCal
if (result->get_id() == td_api::error::ID) {
supergroup_info->custom_emoji_sticker_set_id = 0;
} else {
CHECK(result->get_id() == td_api::text::ID);
auto sticker_set_name = move_object_as<td_api::text>(result);
client_->on_get_sticker_set_name(sticker_set_id_, sticker_set_name->text_);
client_->on_get_sticker_set_name(sticker_set_id_, std::move(result));
}
answer_query(JsonChat(chat_id_, client_, true, pinned_message_id_), std::move(query_));
@ -5254,9 +5252,7 @@ class Client::TdOnGetChatBusinessStartPageStickerSetCallback final : public TdQu
user_info->business_info->start_page_->sticker_->set_id_ = 0;
}
} else {
CHECK(result->get_id() == td_api::text::ID);
auto sticker_set_name = move_object_as<td_api::text>(result);
client_->on_get_sticker_set_name(sticker_set_id_, sticker_set_name->text_);
client_->on_get_sticker_set_name(sticker_set_id_, std::move(result));
}
answer_query(JsonChat(chat_id_, client_, true, pinned_message_id_), std::move(query_));
@ -5289,9 +5285,7 @@ class Client::TdOnGetChatStickerSetCallback final : public TdQueryCallback {
if (result->get_id() == td_api::error::ID) {
supergroup_info->sticker_set_id = 0;
} else {
CHECK(result->get_id() == td_api::text::ID);
auto sticker_set_name = move_object_as<td_api::text>(result);
client_->on_get_sticker_set_name(sticker_set_id_, sticker_set_name->text_);
client_->on_get_sticker_set_name(sticker_set_id_, std::move(result));
}
auto sticker_set_id = supergroup_info->custom_emoji_sticker_set_id;
@ -5851,9 +5845,7 @@ class Client::TdOnGetStickerSetPromiseCallback final : public TdQueryCallback {
return promise_.set_error(td::Status::Error(error->code_, error->message_));
}
CHECK(result->get_id() == td_api::text::ID);
auto sticker_set_name = move_object_as<td_api::text>(result);
client_->on_get_sticker_set_name(sticker_set_id_, sticker_set_name->text_);
client_->on_get_sticker_set_name(sticker_set_id_, std::move(result));
promise_.set_value(td::Unit());
}
@ -6222,6 +6214,12 @@ void Client::on_get_sticker_set_name(int64 set_id, const td::string &name) {
}
}
void Client::on_get_sticker_set_name(int64 set_id, object_ptr<td_api::Object> sticker_set_name) {
CHECK(sticker_set_name->get_id() == td_api::text::ID);
auto text = move_object_as<td_api::text>(sticker_set_name);
on_get_sticker_set_name(set_id, text->text_);
}
template <class OnSuccess>
void Client::check_user_read_access(const UserInfo *user_info, PromisedQueryPtr query, OnSuccess on_success) {
CHECK(user_info != nullptr);

View File

@ -270,6 +270,8 @@ class Client final : public WebhookActor::Callback {
void on_get_sticker_set_name(int64 set_id, const td::string &name);
void on_get_sticker_set_name(int64 set_id, object_ptr<td_api::Object> sticker_set_name);
class TdQueryCallback {
public:
virtual void on_result(object_ptr<td_api::Object> result) = 0;