[Feature] Add purchase notification (#2942)

This commit is contained in:
Mihail Gribkov
2024-06-16 20:33:40 +03:00
committed by GitHub
parent 21195a8a93
commit 9d92435493
9 changed files with 113 additions and 0 deletions

View File

@@ -81,6 +81,9 @@ namespace Discord.WebSocket
/// <inheritdoc />
public MessageRoleSubscriptionData RoleSubscriptionData { get; private set; }
/// <inheritdoc />
public PurchaseNotification PurchaseNotification { get; private set; }
/// <inheritdoc cref="IMessage.Thread"/>
public SocketThreadChannel Thread { get; private set; }
@@ -303,6 +306,14 @@ namespace Discord.WebSocket
Thread = guild?.AddOrUpdateChannel(state, model.Thread.Value) as SocketThreadChannel;
}
if (model.PurchaseNotification.IsSpecified)
{
PurchaseNotification = new PurchaseNotification(model.PurchaseNotification.Value.Type,
model.PurchaseNotification.Value.ProductPurchase.IsSpecified
? new GuildProductPurchase(model.PurchaseNotification.Value.ProductPurchase.Value.ListingId, model.PurchaseNotification.Value.ProductPurchase.Value.ProductName)
: null);
}
if (model.Call.IsSpecified)
CallData = new MessageCallData(model.Call.Value.Participants, model.Call.Value.EndedTimestamp.ToNullable());
}