diff --git a/src/Discord.Net.Core/Entities/Roles/IRole.cs b/src/Discord.Net.Core/Entities/Roles/IRole.cs
index 66556fc2c..c02322be9 100644
--- a/src/Discord.Net.Core/Entities/Roles/IRole.cs
+++ b/src/Discord.Net.Core/Entities/Roles/IRole.cs
@@ -65,6 +65,13 @@ namespace Discord
/// An representing the position of the role in the role list of the guild.
///
int Position { get; }
+ ///
+ /// Gets the tags related to this role.
+ ///
+ ///
+ /// A object containing all tags related to this role.
+ ///
+ RoleTags Tags { get; }
///
/// Modifies this role.
diff --git a/src/Discord.Net.Core/Entities/Roles/RoleTags.cs b/src/Discord.Net.Core/Entities/Roles/RoleTags.cs
new file mode 100644
index 000000000..d0cbd3580
--- /dev/null
+++ b/src/Discord.Net.Core/Entities/Roles/RoleTags.cs
@@ -0,0 +1,40 @@
+namespace Discord
+{
+ ///
+ /// Provides tags related to a discord role.
+ ///
+ 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; }
+
+ internal RoleTags(ulong? botId, ulong? integrationId, bool isPremiumSubscriber)
+ {
+ BotId = botId;
+ IntegrationId = integrationId;
+ IsPremiumSubscriberRole = isPremiumSubscriber;
+ }
+ }
+}
diff --git a/src/Discord.Net.Rest/API/Common/Role.cs b/src/Discord.Net.Rest/API/Common/Role.cs
index 856a8695f..190ae25c0 100644
--- a/src/Discord.Net.Rest/API/Common/Role.cs
+++ b/src/Discord.Net.Rest/API/Common/Role.cs
@@ -1,4 +1,4 @@
-#pragma warning disable CS1591
+#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API
@@ -21,5 +21,7 @@ namespace Discord.API
public ulong Permissions { get; set; }
[JsonProperty("managed")]
public bool Managed { get; set; }
+ [JsonProperty("tags")]
+ public Optional Tags { get; set; }
}
}
diff --git a/src/Discord.Net.Rest/API/Common/RoleTags.cs b/src/Discord.Net.Rest/API/Common/RoleTags.cs
new file mode 100644
index 000000000..6446f2037
--- /dev/null
+++ b/src/Discord.Net.Rest/API/Common/RoleTags.cs
@@ -0,0 +1,15 @@
+#pragma warning disable CS1591
+using Newtonsoft.Json;
+
+namespace Discord.API
+{
+ 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; }
+ }
+}
diff --git a/src/Discord.Net.Rest/Entities/Roles/RestRole.cs b/src/Discord.Net.Rest/Entities/Roles/RestRole.cs
index 7c1a3aaa2..aa33ae7e5 100644
--- a/src/Discord.Net.Rest/Entities/Roles/RestRole.cs
+++ b/src/Discord.Net.Rest/Entities/Roles/RestRole.cs
@@ -26,6 +26,8 @@ namespace Discord.Rest
public GuildPermissions Permissions { get; private set; }
///
public int Position { get; private set; }
+ ///
+ public RoleTags Tags { get; private set; }
///
public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id);
@@ -56,6 +58,8 @@ namespace Discord.Rest
Position = model.Position;
Color = new Color(model.Color);
Permissions = new GuildPermissions(model.Permissions);
+ if (model.Tags.IsSpecified)
+ Tags = model.Tags.Value.ToEntity();
}
///
diff --git a/src/Discord.Net.Rest/Extensions/EntityExtensions.cs b/src/Discord.Net.Rest/Extensions/EntityExtensions.cs
index 8e1b9c6d8..f8676c783 100644
--- a/src/Discord.Net.Rest/Extensions/EntityExtensions.cs
+++ b/src/Discord.Net.Rest/Extensions/EntityExtensions.cs
@@ -34,6 +34,13 @@ namespace Discord.Rest
model.Thumbnail.IsSpecified ? model.Thumbnail.Value.ToEntity() : (EmbedThumbnail?)null,
model.Fields.IsSpecified ? model.Fields.Value.Select(x => x.ToEntity()).ToImmutableArray() : ImmutableArray.Create());
}
+ 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 ? true : false);
+ }
public static API.Embed ToModel(this Embed entity)
{
if (entity == null) return null;
diff --git a/src/Discord.Net.WebSocket/Entities/Roles/SocketRole.cs b/src/Discord.Net.WebSocket/Entities/Roles/SocketRole.cs
index b5e26ad78..e6aac2c04 100644
--- a/src/Discord.Net.WebSocket/Entities/Roles/SocketRole.cs
+++ b/src/Discord.Net.WebSocket/Entities/Roles/SocketRole.cs
@@ -36,6 +36,8 @@ namespace Discord.WebSocket
public GuildPermissions Permissions { get; private set; }
///
public int Position { get; private set; }
+ ///
+ public RoleTags Tags { get; private set; }
///
public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id);
@@ -71,6 +73,8 @@ namespace Discord.WebSocket
Position = model.Position;
Color = new Color(model.Color);
Permissions = new GuildPermissions(model.Permissions);
+ if (model.Tags.IsSpecified)
+ Tags = model.Tags.Value.ToEntity();
}
///