mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Improved process of giveaway messages for export to JSON.
This commit is contained in:
parent
00ad32c5f4
commit
d68ba75457
1 changed files with 17 additions and 2 deletions
|
@ -784,7 +784,7 @@ QByteArray SerializeMessage(
|
||||||
{ "answers", serialized }
|
{ "answers", serialized }
|
||||||
}));
|
}));
|
||||||
}, [&](const GiveawayStart &data) {
|
}, [&](const GiveawayStart &data) {
|
||||||
context.nesting.push_back(Context::kObject);
|
context.nesting.push_back(Context::kArray);
|
||||||
const auto channels = ranges::views::all(
|
const auto channels = ranges::views::all(
|
||||||
data.channels
|
data.channels
|
||||||
) | ranges::views::transform([&](ChannelId id) {
|
) | ranges::views::transform([&](ChannelId id) {
|
||||||
|
@ -793,11 +793,26 @@ QByteArray SerializeMessage(
|
||||||
const auto serialized = SerializeArray(context, channels);
|
const auto serialized = SerializeArray(context, channels);
|
||||||
context.nesting.pop_back();
|
context.nesting.pop_back();
|
||||||
|
|
||||||
push("giveaway_information", SerializeObject(context, {
|
context.nesting.push_back(Context::kArray);
|
||||||
|
const auto countries = ranges::views::all(
|
||||||
|
data.countries
|
||||||
|
) | ranges::views::transform([&](const QString &code) {
|
||||||
|
return SerializeString(code.toUtf8());
|
||||||
|
}) | ranges::to_vector;
|
||||||
|
const auto serializedCountries = SerializeArray(context, countries);
|
||||||
|
context.nesting.pop_back();
|
||||||
|
|
||||||
|
const auto additionalPrize = data.additionalPrize.toUtf8();
|
||||||
|
|
||||||
|
pushBare("giveaway_information", SerializeObject(context, {
|
||||||
{ "quantity", NumberToString(data.quantity) },
|
{ "quantity", NumberToString(data.quantity) },
|
||||||
{ "months", NumberToString(data.months) },
|
{ "months", NumberToString(data.months) },
|
||||||
{ "until_date", SerializeDate(data.untilDate) },
|
{ "until_date", SerializeDate(data.untilDate) },
|
||||||
{ "channels", serialized },
|
{ "channels", serialized },
|
||||||
|
{ "countries", serializedCountries },
|
||||||
|
{ "additional_prize", SerializeString(additionalPrize) },
|
||||||
|
{ "stars", NumberToString(data.credits) },
|
||||||
|
{ "is_only_new_subscribers", (!data.all) ? "true" : "false" },
|
||||||
}));
|
}));
|
||||||
}, [&](const GiveawayResults &data) {
|
}, [&](const GiveawayResults &data) {
|
||||||
}, [&](const PaidMedia &data) {
|
}, [&](const PaidMedia &data) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue