Add td_api::paidReactor.
This commit is contained in:
parent
815d6fd0eb
commit
4995abde1b
@ -461,6 +461,7 @@ set(TDLIB_SOURCE_PART1
|
||||
td/telegram/MessageOrigin.cpp
|
||||
td/telegram/MessageQuote.cpp
|
||||
td/telegram/MessageReaction.cpp
|
||||
td/telegram/MessageReactor.cpp
|
||||
td/telegram/MessageReplyHeader.cpp
|
||||
td/telegram/MessageReplyInfo.cpp
|
||||
td/telegram/MessageSearchFilter.cpp
|
||||
@ -779,6 +780,7 @@ set(TDLIB_SOURCE_PART2
|
||||
td/telegram/MessageOrigin.h
|
||||
td/telegram/MessageQuote.h
|
||||
td/telegram/MessageReaction.h
|
||||
td/telegram/MessageReactor.h
|
||||
td/telegram/MessageReplyHeader.h
|
||||
td/telegram/MessageReplyInfo.h
|
||||
td/telegram/MessageSearchFilter.h
|
||||
@ -1002,6 +1004,7 @@ set(TDLIB_SOURCE_PART2
|
||||
td/telegram/MessageOrigin.hpp
|
||||
td/telegram/MessageQuote.hpp
|
||||
td/telegram/MessageReaction.hpp
|
||||
td/telegram/MessageReactor.hpp
|
||||
td/telegram/MessageReplyInfo.hpp
|
||||
td/telegram/MinChannel.hpp
|
||||
td/telegram/NotificationGroupInfo.hpp
|
||||
|
@ -378,6 +378,7 @@ function split_file($file, $chunks, $undo) {
|
||||
'MessageLinkInfo' => 'MessageLinkInfo',
|
||||
'MessageQuote' => 'MessageQuote',
|
||||
'MessageReaction|UnreadMessageReaction|[a-z_]*message[a-z_]*reaction' => 'MessageReaction',
|
||||
'MessageReactor' => 'MessageReactor',
|
||||
'MessageSearchOffset' => 'MessageSearchOffset',
|
||||
'[a-z_]*_message_sender' => 'MessageSender',
|
||||
'messages_manager[_(-](?![.]get[(][)])|MessagesManager' => 'MessagesManager',
|
||||
|
@ -1495,6 +1495,14 @@ reactionTypeCustomEmoji custom_emoji_id:int64 = ReactionType;
|
||||
reactionTypePaid = ReactionType;
|
||||
|
||||
|
||||
//@description Contains information about a user that added paid reactions
|
||||
//@sender_id Identifier of the user or chat that added the reactions; may be null for anonymous reactors that aren't the current user
|
||||
//@star_count Number of Telegram Stars added
|
||||
//@is_top True, if the reactor is one of the most active reactors; can be false if the reactor is the current user
|
||||
//@is_me True, if the paid reaction was added by the current user
|
||||
//@is_anonymous True, if the reactor is anonymous
|
||||
paidReactor sender_id:MessageSender star_count:int32 is_top:Bool is_me:Bool is_anonymous:Bool = PaidReactor;
|
||||
|
||||
//@description Contains information about a forwarded message
|
||||
//@origin Origin of the forwarded message
|
||||
//@date Point in time (Unix timestamp) when the message was originally sent
|
||||
|
36
td/telegram/MessageReactor.cpp
Normal file
36
td/telegram/MessageReactor.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
//
|
||||
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
#include "td/telegram/MessageReactor.h"
|
||||
|
||||
#include "td/telegram/MessageSender.h"
|
||||
|
||||
namespace td {
|
||||
|
||||
MessageReactor::MessageReactor(telegram_api::object_ptr<telegram_api::messageReactor> &&reactor)
|
||||
: dialog_id_(reactor->peer_id_ == nullptr ? DialogId() : DialogId(reactor->peer_id_))
|
||||
, count_(reactor->count_)
|
||||
, is_top_(reactor->top_)
|
||||
, is_me_(reactor->my_)
|
||||
, is_anonymous_(reactor->anonymous_) {
|
||||
}
|
||||
|
||||
td_api::object_ptr<td_api::paidReactor> MessageReactor::get_paid_reactor_object(Td *td) const {
|
||||
return td_api::make_object<td_api::paidReactor>(
|
||||
dialog_id_ == DialogId() ? nullptr : get_message_sender_object(td, dialog_id_, "paidReactor"), count_, is_top_,
|
||||
is_me_, is_anonymous_);
|
||||
}
|
||||
|
||||
bool operator==(const MessageReactor &lhs, const MessageReactor &rhs) {
|
||||
return lhs.dialog_id_ == rhs.dialog_id_ && lhs.count_ == rhs.count_ && lhs.is_top_ == rhs.is_top_ &&
|
||||
lhs.is_me_ == rhs.is_me_ && lhs.is_anonymous_ == rhs.is_anonymous_;
|
||||
}
|
||||
|
||||
StringBuilder &operator<<(StringBuilder &string_builder, const MessageReactor &reactor) {
|
||||
return string_builder << "PaidReactor[" << reactor.dialog_id_ << " - " << reactor.count_ << ']';
|
||||
}
|
||||
|
||||
} // namespace td
|
57
td/telegram/MessageReactor.h
Normal file
57
td/telegram/MessageReactor.h
Normal file
@ -0,0 +1,57 @@
|
||||
//
|
||||
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "td/telegram/DialogId.h"
|
||||
#include "td/telegram/td_api.h"
|
||||
#include "td/telegram/telegram_api.h"
|
||||
|
||||
#include "td/utils/common.h"
|
||||
#include "td/utils/StringBuilder.h"
|
||||
|
||||
namespace td {
|
||||
|
||||
class Td;
|
||||
|
||||
class MessageReactor {
|
||||
DialogId dialog_id_;
|
||||
int32 count_ = 0;
|
||||
bool is_top_ = false;
|
||||
bool is_me_ = false;
|
||||
bool is_anonymous_ = false;
|
||||
|
||||
friend bool operator==(const MessageReactor &lhs, const MessageReactor &rhs);
|
||||
|
||||
friend StringBuilder &operator<<(StringBuilder &string_builder, const MessageReactor &reactor);
|
||||
|
||||
public:
|
||||
MessageReactor() = default;
|
||||
|
||||
explicit MessageReactor(telegram_api::object_ptr<telegram_api::messageReactor> &&reactor);
|
||||
|
||||
bool is_valid() const {
|
||||
return (dialog_id_.is_valid() || (!is_me_ && !is_anonymous_)) && count_ > 0;
|
||||
}
|
||||
|
||||
td_api::object_ptr<td_api::paidReactor> get_paid_reactor_object(Td *td) const;
|
||||
|
||||
template <class StorerT>
|
||||
void store(StorerT &storer) const;
|
||||
|
||||
template <class ParserT>
|
||||
void parse(ParserT &parser);
|
||||
};
|
||||
|
||||
bool operator==(const MessageReactor &lhs, const MessageReactor &rhs);
|
||||
|
||||
inline bool operator!=(const MessageReactor &lhs, const MessageReactor &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
StringBuilder &operator<<(StringBuilder &string_builder, const MessageReactor &reactor);
|
||||
|
||||
} // namespace td
|
46
td/telegram/MessageReactor.hpp
Normal file
46
td/telegram/MessageReactor.hpp
Normal file
@ -0,0 +1,46 @@
|
||||
//
|
||||
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "td/telegram/MessageReactor.h"
|
||||
|
||||
#include "td/utils/common.h"
|
||||
#include "td/utils/tl_helpers.h"
|
||||
|
||||
namespace td {
|
||||
|
||||
template <class StorerT>
|
||||
void MessageReactor::store(StorerT &storer) const {
|
||||
bool has_dialog_id = dialog_id_.is_valid();
|
||||
BEGIN_STORE_FLAGS();
|
||||
STORE_FLAG(is_top_);
|
||||
STORE_FLAG(is_me_);
|
||||
STORE_FLAG(is_anonymous_);
|
||||
STORE_FLAG(has_dialog_id);
|
||||
END_STORE_FLAGS();
|
||||
if (has_dialog_id) {
|
||||
td::store(dialog_id_, storer);
|
||||
}
|
||||
td::store(count_, storer);
|
||||
}
|
||||
|
||||
template <class ParserT>
|
||||
void MessageReactor::parse(ParserT &parser) {
|
||||
bool has_dialog_id;
|
||||
BEGIN_PARSE_FLAGS();
|
||||
PARSE_FLAG(is_top_);
|
||||
PARSE_FLAG(is_me_);
|
||||
PARSE_FLAG(is_anonymous_);
|
||||
PARSE_FLAG(has_dialog_id);
|
||||
END_PARSE_FLAGS();
|
||||
if (has_dialog_id) {
|
||||
td::parse(dialog_id_, parser);
|
||||
}
|
||||
td::parse(count_, parser);
|
||||
}
|
||||
|
||||
} // namespace td
|
Loading…
Reference in New Issue
Block a user