Merge branch 'tdlib:master' into master

This commit is contained in:
omg-xtao 2024-09-06 22:16:29 +08:00 committed by GitHub
commit 4f01f6c528
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 219 additions and 102 deletions

View File

@ -6,7 +6,7 @@ if (POLICY CMP0065)
cmake_policy(SET CMP0065 NEW) cmake_policy(SET CMP0065 NEW)
endif() endif()
project(TelegramBotApi VERSION 7.9 LANGUAGES CXX) project(TelegramBotApi VERSION 7.10 LANGUAGES CXX)
if (POLICY CMP0069) if (POLICY CMP0069)
option(TELEGRAM_BOT_API_ENABLE_LTO "Use \"ON\" to enable Link Time Optimization.") option(TELEGRAM_BOT_API_ENABLE_LTO "Use \"ON\" to enable Link Time Optimization.")

2
td

@ -1 +1 @@
Subproject commit 8d08b34e22a08e58db8341839c4e18ee06c516c5 Subproject commit 87d881071fe514936bb17029e96761141287d2be

View File

@ -39,6 +39,24 @@ namespace telegram_bot_api {
using td_api::make_object; using td_api::make_object;
using td_api::move_object_as; using td_api::move_object_as;
Client::Client(td::ActorShared<> parent, const td::string &bot_token, bool is_test_dc, int64 tqueue_id,
std::shared_ptr<const ClientParameters> parameters, td::ActorId<BotStatActor> stat_actor)
: parent_(std::move(parent))
, bot_token_(bot_token)
, bot_token_id_("<unknown>")
, is_test_dc_(is_test_dc)
, tqueue_id_(tqueue_id)
, parameters_(std::move(parameters))
, stat_actor_(std::move(stat_actor)) {
static auto is_inited = init_methods();
CHECK(is_inited);
}
Client::~Client() {
td::Scheduler::instance()->destroy_on_scheduler(SharedData::get_file_gc_scheduler_id(), messages_, users_, groups_,
supergroups_, chats_, sticker_set_names_);
}
int Client::get_retry_after_time(td::Slice error_message) { int Client::get_retry_after_time(td::Slice error_message) {
td::Slice prefix = "Too Many Requests: retry after "; td::Slice prefix = "Too Many Requests: retry after ";
if (td::begins_with(error_message, prefix)) { if (td::begins_with(error_message, prefix)) {
@ -179,22 +197,8 @@ void Client::fail_query_with_error(PromisedQueryPtr &&query, object_ptr<td_api::
fail_query_with_error(std::move(query), error->code_, error->message_, default_message); fail_query_with_error(std::move(query), error->code_, error->message_, default_message);
} }
Client::Client(td::ActorShared<> parent, const td::string &bot_token, bool is_test_dc, int64 tqueue_id, bool Client::is_special_error_code(int32 error_code) {
std::shared_ptr<const ClientParameters> parameters, td::ActorId<BotStatActor> stat_actor) return error_code == 401 || error_code == 429 || error_code >= 500;
: parent_(std::move(parent))
, bot_token_(bot_token)
, bot_token_id_("<unknown>")
, is_test_dc_(is_test_dc)
, tqueue_id_(tqueue_id)
, parameters_(std::move(parameters))
, stat_actor_(std::move(stat_actor)) {
static auto is_inited = init_methods();
CHECK(is_inited);
}
Client::~Client() {
td::Scheduler::instance()->destroy_on_scheduler(SharedData::get_file_gc_scheduler_id(), messages_, users_, groups_,
supergroups_, chats_, sticker_set_names_);
} }
bool Client::init_methods() { bool Client::init_methods() {
@ -2416,10 +2420,25 @@ class Client::JsonChatShared final : public td::Jsonable {
const Client *client_; const Client *client_;
}; };
class Client::JsonGiveawayCreated final : public td::Jsonable {
public:
explicit JsonGiveawayCreated(const td_api::messageGiveawayCreated *giveaway_created)
: giveaway_created_(giveaway_created) {
}
void store(td::JsonValueScope *scope) const {
auto object = scope->enter_object();
if (giveaway_created_->star_count_ > 0) {
object("prize_star_count", giveaway_created_->star_count_);
}
}
private:
const td_api::messageGiveawayCreated *giveaway_created_;
};
class Client::JsonGiveaway final : public td::Jsonable { class Client::JsonGiveaway final : public td::Jsonable {
public: public:
JsonGiveaway(const td_api::messagePremiumGiveaway *giveaway, const Client *client) JsonGiveaway(const td_api::messageGiveaway *giveaway, const Client *client) : giveaway_(giveaway), client_(client) {
: giveaway_(giveaway), client_(client) {
} }
void store(td::JsonValueScope *scope) const { void store(td::JsonValueScope *scope) const {
auto object = scope->enter_object(); auto object = scope->enter_object();
@ -2444,19 +2463,34 @@ class Client::JsonGiveaway final : public td::Jsonable {
if (!giveaway_->parameters_->prize_description_.empty()) { if (!giveaway_->parameters_->prize_description_.empty()) {
object("prize_description", giveaway_->parameters_->prize_description_); object("prize_description", giveaway_->parameters_->prize_description_);
} }
if (giveaway_->month_count_ > 0) { switch (giveaway_->prize_->get_id()) {
object("premium_subscription_month_count", giveaway_->month_count_); case td_api::giveawayPrizePremium::ID: {
auto month_count = static_cast<const td_api::giveawayPrizePremium *>(giveaway_->prize_.get())->month_count_;
if (month_count > 0) {
object("premium_subscription_month_count", month_count);
}
break;
}
case td_api::giveawayPrizeStars::ID: {
auto star_count = static_cast<const td_api::giveawayPrizeStars *>(giveaway_->prize_.get())->star_count_;
if (star_count > 0) {
object("prize_star_count", star_count);
}
break;
}
default:
UNREACHABLE();
} }
} }
private: private:
const td_api::messagePremiumGiveaway *giveaway_; const td_api::messageGiveaway *giveaway_;
const Client *client_; const Client *client_;
}; };
class Client::JsonGiveawayWinners final : public td::Jsonable { class Client::JsonGiveawayWinners final : public td::Jsonable {
public: public:
JsonGiveawayWinners(const td_api::messagePremiumGiveawayWinners *giveaway_winners, const Client *client) JsonGiveawayWinners(const td_api::messageGiveawayWinners *giveaway_winners, const Client *client)
: giveaway_winners_(giveaway_winners), client_(client) { : giveaway_winners_(giveaway_winners), client_(client) {
} }
void store(td::JsonValueScope *scope) const { void store(td::JsonValueScope *scope) const {
@ -2473,8 +2507,24 @@ class Client::JsonGiveawayWinners final : public td::Jsonable {
if (giveaway_winners_->was_refunded_) { if (giveaway_winners_->was_refunded_) {
object("was_refunded", td::JsonTrue()); object("was_refunded", td::JsonTrue());
} }
if (giveaway_winners_->month_count_ > 0) { switch (giveaway_winners_->prize_->get_id()) {
object("premium_subscription_month_count", giveaway_winners_->month_count_); case td_api::giveawayPrizePremium::ID: {
auto month_count =
static_cast<const td_api::giveawayPrizePremium *>(giveaway_winners_->prize_.get())->month_count_;
if (month_count > 0) {
object("premium_subscription_month_count", month_count);
}
break;
}
case td_api::giveawayPrizeStars::ID: {
auto star_count = static_cast<const td_api::giveawayPrizeStars *>(giveaway_winners_->prize_.get())->star_count_;
if (star_count > 0) {
object("prize_star_count", star_count);
}
break;
}
default:
UNREACHABLE();
} }
if (!giveaway_winners_->prize_description_.empty()) { if (!giveaway_winners_->prize_description_.empty()) {
object("prize_description", giveaway_winners_->prize_description_); object("prize_description", giveaway_winners_->prize_description_);
@ -2487,14 +2537,13 @@ class Client::JsonGiveawayWinners final : public td::Jsonable {
} }
private: private:
const td_api::messagePremiumGiveawayWinners *giveaway_winners_; const td_api::messageGiveawayWinners *giveaway_winners_;
const Client *client_; const Client *client_;
}; };
class Client::JsonGiveawayCompleted final : public td::Jsonable { class Client::JsonGiveawayCompleted final : public td::Jsonable {
public: public:
JsonGiveawayCompleted(const td_api::messagePremiumGiveawayCompleted *giveaway_completed, int64 chat_id, JsonGiveawayCompleted(const td_api::messageGiveawayCompleted *giveaway_completed, int64 chat_id, const Client *client)
const Client *client)
: giveaway_completed_(giveaway_completed), chat_id_(chat_id), client_(client) { : giveaway_completed_(giveaway_completed), chat_id_(chat_id), client_(client) {
} }
void store(td::JsonValueScope *scope) const { void store(td::JsonValueScope *scope) const {
@ -2503,6 +2552,9 @@ class Client::JsonGiveawayCompleted final : public td::Jsonable {
if (giveaway_completed_->unclaimed_prize_count_ > 0) { if (giveaway_completed_->unclaimed_prize_count_ > 0) {
object("unclaimed_prize_count", giveaway_completed_->unclaimed_prize_count_); object("unclaimed_prize_count", giveaway_completed_->unclaimed_prize_count_);
} }
if (giveaway_completed_->is_star_giveaway_) {
object("is_star_giveaway", td::JsonTrue());
}
const MessageInfo *giveaway_message = const MessageInfo *giveaway_message =
client_->get_message(chat_id_, giveaway_completed_->giveaway_message_id_, true); client_->get_message(chat_id_, giveaway_completed_->giveaway_message_id_, true);
if (giveaway_message != nullptr) { if (giveaway_message != nullptr) {
@ -2511,7 +2563,7 @@ class Client::JsonGiveawayCompleted final : public td::Jsonable {
} }
private: private:
const td_api::messagePremiumGiveawayCompleted *giveaway_completed_; const td_api::messageGiveawayCompleted *giveaway_completed_;
int64 chat_id_; int64 chat_id_;
const Client *client_; const Client *client_;
}; };
@ -2764,13 +2816,13 @@ class Client::JsonExternalReplyInfo final : public td::Jsonable {
} }
case td_api::messageUnsupported::ID: case td_api::messageUnsupported::ID:
break; break;
case td_api::messagePremiumGiveaway::ID: { case td_api::messageGiveaway::ID: {
auto content = static_cast<const td_api::messagePremiumGiveaway *>(reply_->content_.get()); auto content = static_cast<const td_api::messageGiveaway *>(reply_->content_.get());
object("giveaway", JsonGiveaway(content, client_)); object("giveaway", JsonGiveaway(content, client_));
break; break;
} }
case td_api::messagePremiumGiveawayWinners::ID: { case td_api::messageGiveawayWinners::ID: {
auto content = static_cast<const td_api::messagePremiumGiveawayWinners *>(reply_->content_.get()); auto content = static_cast<const td_api::messageGiveawayWinners *>(reply_->content_.get());
object("giveaway_winners", JsonGiveawayWinners(content, client_)); object("giveaway_winners", JsonGiveawayWinners(content, client_));
break; break;
} }
@ -3268,21 +3320,23 @@ void Client::JsonMessage::store(td::JsonValueScope *scope) const {
} }
case td_api::messagePremiumGiftCode::ID: case td_api::messagePremiumGiftCode::ID:
break; break;
case td_api::messagePremiumGiveawayCreated::ID: case td_api::messageGiveawayCreated::ID: {
object("giveaway_created", JsonEmptyObject()); auto content = static_cast<const td_api::messageGiveawayCreated *>(message_->content.get());
object("giveaway_created", JsonGiveawayCreated(content));
break; break;
case td_api::messagePremiumGiveaway::ID: { }
auto content = static_cast<const td_api::messagePremiumGiveaway *>(message_->content.get()); case td_api::messageGiveaway::ID: {
auto content = static_cast<const td_api::messageGiveaway *>(message_->content.get());
object("giveaway", JsonGiveaway(content, client_)); object("giveaway", JsonGiveaway(content, client_));
break; break;
} }
case td_api::messagePremiumGiveawayWinners::ID: { case td_api::messageGiveawayWinners::ID: {
auto content = static_cast<const td_api::messagePremiumGiveawayWinners *>(message_->content.get()); auto content = static_cast<const td_api::messageGiveawayWinners *>(message_->content.get());
object("giveaway_winners", JsonGiveawayWinners(content, client_)); object("giveaway_winners", JsonGiveawayWinners(content, client_));
break; break;
} }
case td_api::messagePremiumGiveawayCompleted::ID: { case td_api::messageGiveawayCompleted::ID: {
auto content = static_cast<const td_api::messagePremiumGiveawayCompleted *>(message_->content.get()); auto content = static_cast<const td_api::messageGiveawayCompleted *>(message_->content.get());
object("giveaway_completed", JsonGiveawayCompleted(content, message_->chat_id, client_)); object("giveaway_completed", JsonGiveawayCompleted(content, message_->chat_id, client_));
break; break;
} }
@ -3298,6 +3352,8 @@ void Client::JsonMessage::store(td::JsonValueScope *scope) const {
} }
case td_api::messageGiftedStars::ID: case td_api::messageGiftedStars::ID:
break; break;
case td_api::messageGiveawayPrizeStars::ID:
break;
default: default:
UNREACHABLE(); UNREACHABLE();
} }
@ -3558,6 +3614,23 @@ class Client::JsonPreCheckoutQuery final : public td::Jsonable {
const Client *client_; const Client *client_;
}; };
class Client::JsonPaidMediaPurchased final : public td::Jsonable {
public:
JsonPaidMediaPurchased(const td_api::updatePaidMediaPurchased *update, const Client *client)
: update_(update), client_(client) {
}
void store(td::JsonValueScope *scope) const {
auto object = scope->enter_object();
object("from", JsonUser(update_->user_id_, client_));
object("payload", update_->payload_);
}
private:
const td_api::updatePaidMediaPurchased *update_;
const Client *client_;
};
class Client::JsonCustomJson final : public td::Jsonable { class Client::JsonCustomJson final : public td::Jsonable {
public: public:
explicit JsonCustomJson(const td::string &json) : json_(json) { explicit JsonCustomJson(const td::string &json) : json_(json) {
@ -3865,6 +3938,9 @@ class Client::JsonChatBoostSource final : public td::Jsonable {
const auto *source = static_cast<const td_api::chatBoostSourceGiveaway *>(boost_source_); const auto *source = static_cast<const td_api::chatBoostSourceGiveaway *>(boost_source_);
object("source", "giveaway"); object("source", "giveaway");
object("giveaway_message_id", as_client_message_id_unchecked(source->giveaway_message_id_)); object("giveaway_message_id", as_client_message_id_unchecked(source->giveaway_message_id_));
if (source->star_count_ > 0) {
object("prize_star_count", source->star_count_);
}
if (source->user_id_ != 0) { if (source->user_id_ != 0) {
object("user", JsonUser(source->user_id_, client_)); object("user", JsonUser(source->user_id_, client_));
} else if (source->is_unclaimed_) { } else if (source->is_unclaimed_) {
@ -4124,6 +4200,9 @@ class Client::JsonStarTransactionPartner final : public td::Jsonable {
object("paid_media", td::json_array(purpose->media_, [client = client_](auto &media) { object("paid_media", td::json_array(purpose->media_, [client = client_](auto &media) {
return JsonPaidMedia(media.get(), client); return JsonPaidMedia(media.get(), client);
})); }));
if (!purpose->payload_.empty()) {
object("paid_media_payload", purpose->payload_);
}
break; break;
} }
default: default:
@ -4139,7 +4218,7 @@ class Client::JsonStarTransactionPartner final : public td::Jsonable {
case td_api::starTransactionPartnerGooglePlay::ID: case td_api::starTransactionPartnerGooglePlay::ID:
case td_api::starTransactionPartnerUser::ID: case td_api::starTransactionPartnerUser::ID:
case td_api::starTransactionPartnerBusiness::ID: case td_api::starTransactionPartnerBusiness::ID:
case td_api::starTransactionPartnerChannel::ID: case td_api::starTransactionPartnerChat::ID:
LOG(ERROR) << "Receive " << to_string(*source_); LOG(ERROR) << "Receive " << to_string(*source_);
object("type", "other"); object("type", "other");
break; break;
@ -5158,10 +5237,10 @@ class Client::TdOnGetStickerSetCallback final : public TdQueryCallback {
nullptr); nullptr);
} }
CHECK(result->get_id() == td_api::stickerSet::ID); CHECK(result->get_id() == td_api::text::ID);
client_->on_get_sticker_set(set_id_, new_callback_query_user_id_, new_message_chat_id_, client_->on_get_sticker_set(set_id_, new_callback_query_user_id_, new_message_chat_id_,
new_message_business_connection_id_, new_business_callback_query_user_id_, new_message_business_connection_id_, new_business_callback_query_user_id_,
move_object_as<td_api::stickerSet>(result)); move_object_as<td_api::text>(result));
} }
private: private:
@ -5175,9 +5254,13 @@ class Client::TdOnGetStickerSetCallback final : public TdQueryCallback {
class Client::TdOnGetChatCustomEmojiStickerSetCallback final : public TdQueryCallback { class Client::TdOnGetChatCustomEmojiStickerSetCallback final : public TdQueryCallback {
public: public:
TdOnGetChatCustomEmojiStickerSetCallback(Client *client, int64 chat_id, int64 pinned_message_id, TdOnGetChatCustomEmojiStickerSetCallback(Client *client, int64 sticker_set_id, int64 chat_id, int64 pinned_message_id,
PromisedQueryPtr query) PromisedQueryPtr query)
: client_(client), chat_id_(chat_id), pinned_message_id_(pinned_message_id), query_(std::move(query)) { : client_(client)
, sticker_set_id_(sticker_set_id)
, chat_id_(chat_id)
, pinned_message_id_(pinned_message_id)
, query_(std::move(query)) {
} }
void on_result(object_ptr<td_api::Object> result) final { void on_result(object_ptr<td_api::Object> result) final {
@ -5188,9 +5271,7 @@ class Client::TdOnGetChatCustomEmojiStickerSetCallback final : public TdQueryCal
if (result->get_id() == td_api::error::ID) { if (result->get_id() == td_api::error::ID) {
supergroup_info->custom_emoji_sticker_set_id = 0; supergroup_info->custom_emoji_sticker_set_id = 0;
} else { } else {
CHECK(result->get_id() == td_api::stickerSet::ID); client_->on_get_sticker_set_name(sticker_set_id_, std::move(result));
auto sticker_set = move_object_as<td_api::stickerSet>(result);
client_->on_get_sticker_set_name(sticker_set->id_, sticker_set->name_);
} }
answer_query(JsonChat(chat_id_, client_, true, pinned_message_id_), std::move(query_)); answer_query(JsonChat(chat_id_, client_, true, pinned_message_id_), std::move(query_));
@ -5198,6 +5279,7 @@ class Client::TdOnGetChatCustomEmojiStickerSetCallback final : public TdQueryCal
private: private:
Client *client_; Client *client_;
int64 sticker_set_id_;
int64 chat_id_; int64 chat_id_;
int64 pinned_message_id_; int64 pinned_message_id_;
PromisedQueryPtr query_; PromisedQueryPtr query_;
@ -5205,9 +5287,13 @@ class Client::TdOnGetChatCustomEmojiStickerSetCallback final : public TdQueryCal
class Client::TdOnGetChatBusinessStartPageStickerSetCallback final : public TdQueryCallback { class Client::TdOnGetChatBusinessStartPageStickerSetCallback final : public TdQueryCallback {
public: public:
TdOnGetChatBusinessStartPageStickerSetCallback(Client *client, int64 chat_id, int64 pinned_message_id, TdOnGetChatBusinessStartPageStickerSetCallback(Client *client, int64 sticker_set_id, int64 chat_id,
PromisedQueryPtr query) int64 pinned_message_id, PromisedQueryPtr query)
: client_(client), chat_id_(chat_id), pinned_message_id_(pinned_message_id), query_(std::move(query)) { : client_(client)
, sticker_set_id_(sticker_set_id)
, chat_id_(chat_id)
, pinned_message_id_(pinned_message_id)
, query_(std::move(query)) {
} }
void on_result(object_ptr<td_api::Object> result) final { void on_result(object_ptr<td_api::Object> result) final {
@ -5221,9 +5307,7 @@ class Client::TdOnGetChatBusinessStartPageStickerSetCallback final : public TdQu
user_info->business_info->start_page_->sticker_->set_id_ = 0; user_info->business_info->start_page_->sticker_->set_id_ = 0;
} }
} else { } else {
CHECK(result->get_id() == td_api::stickerSet::ID); client_->on_get_sticker_set_name(sticker_set_id_, std::move(result));
auto sticker_set = move_object_as<td_api::stickerSet>(result);
client_->on_get_sticker_set_name(sticker_set->id_, sticker_set->name_);
} }
answer_query(JsonChat(chat_id_, client_, true, pinned_message_id_), std::move(query_)); answer_query(JsonChat(chat_id_, client_, true, pinned_message_id_), std::move(query_));
@ -5231,6 +5315,7 @@ class Client::TdOnGetChatBusinessStartPageStickerSetCallback final : public TdQu
private: private:
Client *client_; Client *client_;
int64 sticker_set_id_;
int64 chat_id_; int64 chat_id_;
int64 pinned_message_id_; int64 pinned_message_id_;
PromisedQueryPtr query_; PromisedQueryPtr query_;
@ -5238,8 +5323,13 @@ class Client::TdOnGetChatBusinessStartPageStickerSetCallback final : public TdQu
class Client::TdOnGetChatStickerSetCallback final : public TdQueryCallback { class Client::TdOnGetChatStickerSetCallback final : public TdQueryCallback {
public: public:
TdOnGetChatStickerSetCallback(Client *client, int64 chat_id, int64 pinned_message_id, PromisedQueryPtr query) TdOnGetChatStickerSetCallback(Client *client, int64 sticker_set_id, int64 chat_id, int64 pinned_message_id,
: client_(client), chat_id_(chat_id), pinned_message_id_(pinned_message_id), query_(std::move(query)) { PromisedQueryPtr query)
: client_(client)
, sticker_set_id_(sticker_set_id)
, chat_id_(chat_id)
, pinned_message_id_(pinned_message_id)
, query_(std::move(query)) {
} }
void on_result(object_ptr<td_api::Object> result) final { void on_result(object_ptr<td_api::Object> result) final {
@ -5250,16 +5340,14 @@ class Client::TdOnGetChatStickerSetCallback final : public TdQueryCallback {
if (result->get_id() == td_api::error::ID) { if (result->get_id() == td_api::error::ID) {
supergroup_info->sticker_set_id = 0; supergroup_info->sticker_set_id = 0;
} else { } else {
CHECK(result->get_id() == td_api::stickerSet::ID); client_->on_get_sticker_set_name(sticker_set_id_, std::move(result));
auto sticker_set = move_object_as<td_api::stickerSet>(result);
client_->on_get_sticker_set_name(sticker_set->id_, sticker_set->name_);
} }
auto sticker_set_id = supergroup_info->custom_emoji_sticker_set_id; auto sticker_set_id = supergroup_info->custom_emoji_sticker_set_id;
if (sticker_set_id != 0 && client_->get_sticker_set_name(sticker_set_id).empty()) { if (sticker_set_id != 0 && client_->get_sticker_set_name(sticker_set_id).empty()) {
return client_->send_request(make_object<td_api::getStickerSet>(sticker_set_id), return client_->send_request(make_object<td_api::getStickerSetName>(sticker_set_id),
td::make_unique<TdOnGetChatCustomEmojiStickerSetCallback>( td::make_unique<TdOnGetChatCustomEmojiStickerSetCallback>(
client_, chat_id_, pinned_message_id_, std::move(query_))); client_, sticker_set_id, chat_id_, pinned_message_id_, std::move(query_)));
} }
answer_query(JsonChat(chat_id_, client_, true, pinned_message_id_), std::move(query_)); answer_query(JsonChat(chat_id_, client_, true, pinned_message_id_), std::move(query_));
@ -5267,6 +5355,7 @@ class Client::TdOnGetChatStickerSetCallback final : public TdQueryCallback {
private: private:
Client *client_; Client *client_;
int64 sticker_set_id_;
int64 chat_id_; int64 chat_id_;
int64 pinned_message_id_; int64 pinned_message_id_;
PromisedQueryPtr query_; PromisedQueryPtr query_;
@ -5282,7 +5371,7 @@ class Client::TdOnGetChatPinnedMessageCallback final : public TdQueryCallback {
int64 pinned_message_id = 0; int64 pinned_message_id = 0;
if (result->get_id() == td_api::error::ID) { if (result->get_id() == td_api::error::ID) {
auto error = move_object_as<td_api::error>(result); auto error = move_object_as<td_api::error>(result);
if (error->code_ == 429) { if (is_special_error_code(error->code_)) {
return fail_query_with_error(std::move(query_), std::move(error)); return fail_query_with_error(std::move(query_), std::move(error));
} else if (error->code_ != 404 && error->message_ != "CHANNEL_PRIVATE") { } else if (error->code_ != 404 && error->message_ != "CHANNEL_PRIVATE") {
LOG(ERROR) << "Failed to get chat pinned message: " << to_string(error); LOG(ERROR) << "Failed to get chat pinned message: " << to_string(error);
@ -5303,16 +5392,16 @@ class Client::TdOnGetChatPinnedMessageCallback final : public TdQueryCallback {
auto sticker_set_id = supergroup_info->sticker_set_id; auto sticker_set_id = supergroup_info->sticker_set_id;
if (sticker_set_id != 0 && client_->get_sticker_set_name(sticker_set_id).empty()) { if (sticker_set_id != 0 && client_->get_sticker_set_name(sticker_set_id).empty()) {
return client_->send_request( return client_->send_request(make_object<td_api::getStickerSetName>(sticker_set_id),
make_object<td_api::getStickerSet>(sticker_set_id), td::make_unique<TdOnGetChatStickerSetCallback>(
td::make_unique<TdOnGetChatStickerSetCallback>(client_, chat_id_, pinned_message_id, std::move(query_))); client_, sticker_set_id, chat_id_, pinned_message_id, std::move(query_)));
} }
sticker_set_id = supergroup_info->custom_emoji_sticker_set_id; sticker_set_id = supergroup_info->custom_emoji_sticker_set_id;
if (sticker_set_id != 0 && client_->get_sticker_set_name(sticker_set_id).empty()) { if (sticker_set_id != 0 && client_->get_sticker_set_name(sticker_set_id).empty()) {
return client_->send_request(make_object<td_api::getStickerSet>(sticker_set_id), return client_->send_request(make_object<td_api::getStickerSetName>(sticker_set_id),
td::make_unique<TdOnGetChatCustomEmojiStickerSetCallback>( td::make_unique<TdOnGetChatCustomEmojiStickerSetCallback>(
client_, chat_id_, pinned_message_id, std::move(query_))); client_, sticker_set_id, chat_id_, pinned_message_id, std::move(query_)));
} }
} else if (chat_info->type == ChatInfo::Type::Private) { } else if (chat_info->type == ChatInfo::Type::Private) {
auto user_info = client_->get_user_info(chat_info->user_id); auto user_info = client_->get_user_info(chat_info->user_id);
@ -5323,9 +5412,9 @@ class Client::TdOnGetChatPinnedMessageCallback final : public TdQueryCallback {
if (sticker != nullptr) { if (sticker != nullptr) {
auto sticker_set_id = sticker->set_id_; auto sticker_set_id = sticker->set_id_;
if (sticker_set_id != 0 && client_->get_sticker_set_name(sticker_set_id).empty()) { if (sticker_set_id != 0 && client_->get_sticker_set_name(sticker_set_id).empty()) {
return client_->send_request(make_object<td_api::getStickerSet>(sticker_set_id), return client_->send_request(make_object<td_api::getStickerSetName>(sticker_set_id),
td::make_unique<TdOnGetChatBusinessStartPageStickerSetCallback>( td::make_unique<TdOnGetChatBusinessStartPageStickerSetCallback>(
client_, chat_id_, pinned_message_id, std::move(query_))); client_, sticker_set_id, chat_id_, pinned_message_id, std::move(query_)));
} }
} }
} }
@ -5350,7 +5439,7 @@ class Client::TdOnGetChatPinnedMessageToUnpinCallback final : public TdQueryCall
int64 pinned_message_id = 0; int64 pinned_message_id = 0;
if (result->get_id() == td_api::error::ID) { if (result->get_id() == td_api::error::ID) {
auto error = move_object_as<td_api::error>(result); auto error = move_object_as<td_api::error>(result);
if (error->code_ == 429) { if (is_special_error_code(error->code_)) {
return fail_query_with_error(std::move(query_), std::move(error)); return fail_query_with_error(std::move(query_), std::move(error));
} else { } else {
return fail_query_with_error(std::move(query_), 400, "Message to unpin not found"); return fail_query_with_error(std::move(query_), 400, "Message to unpin not found");
@ -5801,8 +5890,8 @@ class Client::TdOnReturnStickerSetCallback final : public TdQueryCallback {
class Client::TdOnGetStickerSetPromiseCallback final : public TdQueryCallback { class Client::TdOnGetStickerSetPromiseCallback final : public TdQueryCallback {
public: public:
TdOnGetStickerSetPromiseCallback(Client *client, td::Promise<td::Unit> &&promise) TdOnGetStickerSetPromiseCallback(Client *client, int64 sticker_set_id, td::Promise<td::Unit> &&promise)
: client_(client), promise_(std::move(promise)) { : client_(client), sticker_set_id_(sticker_set_id), promise_(std::move(promise)) {
} }
void on_result(object_ptr<td_api::Object> result) final { void on_result(object_ptr<td_api::Object> result) final {
@ -5811,14 +5900,13 @@ class Client::TdOnGetStickerSetPromiseCallback final : public TdQueryCallback {
return promise_.set_error(td::Status::Error(error->code_, error->message_)); return promise_.set_error(td::Status::Error(error->code_, error->message_));
} }
CHECK(result->get_id() == td_api::stickerSet::ID); client_->on_get_sticker_set_name(sticker_set_id_, std::move(result));
auto sticker_set = move_object_as<td_api::stickerSet>(result);
client_->on_get_sticker_set_name(sticker_set->id_, sticker_set->name_);
promise_.set_value(td::Unit()); promise_.set_value(td::Unit());
} }
private: private:
Client *client_; Client *client_;
int64 sticker_set_id_;
td::Promise<td::Unit> promise_; td::Promise<td::Unit> promise_;
}; };
@ -5850,8 +5938,9 @@ class Client::TdOnGetStickersCallback final : public TdQueryCallback {
auto lock = mpas.get_promise(); auto lock = mpas.get_promise();
for (auto sticker_set_id : sticker_set_ids) { for (auto sticker_set_id : sticker_set_ids) {
client_->send_request(make_object<td_api::getStickerSet>(sticker_set_id), client_->send_request(
td::make_unique<TdOnGetStickerSetPromiseCallback>(client_, mpas.get_promise())); make_object<td_api::getStickerSetName>(sticker_set_id),
td::make_unique<TdOnGetStickerSetPromiseCallback>(client_, sticker_set_id, mpas.get_promise()));
} }
lock.set_value(td::Unit()); lock.set_value(td::Unit());
} }
@ -6121,7 +6210,7 @@ void Client::on_get_callback_query_message(object_ptr<td_api::message> message,
void Client::on_get_sticker_set(int64 set_id, int64 new_callback_query_user_id, int64 new_message_chat_id, void Client::on_get_sticker_set(int64 set_id, int64 new_callback_query_user_id, int64 new_message_chat_id,
const td::string &new_message_business_connection_id, const td::string &new_message_business_connection_id,
int64 new_business_callback_query_user_id, object_ptr<td_api::stickerSet> sticker_set) { int64 new_business_callback_query_user_id, object_ptr<td_api::text> sticker_set_name) {
if (new_callback_query_user_id != 0) { if (new_callback_query_user_id != 0) {
auto &queue = new_callback_query_queues_[new_callback_query_user_id]; auto &queue = new_callback_query_queues_[new_callback_query_user_id];
CHECK(queue.has_active_request_); CHECK(queue.has_active_request_);
@ -6154,8 +6243,8 @@ void Client::on_get_sticker_set(int64 set_id, int64 new_callback_query_user_id,
CHECK(set_id != 0); CHECK(set_id != 0);
if (set_id != GREAT_MINDS_SET_ID) { if (set_id != GREAT_MINDS_SET_ID) {
td::string &set_name = sticker_set_names_[set_id]; td::string &set_name = sticker_set_names_[set_id];
if (sticker_set != nullptr) { if (sticker_set_name != nullptr) {
set_name = std::move(sticker_set->name_); set_name = std::move(sticker_set_name->text_);
} }
} }
@ -6180,6 +6269,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> template <class OnSuccess>
void Client::check_user_read_access(const UserInfo *user_info, PromisedQueryPtr query, OnSuccess on_success) { void Client::check_user_read_access(const UserInfo *user_info, PromisedQueryPtr query, OnSuccess on_success) {
CHECK(user_info != nullptr); CHECK(user_info != nullptr);
@ -7181,6 +7276,9 @@ void Client::on_update(object_ptr<td_api::Object> result) {
case td_api::updateNewPreCheckoutQuery::ID: case td_api::updateNewPreCheckoutQuery::ID:
add_new_pre_checkout_query(move_object_as<td_api::updateNewPreCheckoutQuery>(result)); add_new_pre_checkout_query(move_object_as<td_api::updateNewPreCheckoutQuery>(result));
break; break;
case td_api::updatePaidMediaPurchased::ID:
add_update_purchased_paid_media(move_object_as<td_api::updatePaidMediaPurchased>(result));
break;
case td_api::updateNewCustomEvent::ID: case td_api::updateNewCustomEvent::ID:
add_new_custom_event(move_object_as<td_api::updateNewCustomEvent>(result)); add_new_custom_event(move_object_as<td_api::updateNewCustomEvent>(result));
break; break;
@ -9960,7 +10058,7 @@ void Client::on_message_send_failed(int64 chat_id, int64 old_message_id, int64 n
auto &query = *pending_send_message_queries_[query_id]; auto &query = *pending_send_message_queries_[query_id];
if (query.is_multisend) { if (query.is_multisend) {
if (query.error == nullptr || query.error->message_ == "Group send failed") { if (query.error == nullptr || query.error->message_ == "Group send failed") {
if (error->code_ == 401 || error->code_ == 429 || error->code_ >= 500 || error->message_ == "Group send failed") { if (is_special_error_code(error->code_) || error->message_ == "Group send failed") {
query.error = std::move(error); query.error = std::move(error);
} else { } else {
auto pos = (query.total_message_count - query.awaited_message_count + 1); auto pos = (query.total_message_count - query.awaited_message_count + 1);
@ -10357,9 +10455,10 @@ td::Status Client::process_send_paid_media_query(PromisedQueryPtr &query) {
int32 star_count = get_integer_arg(query.get(), "star_count", 0, 0, 1000000000); int32 star_count = get_integer_arg(query.get(), "star_count", 0, 0, 1000000000);
TRY_RESULT(paid_media, get_paid_media(query.get(), "media")); TRY_RESULT(paid_media, get_paid_media(query.get(), "media"));
TRY_RESULT(caption, get_caption(query.get())); TRY_RESULT(caption, get_caption(query.get()));
auto payload = query->arg("payload").str();
auto show_caption_above_media = to_bool(query->arg("show_caption_above_media")); auto show_caption_above_media = to_bool(query->arg("show_caption_above_media"));
do_send_message(make_object<td_api::inputMessagePaidMedia>(star_count, std::move(paid_media), std::move(caption), do_send_message(make_object<td_api::inputMessagePaidMedia>(star_count, std::move(paid_media), std::move(caption),
show_caption_above_media), show_caption_above_media, payload),
std::move(query)); std::move(query));
return td::Status::OK(); return td::Status::OK();
} }
@ -13298,6 +13397,8 @@ td::Slice Client::get_update_type_name(UpdateType update_type) {
return td::Slice("edited_business_message"); return td::Slice("edited_business_message");
case UpdateType::BusinessMessagesDeleted: case UpdateType::BusinessMessagesDeleted:
return td::Slice("deleted_business_messages"); return td::Slice("deleted_business_messages");
case UpdateType::PurchasedPaidMedia:
return td::Slice("purchased_paid_media");
default: default:
UNREACHABLE(); UNREACHABLE();
return td::Slice(); return td::Slice();
@ -13514,7 +13615,7 @@ void Client::process_new_callback_query_queue(int64 user_id, int state) {
if (!have_sticker_set_name(message_sticker_set_id)) { if (!have_sticker_set_name(message_sticker_set_id)) {
queue.has_active_request_ = true; queue.has_active_request_ = true;
return send_request( return send_request(
make_object<td_api::getStickerSet>(message_sticker_set_id), make_object<td_api::getStickerSetName>(message_sticker_set_id),
td::make_unique<TdOnGetStickerSetCallback>(this, message_sticker_set_id, user_id, 0, td::string(), 0)); td::make_unique<TdOnGetStickerSetCallback>(this, message_sticker_set_id, user_id, 0, td::string(), 0));
} }
auto reply_to_message_id = get_same_chat_reply_to_message_id(message_info); auto reply_to_message_id = get_same_chat_reply_to_message_id(message_info);
@ -13525,7 +13626,7 @@ void Client::process_new_callback_query_queue(int64 user_id, int state) {
if (!have_sticker_set_name(reply_sticker_set_id)) { if (!have_sticker_set_name(reply_sticker_set_id)) {
queue.has_active_request_ = true; queue.has_active_request_ = true;
return send_request( return send_request(
make_object<td_api::getStickerSet>(reply_sticker_set_id), make_object<td_api::getStickerSetName>(reply_sticker_set_id),
td::make_unique<TdOnGetStickerSetCallback>(this, reply_sticker_set_id, user_id, 0, td::string(), 0)); td::make_unique<TdOnGetStickerSetCallback>(this, reply_sticker_set_id, user_id, 0, td::string(), 0));
} }
} }
@ -13576,7 +13677,7 @@ void Client::process_new_business_callback_query_queue(int64 user_id) {
if (!have_sticker_set_name(message_sticker_set_id)) { if (!have_sticker_set_name(message_sticker_set_id)) {
queue.has_active_request_ = true; queue.has_active_request_ = true;
return send_request( return send_request(
make_object<td_api::getStickerSet>(message_sticker_set_id), make_object<td_api::getStickerSetName>(message_sticker_set_id),
td::make_unique<TdOnGetStickerSetCallback>(this, message_sticker_set_id, 0, 0, td::string(), user_id)); td::make_unique<TdOnGetStickerSetCallback>(this, message_sticker_set_id, 0, 0, td::string(), user_id));
} }
if (message_ref->reply_to_message_ != nullptr) { if (message_ref->reply_to_message_ != nullptr) {
@ -13585,7 +13686,7 @@ void Client::process_new_business_callback_query_queue(int64 user_id) {
if (!have_sticker_set_name(reply_sticker_set_id)) { if (!have_sticker_set_name(reply_sticker_set_id)) {
queue.has_active_request_ = true; queue.has_active_request_ = true;
return send_request( return send_request(
make_object<td_api::getStickerSet>(reply_sticker_set_id), make_object<td_api::getStickerSetName>(reply_sticker_set_id),
td::make_unique<TdOnGetStickerSetCallback>(this, reply_sticker_set_id, 0, 0, td::string(), user_id)); td::make_unique<TdOnGetStickerSetCallback>(this, reply_sticker_set_id, 0, 0, td::string(), user_id));
} }
} }
@ -13621,6 +13722,12 @@ void Client::add_new_pre_checkout_query(object_ptr<td_api::updateNewPreCheckoutQ
query->sender_user_id_ + (static_cast<int64>(4) << 33)); query->sender_user_id_ + (static_cast<int64>(4) << 33));
} }
void Client::add_update_purchased_paid_media(object_ptr<td_api::updatePaidMediaPurchased> &&query) {
CHECK(query != nullptr);
add_update(UpdateType::PurchasedPaidMedia, JsonPaidMediaPurchased(query.get(), this), 86400,
query->user_id_ + (static_cast<int64>(12) << 33));
}
void Client::add_new_custom_event(object_ptr<td_api::updateNewCustomEvent> &&event) { void Client::add_new_custom_event(object_ptr<td_api::updateNewCustomEvent> &&event) {
CHECK(event != nullptr); CHECK(event != nullptr);
add_update(UpdateType::CustomEvent, JsonCustomJson(event->event_), 600, 0); add_update(UpdateType::CustomEvent, JsonCustomJson(event->event_), 600, 0);
@ -13776,10 +13883,10 @@ bool Client::need_skip_update_message(int64 chat_id, const object_ptr<td_api::me
case td_api::messageForumTopicEdited::ID: case td_api::messageForumTopicEdited::ID:
case td_api::messageForumTopicIsClosedToggled::ID: case td_api::messageForumTopicIsClosedToggled::ID:
case td_api::messageForumTopicIsHiddenToggled::ID: case td_api::messageForumTopicIsHiddenToggled::ID:
case td_api::messagePremiumGiveawayCreated::ID: case td_api::messageGiveawayCreated::ID:
case td_api::messagePremiumGiveaway::ID: case td_api::messageGiveaway::ID:
case td_api::messagePremiumGiveawayWinners::ID: case td_api::messageGiveawayWinners::ID:
case td_api::messagePremiumGiveawayCompleted::ID: case td_api::messageGiveawayCompleted::ID:
case td_api::messagePaymentRefunded::ID: case td_api::messagePaymentRefunded::ID:
// don't skip // don't skip
break; break;
@ -13891,6 +13998,8 @@ bool Client::need_skip_update_message(int64 chat_id, const object_ptr<td_api::me
return true; return true;
case td_api::messageGiftedStars::ID: case td_api::messageGiftedStars::ID:
return true; return true;
case td_api::messageGiveawayPrizeStars::ID:
return true;
default: default:
break; break;
} }
@ -13941,9 +14050,8 @@ td::int64 Client::get_same_chat_reply_to_message_id(const object_ptr<td_api::mes
case td_api::messageChatSetBackground::ID: case td_api::messageChatSetBackground::ID:
return static_cast<const td_api::messageChatSetBackground *>(message->content_.get()) return static_cast<const td_api::messageChatSetBackground *>(message->content_.get())
->old_background_message_id_; ->old_background_message_id_;
case td_api::messagePremiumGiveawayCompleted::ID: case td_api::messageGiveawayCompleted::ID:
return static_cast<const td_api::messagePremiumGiveawayCompleted *>(message->content_.get()) return static_cast<const td_api::messageGiveawayCompleted *>(message->content_.get())->giveaway_message_id_;
->giveaway_message_id_;
case td_api::messagePaymentSuccessful::ID: case td_api::messagePaymentSuccessful::ID:
UNREACHABLE(); UNREACHABLE();
return static_cast<int64>(0); return static_cast<int64>(0);
@ -14159,7 +14267,7 @@ void Client::process_new_message_queue(int64 chat_id, int state) {
if (!have_sticker_set_name(message_sticker_set_id)) { if (!have_sticker_set_name(message_sticker_set_id)) {
queue.has_active_request_ = true; queue.has_active_request_ = true;
return send_request( return send_request(
make_object<td_api::getStickerSet>(message_sticker_set_id), make_object<td_api::getStickerSetName>(message_sticker_set_id),
td::make_unique<TdOnGetStickerSetCallback>(this, message_sticker_set_id, 0, chat_id, td::string(), 0)); td::make_unique<TdOnGetStickerSetCallback>(this, message_sticker_set_id, 0, chat_id, td::string(), 0));
} }
if (reply_to_message_id > 0) { if (reply_to_message_id > 0) {
@ -14169,7 +14277,7 @@ void Client::process_new_message_queue(int64 chat_id, int state) {
if (!have_sticker_set_name(reply_sticker_set_id)) { if (!have_sticker_set_name(reply_sticker_set_id)) {
queue.has_active_request_ = true; queue.has_active_request_ = true;
return send_request( return send_request(
make_object<td_api::getStickerSet>(reply_sticker_set_id), make_object<td_api::getStickerSetName>(reply_sticker_set_id),
td::make_unique<TdOnGetStickerSetCallback>(this, reply_sticker_set_id, 0, chat_id, td::string(), 0)); td::make_unique<TdOnGetStickerSetCallback>(this, reply_sticker_set_id, 0, chat_id, td::string(), 0));
} }
} }
@ -14259,7 +14367,7 @@ void Client::process_new_business_message_queue(const td::string &connection_id)
if (!have_sticker_set_name(message_sticker_set_id)) { if (!have_sticker_set_name(message_sticker_set_id)) {
queue.has_active_request_ = true; queue.has_active_request_ = true;
return send_request( return send_request(
make_object<td_api::getStickerSet>(message_sticker_set_id), make_object<td_api::getStickerSetName>(message_sticker_set_id),
td::make_unique<TdOnGetStickerSetCallback>(this, message_sticker_set_id, 0, 0, connection_id, 0)); td::make_unique<TdOnGetStickerSetCallback>(this, message_sticker_set_id, 0, 0, connection_id, 0));
} }
if (message_ref->reply_to_message_ != nullptr) { if (message_ref->reply_to_message_ != nullptr) {
@ -14268,7 +14376,7 @@ void Client::process_new_business_message_queue(const td::string &connection_id)
if (!have_sticker_set_name(reply_sticker_set_id)) { if (!have_sticker_set_name(reply_sticker_set_id)) {
queue.has_active_request_ = true; queue.has_active_request_ = true;
return send_request( return send_request(
make_object<td_api::getStickerSet>(reply_sticker_set_id), make_object<td_api::getStickerSetName>(reply_sticker_set_id),
td::make_unique<TdOnGetStickerSetCallback>(this, reply_sticker_set_id, 0, 0, connection_id, 0)); td::make_unique<TdOnGetStickerSetCallback>(this, reply_sticker_set_id, 0, 0, connection_id, 0));
} }
} }
@ -14422,7 +14530,7 @@ void Client::init_message(MessageInfo *message_info, object_ptr<td_api::message>
auto sticker_set_id = get_sticker_set_id(message_info->content); auto sticker_set_id = get_sticker_set_id(message_info->content);
if (!have_sticker_set_name(sticker_set_id)) { if (!have_sticker_set_name(sticker_set_id)) {
send_request(make_object<td_api::getStickerSet>(sticker_set_id), send_request(make_object<td_api::getStickerSetName>(sticker_set_id),
td::make_unique<TdOnGetStickerSetCallback>(this, sticker_set_id, 0, 0, td::string(), 0)); td::make_unique<TdOnGetStickerSetCallback>(this, sticker_set_id, 0, 0, td::string(), 0));
} }
} else if (message->content_->get_id() == td_api::messagePoll::ID) { } else if (message->content_->get_id() == td_api::messagePoll::ID) {

View File

@ -148,6 +148,7 @@ class Client final : public WebhookActor::Callback {
class JsonInlineCallbackQuery; class JsonInlineCallbackQuery;
class JsonShippingQuery; class JsonShippingQuery;
class JsonPreCheckoutQuery; class JsonPreCheckoutQuery;
class JsonPaidMediaPurchased;
class JsonBotCommand; class JsonBotCommand;
class JsonBotMenuButton; class JsonBotMenuButton;
class JsonBotName; class JsonBotName;
@ -194,6 +195,7 @@ class Client final : public WebhookActor::Callback {
class JsonSharedUser; class JsonSharedUser;
class JsonUsersShared; class JsonUsersShared;
class JsonChatShared; class JsonChatShared;
class JsonGiveawayCreated;
class JsonGiveaway; class JsonGiveaway;
class JsonGiveawayWinners; class JsonGiveawayWinners;
class JsonGiveawayCompleted; class JsonGiveawayCompleted;
@ -266,10 +268,12 @@ class Client final : public WebhookActor::Callback {
void on_get_sticker_set(int64 set_id, int64 new_callback_query_user_id, int64 new_message_chat_id, void on_get_sticker_set(int64 set_id, int64 new_callback_query_user_id, int64 new_message_chat_id,
const td::string &new_message_business_connection_id, const td::string &new_message_business_connection_id,
int64 new_business_callback_query_user_id, object_ptr<td_api::stickerSet> sticker_set); int64 new_business_callback_query_user_id, object_ptr<td_api::text> sticker_set_name);
void on_get_sticker_set_name(int64 set_id, const td::string &name); 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 { class TdQueryCallback {
public: public:
virtual void on_result(object_ptr<td_api::Object> result) = 0; virtual void on_result(object_ptr<td_api::Object> result) = 0;
@ -811,6 +815,8 @@ class Client final : public WebhookActor::Callback {
static void fail_query_with_error(PromisedQueryPtr &&query, object_ptr<td_api::error> error, static void fail_query_with_error(PromisedQueryPtr &&query, object_ptr<td_api::error> error,
td::Slice default_message = td::Slice()); td::Slice default_message = td::Slice());
static bool is_special_error_code(int32 error_code);
class JsonUpdates; class JsonUpdates;
void do_get_updates(int32 offset, int32 limit, int32 timeout, PromisedQueryPtr query); void do_get_updates(int32 offset, int32 limit, int32 timeout, PromisedQueryPtr query);
@ -1104,6 +1110,8 @@ class Client final : public WebhookActor::Callback {
void add_new_pre_checkout_query(object_ptr<td_api::updateNewPreCheckoutQuery> &&query); void add_new_pre_checkout_query(object_ptr<td_api::updateNewPreCheckoutQuery> &&query);
void add_update_purchased_paid_media(object_ptr<td_api::updatePaidMediaPurchased> &&query);
void add_new_custom_event(object_ptr<td_api::updateNewCustomEvent> &&event); void add_new_custom_event(object_ptr<td_api::updateNewCustomEvent> &&event);
void add_new_custom_query(object_ptr<td_api::updateNewCustomQuery> &&query); void add_new_custom_query(object_ptr<td_api::updateNewCustomQuery> &&query);
@ -1148,6 +1156,7 @@ class Client final : public WebhookActor::Callback {
BusinessMessage, BusinessMessage,
EditedBusinessMessage, EditedBusinessMessage,
BusinessMessagesDeleted, BusinessMessagesDeleted,
PurchasedPaidMedia,
Size Size
}; };

View File

@ -165,7 +165,7 @@ int main(int argc, char *argv[]) {
auto start_time = td::Time::now(); auto start_time = td::Time::now();
auto shared_data = std::make_shared<SharedData>(); auto shared_data = std::make_shared<SharedData>();
auto parameters = std::make_unique<ClientParameters>(); auto parameters = std::make_unique<ClientParameters>();
parameters->version_ = "7.9"; parameters->version_ = "7.10";
parameters->shared_data_ = shared_data; parameters->shared_data_ = shared_data;
parameters->start_time_ = start_time; parameters->start_time_ = start_time;
auto net_query_stats = td::create_net_query_stats(); auto net_query_stats = td::create_net_query_stats();