Merge update to version 7.10

This commit is contained in:
David Guillen Fandos 2024-09-09 00:34:57 +02:00
commit 7d69086f55
6 changed files with 348 additions and 126 deletions

View File

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

View File

@ -201,8 +201,10 @@
<option>Alpine</option>
<option>CentOS 7</option>
<option>CentOS 8</option>
<option>CentOS Stream 9</option>
<option>Debian 8/9</option>
<option>Debian 10+</option>
<option>Fedora 21+</option>
<option>Ubuntu 14</option>
<option>Ubuntu 16</option>
<option>Ubuntu 18</option>
@ -354,7 +356,7 @@ function onOptionsChanged() {
document.getElementById('buildCommandsDiv').style.display = 'block';
var use_clang = os_freebsd || os_openbsd;
if (os_linux && linux_distro !== 'Alpine' && !linux_distro.includes('CentOS')) {
if (os_linux && linux_distro !== 'Alpine' && !linux_distro.includes('CentOS') && !linux_distro.includes('Fedora')) {
document.getElementById('buildCompilerDiv').style.display = 'block';
use_clang = document.getElementById('buildCompilerRadioClang').checked;
} else {
@ -531,20 +533,29 @@ function onOptionsChanged() {
commands.push(sudo + 'apk add ' + packages);
break;
case 'CentOS 7':
case 'CentOS 8':
commands.push(sudo + 'yum update -y');
var packages = 'gcc-c++ make git zlib-devel openssl-devel';
if (linux_distro === 'CentOS 7') {
commands.push(sudo + 'yum install -y centos-release-scl-rh epel-release');
commands.push(sudo + 'yum install -y devtoolset-9-gcc devtoolset-9-gcc-c++');
cmake = 'cmake3';
packages += ' gperf';
} else {
commands.push(sudo + 'dnf --enablerepo=powertools install gperf');
}
packages += ' ' + cmake;
var packages = 'gcc-c++ make git zlib-devel openssl-devel gperf ' + cmake;
commands.push(sudo + 'yum install -y ' + packages);
break;
case 'CentOS 8':
case 'CentOS Stream 9':
commands.push(sudo + 'dnf update -y');
if (linux_distro === 'CentOS 8') {
commands.push(sudo + 'dnf --enablerepo=powertools install gperf');
} else {
commands.push(sudo + 'dnf --enablerepo=crb install gperf');
}
var packages = 'gcc-c++ make git zlib-devel openssl-devel cmake';
commands.push(sudo + 'dnf install -y ' + packages);
break;
case 'Fedora 21+':
commands.push(sudo + 'dnf update -y');
var packages = 'gperf gcc-c++ make git zlib-devel openssl-devel cmake';
commands.push(sudo + 'dnf install -y ' + packages);
break;
case 'Debian 8/9':
case 'Debian 10+':
case 'Ubuntu 14':

2
td

@ -1 +1 @@
Subproject commit cb164927417f22811c74cd8678ed4a5ab7cb80ba
Subproject commit 87d881071fe514936bb17029e96761141287d2be

View File

@ -55,6 +55,25 @@ namespace telegram_bot_api {
using td_api::make_object;
using td_api::move_object_as;
Client::Client(td::ActorShared<> parent, const td::string &bot_token, bool is_user, 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_user_(is_user)
, 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) {
td::Slice prefix = "Too Many Requests: retry after ";
if (td::begins_with(error_message, prefix)) {
@ -198,23 +217,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);
}
Client::Client(td::ActorShared<> parent, const td::string &bot_token, bool is_user, 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_user_(is_user)
, 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::is_special_error_code(int32 error_code) {
return error_code == 401 || error_code == 429 || error_code >= 500;
}
bool Client::init_methods() {
@ -278,7 +282,9 @@ bool Client::init_methods() {
methods_.emplace("answerprecheckoutquery", &Client::process_answer_pre_checkout_query_query);
methods_.emplace("exportchatinvitelink", &Client::process_export_chat_invite_link_query);
methods_.emplace("createchatinvitelink", &Client::process_create_chat_invite_link_query);
methods_.emplace("createchatsubscriptioninvitelink", &Client::process_create_chat_subscription_invite_link_query);
methods_.emplace("editchatinvitelink", &Client::process_edit_chat_invite_link_query);
methods_.emplace("editchatsubscriptioninvitelink", &Client::process_edit_chat_subscription_invite_link_query);
methods_.emplace("revokechatinvitelink", &Client::process_revoke_chat_invite_link_query);
methods_.emplace("getbusinessconnection", &Client::process_get_business_connection_query);
methods_.emplace("getchat", &Client::process_get_chat_query);
@ -487,6 +493,7 @@ class Client::JsonUser final : public td::Jsonable {
object("can_read_all_group_messages", td::JsonBool(user_info->can_read_all_group_messages));
object("supports_inline_queries", td::JsonBool(user_info->is_inline_bot));
object("can_connect_to_business", td::JsonBool(user_info->can_connect_to_business));
object("has_main_web_app", td::JsonBool(user_info->has_main_web_app));
}
}
@ -775,6 +782,9 @@ class Client::JsonReactionType final : public td::Jsonable {
object("custom_emoji_id",
td::to_string(static_cast<const td_api::reactionTypeCustomEmoji *>(reaction_type_)->custom_emoji_id_));
break;
case td_api::reactionTypePaid::ID:
object("type", "paid");
break;
default:
UNREACHABLE();
}
@ -950,6 +960,10 @@ class Client::JsonChatInviteLink final : public td::Jsonable {
if (chat_invite_link_->pending_join_request_count_ != 0) {
object("pending_join_request_count", chat_invite_link_->pending_join_request_count_);
}
if (chat_invite_link_->subscription_pricing_ != nullptr) {
object("subscription_period", chat_invite_link_->subscription_pricing_->period_);
object("subscription_price", chat_invite_link_->subscription_pricing_->star_count_);
}
object("creates_join_request", td::JsonBool(chat_invite_link_->creates_join_request_));
object("is_primary", td::JsonBool(chat_invite_link_->is_primary_));
object("is_revoked", td::JsonBool(chat_invite_link_->is_revoked_));
@ -2506,10 +2520,25 @@ class Client::JsonChatShared final : public td::Jsonable {
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 {
public:
JsonGiveaway(const td_api::messagePremiumGiveaway *giveaway, const Client *client)
: giveaway_(giveaway), client_(client) {
JsonGiveaway(const td_api::messageGiveaway *giveaway, const Client *client) : giveaway_(giveaway), client_(client) {
}
void store(td::JsonValueScope *scope) const {
auto object = scope->enter_object();
@ -2534,19 +2563,34 @@ class Client::JsonGiveaway final : public td::Jsonable {
if (!giveaway_->parameters_->prize_description_.empty()) {
object("prize_description", giveaway_->parameters_->prize_description_);
}
if (giveaway_->month_count_ > 0) {
object("premium_subscription_month_count", giveaway_->month_count_);
switch (giveaway_->prize_->get_id()) {
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:
const td_api::messagePremiumGiveaway *giveaway_;
const td_api::messageGiveaway *giveaway_;
const Client *client_;
};
class Client::JsonGiveawayWinners final : public td::Jsonable {
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) {
}
void store(td::JsonValueScope *scope) const {
@ -2563,8 +2607,24 @@ class Client::JsonGiveawayWinners final : public td::Jsonable {
if (giveaway_winners_->was_refunded_) {
object("was_refunded", td::JsonTrue());
}
if (giveaway_winners_->month_count_ > 0) {
object("premium_subscription_month_count", giveaway_winners_->month_count_);
switch (giveaway_winners_->prize_->get_id()) {
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()) {
object("prize_description", giveaway_winners_->prize_description_);
@ -2577,14 +2637,13 @@ class Client::JsonGiveawayWinners final : public td::Jsonable {
}
private:
const td_api::messagePremiumGiveawayWinners *giveaway_winners_;
const td_api::messageGiveawayWinners *giveaway_winners_;
const Client *client_;
};
class Client::JsonGiveawayCompleted final : public td::Jsonable {
public:
JsonGiveawayCompleted(const td_api::messagePremiumGiveawayCompleted *giveaway_completed, int64 chat_id,
const Client *client)
JsonGiveawayCompleted(const td_api::messageGiveawayCompleted *giveaway_completed, int64 chat_id, const Client *client)
: giveaway_completed_(giveaway_completed), chat_id_(chat_id), client_(client) {
}
void store(td::JsonValueScope *scope) const {
@ -2593,6 +2652,9 @@ class Client::JsonGiveawayCompleted final : public td::Jsonable {
if (giveaway_completed_->unclaimed_prize_count_ > 0) {
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 =
client_->get_message(chat_id_, giveaway_completed_->giveaway_message_id_, true);
if (giveaway_message != nullptr) {
@ -2601,7 +2663,7 @@ class Client::JsonGiveawayCompleted final : public td::Jsonable {
}
private:
const td_api::messagePremiumGiveawayCompleted *giveaway_completed_;
const td_api::messageGiveawayCompleted *giveaway_completed_;
int64 chat_id_;
const Client *client_;
};
@ -2854,13 +2916,13 @@ class Client::JsonExternalReplyInfo final : public td::Jsonable {
}
case td_api::messageUnsupported::ID:
break;
case td_api::messagePremiumGiveaway::ID: {
auto content = static_cast<const td_api::messagePremiumGiveaway *>(reply_->content_.get());
case td_api::messageGiveaway::ID: {
auto content = static_cast<const td_api::messageGiveaway *>(reply_->content_.get());
object("giveaway", JsonGiveaway(content, client_));
break;
}
case td_api::messagePremiumGiveawayWinners::ID: {
auto content = static_cast<const td_api::messagePremiumGiveawayWinners *>(reply_->content_.get());
case td_api::messageGiveawayWinners::ID: {
auto content = static_cast<const td_api::messageGiveawayWinners *>(reply_->content_.get());
object("giveaway_winners", JsonGiveawayWinners(content, client_));
break;
}
@ -3373,21 +3435,23 @@ void Client::JsonMessage::store(td::JsonValueScope *scope) const {
}
case td_api::messagePremiumGiftCode::ID:
break;
case td_api::messagePremiumGiveawayCreated::ID:
object("giveaway_created", JsonEmptyObject());
case td_api::messageGiveawayCreated::ID: {
auto content = static_cast<const td_api::messageGiveawayCreated *>(message_->content.get());
object("giveaway_created", JsonGiveawayCreated(content));
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_));
break;
}
case td_api::messagePremiumGiveawayWinners::ID: {
auto content = static_cast<const td_api::messagePremiumGiveawayWinners *>(message_->content.get());
case td_api::messageGiveawayWinners::ID: {
auto content = static_cast<const td_api::messageGiveawayWinners *>(message_->content.get());
object("giveaway_winners", JsonGiveawayWinners(content, client_));
break;
}
case td_api::messagePremiumGiveawayCompleted::ID: {
auto content = static_cast<const td_api::messagePremiumGiveawayCompleted *>(message_->content.get());
case td_api::messageGiveawayCompleted::ID: {
auto content = static_cast<const td_api::messageGiveawayCompleted *>(message_->content.get());
object("giveaway_completed", JsonGiveawayCompleted(content, message_->chat_id, client_));
break;
}
@ -3401,6 +3465,10 @@ void Client::JsonMessage::store(td::JsonValueScope *scope) const {
object("refunded_payment", JsonRefundedPayment(content));
break;
}
case td_api::messageGiftedStars::ID:
break;
case td_api::messageGiveawayPrizeStars::ID:
break;
default:
UNREACHABLE();
}
@ -3661,6 +3729,23 @@ class Client::JsonPreCheckoutQuery final : public td::Jsonable {
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 {
public:
explicit JsonCustomJson(const td::string &json) : json_(json) {
@ -3832,8 +3917,13 @@ class Client::JsonChatMember final : public td::Jsonable {
}
break;
}
case td_api::chatMemberStatusMember::ID:
case td_api::chatMemberStatusMember::ID: {
auto member = static_cast<const td_api::chatMemberStatusMember *>(member_->status_.get());
if (member->member_until_date_ > 0) {
object("until_date", member->member_until_date_);
}
break;
}
case td_api::chatMemberStatusRestricted::ID:
if (chat_type_ == Client::ChatType::Supergroup) {
auto restricted = static_cast<const td_api::chatMemberStatusRestricted *>(member_->status_.get());
@ -3984,6 +4074,9 @@ class Client::JsonChatBoostSource final : public td::Jsonable {
const auto *source = static_cast<const td_api::chatBoostSourceGiveaway *>(boost_source_);
object("source", "giveaway");
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) {
object("user", JsonUser(source->user_id_, client_));
} else if (source->is_unclaimed_) {
@ -4222,24 +4315,46 @@ class Client::JsonStarTransactionPartner final : public td::Jsonable {
case td_api::starTransactionPartnerBot::ID: {
auto source_user = static_cast<const td_api::starTransactionPartnerBot *>(source_);
object("type", "user");
object("user", JsonUser(source_user->bot_user_id_, client_));
if (!source_user->invoice_payload_.empty()) {
if (!td::check_utf8(source_user->invoice_payload_)) {
object("user", JsonUser(source_user->user_id_, client_));
CHECK(source_user->purpose_ != nullptr);
switch (source_user->purpose_->get_id()) {
case td_api::botTransactionPurposeInvoicePayment::ID: {
auto purpose =
static_cast<const td_api::botTransactionPurposeInvoicePayment *>(source_user->purpose_.get());
if (!purpose->invoice_payload_.empty()) {
if (!td::check_utf8(purpose->invoice_payload_)) {
LOG(WARNING) << "Receive non-UTF-8 invoice payload";
object("invoice_payload", td::JsonRawString(source_user->invoice_payload_));
object("invoice_payload", td::JsonRawString(purpose->invoice_payload_));
} else {
object("invoice_payload", source_user->invoice_payload_);
object("invoice_payload", purpose->invoice_payload_);
}
}
break;
}
case td_api::botTransactionPurposePaidMedia::ID: {
auto purpose = static_cast<const td_api::botTransactionPurposePaidMedia *>(source_user->purpose_.get());
object("paid_media", td::json_array(purpose->media_, [client = client_](auto &media) {
return JsonPaidMedia(media.get(), client);
}));
if (!purpose->payload_.empty()) {
object("paid_media_payload", purpose->payload_);
}
break;
}
default:
UNREACHABLE();
}
break;
}
case td_api::starTransactionPartnerTelegramAds::ID:
object("type", "telegram_ads");
break;
case td_api::starTransactionPartnerTelegram::ID:
case td_api::starTransactionPartnerAppStore::ID:
case td_api::starTransactionPartnerGooglePlay::ID:
case td_api::starTransactionPartnerChannel::ID:
case td_api::starTransactionPartnerUser::ID:
case td_api::starTransactionPartnerBusiness::ID:
case td_api::starTransactionPartnerChat::ID:
LOG(ERROR) << "Receive " << to_string(*source_);
object("type", "other");
break;
@ -5541,10 +5656,10 @@ class Client::TdOnGetStickerSetCallback final : public TdQueryCallback {
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_,
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:
@ -5558,9 +5673,13 @@ class Client::TdOnGetStickerSetCallback final : public TdQueryCallback {
class Client::TdOnGetChatCustomEmojiStickerSetCallback final : public TdQueryCallback {
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)
: 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 {
@ -5571,9 +5690,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::stickerSet::ID);
auto sticker_set = move_object_as<td_api::stickerSet>(result);
client_->on_get_sticker_set_name(sticker_set->id_, sticker_set->name_);
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_));
@ -5581,6 +5698,7 @@ class Client::TdOnGetChatCustomEmojiStickerSetCallback final : public TdQueryCal
private:
Client *client_;
int64 sticker_set_id_;
int64 chat_id_;
int64 pinned_message_id_;
PromisedQueryPtr query_;
@ -5588,9 +5706,13 @@ class Client::TdOnGetChatCustomEmojiStickerSetCallback final : public TdQueryCal
class Client::TdOnGetChatBusinessStartPageStickerSetCallback final : public TdQueryCallback {
public:
TdOnGetChatBusinessStartPageStickerSetCallback(Client *client, int64 chat_id, int64 pinned_message_id,
PromisedQueryPtr query)
: client_(client), chat_id_(chat_id), pinned_message_id_(pinned_message_id), query_(std::move(query)) {
TdOnGetChatBusinessStartPageStickerSetCallback(Client *client, int64 sticker_set_id, int64 chat_id,
int64 pinned_message_id, 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 {
@ -5604,9 +5726,7 @@ class Client::TdOnGetChatBusinessStartPageStickerSetCallback final : public TdQu
user_info->business_info->start_page_->sticker_->set_id_ = 0;
}
} else {
CHECK(result->get_id() == td_api::stickerSet::ID);
auto sticker_set = move_object_as<td_api::stickerSet>(result);
client_->on_get_sticker_set_name(sticker_set->id_, sticker_set->name_);
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_));
@ -5614,6 +5734,7 @@ class Client::TdOnGetChatBusinessStartPageStickerSetCallback final : public TdQu
private:
Client *client_;
int64 sticker_set_id_;
int64 chat_id_;
int64 pinned_message_id_;
PromisedQueryPtr query_;
@ -5621,8 +5742,13 @@ class Client::TdOnGetChatBusinessStartPageStickerSetCallback final : public TdQu
class Client::TdOnGetChatStickerSetCallback final : public TdQueryCallback {
public:
TdOnGetChatStickerSetCallback(Client *client, int64 chat_id, int64 pinned_message_id, PromisedQueryPtr query)
: client_(client), chat_id_(chat_id), pinned_message_id_(pinned_message_id), query_(std::move(query)) {
TdOnGetChatStickerSetCallback(Client *client, int64 sticker_set_id, int64 chat_id, int64 pinned_message_id,
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 {
@ -5633,16 +5759,14 @@ 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::stickerSet::ID);
auto sticker_set = move_object_as<td_api::stickerSet>(result);
client_->on_get_sticker_set_name(sticker_set->id_, sticker_set->name_);
client_->on_get_sticker_set_name(sticker_set_id_, std::move(result));
}
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()) {
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>(
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_));
@ -5650,6 +5774,7 @@ class Client::TdOnGetChatStickerSetCallback final : public TdQueryCallback {
private:
Client *client_;
int64 sticker_set_id_;
int64 chat_id_;
int64 pinned_message_id_;
PromisedQueryPtr query_;
@ -5665,7 +5790,7 @@ class Client::TdOnGetChatPinnedMessageCallback final : public TdQueryCallback {
int64 pinned_message_id = 0;
if (result->get_id() == td_api::error::ID) {
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));
} else if (error->code_ != 404 && error->message_ != "CHANNEL_PRIVATE") {
LOG(ERROR) << "Failed to get chat pinned message: " << to_string(error);
@ -5686,16 +5811,16 @@ class Client::TdOnGetChatPinnedMessageCallback final : public TdQueryCallback {
auto sticker_set_id = supergroup_info->sticker_set_id;
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),
td::make_unique<TdOnGetChatStickerSetCallback>(client_, chat_id_, pinned_message_id, std::move(query_)));
return client_->send_request(make_object<td_api::getStickerSetName>(sticker_set_id),
td::make_unique<TdOnGetChatStickerSetCallback>(
client_, sticker_set_id, chat_id_, pinned_message_id, std::move(query_)));
}
sticker_set_id = supergroup_info->custom_emoji_sticker_set_id;
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>(
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) {
auto user_info = client_->get_user_info(chat_info->user_id);
@ -5706,9 +5831,9 @@ class Client::TdOnGetChatPinnedMessageCallback final : public TdQueryCallback {
if (sticker != nullptr) {
auto sticker_set_id = sticker->set_id_;
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>(
client_, chat_id_, pinned_message_id, std::move(query_)));
client_, sticker_set_id, chat_id_, pinned_message_id, std::move(query_)));
}
}
}
@ -5733,7 +5858,7 @@ class Client::TdOnGetChatPinnedMessageToUnpinCallback final : public TdQueryCall
int64 pinned_message_id = 0;
if (result->get_id() == td_api::error::ID) {
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));
} else {
return fail_query_with_error(std::move(query_), 400, "Message to unpin not found");
@ -6184,8 +6309,8 @@ class Client::TdOnReturnStickerSetCallback final : public TdQueryCallback {
class Client::TdOnGetStickerSetPromiseCallback final : public TdQueryCallback {
public:
TdOnGetStickerSetPromiseCallback(Client *client, td::Promise<td::Unit> &&promise)
: client_(client), promise_(std::move(promise)) {
TdOnGetStickerSetPromiseCallback(Client *client, int64 sticker_set_id, td::Promise<td::Unit> &&promise)
: client_(client), sticker_set_id_(sticker_set_id), promise_(std::move(promise)) {
}
void on_result(object_ptr<td_api::Object> result) final {
@ -6194,14 +6319,13 @@ class Client::TdOnGetStickerSetPromiseCallback final : public TdQueryCallback {
return promise_.set_error(td::Status::Error(error->code_, error->message_));
}
CHECK(result->get_id() == td_api::stickerSet::ID);
auto sticker_set = move_object_as<td_api::stickerSet>(result);
client_->on_get_sticker_set_name(sticker_set->id_, sticker_set->name_);
client_->on_get_sticker_set_name(sticker_set_id_, std::move(result));
promise_.set_value(td::Unit());
}
private:
Client *client_;
int64 sticker_set_id_;
td::Promise<td::Unit> promise_;
};
@ -6233,8 +6357,9 @@ class Client::TdOnGetStickersCallback final : public TdQueryCallback {
auto lock = mpas.get_promise();
for (auto sticker_set_id : sticker_set_ids) {
client_->send_request(make_object<td_api::getStickerSet>(sticker_set_id),
td::make_unique<TdOnGetStickerSetPromiseCallback>(client_, mpas.get_promise()));
client_->send_request(
make_object<td_api::getStickerSetName>(sticker_set_id),
td::make_unique<TdOnGetStickerSetPromiseCallback>(client_, sticker_set_id, mpas.get_promise()));
}
lock.set_value(td::Unit());
}
@ -6737,7 +6862,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,
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) {
auto &queue = new_callback_query_queues_[new_callback_query_user_id];
CHECK(queue.has_active_request_);
@ -6770,8 +6895,8 @@ void Client::on_get_sticker_set(int64 set_id, int64 new_callback_query_user_id,
CHECK(set_id != 0);
if (set_id != GREAT_MINDS_SET_ID) {
td::string &set_name = sticker_set_names_[set_id];
if (sticker_set != nullptr) {
set_name = std::move(sticker_set->name_);
if (sticker_set_name != nullptr) {
set_name = std::move(sticker_set_name->text_);
}
}
@ -6796,6 +6921,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);
@ -7831,6 +7962,9 @@ void Client::on_update(object_ptr<td_api::Object> result) {
case td_api::updateNewPreCheckoutQuery::ID:
add_new_pre_checkout_query(move_object_as<td_api::updateNewPreCheckoutQuery>(result));
break;
case td_api::updatePaidMediaPurchased::ID:
add_update_purchased_paid_media(move_object_as<td_api::updatePaidMediaPurchased>(result));
break;
case td_api::updateNewCustomEvent::ID:
add_new_custom_event(move_object_as<td_api::updateNewCustomEvent>(result));
break;
@ -10737,7 +10871,7 @@ void Client::on_message_send_failed(int64 chat_id, int64 old_message_id, int64 n
auto &query = *pending_send_message_queries_[query_id];
if (query.is_multisend) {
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);
} else {
auto pos = (query.total_message_count - query.awaited_message_count + 1);
@ -11148,9 +11282,10 @@ td::Status Client::process_send_paid_media_query(PromisedQueryPtr &query) {
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(caption, get_caption(query.get()));
auto payload = query->arg("payload").str();
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),
show_caption_above_media),
show_caption_above_media, payload),
std::move(query));
return td::Status::OK();
}
@ -11818,8 +11953,8 @@ td::Status Client::process_create_invoice_link_query(PromisedQueryPtr &query) {
td::Status Client::process_get_star_transactions_query(PromisedQueryPtr &query) {
auto offset = get_integer_arg(query.get(), "offset", 0, 0);
auto limit = get_integer_arg(query.get(), "limit", 100, 1, 100);
send_request(make_object<td_api::getStarTransactions>(make_object<td_api::messageSenderUser>(my_id_), nullptr,
td::to_string(offset), limit),
send_request(make_object<td_api::getStarTransactions>(make_object<td_api::messageSenderUser>(my_id_), td::string(),
nullptr, td::to_string(offset), limit),
td::make_unique<TdOnGetStarTransactionsQueryCallback>(this, std::move(query)));
return td::Status::OK();
}
@ -12017,6 +12152,22 @@ td::Status Client::process_create_chat_invite_link_query(PromisedQueryPtr &query
return td::Status::OK();
}
td::Status Client::process_create_chat_subscription_invite_link_query(PromisedQueryPtr &query) {
auto chat_id = query->arg("chat_id");
auto name = query->arg("name");
auto subscription_period = get_integer_arg(query.get(), "subscription_period", 0, 0, 1000000000);
auto subscription_price = get_integer_arg(query.get(), "subscription_price", 0, 0, 1000000);
check_chat(chat_id, AccessRights::Write, std::move(query),
[this, name = name.str(), subscription_period, subscription_price](int64 chat_id, PromisedQueryPtr query) {
send_request(make_object<td_api::createChatSubscriptionInviteLink>(
chat_id, name,
make_object<td_api::starSubscriptionPricing>(subscription_period, subscription_price)),
td::make_unique<TdOnGetChatInviteLinkCallback>(this, std::move(query)));
});
return td::Status::OK();
}
td::Status Client::process_edit_chat_invite_link_query(PromisedQueryPtr &query) {
auto chat_id = query->arg("chat_id");
auto invite_link = query->arg("invite_link");
@ -12035,6 +12186,19 @@ td::Status Client::process_edit_chat_invite_link_query(PromisedQueryPtr &query)
return td::Status::OK();
}
td::Status Client::process_edit_chat_subscription_invite_link_query(PromisedQueryPtr &query) {
auto chat_id = query->arg("chat_id");
auto invite_link = query->arg("invite_link");
auto name = query->arg("name");
check_chat(chat_id, AccessRights::Write, std::move(query),
[this, invite_link = invite_link.str(), name = name.str()](int64 chat_id, PromisedQueryPtr query) {
send_request(make_object<td_api::editChatSubscriptionInviteLink>(chat_id, invite_link, name),
td::make_unique<TdOnGetChatInviteLinkCallback>(this, std::move(query)));
});
return td::Status::OK();
}
td::Status Client::process_revoke_chat_invite_link_query(PromisedQueryPtr &query) {
auto chat_id = query->arg("chat_id");
auto invite_link = query->arg("invite_link");
@ -12149,10 +12313,21 @@ td::Status Client::process_set_chat_description_query(PromisedQueryPtr &query) {
}
td::Status Client::process_pin_chat_message_query(PromisedQueryPtr &query) {
auto business_connection_id = query->arg("business_connection_id");
auto chat_id = query->arg("chat_id");
auto message_id = get_message_id(query.get());
auto disable_notification = to_bool(query->arg("disable_notification"));
if (!business_connection_id.empty()) {
check_business_connection_chat_id(
business_connection_id.str(), chat_id.str(), std::move(query),
[this, message_id](const BusinessConnection *business_connection, int64 chat_id, PromisedQueryPtr query) {
send_request(
make_object<td_api::setBusinessMessageIsPinned>(business_connection->id_, chat_id, message_id, true),
td::make_unique<TdOnOkQueryCallback>(std::move(query)));
});
return td::Status::OK();
}
check_message(chat_id, message_id, false, AccessRights::Write, "message to pin", std::move(query),
[this, disable_notification](int64 chat_id, int64 message_id, PromisedQueryPtr query) {
send_request(make_object<td_api::pinChatMessage>(chat_id, message_id, disable_notification, false),
@ -12162,9 +12337,21 @@ td::Status Client::process_pin_chat_message_query(PromisedQueryPtr &query) {
}
td::Status Client::process_unpin_chat_message_query(PromisedQueryPtr &query) {
auto business_connection_id = query->arg("business_connection_id");
auto chat_id = query->arg("chat_id");
auto message_id = get_message_id(query.get());
if (!business_connection_id.empty()) {
check_business_connection_chat_id(
business_connection_id.str(), chat_id.str(), std::move(query),
[this, message_id](const BusinessConnection *business_connection, int64 chat_id, PromisedQueryPtr query) {
send_request(
make_object<td_api::setBusinessMessageIsPinned>(business_connection->id_, chat_id, message_id, false),
td::make_unique<TdOnOkQueryCallback>(std::move(query)));
});
return td::Status::OK();
}
if (message_id == 0) {
check_chat(chat_id, AccessRights::Write, std::move(query), [this](int64 chat_id, PromisedQueryPtr query) {
send_request(make_object<td_api::getChatPinnedMessage>(chat_id),
@ -14186,6 +14373,7 @@ void Client::add_user(UserInfo *user_info, object_ptr<td_api::user> &&user) {
user_info->can_read_all_group_messages = bot->can_read_all_group_messages_;
user_info->is_inline_bot = bot->is_inline_;
user_info->can_connect_to_business = bot->can_connect_to_business_;
user_info->has_main_web_app = bot->has_main_web_app_;
break;
}
case td_api::userTypeDeleted::ID:
@ -14574,6 +14762,8 @@ td::Slice Client::get_update_type_name(UpdateType update_type) {
return td::Slice("edited_business_message");
case UpdateType::BusinessMessagesDeleted:
return td::Slice("deleted_business_messages");
case UpdateType::PurchasedPaidMedia:
return td::Slice("purchased_paid_media");
default:
UNREACHABLE();
return td::Slice();
@ -14790,7 +14980,7 @@ void Client::process_new_callback_query_queue(int64 user_id, int state) {
if (!have_sticker_set_name(message_sticker_set_id)) {
queue.has_active_request_ = true;
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));
}
auto reply_to_message_id = get_same_chat_reply_to_message_id(message_info);
@ -14801,7 +14991,7 @@ void Client::process_new_callback_query_queue(int64 user_id, int state) {
if (!have_sticker_set_name(reply_sticker_set_id)) {
queue.has_active_request_ = true;
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));
}
}
@ -14852,7 +15042,7 @@ void Client::process_new_business_callback_query_queue(int64 user_id) {
if (!have_sticker_set_name(message_sticker_set_id)) {
queue.has_active_request_ = true;
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));
}
if (message_ref->reply_to_message_ != nullptr) {
@ -14861,7 +15051,7 @@ void Client::process_new_business_callback_query_queue(int64 user_id) {
if (!have_sticker_set_name(reply_sticker_set_id)) {
queue.has_active_request_ = true;
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));
}
}
@ -14897,6 +15087,12 @@ void Client::add_new_pre_checkout_query(object_ptr<td_api::updateNewPreCheckoutQ
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) {
CHECK(event != nullptr);
add_update(UpdateType::CustomEvent, JsonCustomJson(event->event_), 600, 0);
@ -15052,10 +15248,10 @@ bool Client::need_skip_update_message(int64 chat_id, const object_ptr<td_api::me
case td_api::messageForumTopicEdited::ID:
case td_api::messageForumTopicIsClosedToggled::ID:
case td_api::messageForumTopicIsHiddenToggled::ID:
case td_api::messagePremiumGiveawayCreated::ID:
case td_api::messagePremiumGiveaway::ID:
case td_api::messagePremiumGiveawayWinners::ID:
case td_api::messagePremiumGiveawayCompleted::ID:
case td_api::messageGiveawayCreated::ID:
case td_api::messageGiveaway::ID:
case td_api::messageGiveawayWinners::ID:
case td_api::messageGiveawayCompleted::ID:
case td_api::messagePaymentRefunded::ID:
// don't skip
break;
@ -15165,6 +15361,10 @@ bool Client::need_skip_update_message(int64 chat_id, const object_ptr<td_api::me
return true;
case td_api::messagePremiumGiftCode::ID:
return true;
case td_api::messageGiftedStars::ID:
return true;
case td_api::messageGiveawayPrizeStars::ID:
return true;
default:
break;
}
@ -15215,9 +15415,8 @@ td::int64 Client::get_same_chat_reply_to_message_id(const object_ptr<td_api::mes
case td_api::messageChatSetBackground::ID:
return static_cast<const td_api::messageChatSetBackground *>(message->content_.get())
->old_background_message_id_;
case td_api::messagePremiumGiveawayCompleted::ID:
return static_cast<const td_api::messagePremiumGiveawayCompleted *>(message->content_.get())
->giveaway_message_id_;
case td_api::messageGiveawayCompleted::ID:
return static_cast<const td_api::messageGiveawayCompleted *>(message->content_.get())->giveaway_message_id_;
case td_api::messagePaymentSuccessful::ID:
UNREACHABLE();
return static_cast<int64>(0);
@ -15433,7 +15632,7 @@ void Client::process_new_message_queue(int64 chat_id, int state) {
if (!have_sticker_set_name(message_sticker_set_id)) {
queue.has_active_request_ = true;
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));
}
if (reply_to_message_id > 0) {
@ -15443,7 +15642,7 @@ void Client::process_new_message_queue(int64 chat_id, int state) {
if (!have_sticker_set_name(reply_sticker_set_id)) {
queue.has_active_request_ = true;
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));
}
}
@ -15533,7 +15732,7 @@ void Client::process_new_business_message_queue(const td::string &connection_id)
if (!have_sticker_set_name(message_sticker_set_id)) {
queue.has_active_request_ = true;
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));
}
if (message_ref->reply_to_message_ != nullptr) {
@ -15542,7 +15741,7 @@ void Client::process_new_business_message_queue(const td::string &connection_id)
if (!have_sticker_set_name(reply_sticker_set_id)) {
queue.has_active_request_ = true;
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));
}
}
@ -15707,7 +15906,7 @@ void Client::init_message(MessageInfo *message_info, object_ptr<td_api::message>
auto sticker_set_id = get_sticker_set_id(message_info->content);
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));
}
} else if (message->content_->get_id() == td_api::messagePoll::ID) {

View File

@ -161,6 +161,7 @@ class Client final : public WebhookActor::Callback {
class JsonInlineCallbackQuery;
class JsonShippingQuery;
class JsonPreCheckoutQuery;
class JsonPaidMediaPurchased;
class JsonBotCommand;
class JsonBotMenuButton;
class JsonBotName;
@ -207,6 +208,7 @@ class Client final : public WebhookActor::Callback {
class JsonSharedUser;
class JsonUsersShared;
class JsonChatShared;
class JsonGiveawayCreated;
class JsonGiveaway;
class JsonGiveawayWinners;
class JsonGiveawayCompleted;
@ -305,10 +307,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,
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, object_ptr<td_api::Object> sticker_set_name);
class TdQueryCallback {
public:
virtual void on_result(object_ptr<td_api::Object> result) = 0;
@ -747,7 +751,9 @@ class Client final : public WebhookActor::Callback {
td::Status process_answer_pre_checkout_query_query(PromisedQueryPtr &query);
td::Status process_export_chat_invite_link_query(PromisedQueryPtr &query);
td::Status process_create_chat_invite_link_query(PromisedQueryPtr &query);
td::Status process_create_chat_subscription_invite_link_query(PromisedQueryPtr &query);
td::Status process_edit_chat_invite_link_query(PromisedQueryPtr &query);
td::Status process_edit_chat_subscription_invite_link_query(PromisedQueryPtr &query);
td::Status process_revoke_chat_invite_link_query(PromisedQueryPtr &query);
td::Status process_get_business_connection_query(PromisedQueryPtr &query);
td::Status process_get_chat_query(PromisedQueryPtr &query);
@ -910,6 +916,8 @@ class Client final : public WebhookActor::Callback {
static void fail_query_with_error(PromisedQueryPtr &&query, object_ptr<td_api::error> error,
td::Slice default_message = td::Slice());
static bool is_special_error_code(int32 error_code);
class JsonUpdates;
void do_get_updates(int32 offset, int32 limit, int32 timeout, PromisedQueryPtr query);
@ -949,9 +957,10 @@ class Client final : public WebhookActor::Callback {
bool can_join_groups = false;
bool can_read_all_group_messages = false;
bool can_connect_to_business = false;
bool is_inline_bot = false;
bool has_main_web_app = false;
bool has_private_forwards = false;
bool has_restricted_voice_and_video_messages = false;
bool is_inline_bot = false;
bool is_premium = false;
bool added_to_attachment_menu = false;
};
@ -1229,6 +1238,8 @@ class Client final : public WebhookActor::Callback {
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_query(object_ptr<td_api::updateNewCustomQuery> &&query);
@ -1273,6 +1284,7 @@ class Client final : public WebhookActor::Callback {
BusinessMessage,
EditedBusinessMessage,
BusinessMessagesDeleted,
PurchasedPaidMedia,
Size
};

View File

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