Update API scheme to layer 189.
This commit is contained in:
@@ -1658,6 +1658,19 @@ ServiceAction ParseServiceAction(
|
||||
.giveawayMsgId = data.vgiveaway_msg_id().v,
|
||||
.isUnclaimed = data.is_unclaimed(),
|
||||
};
|
||||
}, [&](const MTPDmessageActionStarGift &data) {
|
||||
const auto &gift = data.vgift().data();
|
||||
result.content = ActionStarGift{
|
||||
.giftId = uint64(gift.vid().v),
|
||||
.stars = int64(gift.vstars().v),
|
||||
.text = (data.vmessage()
|
||||
? ParseText(
|
||||
data.vmessage()->data().vtext(),
|
||||
data.vmessage()->data().ventities().v)
|
||||
: std::vector<TextPart>()),
|
||||
.anonymous = data.is_name_hidden(),
|
||||
.limited = gift.is_limited(),
|
||||
};
|
||||
}, [](const MTPDmessageActionEmpty &data) {});
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -401,6 +401,39 @@ Media ParseMedia(
|
||||
const QString &folder,
|
||||
TimeId date);
|
||||
|
||||
struct TextPart {
|
||||
enum class Type {
|
||||
Text,
|
||||
Unknown,
|
||||
Mention,
|
||||
Hashtag,
|
||||
BotCommand,
|
||||
Url,
|
||||
Email,
|
||||
Bold,
|
||||
Italic,
|
||||
Code,
|
||||
Pre,
|
||||
TextUrl,
|
||||
MentionName,
|
||||
Phone,
|
||||
Cashtag,
|
||||
Underline,
|
||||
Strike,
|
||||
Blockquote,
|
||||
BankCard,
|
||||
Spoiler,
|
||||
CustomEmoji,
|
||||
};
|
||||
Type type = Type::Text;
|
||||
Utf8String text;
|
||||
Utf8String additional;
|
||||
|
||||
[[nodiscard]] static Utf8String UnavailableEmoji() {
|
||||
return "(unavailable)";
|
||||
}
|
||||
};
|
||||
|
||||
struct ActionChatCreate {
|
||||
Utf8String title;
|
||||
std::vector<UserId> userIds;
|
||||
@@ -617,6 +650,14 @@ struct ActionPrizeStars {
|
||||
bool isUnclaimed = false;
|
||||
};
|
||||
|
||||
struct ActionStarGift {
|
||||
uint64 giftId = 0;
|
||||
int64 stars = 0;
|
||||
std::vector<TextPart> text;
|
||||
bool anonymous = false;
|
||||
bool limited = false;
|
||||
};
|
||||
|
||||
struct ServiceAction {
|
||||
std::variant<
|
||||
v::null_t,
|
||||
@@ -661,7 +702,8 @@ struct ServiceAction {
|
||||
ActionBoostApply,
|
||||
ActionPaymentRefunded,
|
||||
ActionGiftStars,
|
||||
ActionPrizeStars> content;
|
||||
ActionPrizeStars,
|
||||
ActionStarGift> content;
|
||||
};
|
||||
|
||||
ServiceAction ParseServiceAction(
|
||||
@@ -669,39 +711,6 @@ ServiceAction ParseServiceAction(
|
||||
const MTPMessageAction &data,
|
||||
const QString &mediaFolder);
|
||||
|
||||
struct TextPart {
|
||||
enum class Type {
|
||||
Text,
|
||||
Unknown,
|
||||
Mention,
|
||||
Hashtag,
|
||||
BotCommand,
|
||||
Url,
|
||||
Email,
|
||||
Bold,
|
||||
Italic,
|
||||
Code,
|
||||
Pre,
|
||||
TextUrl,
|
||||
MentionName,
|
||||
Phone,
|
||||
Cashtag,
|
||||
Underline,
|
||||
Strike,
|
||||
Blockquote,
|
||||
BankCard,
|
||||
Spoiler,
|
||||
CustomEmoji,
|
||||
};
|
||||
Type type = Type::Text;
|
||||
Utf8String text;
|
||||
Utf8String additional;
|
||||
|
||||
[[nodiscard]] static Utf8String UnavailableEmoji() {
|
||||
return "(unavailable)";
|
||||
}
|
||||
};
|
||||
|
||||
struct Reaction {
|
||||
enum class Type {
|
||||
Empty,
|
||||
|
||||
@@ -1362,6 +1362,11 @@ auto HtmlWriter::Wrap::pushMessage(
|
||||
+ ".\n Your prize is "
|
||||
+ QString::number(data.amount).toUtf8()
|
||||
+ " Telegram Stars.";
|
||||
}, [&](const ActionStarGift &data) {
|
||||
return serviceFrom
|
||||
+ " sent you a gift of "
|
||||
+ QByteArray::number(data.stars)
|
||||
+ " Telegram Stars.";
|
||||
}, [](v::null_t) { return QByteArray(); });
|
||||
|
||||
if (!serviceText.isEmpty()) {
|
||||
|
||||
@@ -647,6 +647,14 @@ QByteArray SerializeMessage(
|
||||
push("is_unclaimed", data.isUnclaimed);
|
||||
push("giveaway_msg_id", data.giveawayMsgId);
|
||||
push("transaction_id", data.transactionId);
|
||||
}, [&](const ActionStarGift &data) {
|
||||
pushActor();
|
||||
pushAction("send_star_gift");
|
||||
push("gift_id", data.giftId);
|
||||
push("stars", data.stars);
|
||||
push("is_limited", data.limited);
|
||||
push("is_anonymous", data.anonymous);
|
||||
pushBare("text", SerializeText(context, data.text));
|
||||
}, [](v::null_t) {});
|
||||
|
||||
if (v::is_null(message.action.content)) {
|
||||
|
||||
Reference in New Issue
Block a user