mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Added support of service actions for premium gifts to export.
This commit is contained in:
parent
e84f5aaa3d
commit
b295a9eeb1
4 changed files with 31 additions and 2 deletions
|
@ -1146,7 +1146,12 @@ ServiceAction ParseServiceAction(
|
||||||
content.text = ParseString(data.vtext());
|
content.text = ParseString(data.vtext());
|
||||||
result.content = content;
|
result.content = content;
|
||||||
}, [&](const MTPDmessageActionGiftPremium &data) {
|
}, [&](const MTPDmessageActionGiftPremium &data) {
|
||||||
// #TODO gifts
|
auto content = ActionGiftPremium();
|
||||||
|
content.cost = Ui::FillAmountAndCurrency(
|
||||||
|
data.vamount().v,
|
||||||
|
qs(data.vcurrency())).toUtf8();
|
||||||
|
content.months = data.vmonths().v;
|
||||||
|
result.content = content;
|
||||||
}, [](const MTPDmessageActionEmpty &data) {});
|
}, [](const MTPDmessageActionEmpty &data) {});
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -488,6 +488,11 @@ struct ActionWebViewDataSent {
|
||||||
Utf8String text;
|
Utf8String text;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ActionGiftPremium {
|
||||||
|
Utf8String cost;
|
||||||
|
int months;
|
||||||
|
};
|
||||||
|
|
||||||
struct ServiceAction {
|
struct ServiceAction {
|
||||||
std::variant<
|
std::variant<
|
||||||
v::null_t,
|
v::null_t,
|
||||||
|
@ -519,7 +524,8 @@ struct ServiceAction {
|
||||||
ActionGroupCallScheduled,
|
ActionGroupCallScheduled,
|
||||||
ActionSetChatTheme,
|
ActionSetChatTheme,
|
||||||
ActionChatJoinedByRequest,
|
ActionChatJoinedByRequest,
|
||||||
ActionWebViewDataSent> content;
|
ActionWebViewDataSent,
|
||||||
|
ActionGiftPremium> content;
|
||||||
};
|
};
|
||||||
|
|
||||||
ServiceAction ParseServiceAction(
|
ServiceAction ParseServiceAction(
|
||||||
|
|
|
@ -1128,6 +1128,15 @@ auto HtmlWriter::Wrap::pushMessage(
|
||||||
return "You have just successfully transferred data from the «"
|
return "You have just successfully transferred data from the «"
|
||||||
+ SerializeString(data.text)
|
+ SerializeString(data.text)
|
||||||
+ "» button to the bot";
|
+ "» button to the bot";
|
||||||
|
}, [&](const ActionGiftPremium &data) {
|
||||||
|
if (!data.months || data.cost.isEmpty()) {
|
||||||
|
return (serviceFrom + " sent you a gift.");
|
||||||
|
}
|
||||||
|
return (serviceFrom
|
||||||
|
+ " sent you a gift for "
|
||||||
|
+ data.cost
|
||||||
|
+ ": Telegram Premium for "
|
||||||
|
+ QString::number(data.months).toUtf8() + " months.");
|
||||||
}, [](v::null_t) { return QByteArray(); });
|
}, [](v::null_t) { return QByteArray(); });
|
||||||
|
|
||||||
if (!serviceText.isEmpty()) {
|
if (!serviceText.isEmpty()) {
|
||||||
|
|
|
@ -546,6 +546,15 @@ QByteArray SerializeMessage(
|
||||||
}, [&](const ActionWebViewDataSent &data) {
|
}, [&](const ActionWebViewDataSent &data) {
|
||||||
pushAction("send_webview_data");
|
pushAction("send_webview_data");
|
||||||
push("text", data.text);
|
push("text", data.text);
|
||||||
|
}, [&](const ActionGiftPremium &data) {
|
||||||
|
pushActor();
|
||||||
|
pushAction("send_premium_gift");
|
||||||
|
if (!data.cost.isEmpty()) {
|
||||||
|
push("cost", data.cost);
|
||||||
|
}
|
||||||
|
if (data.months) {
|
||||||
|
push("months", data.months);
|
||||||
|
}
|
||||||
}, [](v::null_t) {});
|
}, [](v::null_t) {});
|
||||||
|
|
||||||
if (v::is_null(message.action.content)) {
|
if (v::is_null(message.action.content)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue