diff --git a/telegram-bot-api/Client.cpp b/telegram-bot-api/Client.cpp index 4ccc222..47b1c43 100644 --- a/telegram-bot-api/Client.cpp +++ b/telegram-bot-api/Client.cpp @@ -627,6 +627,22 @@ class Client::JsonReactionCount final : public td::Jsonable { const td_api::messageReaction *message_reaction_; }; +class Client::JsonBusinessLocation final : public td::Jsonable { + public: + JsonBusinessLocation(const td_api::businessLocation *business_location) : business_location_(business_location) { + } + void store(td::JsonValueScope *scope) const { + auto object = scope->enter_object(); + if (business_location_->location_ != nullptr) { + object("location", JsonLocation(business_location_->location_.get())); + } + object("address", business_location_->address_); + } + + private: + const td_api::businessLocation *business_location_; +}; + class Client::JsonChatPermissions final : public td::Jsonable { public: explicit JsonChatPermissions(const td_api::chatPermissions *chat_permissions) : chat_permissions_(chat_permissions) { @@ -769,6 +785,9 @@ class Client::JsonChat final : public td::Jsonable { if (user_info->has_restricted_voice_and_video_messages) { object("has_restricted_voice_and_video_messages", td::JsonTrue()); } + if (user_info->business_location != nullptr) { + object("business_location", JsonBusinessLocation(user_info->business_location.get())); + } } photo = user_info->photo.get(); break; @@ -6340,6 +6359,10 @@ void Client::on_update(object_ptr result) { user_info->photo = full_info->photo_ == nullptr ? std::move(full_info->public_photo_) : std::move(full_info->photo_); user_info->bio = full_info->bio_ != nullptr ? std::move(full_info->bio_->text_) : td::string(); + user_info->business_location = + full_info->business_info_ != nullptr && full_info->business_info_->location_ != nullptr + ? std::move(full_info->business_info_->location_) + : nullptr; user_info->has_private_forwards = full_info->has_private_forwards_; user_info->has_restricted_voice_and_video_messages = full_info->has_restricted_voice_and_video_note_messages_; break; diff --git a/telegram-bot-api/Client.h b/telegram-bot-api/Client.h index 80a6a1b..619f006 100644 --- a/telegram-bot-api/Client.h +++ b/telegram-bot-api/Client.h @@ -93,6 +93,7 @@ class Client final : public WebhookActor::Callback { class JsonUsers; class JsonReactionType; class JsonReactionCount; + class JsonBusinessLocation; class JsonChatPermissions; class JsonChatPhotoInfo; class JsonChatLocation; @@ -793,6 +794,7 @@ class Client final : public WebhookActor::Callback { object_ptr photo; td::string bio; + object_ptr business_location; bool have_access = false; bool can_join_groups = false;