mirror of
https://github.com/tdlib/telegram-bot-api
synced 2025-08-22 01:49:24 +00:00
Compare commits
10 Commits
16625f70c7
...
df0c845372
Author | SHA1 | Date | |
---|---|---|---|
|
df0c845372 | ||
|
fa6706fc8f | ||
|
d69265e61b | ||
|
faf2f9b60b | ||
|
1f8ba44aaa | ||
|
5b01642142 | ||
|
d4ea517c2f | ||
|
bff46219ae | ||
|
bc771a3b2f | ||
|
e2c834103a |
@ -6,7 +6,7 @@ if (POLICY CMP0065)
|
|||||||
cmake_policy(SET CMP0065 NEW)
|
cmake_policy(SET CMP0065 NEW)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
project(TelegramBotApi VERSION 8.1 LANGUAGES CXX)
|
project(TelegramBotApi VERSION 8.2 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.")
|
||||||
|
18
build.html
18
build.html
@ -75,7 +75,7 @@
|
|||||||
a:hover {
|
a:hover {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
select, button {
|
select, button, input {
|
||||||
border: 1px solid var(--color-select-border);
|
border: 1px solid var(--color-select-border);
|
||||||
background-color: var(--background);
|
background-color: var(--background);
|
||||||
color: var(--color);
|
color: var(--color);
|
||||||
@ -266,6 +266,14 @@
|
|||||||
<label><input type="checkbox" id="buildRootCheckbox" onchange="onOptionsChanged()"/>Build from root user (not recommended).</label>
|
<label><input type="checkbox" id="buildRootCheckbox" onchange="onOptionsChanged()"/>Build from root user (not recommended).</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="buildMultiCoreDiv" class="hide">
|
||||||
|
<label><input type="checkbox" id="buildMultiCoreCheckbox" onchange="onOptionsChanged()"/>Build using mulitple cores<span class="hide" id="buildMultiCoreColon">:</span></label>
|
||||||
|
|
||||||
|
<div id="buildMultiCoreInputDiv" class="hide">
|
||||||
|
<input type="number" id="buildMultiCoreInput" onchange="onOptionsChanged()" placeholder="Cores number" min="1" style="text-align: center;"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<p></p>
|
<p></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -354,6 +362,7 @@ function onOptionsChanged() {
|
|||||||
linux_distro = document.getElementById('linuxSelect').value;
|
linux_distro = document.getElementById('linuxSelect').value;
|
||||||
}
|
}
|
||||||
document.getElementById('buildCommandsDiv').style.display = 'block';
|
document.getElementById('buildCommandsDiv').style.display = 'block';
|
||||||
|
document.getElementById('buildMultiCoreDiv').style.display = 'block';
|
||||||
|
|
||||||
var use_clang = os_freebsd || os_openbsd;
|
var use_clang = os_freebsd || os_openbsd;
|
||||||
if (os_linux && linux_distro !== 'Alpine' && !linux_distro.includes('CentOS') && !linux_distro.includes('Fedora')) {
|
if (os_linux && linux_distro !== 'Alpine' && !linux_distro.includes('CentOS') && !linux_distro.includes('Fedora')) {
|
||||||
@ -686,6 +695,11 @@ function onOptionsChanged() {
|
|||||||
commands.push('cd ../build');
|
commands.push('cd ../build');
|
||||||
}
|
}
|
||||||
let build_command = cmake + ' --build . --target install';
|
let build_command = cmake + ' --build . --target install';
|
||||||
|
|
||||||
|
if (document.getElementById('buildMultiCoreCheckbox').checked && document.getElementById('buildMultiCoreInput').value.toString().length > 0 && !(isNaN(document.getElementById('buildMultiCoreInput').value))) {
|
||||||
|
build_command += ` -j ${ document.getElementById('buildMultiCoreInput').value }`;
|
||||||
|
}
|
||||||
|
|
||||||
if (use_msvc) {
|
if (use_msvc) {
|
||||||
if (!is_debug_build) {
|
if (!is_debug_build) {
|
||||||
commands.push(build_command + ' --config Release');
|
commands.push(build_command + ' --config Release');
|
||||||
@ -704,6 +718,8 @@ function onOptionsChanged() {
|
|||||||
if (install_dir !== '/usr/local') {
|
if (install_dir !== '/usr/local') {
|
||||||
install_dir = 'telegram-bot-api';
|
install_dir = 'telegram-bot-api';
|
||||||
}
|
}
|
||||||
|
document.getElementById('buildMultiCoreInputDiv').style.display = document.getElementById('buildMultiCoreCheckbox').checked ? 'block' : 'none';
|
||||||
|
document.getElementById('buildMultiCoreColon').style.display = document.getElementById('buildMultiCoreCheckbox').checked ? 'inline' : 'none';
|
||||||
commands.push((use_powershell ? 'dir ' : 'ls -l ') + install_dir + '/bin/telegram-bot-api*');
|
commands.push((use_powershell ? 'dir ' : 'ls -l ') + install_dir + '/bin/telegram-bot-api*');
|
||||||
document.getElementById('buildCommands').innerHTML = '<ul><li>' + commands.join('</li><li>') + '</li></ul>';
|
document.getElementById('buildCommands').innerHTML = '<ul><li>' + commands.join('</li><li>') + '</li></ul>';
|
||||||
document.getElementById('copyBuildCommandsButton').style.display = commands.includes('exit') ? 'none' : 'block';
|
document.getElementById('copyBuildCommandsButton').style.display = commands.includes('exit') ? 'none' : 'block';
|
||||||
|
2
td
2
td
@ -1 +1 @@
|
|||||||
Subproject commit 7648b99d81d36d44bae3ca6c514a816a2fe8cfd1
|
Subproject commit ef580cd3dd0e5223c2be503342dc29e128be866e
|
@ -256,6 +256,10 @@ bool Client::init_methods() {
|
|||||||
methods_.emplace("edituserstarsubscription", &Client::process_edit_user_star_subscription_query);
|
methods_.emplace("edituserstarsubscription", &Client::process_edit_user_star_subscription_query);
|
||||||
methods_.emplace("getavailablegifts", &Client::process_get_available_gifts_query);
|
methods_.emplace("getavailablegifts", &Client::process_get_available_gifts_query);
|
||||||
methods_.emplace("sendgift", &Client::process_send_gift_query);
|
methods_.emplace("sendgift", &Client::process_send_gift_query);
|
||||||
|
methods_.emplace("verifyuser", &Client::process_verify_user_query);
|
||||||
|
methods_.emplace("verifychat", &Client::process_verify_chat_query);
|
||||||
|
methods_.emplace("removeuserverification", &Client::process_remove_user_verification_query);
|
||||||
|
methods_.emplace("removechatverification", &Client::process_remove_chat_verification_query);
|
||||||
methods_.emplace("setgamescore", &Client::process_set_game_score_query);
|
methods_.emplace("setgamescore", &Client::process_set_game_score_query);
|
||||||
methods_.emplace("getgamehighscores", &Client::process_get_game_high_scores_query);
|
methods_.emplace("getgamehighscores", &Client::process_get_game_high_scores_query);
|
||||||
methods_.emplace("answerwebappquery", &Client::process_answer_web_app_query_query);
|
methods_.emplace("answerwebappquery", &Client::process_answer_web_app_query_query);
|
||||||
@ -3389,6 +3393,10 @@ void Client::JsonMessage::store(td::JsonValueScope *scope) const {
|
|||||||
break;
|
break;
|
||||||
case td_api::messageGift::ID:
|
case td_api::messageGift::ID:
|
||||||
break;
|
break;
|
||||||
|
case td_api::messageUpgradedGift::ID:
|
||||||
|
break;
|
||||||
|
case td_api::messageRefundedUpgradedGift::ID:
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
@ -4084,6 +4092,9 @@ class Client::JsonGift final : public td::Jsonable {
|
|||||||
object("id", td::to_string(gift_->id_));
|
object("id", td::to_string(gift_->id_));
|
||||||
object("sticker", JsonSticker(gift_->sticker_.get(), client_));
|
object("sticker", JsonSticker(gift_->sticker_.get(), client_));
|
||||||
object("star_count", gift_->star_count_);
|
object("star_count", gift_->star_count_);
|
||||||
|
if (gift_->upgrade_star_count_ > 0) {
|
||||||
|
object("upgrade_star_count", gift_->upgrade_star_count_);
|
||||||
|
}
|
||||||
if (gift_->total_count_ > 0) {
|
if (gift_->total_count_ > 0) {
|
||||||
object("remaining_count", gift_->remaining_count_);
|
object("remaining_count", gift_->remaining_count_);
|
||||||
object("total_count", gift_->total_count_);
|
object("total_count", gift_->total_count_);
|
||||||
@ -6666,8 +6677,8 @@ void Client::check_business_connection_chat_id(const td::string &business_connec
|
|||||||
}
|
}
|
||||||
auto chat_id = r_chat_id.move_as_ok();
|
auto chat_id = r_chat_id.move_as_ok();
|
||||||
check_business_connection(business_connection_id, std::move(query),
|
check_business_connection(business_connection_id, std::move(query),
|
||||||
[chat_id, on_success = std::move(on_success)](
|
[chat_id, on_success = std::move(on_success)](const BusinessConnection *business_connection,
|
||||||
const BusinessConnection *business_connection, PromisedQueryPtr query) mutable {
|
PromisedQueryPtr query) mutable {
|
||||||
on_success(business_connection, chat_id, std::move(query));
|
on_success(business_connection, chat_id, std::move(query));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -8577,7 +8588,7 @@ td::Result<td_api::object_ptr<td_api::InputInlineQueryResult>> Client::get_inlin
|
|||||||
|
|
||||||
CHECK(input_message_content != nullptr);
|
CHECK(input_message_content != nullptr);
|
||||||
return make_object<td_api::inputInlineQueryResultArticle>(
|
return make_object<td_api::inputInlineQueryResultArticle>(
|
||||||
id, url, hide_url, title, description, thumbnail_url, thumbnail_width, thumbnail_height,
|
id, hide_url ? td::string() : url, title, description, thumbnail_url, thumbnail_width, thumbnail_height,
|
||||||
std::move(reply_markup), std::move(input_message_content));
|
std::move(reply_markup), std::move(input_message_content));
|
||||||
}
|
}
|
||||||
if (type == "audio") {
|
if (type == "audio") {
|
||||||
@ -11377,17 +11388,62 @@ td::Status Client::process_get_available_gifts_query(PromisedQueryPtr &query) {
|
|||||||
|
|
||||||
td::Status Client::process_send_gift_query(PromisedQueryPtr &query) {
|
td::Status Client::process_send_gift_query(PromisedQueryPtr &query) {
|
||||||
auto gift_id = td::to_integer<int64>(query->arg("gift_id"));
|
auto gift_id = td::to_integer<int64>(query->arg("gift_id"));
|
||||||
|
auto pay_for_upgrade = to_bool(query->arg("pay_for_upgrade"));
|
||||||
TRY_RESULT(user_id, get_user_id(query.get()));
|
TRY_RESULT(user_id, get_user_id(query.get()));
|
||||||
TRY_RESULT(text, get_formatted_text(query->arg("text").str(), query->arg("text_parse_mode").str(),
|
TRY_RESULT(text, get_formatted_text(query->arg("text").str(), query->arg("text_parse_mode").str(),
|
||||||
get_input_entities(query.get(), "text_entities")));
|
get_input_entities(query.get(), "text_entities")));
|
||||||
check_user(user_id, std::move(query),
|
check_user(user_id, std::move(query),
|
||||||
[this, gift_id, user_id, text = std::move(text)](PromisedQueryPtr query) mutable {
|
[this, gift_id, pay_for_upgrade, user_id, text = std::move(text)](PromisedQueryPtr query) mutable {
|
||||||
send_request(make_object<td_api::sendGift>(gift_id, user_id, std::move(text), false),
|
send_request(make_object<td_api::sendGift>(gift_id, user_id, std::move(text), false, pay_for_upgrade),
|
||||||
td::make_unique<TdOnOkQueryCallback>(std::move(query)));
|
td::make_unique<TdOnOkQueryCallback>(std::move(query)));
|
||||||
});
|
});
|
||||||
return td::Status::OK();
|
return td::Status::OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
td::Status Client::process_verify_user_query(PromisedQueryPtr &query) {
|
||||||
|
TRY_RESULT(user_id, get_user_id(query.get()));
|
||||||
|
auto custom_description = query->arg("custom_description");
|
||||||
|
check_user(user_id, std::move(query),
|
||||||
|
[this, user_id, custom_description = custom_description.str()](PromisedQueryPtr query) {
|
||||||
|
send_request(make_object<td_api::setMessageSenderBotVerification>(
|
||||||
|
0, make_object<td_api::messageSenderUser>(user_id), custom_description),
|
||||||
|
td::make_unique<TdOnOkQueryCallback>(std::move(query)));
|
||||||
|
});
|
||||||
|
return td::Status::OK();
|
||||||
|
}
|
||||||
|
|
||||||
|
td::Status Client::process_verify_chat_query(PromisedQueryPtr &query) {
|
||||||
|
auto chat_id = query->arg("chat_id");
|
||||||
|
auto custom_description = query->arg("custom_description");
|
||||||
|
check_chat(chat_id, AccessRights::Read, std::move(query),
|
||||||
|
[this, custom_description = custom_description.str()](int64 chat_id, PromisedQueryPtr query) {
|
||||||
|
send_request(make_object<td_api::setMessageSenderBotVerification>(
|
||||||
|
0, make_object<td_api::messageSenderChat>(chat_id), custom_description),
|
||||||
|
td::make_unique<TdOnOkQueryCallback>(std::move(query)));
|
||||||
|
});
|
||||||
|
return td::Status::OK();
|
||||||
|
}
|
||||||
|
|
||||||
|
td::Status Client::process_remove_user_verification_query(PromisedQueryPtr &query) {
|
||||||
|
TRY_RESULT(user_id, get_user_id(query.get()));
|
||||||
|
check_user(user_id, std::move(query), [this, user_id](PromisedQueryPtr query) {
|
||||||
|
send_request(
|
||||||
|
make_object<td_api::removeMessageSenderBotVerification>(0, make_object<td_api::messageSenderUser>(user_id)),
|
||||||
|
td::make_unique<TdOnOkQueryCallback>(std::move(query)));
|
||||||
|
});
|
||||||
|
return td::Status::OK();
|
||||||
|
}
|
||||||
|
|
||||||
|
td::Status Client::process_remove_chat_verification_query(PromisedQueryPtr &query) {
|
||||||
|
auto chat_id = query->arg("chat_id");
|
||||||
|
check_chat(chat_id, AccessRights::Read, std::move(query), [this](int64 chat_id, PromisedQueryPtr query) {
|
||||||
|
send_request(
|
||||||
|
make_object<td_api::removeMessageSenderBotVerification>(0, make_object<td_api::messageSenderChat>(chat_id)),
|
||||||
|
td::make_unique<TdOnOkQueryCallback>(std::move(query)));
|
||||||
|
});
|
||||||
|
return td::Status::OK();
|
||||||
|
}
|
||||||
|
|
||||||
td::Status Client::process_set_game_score_query(PromisedQueryPtr &query) {
|
td::Status Client::process_set_game_score_query(PromisedQueryPtr &query) {
|
||||||
auto chat_id = query->arg("chat_id");
|
auto chat_id = query->arg("chat_id");
|
||||||
auto message_id = get_message_id(query.get());
|
auto message_id = get_message_id(query.get());
|
||||||
@ -14284,6 +14340,10 @@ bool Client::need_skip_update_message(int64 chat_id, const object_ptr<td_api::me
|
|||||||
return true;
|
return true;
|
||||||
case td_api::messageGift::ID:
|
case td_api::messageGift::ID:
|
||||||
return true;
|
return true;
|
||||||
|
case td_api::messageUpgradedGift::ID:
|
||||||
|
return true;
|
||||||
|
case td_api::messageRefundedUpgradedGift::ID:
|
||||||
|
return true;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -690,6 +690,10 @@ class Client final : public WebhookActor::Callback {
|
|||||||
td::Status process_edit_user_star_subscription_query(PromisedQueryPtr &query);
|
td::Status process_edit_user_star_subscription_query(PromisedQueryPtr &query);
|
||||||
td::Status process_get_available_gifts_query(PromisedQueryPtr &query);
|
td::Status process_get_available_gifts_query(PromisedQueryPtr &query);
|
||||||
td::Status process_send_gift_query(PromisedQueryPtr &query);
|
td::Status process_send_gift_query(PromisedQueryPtr &query);
|
||||||
|
td::Status process_verify_user_query(PromisedQueryPtr &query);
|
||||||
|
td::Status process_verify_chat_query(PromisedQueryPtr &query);
|
||||||
|
td::Status process_remove_user_verification_query(PromisedQueryPtr &query);
|
||||||
|
td::Status process_remove_chat_verification_query(PromisedQueryPtr &query);
|
||||||
td::Status process_set_game_score_query(PromisedQueryPtr &query);
|
td::Status process_set_game_score_query(PromisedQueryPtr &query);
|
||||||
td::Status process_get_game_high_scores_query(PromisedQueryPtr &query);
|
td::Status process_get_game_high_scores_query(PromisedQueryPtr &query);
|
||||||
td::Status process_answer_web_app_query_query(PromisedQueryPtr &query);
|
td::Status process_answer_web_app_query_query(PromisedQueryPtr &query);
|
||||||
|
@ -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_ = "8.1";
|
parameters->version_ = "8.2";
|
||||||
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();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user