Add td_api::setBotInfoShareText.

This commit is contained in:
levlam 2023-02-27 01:41:46 +03:00
parent d7ba7f693b
commit 0c8b9bf555
5 changed files with 22 additions and 0 deletions

View File

@ -7608,6 +7608,11 @@ 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
//@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 all active sessions of the current user
getActiveSessions = Sessions;

View File

@ -808,6 +808,12 @@ void get_bot_info_description(Td *td, const string &language_code, Promise<strin
td->create_handler<GetBotInfoQuery>(std::move(promise))->send(language_code, 1);
}
void set_bot_info_share_text(Td *td, const string &language_code, const string &share_text, Promise<Unit> &&promise) {
TRY_STATUS_PROMISE(promise, validate_bot_language_code(language_code));
td->contacts_manager_->invalidate_user_full(td->contacts_manager_->get_my_id());
td->create_handler<SetBotInfoQuery>(std::move(promise))->send(language_code, true, share_text, false, string());
}
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

@ -54,6 +54,8 @@ void set_bot_info_description(Td *td, const string &language_code, const string
void get_bot_info_description(Td *td, const string &language_code, Promise<string> &&promise);
void set_bot_info_share_text(Td *td, const string &language_code, const string &share_text, Promise<Unit> &&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

@ -7032,6 +7032,13 @@ void Td::on_request(uint64 id, const td_api::getBotInfoDescription &request) {
get_bot_info_description(this, request.language_code_, std::move(query_promise));
}
void Td::on_request(uint64 id, td_api::setBotInfoShareText &request) {
CHECK_IS_BOT();
CLEAN_INPUT_STRING(request.share_text_);
CREATE_OK_REQUEST_PROMISE();
set_bot_info_share_text(this, request.language_code_, request.share_text_, std::move(promise));
}
void Td::on_request(uint64 id, const td_api::setLocation &request) {
CHECK_IS_USER();
CREATE_OK_REQUEST_PROMISE();

View File

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