mirror of
https://github.com/tdlight-team/tdlight-telegram-bot-api.git
synced 2024-12-26 20:55:52 +01:00
Add chat.business_opening_hours field.
This commit is contained in:
parent
f1c1447185
commit
1a86bb56db
@ -643,6 +643,37 @@ class Client::JsonBusinessLocation final : public td::Jsonable {
|
||||
const td_api::businessLocation *business_location_;
|
||||
};
|
||||
|
||||
class Client::JsonBusinessOpeningHoursInterval final : public td::Jsonable {
|
||||
public:
|
||||
JsonBusinessOpeningHoursInterval(const td_api::businessOpeningHoursInterval *opening_hours_interval)
|
||||
: opening_hours_interval_(opening_hours_interval) {
|
||||
}
|
||||
void store(td::JsonValueScope *scope) const {
|
||||
auto object = scope->enter_object();
|
||||
object("opening_minute", opening_hours_interval_->start_minute_);
|
||||
object("closing_minute", opening_hours_interval_->end_minute_);
|
||||
}
|
||||
|
||||
private:
|
||||
const td_api::businessOpeningHoursInterval *opening_hours_interval_;
|
||||
};
|
||||
|
||||
class Client::JsonBusinessOpeningHours final : public td::Jsonable {
|
||||
public:
|
||||
JsonBusinessOpeningHours(const td_api::businessOpeningHours *opening_hours) : opening_hours_(opening_hours) {
|
||||
}
|
||||
void store(td::JsonValueScope *scope) const {
|
||||
auto object = scope->enter_object();
|
||||
object("opening_hours", td::json_array(opening_hours_->opening_hours_, [](const auto &opening_hours_interval) {
|
||||
return JsonBusinessOpeningHoursInterval(opening_hours_interval.get());
|
||||
}));
|
||||
object("time_zone_name", opening_hours_->time_zone_id_);
|
||||
}
|
||||
|
||||
private:
|
||||
const td_api::businessOpeningHours *opening_hours_;
|
||||
};
|
||||
|
||||
class Client::JsonChatPermissions final : public td::Jsonable {
|
||||
public:
|
||||
explicit JsonChatPermissions(const td_api::chatPermissions *chat_permissions) : chat_permissions_(chat_permissions) {
|
||||
@ -788,6 +819,9 @@ class Client::JsonChat final : public td::Jsonable {
|
||||
if (user_info->business_location != nullptr) {
|
||||
object("business_location", JsonBusinessLocation(user_info->business_location.get()));
|
||||
}
|
||||
if (user_info->business_opening_hours != nullptr) {
|
||||
object("business_opening_hours", JsonBusinessOpeningHours(user_info->business_opening_hours.get()));
|
||||
}
|
||||
}
|
||||
photo = user_info->photo.get();
|
||||
break;
|
||||
@ -6363,6 +6397,10 @@ void Client::on_update(object_ptr<td_api::Object> result) {
|
||||
full_info->business_info_ != nullptr && full_info->business_info_->location_ != nullptr
|
||||
? std::move(full_info->business_info_->location_)
|
||||
: nullptr;
|
||||
user_info->business_opening_hours =
|
||||
full_info->business_info_ != nullptr && full_info->business_info_->opening_hours_ != nullptr
|
||||
? std::move(full_info->business_info_->opening_hours_)
|
||||
: 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;
|
||||
|
@ -94,6 +94,8 @@ class Client final : public WebhookActor::Callback {
|
||||
class JsonReactionType;
|
||||
class JsonReactionCount;
|
||||
class JsonBusinessLocation;
|
||||
class JsonBusinessOpeningHoursInterval;
|
||||
class JsonBusinessOpeningHours;
|
||||
class JsonChatPermissions;
|
||||
class JsonChatPhotoInfo;
|
||||
class JsonChatLocation;
|
||||
@ -795,6 +797,7 @@ class Client final : public WebhookActor::Callback {
|
||||
object_ptr<td_api::chatPhoto> photo;
|
||||
td::string bio;
|
||||
object_ptr<td_api::businessLocation> business_location;
|
||||
object_ptr<td_api::businessOpeningHours> business_opening_hours;
|
||||
|
||||
bool have_access = false;
|
||||
bool can_join_groups = false;
|
||||
|
Loading…
Reference in New Issue
Block a user