[Feature] Add new message types & error codes (#2562)

* Add new message types & error codes

* add role subscription system channel flags and message property
This commit is contained in:
Misha133
2023-01-21 13:50:57 +03:00
committed by GitHub
parent f224eb0523
commit a3ee8555c6
9 changed files with 146 additions and 10 deletions

View File

@@ -62,5 +62,7 @@ namespace Discord.API
public Optional<MessageInteraction> Interaction { get; set; }
[JsonProperty("sticker_items")]
public Optional<StickerItem[]> StickerItems { get; set; }
[JsonProperty("role_subscription_data")]
public Optional<MessageRoleSubscriptionData> RoleSubscriptionData { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
using Newtonsoft.Json;
namespace Discord.API;
internal class MessageRoleSubscriptionData
{
[JsonProperty("role_subscription_listing_id")]
public ulong SubscriptionListingId { get; set; }
[JsonProperty("tier_name")]
public string TierName { get; set; }
[JsonProperty("total_months_subscribed")]
public int MonthsSubscribed { get; set; }
[JsonProperty("is_renewal")]
public bool IsRenewal { get; set; }
}

View File

@@ -80,6 +80,9 @@ namespace Discord.Rest
/// <inheritdoc/>
public MessageType Type { get; private set; }
/// <inheritdoc />
public MessageRoleSubscriptionData RoleSubscriptionData { get; private set; }
/// <inheritdoc/>
public IReadOnlyCollection<ActionRowComponent> Components { get; private set; }
/// <summary>
@@ -243,6 +246,15 @@ namespace Discord.Rest
_userMentions = newMentions.ToImmutable();
}
}
if (model.RoleSubscriptionData.IsSpecified)
{
RoleSubscriptionData = new(
model.RoleSubscriptionData.Value.SubscriptionListingId,
model.RoleSubscriptionData.Value.TierName,
model.RoleSubscriptionData.Value.MonthsSubscribed,
model.RoleSubscriptionData.Value.IsRenewal);
}
}
/// <inheritdoc />
public async Task UpdateAsync(RequestOptions options = null)