diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index e23b5a746..fc719b931 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -1407,17 +1407,17 @@ keyboardButtonTypeRequestLocation = KeyboardButtonType; //@description A button that allows the user to create and send a poll when pressed; available only in private chats @force_regular If true, only regular polls must be allowed to create @force_quiz If true, only polls in quiz mode must be allowed to create keyboardButtonTypeRequestPoll force_regular:Bool force_quiz:Bool = KeyboardButtonType; -//@description A button that requests a user to be chosen by the current user; available only in private chats +//@description A button that requests a user to be shared by the current user; available only in private chats. Use the method shareUserWithBot to complete the request //@id Unique button identifier -//@restrict_user_is_bot True, if the chosen user must or must not be a bot -//@user_is_bot True, if the chosen user must be a bot; otherwise, the chosen user must no be a bot. Ignored if restrict_user_is_bot is false -//@restrict_user_is_premium True, if the chosen user must or must not be a Telegram Premium user -//@user_is_premium True, if the chosen user must be a Telegram Premium user; otherwise, the chosen user must no be a Telegram Premium user. Ignored if restrict_user_is_premium is false +//@restrict_user_is_bot True, if the shared user must or must not be a bot +//@user_is_bot True, if the shared user must be a bot; otherwise, the shared user must no be a bot. Ignored if restrict_user_is_bot is false +//@restrict_user_is_premium True, if the shared user must or must not be a Telegram Premium user +//@user_is_premium True, if the shared user must be a Telegram Premium user; otherwise, the shared user must no be a Telegram Premium user. Ignored if restrict_user_is_premium is false keyboardButtonTypeRequestUser id:int32 restrict_user_is_bot:Bool user_is_bot:Bool restrict_user_is_premium:Bool user_is_premium:Bool = KeyboardButtonType; -//@description A button that requests a chat to be chosen by the current user; available only in private chats +//@description A button that requests a chat to be shared by the current user; available only in private chats. Use the method shareChatWithBot to complete the request //@id Unique button identifier -//@chat_is_channel True, if the chat must be a channel; otherwise, a basic group or a supergroup chat is chosen +//@chat_is_channel True, if the chat must be a channel; otherwise, a basic group or a supergroup chat is shared //@restrict_chat_is_forum True, if the chat must or must not be a forum supergroup //@chat_is_forum True, if the chat must be a forum supergroup; otherwise, the chat must not be a forum supergroup. Ignored if restrict_chat_is_forum is false //@restrict_chat_has_username True, if the chat must or must not have a username @@ -2514,11 +2514,11 @@ messageGiftedPremium currency:string amount:int53 month_count:int32 sticker:stic //@description A contact has registered with Telegram messageContactRegistered = MessageContent; -//@description The current user chosen a user, which was requested by the bot @user_id Identifier of the chosen user @button_id Identifier of the keyboard button with the request -messageUserChosen user_id:int53 button_id:int32 = MessageContent; +//@description The current user shared a user, which was requested by the bot @user_id Identifier of the shared user @button_id Identifier of the keyboard button with the request +messageUserShared user_id:int53 button_id:int32 = MessageContent; -//@description The current user chosen a chat, which was requested by the bot @chat_id Identifier of the chosen chat @button_id Identifier of the keyboard button with the request -messageChatChosen chat_id:int53 button_id:int32 = MessageContent; +//@description The current user shared a chat, which was requested by the bot @chat_id Identifier of the shared chat @button_id Identifier of the keyboard button with the request +messageChatShared chat_id:int53 button_id:int32 = MessageContent; //@description The current user has connected a website by logging in using Telegram Login Widget on it @domain_name Domain name of the connected website messageWebsiteConnected domain_name:string = MessageContent; @@ -6355,19 +6355,19 @@ getLoginUrlInfo chat_id:int53 message_id:int53 button_id:int53 = LoginUrlInfo; getLoginUrl chat_id:int53 message_id:int53 button_id:int53 allow_write_access:Bool = HttpUrl; -//@description Sends a user chosen after pressing a keyboardButtonTypeRequestUser button to the bot +//@description Shares a user after pressing a keyboardButtonTypeRequestUser button with the bot //@chat_id Identifier of the chat with the bot //@message_id Identifier of the message with the button //@button_id Identifier of the button -//@chosen_user_id Identifier of the chosen user -sendChosenUser chat_id:int53 message_id:int53 button_id:int32 chosen_user_id:int53 = Ok; +//@shared_user_id Identifier of the shared user +shareUserWithBot chat_id:int53 message_id:int53 button_id:int32 shared_user_id:int53 = Ok; -//@description Sends a chat chosen after pressing a keyboardButtonTypeRequestChat button to the bot +//@description Shares a chat after pressing a keyboardButtonTypeRequestChat button with the bot //@chat_id Identifier of the chat with the bot //@message_id Identifier of the message with the button //@button_id Identifier of the button -//@chosen_chat_id Identifier of the chosen chat -sendChosenChat chat_id:int53 message_id:int53 button_id:int32 chosen_chat_id:int53 = Ok; +//@shared_chat_id Identifier of the shared chat +shareChatWithBot chat_id:int53 message_id:int53 button_id:int32 shared_chat_id:int53 = Ok; //@description Sends an inline query to a bot and returns its results. Returns an error with code 502 if the bot fails to answer the query before the query timeout expires diff --git a/td/telegram/MessageContent.cpp b/td/telegram/MessageContent.cpp index b920feaa2..e4689636b 100644 --- a/td/telegram/MessageContent.cpp +++ b/td/telegram/MessageContent.cpp @@ -5681,11 +5681,11 @@ tl_object_ptr get_message_content_object(const MessageCo case MessageContentType::RequestedDialog: { const auto *m = static_cast(content); if (m->dialog_id.get_type() == DialogType::User) { - return make_tl_object( + return make_tl_object( td->contacts_manager_->get_user_id_object(m->dialog_id.get_user_id(), "MessageRequestedDialog"), m->button_id); } - return make_tl_object(m->dialog_id.get(), m->button_id); + return make_tl_object(m->dialog_id.get(), m->button_id); } default: UNREACHABLE(); diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 6af8dc792..da51b5cc9 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -29882,9 +29882,9 @@ void MessagesManager::do_send_screenshot_taken_notification_message(DialogId dia ->send(dialog_id, random_id); } -void MessagesManager::send_chosen_dialog(FullMessageId full_message_id, int32 button_id, DialogId chosen_dialog_id, - Promise &&promise) { - const Message *m = get_message_force(full_message_id, "send_chosen_dialog"); +void MessagesManager::share_dialog_with_bot(FullMessageId full_message_id, int32 button_id, DialogId shared_dialog_id, + Promise &&promise) { + const Message *m = get_message_force(full_message_id, "share_dialog_with_bot"); if (m == nullptr) { return promise.set_error(Status::Error(400, "Message not found")); } @@ -29892,12 +29892,12 @@ void MessagesManager::send_chosen_dialog(FullMessageId full_message_id, int32 bu return promise.set_error(Status::Error(400, "Message has no buttons")); } CHECK(m->message_id.is_valid() && m->message_id.is_server()); - if (chosen_dialog_id.get_type() != DialogType::User) { - get_dialog_force(chosen_dialog_id, "send_chosen_dialog"); + if (shared_dialog_id.get_type() != DialogType::User) { + get_dialog_force(shared_dialog_id, "share_dialog_with_bot"); } - TRY_STATUS_PROMISE(promise, m->reply_markup->check_chosen_dialog(td_, button_id, chosen_dialog_id)); + TRY_STATUS_PROMISE(promise, m->reply_markup->check_shared_dialog(td_, button_id, shared_dialog_id)); - td_->create_handler(std::move(promise))->send(full_message_id, button_id, chosen_dialog_id); + td_->create_handler(std::move(promise))->send(full_message_id, button_id, shared_dialog_id); } Result MessagesManager::add_local_message( diff --git a/td/telegram/MessagesManager.h b/td/telegram/MessagesManager.h index 2af6c263c..681fcf684 100644 --- a/td/telegram/MessagesManager.h +++ b/td/telegram/MessagesManager.h @@ -467,8 +467,8 @@ class MessagesManager final : public Actor { Status send_screenshot_taken_notification_message(DialogId dialog_id); - void send_chosen_dialog(FullMessageId full_message_id, int32 button_id, DialogId chosen_dialog_id, - Promise &&promise); + void share_dialog_with_bot(FullMessageId full_message_id, int32 button_id, DialogId shared_dialog_id, + Promise &&promise); Result add_local_message(DialogId dialog_id, td_api::object_ptr &&sender, MessageId reply_to_message_id, bool disable_notification, diff --git a/td/telegram/ReplyMarkup.cpp b/td/telegram/ReplyMarkup.cpp index bc10cff00..d52a5cf8b 100644 --- a/td/telegram/ReplyMarkup.cpp +++ b/td/telegram/ReplyMarkup.cpp @@ -1047,7 +1047,7 @@ tl_object_ptr ReplyMarkup::get_reply_markup_object(Contacts } } -Status ReplyMarkup::check_chosen_dialog(Td *td, int32 button_id, DialogId dialog_id) const { +Status ReplyMarkup::check_shared_dialog(Td *td, int32 button_id, DialogId dialog_id) const { // TODO return Status::OK(); } diff --git a/td/telegram/ReplyMarkup.h b/td/telegram/ReplyMarkup.h index 615765820..c02d22c15 100644 --- a/td/telegram/ReplyMarkup.h +++ b/td/telegram/ReplyMarkup.h @@ -82,7 +82,7 @@ struct ReplyMarkup { tl_object_ptr get_reply_markup_object(ContactsManager *contacts_manager) const; - Status check_chosen_dialog(Td *td, int32 button_id, DialogId dialog_id) const; + Status check_shared_dialog(Td *td, int32 button_id, DialogId dialog_id) const; }; bool operator==(const ReplyMarkup &lhs, const ReplyMarkup &rhs); diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index 84142b0cc..f0dc3cb1b 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -7655,19 +7655,19 @@ void Td::on_request(uint64 id, const td_api::getLoginUrl &request) { request.allow_write_access_, std::move(promise)); } -void Td::on_request(uint64 id, const td_api::sendChosenUser &request) { +void Td::on_request(uint64 id, const td_api::shareUserWithBot &request) { CHECK_IS_USER(); CREATE_OK_REQUEST_PROMISE(); - messages_manager_->send_chosen_dialog({DialogId(request.chat_id_), MessageId(request.message_id_)}, - request.button_id_, DialogId(UserId(request.chosen_user_id_)), - std::move(promise)); + messages_manager_->share_dialog_with_bot({DialogId(request.chat_id_), MessageId(request.message_id_)}, + request.button_id_, DialogId(UserId(request.shared_user_id_)), + std::move(promise)); } -void Td::on_request(uint64 id, const td_api::sendChosenChat &request) { +void Td::on_request(uint64 id, const td_api::shareChatWithBot &request) { CHECK_IS_USER(); CREATE_OK_REQUEST_PROMISE(); - messages_manager_->send_chosen_dialog({DialogId(request.chat_id_), MessageId(request.message_id_)}, - request.button_id_, DialogId(request.chosen_chat_id_), std::move(promise)); + messages_manager_->share_dialog_with_bot({DialogId(request.chat_id_), MessageId(request.message_id_)}, + request.button_id_, DialogId(request.shared_chat_id_), std::move(promise)); } void Td::on_request(uint64 id, td_api::getInlineQueryResults &request) { diff --git a/td/telegram/Td.h b/td/telegram/Td.h index 7630170df..6a34d7f7a 100644 --- a/td/telegram/Td.h +++ b/td/telegram/Td.h @@ -1299,9 +1299,9 @@ class Td final : public Actor { void on_request(uint64 id, const td_api::getLoginUrl &request); - void on_request(uint64 id, const td_api::sendChosenUser &request); + void on_request(uint64 id, const td_api::shareUserWithBot &request); - void on_request(uint64 id, const td_api::sendChosenChat &request); + void on_request(uint64 id, const td_api::shareChatWithBot &request); void on_request(uint64 id, td_api::getInlineQueryResults &request); diff --git a/td/telegram/cli.cpp b/td/telegram/cli.cpp index 0a08de15c..35c057832 100644 --- a/td/telegram/cli.cpp +++ b/td/telegram/cli.cpp @@ -5172,20 +5172,20 @@ class CliClient final : public Actor { send_request( td_api::make_object(chat_id, message_id, as_button_id(button_id), op == "glua")); } - } else if (op == "scu") { + } else if (op == "suwb") { ChatId chat_id; MessageId message_id; int32 button_id; - UserId chosen_user_id; - get_args(args, chat_id, message_id, button_id, chosen_user_id); - send_request(td_api::make_object(chat_id, message_id, button_id, chosen_user_id)); - } else if (op == "scc") { + UserId shared_user_id; + get_args(args, chat_id, message_id, button_id, shared_user_id); + send_request(td_api::make_object(chat_id, message_id, button_id, shared_user_id)); + } else if (op == "scwb") { ChatId chat_id; MessageId message_id; int32 button_id; - ChatId chosen_chat_id; - get_args(args, chat_id, message_id, button_id, chosen_chat_id); - send_request(td_api::make_object(chat_id, message_id, button_id, chosen_chat_id)); + ChatId shared_chat_id; + get_args(args, chat_id, message_id, button_id, shared_chat_id); + send_request(td_api::make_object(chat_id, message_id, button_id, shared_chat_id)); } else if (op == "rsgs") { string supergroup_id; string message_ids;