Add td_api::getBotInfoShareText.

This commit is contained in:
levlam 2023-02-27 01:47:55 +03:00
parent 0c8b9bf555
commit 57655958a9
5 changed files with 27 additions and 1 deletions

View File

@ -7608,11 +7608,15 @@ setBotInfoDescription language_code:string description:string = Ok;
//@language_code A two-letter ISO 639-1 language code or an empty string
getBotInfoDescription language_code:string = Text;
//@description Sets the text shown on the bot's profile page and sent together with the link when users share the bot
//@description Sets the text shown on the bot's profile page and sent together with the link when users share the bot; bots only
//@language_code A two-letter ISO 639-1 language code. If empty, the share text will be shown to all users, for which language there are no dedicated description
//@share_text New bot's share text on the specified language
setBotInfoShareText language_code:string share_text:string = Ok;
//@description Returns the text shown on the bot's profile page and sent together with the link when users share the bot in the given language; bots only
//@language_code A two-letter ISO 639-1 language code or an empty string
getBotInfoShareText language_code:string = Text;
//@description Returns all active sessions of the current user
getActiveSessions = Sessions;

View File

@ -814,6 +814,11 @@ void set_bot_info_share_text(Td *td, const string &language_code, const string &
td->create_handler<SetBotInfoQuery>(std::move(promise))->send(language_code, true, share_text, false, string());
}
void get_bot_info_share_text(Td *td, const string &language_code, Promise<string> &&promise) {
TRY_STATUS_PROMISE(promise, validate_bot_language_code(language_code));
td->create_handler<GetBotInfoQuery>(std::move(promise))->send(language_code, 0);
}
void export_contact_token(Td *td, Promise<td_api::object_ptr<td_api::userLink>> &&promise) {
td->create_handler<ExportContactTokenQuery>(std::move(promise))->send();
}

View File

@ -56,6 +56,8 @@ void get_bot_info_description(Td *td, const string &language_code, Promise<strin
void set_bot_info_share_text(Td *td, const string &language_code, const string &share_text, Promise<Unit> &&promise);
void get_bot_info_share_text(Td *td, const string &language_code, Promise<string> &&promise);
void export_contact_token(Td *td, Promise<td_api::object_ptr<td_api::userLink>> &&promise);
void import_contact_token(Td *td, const string &token, Promise<td_api::object_ptr<td_api::user>> &&promise);

View File

@ -7039,6 +7039,19 @@ void Td::on_request(uint64 id, td_api::setBotInfoShareText &request) {
set_bot_info_share_text(this, request.language_code_, request.share_text_, std::move(promise));
}
void Td::on_request(uint64 id, const td_api::getBotInfoShareText &request) {
CHECK_IS_BOT();
CREATE_REQUEST_PROMISE();
auto query_promise = PromiseCreator::lambda([promise = std::move(promise)](Result<string> result) mutable {
if (result.is_error()) {
promise.set_error(result.move_as_error());
} else {
promise.set_value(td_api::make_object<td_api::text>(result.move_as_ok()));
}
});
get_bot_info_share_text(this, request.language_code_, std::move(query_promise));
}
void Td::on_request(uint64 id, const td_api::setLocation &request) {
CHECK_IS_USER();
CREATE_OK_REQUEST_PROMISE();

View File

@ -1124,6 +1124,8 @@ class Td final : public Actor {
void on_request(uint64 id, td_api::setBotInfoShareText &request);
void on_request(uint64 id, const td_api::getBotInfoShareText &request);
void on_request(uint64 id, const td_api::setLocation &request);
void on_request(uint64 id, td_api::setProfilePhoto &request);