From 6b691b1ad244dddd3f9a9f05add9159958f73ee6 Mon Sep 17 00:00:00 2001
From: Mihail Gribkov <61027276+Misha-133@users.noreply.github.com>
Date: Thu, 4 Jul 2024 00:00:49 +0300
Subject: [PATCH] this object is fucked but at least its not missing props now
(#2956)
---
.../Entities/Roles/RoleTags.cs | 87 +++++++++++--------
src/Discord.Net.Rest/API/Common/RoleTags.cs | 30 ++++---
.../Extensions/EntityExtensions.cs | 9 +-
3 files changed, 79 insertions(+), 47 deletions(-)
diff --git a/src/Discord.Net.Core/Entities/Roles/RoleTags.cs b/src/Discord.Net.Core/Entities/Roles/RoleTags.cs
index d0cbd3580..b0d963cf0 100644
--- a/src/Discord.Net.Core/Entities/Roles/RoleTags.cs
+++ b/src/Discord.Net.Core/Entities/Roles/RoleTags.cs
@@ -1,40 +1,59 @@
-namespace Discord
+namespace Discord;
+
+///
+/// Provides tags related to a discord role.
+///
+public class RoleTags
{
///
- /// Provides tags related to a discord role.
+ /// Gets the identifier of the bot that this role belongs to, if it does.
///
- public class RoleTags
- {
- ///
- /// Gets the identifier of the bot that this role belongs to, if it does.
- ///
- ///
- /// A if this role belongs to a bot; otherwise
- /// .
- ///
- public ulong? BotId { get; }
- ///
- /// Gets the identifier of the integration that this role belongs to, if it does.
- ///
- ///
- /// A if this role belongs to an integration; otherwise
- /// .
- ///
- public ulong? IntegrationId { get; }
- ///
- /// Gets if this role is the guild's premium subscriber (booster) role.
- ///
- ///
- /// if this role is the guild's premium subscriber role;
- /// otherwise .
- ///
- public bool IsPremiumSubscriberRole { get; }
+ ///
+ /// A if this role belongs to a bot; otherwise
+ /// .
+ ///
+ public ulong? BotId { get; }
+
+ ///
+ /// Gets the identifier of the integration that this role belongs to, if it does.
+ ///
+ ///
+ /// A if this role belongs to an integration; otherwise
+ /// .
+ ///
+ public ulong? IntegrationId { get; }
+
+ ///
+ /// Gets if this role is the guild's premium subscriber (booster) role.
+ ///
+ ///
+ /// if this role is the guild's premium subscriber role;
+ /// otherwise .
+ ///
+ public bool IsPremiumSubscriberRole { get; }
+
+ ///
+ /// Gets the identifier of the subscription listing that this role belongs to, if it does.
+ ///
+ public ulong? SubscriptionListingId { get; }
+
+ ///
+ /// Gets whether this role is available for purchase.
+ ///
+ public bool IsAvailableForPurchase { get; }
- internal RoleTags(ulong? botId, ulong? integrationId, bool isPremiumSubscriber)
- {
- BotId = botId;
- IntegrationId = integrationId;
- IsPremiumSubscriberRole = isPremiumSubscriber;
- }
+ ///
+ /// Gets whether this role is a guild's linked role.
+ ///
+ public bool IsGuildConnection { get; }
+
+ internal RoleTags(ulong? botId, ulong? integrationId, bool isPremiumSubscriber, ulong? subscriptionListingId, bool isAvailableForPurchase, bool isGuildConnection)
+ {
+ BotId = botId;
+ IntegrationId = integrationId;
+ IsPremiumSubscriberRole = isPremiumSubscriber;
+ SubscriptionListingId = subscriptionListingId;
+ IsAvailableForPurchase = isAvailableForPurchase;
+ IsGuildConnection = isGuildConnection;
}
}
diff --git a/src/Discord.Net.Rest/API/Common/RoleTags.cs b/src/Discord.Net.Rest/API/Common/RoleTags.cs
index 9ddd39a64..fa6694b13 100644
--- a/src/Discord.Net.Rest/API/Common/RoleTags.cs
+++ b/src/Discord.Net.Rest/API/Common/RoleTags.cs
@@ -1,14 +1,24 @@
using Newtonsoft.Json;
-namespace Discord.API
+namespace Discord.API;
+
+internal class RoleTags
{
- internal class RoleTags
- {
- [JsonProperty("bot_id")]
- public Optional BotId { get; set; }
- [JsonProperty("integration_id")]
- public Optional IntegrationId { get; set; }
- [JsonProperty("premium_subscriber")]
- public Optional IsPremiumSubscriber { get; set; }
- }
+ [JsonProperty("bot_id")]
+ public Optional BotId { get; set; }
+
+ [JsonProperty("integration_id")]
+ public Optional IntegrationId { get; set; }
+
+ [JsonProperty("premium_subscriber")]
+ public Optional IsPremiumSubscriber { get; set; }
+
+ [JsonProperty("subscription_listing_id")]
+ public Optional SubscriptionListingId { get; set; }
+
+ [JsonProperty("available_for_purchase")]
+ public Optional IsAvailableForPurchase { get; set; }
+
+ [JsonProperty("guild_connections")]
+ public Optional GuildConnections { get; set; }
}
diff --git a/src/Discord.Net.Rest/Extensions/EntityExtensions.cs b/src/Discord.Net.Rest/Extensions/EntityExtensions.cs
index 885d0f080..3e7ec81bb 100644
--- a/src/Discord.Net.Rest/Extensions/EntityExtensions.cs
+++ b/src/Discord.Net.Rest/Extensions/EntityExtensions.cs
@@ -38,9 +38,12 @@ public static Embed ToEntity(this API.Embed model)
public static RoleTags ToEntity(this API.RoleTags model)
{
return new RoleTags(
- model.BotId.IsSpecified ? model.BotId.Value : null,
- model.IntegrationId.IsSpecified ? model.IntegrationId.Value : null,
- model.IsPremiumSubscriber.IsSpecified);
+ model.BotId.ToNullable(),
+ model.IntegrationId.ToNullable(),
+ model.IsPremiumSubscriber.IsSpecified,
+ model.SubscriptionListingId.ToNullable(),
+ model.IsAvailableForPurchase.IsSpecified,
+ model.GuildConnections.IsSpecified);
}
public static API.Embed ToModel(this Embed entity)
{