2
0
mirror of https://github.com/tdlib/telegram-bot-api synced 2025-08-22 18:08:31 +00:00

Add Message.suggested_post_refunded.

This commit is contained in:
levlam 2025-08-02 23:44:32 +03:00
parent b142642208
commit 01c64655da
2 changed files with 40 additions and 10 deletions

View File

@ -2223,7 +2223,7 @@ class Client::JsonSuggestedPostApprovalFailed final : public td::Jsonable {
client_->get_message(chat_id_, suggested_post_approval_failed_->suggested_post_message_id_, true); client_->get_message(chat_id_, suggested_post_approval_failed_->suggested_post_message_id_, true);
if (suggested_post_message != nullptr) { if (suggested_post_message != nullptr) {
object("suggested_post_message", object("suggested_post_message",
JsonMessage(suggested_post_message, false, "suggested post approval added", client_)); JsonMessage(suggested_post_message, false, "suggested post approval failed", client_));
} }
object("price", JsonSuggestedPostPrice(suggested_post_approval_failed_->price_.get())); object("price", JsonSuggestedPostPrice(suggested_post_approval_failed_->price_.get()));
} }
@ -2245,8 +2245,7 @@ class Client::JsonSuggestedPostApproved final : public td::Jsonable {
const MessageInfo *suggested_post_message = const MessageInfo *suggested_post_message =
client_->get_message(chat_id_, suggested_post_approved_->suggested_post_message_id_, true); client_->get_message(chat_id_, suggested_post_approved_->suggested_post_message_id_, true);
if (suggested_post_message != nullptr) { if (suggested_post_message != nullptr) {
object("suggested_post_message", object("suggested_post_message", JsonMessage(suggested_post_message, false, "suggested post approved", client_));
JsonMessage(suggested_post_message, false, "suggested post approval added", client_));
} }
if (suggested_post_approved_->price_ != nullptr) { if (suggested_post_approved_->price_ != nullptr) {
object("price", JsonSuggestedPostPrice(suggested_post_approved_->price_.get())); object("price", JsonSuggestedPostPrice(suggested_post_approved_->price_.get()));
@ -2271,8 +2270,7 @@ class Client::JsonSuggestedPostDeclined final : public td::Jsonable {
const MessageInfo *suggested_post_message = const MessageInfo *suggested_post_message =
client_->get_message(chat_id_, suggested_post_declined_->suggested_post_message_id_, true); client_->get_message(chat_id_, suggested_post_declined_->suggested_post_message_id_, true);
if (suggested_post_message != nullptr) { if (suggested_post_message != nullptr) {
object("suggested_post_message", object("suggested_post_message", JsonMessage(suggested_post_message, false, "suggested post declined", client_));
JsonMessage(suggested_post_message, false, "suggested post approval added", client_));
} }
if (!suggested_post_declined_->comment_.empty()) { if (!suggested_post_declined_->comment_.empty()) {
object("comment", suggested_post_declined_->comment_); object("comment", suggested_post_declined_->comment_);
@ -2296,8 +2294,7 @@ class Client::JsonSuggestedPostPaid final : public td::Jsonable {
const MessageInfo *suggested_post_message = const MessageInfo *suggested_post_message =
client_->get_message(chat_id_, suggested_post_paid_->suggested_post_message_id_, true); client_->get_message(chat_id_, suggested_post_paid_->suggested_post_message_id_, true);
if (suggested_post_message != nullptr) { if (suggested_post_message != nullptr) {
object("suggested_post_message", object("suggested_post_message", JsonMessage(suggested_post_message, false, "suggested post paid", client_));
JsonMessage(suggested_post_message, false, "suggested post approval added", client_));
} }
if (suggested_post_paid_->star_amount_->star_count_ != 0 || if (suggested_post_paid_->star_amount_->star_count_ != 0 ||
suggested_post_paid_->star_amount_->nanostar_count_ != 0) { suggested_post_paid_->star_amount_->nanostar_count_ != 0) {
@ -2315,6 +2312,37 @@ class Client::JsonSuggestedPostPaid final : public td::Jsonable {
const Client *client_; const Client *client_;
}; };
class Client::JsonSuggestedPostRefunded final : public td::Jsonable {
public:
JsonSuggestedPostRefunded(const td_api::messageSuggestedPostRefunded *suggested_post_refunded, int64 chat_id,
const Client *client)
: suggested_post_refunded_(suggested_post_refunded), chat_id_(chat_id), client_(client) {
}
void store(td::JsonValueScope *scope) const {
auto object = scope->enter_object();
const MessageInfo *suggested_post_message =
client_->get_message(chat_id_, suggested_post_refunded_->suggested_post_message_id_, true);
if (suggested_post_message != nullptr) {
object("suggested_post_message", JsonMessage(suggested_post_message, false, "suggested post refunded", client_));
}
switch (suggested_post_refunded_->reason_->get_id()) {
case td_api::suggestedPostRefundReasonPostDeleted::ID:
object("reason", "post_deleted");
break;
case td_api::suggestedPostRefundReasonPaymentRefunded::ID:
object("reason", "payment_refunded");
break;
default:
UNREACHABLE();
}
}
private:
const td_api::messageSuggestedPostRefunded *suggested_post_refunded_;
int64 chat_id_;
const Client *client_;
};
class Client::JsonStory final : public td::Jsonable { class Client::JsonStory final : public td::Jsonable {
public: public:
JsonStory(int64 chat_id, int32 story_id, const Client *client) JsonStory(int64 chat_id, int32 story_id, const Client *client)
@ -4065,8 +4093,11 @@ void Client::JsonMessage::store(td::JsonValueScope *scope) const {
object("suggested_post_paid", JsonSuggestedPostPaid(content, message_->chat_id, client_)); object("suggested_post_paid", JsonSuggestedPostPaid(content, message_->chat_id, client_));
break; break;
} }
case td_api::messageSuggestedPostRefunded::ID: case td_api::messageSuggestedPostRefunded::ID: {
auto content = static_cast<const td_api::messageSuggestedPostRefunded *>(message_->content.get());
object("suggested_post_refunded", JsonSuggestedPostRefunded(content, message_->chat_id, client_));
break; break;
}
default: default:
UNREACHABLE(); UNREACHABLE();
} }
@ -15999,8 +16030,6 @@ bool Client::need_skip_update_message(int64 chat_id, const object_ptr<td_api::me
return true; return true;
case td_api::messageGiftedTon::ID: case td_api::messageGiftedTon::ID:
return true; return true;
case td_api::messageSuggestedPostRefunded::ID:
return true;
default: default:
break; break;
} }

View File

@ -141,6 +141,7 @@ class Client final : public WebhookActor::Callback {
class JsonSuggestedPostApproved; class JsonSuggestedPostApproved;
class JsonSuggestedPostDeclined; class JsonSuggestedPostDeclined;
class JsonSuggestedPostPaid; class JsonSuggestedPostPaid;
class JsonSuggestedPostRefunded;
class JsonEntity; class JsonEntity;
class JsonVectorEntities; class JsonVectorEntities;
class JsonWebAppInfo; class JsonWebAppInfo;