Skip to content

Commit

Permalink
Add additional role tags.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nihlus committed Jan 18, 2023
1 parent 682eb68 commit ce28c6b
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,27 @@ public interface IRoleTags
/// nonpresence may correspond to "false".
/// </remarks>
Optional<bool?> IsPremiumSubscriberRole { get; }

/// <summary>
/// Gets the ID of the role's subscription SKU and listing.
/// </summary>
Optional<Snowflake> SubscriptionListingID { get; }

/// <summary>
/// Gets a value indicating whether the role is available for purchase.
/// </summary>
/// <remarks>
/// This value is strangely documented in Discord. It appears that a null value may correspond to "true", and
/// nonpresence may correspond to "false".
/// </remarks>
Optional<bool?> IsAvailableForPurchase { get; }

/// <summary>
/// Gets a value indicating whether this role is a guild's linked role.
/// </summary>
/// <remarks>
/// This value is strangely documented in Discord. It appears that a null value may correspond to "true", and
/// nonpresence may correspond to "false".
/// </remarks>
Optional<bool?> HasGuildConnections { get; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,8 @@ public record RoleTags
(
Optional<Snowflake> BotID = default,
Optional<Snowflake> IntegrationID = default,
Optional<bool?> IsPremiumSubscriberRole = default
Optional<bool?> IsPremiumSubscriberRole = default,
Optional<Snowflake> SubscriptionListingID = default,
Optional<bool?> IsAvailableForPurchase = default,
Optional<bool?> HasGuildConnections = default
) : IRoleTags;
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,9 @@ private static JsonSerializerOptions AddPermissionObjectConverters(this JsonSeri
.WithPropertyName(r => r.IsMentionable, "mentionable");

options.AddDataObjectConverter<IRoleTags, RoleTags>()
.WithPropertyName(t => t.IsPremiumSubscriberRole, "premium_subscriber");
.WithPropertyName(t => t.IsPremiumSubscriberRole, "premium_subscriber")
.WithPropertyName(t => t.IsAvailableForPurchase, "available_for_purchase")
.WithPropertyName(t => t.HasGuildConnections, "guild_connections");

return options;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"bot_id": "999999999999999999",
"integration_id": "999999999999999999",
"premium_subscriber": null
}
"premium_subscriber": null,
"subscription_listing_id": "999999999999999999",
"available_for_purchase": null,
"guild_connections": null
}

0 comments on commit ce28c6b

Please sign in to comment.