Add messageUserChosen.

This commit is contained in:
levlam 2023-01-11 20:03:43 +03:00
parent 9a2dd58b6f
commit 4922b0c776
2 changed files with 14 additions and 2 deletions

View File

@ -2476,7 +2476,10 @@ messageGiftedPremium currency:string amount:int53 month_count:int32 sticker:stic
//@description A contact has registered with Telegram
messageContactRegistered = MessageContent;
//@description The 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
//@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 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 has connected a website by logging in using Telegram Login Widget on it @domain_name Domain name of the connected website

View File

@ -5680,6 +5680,11 @@ tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageCo
return make_tl_object<td_api::messageBotWriteAccessAllowed>();
case MessageContentType::RequestedDialog: {
const auto *m = static_cast<const MessageRequestedDialog *>(content);
if (m->dialog_id.get_type() == DialogType::User) {
return make_tl_object<td_api::messageUserChosen>(
td->contacts_manager_->get_user_id_object(m->dialog_id.get_user_id(), "MessageRequestedDialog"),
m->button_id);
}
return make_tl_object<td_api::messageChatChosen>(m->dialog_id.get(), m->button_id);
}
default:
@ -6368,7 +6373,11 @@ void add_message_content_dependencies(Dependencies &dependencies, const MessageC
case MessageContentType::RequestedDialog: {
const auto *content = static_cast<const MessageRequestedDialog *>(message_content);
if (!is_bot) {
dependencies.add_dialog_and_dependencies(content->dialog_id);
if (content->dialog_id.get_type() == DialogType::User) {
dependencies.add(content->dialog_id.get_user_id());
} else {
dependencies.add_dialog_and_dependencies(content->dialog_id);
}
}
break;
}