Add RequestedDialogType::get_input_keyboard_button_request_peer.

This commit is contained in:
levlam 2024-03-22 14:13:57 +03:00
parent 21bda74636
commit 4e51567a8c
3 changed files with 11 additions and 11 deletions

View File

@ -895,10 +895,7 @@ static tl_object_ptr<telegram_api::KeyboardButton> get_input_keyboard_button(con
return make_tl_object<telegram_api::keyboardButtonSimpleWebView>(keyboard_button.text, keyboard_button.url);
case KeyboardButton::Type::RequestDialog:
CHECK(keyboard_button.requested_dialog_type != nullptr);
return make_tl_object<telegram_api::keyboardButtonRequestPeer>(
keyboard_button.text, keyboard_button.requested_dialog_type->get_button_id(),
keyboard_button.requested_dialog_type->get_input_request_peer_type_object(),
keyboard_button.requested_dialog_type->get_max_quantity());
return keyboard_button.requested_dialog_type->get_input_keyboard_button_request_peer(keyboard_button.text);
default:
UNREACHABLE();
return nullptr;

View File

@ -171,12 +171,14 @@ telegram_api::object_ptr<telegram_api::RequestPeerType> RequestedDialogType::get
}
}
int32 RequestedDialogType::get_button_id() const {
return button_id_;
telegram_api::object_ptr<telegram_api::keyboardButtonRequestPeer>
RequestedDialogType::get_input_keyboard_button_request_peer(const string &text) const {
return telegram_api::make_object<telegram_api::keyboardButtonRequestPeer>(
text, button_id_, get_input_request_peer_type_object(), max_quantity_);
}
int32 RequestedDialogType::get_max_quantity() const {
return max_quantity_;
int32 RequestedDialogType::get_button_id() const {
return button_id_;
}
Status RequestedDialogType::check_shared_dialog(Td *td, DialogId dialog_id) const {

View File

@ -39,6 +39,8 @@ class RequestedDialogType {
AdministratorRights user_administrator_rights_; // Group and Channel only
AdministratorRights bot_administrator_rights_; // Group and Channel only
telegram_api::object_ptr<telegram_api::RequestPeerType> get_input_request_peer_type_object() const;
public:
RequestedDialogType() = default;
@ -51,12 +53,11 @@ class RequestedDialogType {
td_api::object_ptr<td_api::KeyboardButtonType> get_keyboard_button_type_object() const;
telegram_api::object_ptr<telegram_api::RequestPeerType> get_input_request_peer_type_object() const;
telegram_api::object_ptr<telegram_api::keyboardButtonRequestPeer> get_input_keyboard_button_request_peer(
const string &text) const;
int32 get_button_id() const;
int32 get_max_quantity() const;
Status check_shared_dialog(Td *td, DialogId dialog_id) const;
Status check_shared_dialog_count(size_t count) const;