Add ChatFullInfo.rating.

main
levlam 9 months ago
parent 5caec59b90
commit d4eec4d2a3

@ -963,6 +963,24 @@ class Client::JsonChatInviteLink final : public td::Jsonable {
const Client *client_; const Client *client_;
}; };
class Client::JsonUserRating final : public td::Jsonable {
public:
explicit JsonUserRating(const td_api::userRating *user_rating) : user_rating_(user_rating) {
}
void store(td::JsonValueScope *scope) const {
auto object = scope->enter_object();
object("level", user_rating_->level_);
object("rating", user_rating_->rating_);
object("current_level_rating", user_rating_->current_level_rating_);
if (!user_rating_->is_maximum_level_reached_) {
object("next_level_rating", user_rating_->next_level_rating_);
}
}
private:
const td_api::userRating *user_rating_;
};
class Client::JsonMessage final : public td::Jsonable { class Client::JsonMessage final : public td::Jsonable {
public: public:
JsonMessage(const MessageInfo *message, bool need_reply, const td::string &source, const Client *client) JsonMessage(const MessageInfo *message, bool need_reply, const td::string &source, const Client *client)
@ -1062,6 +1080,9 @@ class Client::JsonChat final : public td::Jsonable {
if (user_info->personal_chat_id != 0) { if (user_info->personal_chat_id != 0) {
object("personal_chat", JsonChat(user_info->personal_chat_id, client_)); object("personal_chat", JsonChat(user_info->personal_chat_id, client_));
} }
if (user_info->rating != nullptr) {
object("rating", JsonUserRating(user_info->rating.get()));
}
} }
photo = user_info->photo.get(); photo = user_info->photo.get();
break; break;
@ -8416,6 +8437,7 @@ void Client::on_update(object_ptr<td_api::Object> result) {
user_info->birthdate = std::move(full_info->birthdate_); user_info->birthdate = std::move(full_info->birthdate_);
user_info->business_info = std::move(full_info->business_info_); user_info->business_info = std::move(full_info->business_info_);
user_info->accepted_gift_types = std::move(full_info->gift_settings_->accepted_gift_types_); user_info->accepted_gift_types = std::move(full_info->gift_settings_->accepted_gift_types_);
user_info->rating = std::move(full_info->rating_);
user_info->personal_chat_id = full_info->personal_chat_id_; user_info->personal_chat_id = full_info->personal_chat_id_;
user_info->has_private_forwards = full_info->has_private_forwards_; 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_; user_info->has_restricted_voice_and_video_messages = full_info->has_restricted_voice_and_video_note_messages_;

@ -104,6 +104,7 @@ class Client final : public WebhookActor::Callback {
class JsonChatLocation; class JsonChatLocation;
class JsonChatInviteLink; class JsonChatInviteLink;
class JsonChat; class JsonChat;
class JsonUserRating;
class JsonMessageSender; class JsonMessageSender;
class JsonMessageOrigin; class JsonMessageOrigin;
class JsonExternalReplyInfo; class JsonExternalReplyInfo;
@ -961,6 +962,7 @@ class Client final : public WebhookActor::Callback {
object_ptr<td_api::birthdate> birthdate; object_ptr<td_api::birthdate> birthdate;
object_ptr<td_api::businessInfo> business_info; object_ptr<td_api::businessInfo> business_info;
object_ptr<td_api::acceptedGiftTypes> accepted_gift_types; object_ptr<td_api::acceptedGiftTypes> accepted_gift_types;
object_ptr<td_api::userRating> rating;
int64 personal_chat_id = 0; int64 personal_chat_id = 0;
bool have_access = false; bool have_access = false;

Loading…
Cancel
Save