2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-30 22:16:14 +00:00

Support non-convertible star gifts from bots.

This commit is contained in:
John Preston
2024-11-15 12:14:49 +04:00
parent d0911b6a45
commit 3cfbd6a93b
13 changed files with 63 additions and 43 deletions

View File

@@ -117,11 +117,12 @@ constexpr auto kTransactionsLimit = 100;
? base::unixtime::parse(tl.data().vtransaction_date()->v)
: QDateTime(),
.successLink = qs(tl.data().vtransaction_url().value_or_empty()),
.convertStars = int(stargift
.starsConverted = int(stargift
? stargift->data().vconvert_stars().v
: 0),
.floodSkip = int(tl.data().vfloodskip_number().value_or(0)),
.converted = stargift && incoming,
.stargift = stargift.has_value(),
.reaction = tl.data().is_reaction(),
.refunded = tl.data().is_refund(),
.pending = tl.data().is_pending(),

View File

@@ -772,7 +772,7 @@ std::optional<StarGift> FromTL(
return StarGift{
.id = uint64(data.vid().v),
.stars = int64(data.vstars().v),
.convertStars = int64(data.vconvert_stars().v),
.starsConverted = int64(data.vconvert_stars().v),
.document = document,
.limitedLeft = remaining.value_or_empty(),
.limitedCount = total.value_or_empty(),
@@ -800,7 +800,7 @@ std::optional<UserStarGift> FromTL(
data.vmessage()->data().ventities().v),
}
: TextWithEntities()),
.convertStars = int64(data.vconvert_stars().value_or_empty()),
.starsConverted = int64(data.vconvert_stars().value_or_empty()),
.fromId = (data.vfrom_id()
? peerFromUser(data.vfrom_id()->v)
: PeerId()),

View File

@@ -76,7 +76,7 @@ struct GiftOptionData {
struct StarGift {
uint64 id = 0;
int64 stars = 0;
int64 convertStars = 0;
int64 starsConverted = 0;
not_null<DocumentData*> document;
int limitedLeft = 0;
int limitedCount = 0;
@@ -91,7 +91,7 @@ struct StarGift {
struct UserStarGift {
StarGift info;
TextWithEntities message;
int64 convertStars = 0;
int64 starsConverted = 0;
PeerId fromId = 0;
MsgId messageId = 0;
TimeId date = 0;