mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Added support of giveaway prize action messages to export to HTML.
This commit is contained in:
parent
36141a9df9
commit
bc4b427ed1
4 changed files with 13 additions and 7 deletions
|
@ -1562,10 +1562,11 @@ ServiceAction ParseServiceAction(
|
|||
content.cost = Ui::FillAmountAndCurrency(
|
||||
data.vamount().v,
|
||||
qs(data.vcurrency())).toUtf8();
|
||||
content.stars = data.vstars().v;
|
||||
content.credits = data.vstars().v;
|
||||
result.content = content;
|
||||
}, [&](const MTPDmessageActionPrizeStars &data) {
|
||||
auto content = ActionPrizeStars();
|
||||
content.peerId = ParsePeerId(data.vboost_peer());
|
||||
content.amount = data.vstars().v;
|
||||
result.content = content;
|
||||
}, [](const MTPDmessageActionEmpty &data) {});
|
||||
|
|
|
@ -605,10 +605,11 @@ struct ActionPaymentRefunded {
|
|||
|
||||
struct ActionGiftStars {
|
||||
Utf8String cost;
|
||||
int stars = 0;
|
||||
int credits = 0;
|
||||
};
|
||||
|
||||
struct ActionPrizeStars {
|
||||
PeerId peerId = 0;
|
||||
uint64 amount = 0;
|
||||
};
|
||||
|
||||
|
|
|
@ -1330,17 +1330,21 @@ auto HtmlWriter::Wrap::pushMessage(
|
|||
+ amount;
|
||||
return result;
|
||||
}, [&](const ActionGiftStars &data) {
|
||||
if (!data.stars || data.cost.isEmpty()) {
|
||||
if (!data.credits || data.cost.isEmpty()) {
|
||||
return serviceFrom + " sent you a gift.";
|
||||
}
|
||||
return serviceFrom
|
||||
+ " sent you a gift for "
|
||||
+ data.cost
|
||||
+ ": "
|
||||
+ QString::number(data.stars).toUtf8()
|
||||
+ QString::number(data.credits).toUtf8()
|
||||
+ " Telegram Stars.";
|
||||
}, [&](const ActionPrizeStars &data) {
|
||||
return serviceFrom + " prize stars."; AssertIsDebug();
|
||||
return "You won a prize in a giveaway organized by "
|
||||
+ peers.wrapPeerName(data.peerId)
|
||||
+ ".\n Your prize is "
|
||||
+ QString::number(data.amount).toUtf8()
|
||||
+ " Telegram Stars.";
|
||||
}, [](v::null_t) { return QByteArray(); });
|
||||
|
||||
if (!serviceText.isEmpty()) {
|
||||
|
|
|
@ -638,8 +638,8 @@ QByteArray SerializeMessage(
|
|||
if (!data.cost.isEmpty()) {
|
||||
push("cost", data.cost);
|
||||
}
|
||||
if (data.stars) {
|
||||
push("stars", data.stars);
|
||||
if (data.credits) {
|
||||
push("stars", data.credits);
|
||||
}
|
||||
}, [&](const ActionPrizeStars &data) {
|
||||
pushActor();
|
||||
|
|
Loading…
Add table
Reference in a new issue