* Added icon field to IRole * Added GetGuildRoleIconUrl()pull/1923/head
@@ -86,6 +86,16 @@ namespace Discord | |||||
public static string GetGuildIconUrl(ulong guildId, string iconId) | public static string GetGuildIconUrl(ulong guildId, string iconId) | ||||
=> iconId != null ? $"{DiscordConfig.CDNUrl}icons/{guildId}/{iconId}.jpg" : null; | => iconId != null ? $"{DiscordConfig.CDNUrl}icons/{guildId}/{iconId}.jpg" : null; | ||||
/// <summary> | /// <summary> | ||||
/// Returns a guild role's icon URL. | |||||
/// </summary> | |||||
/// <param name="roleId">The role identifier.</param> | |||||
/// <param name="roleHash">The icon hash.</param> | |||||
/// <returns> | |||||
/// A URL pointing to the guild role's icon. | |||||
/// </returns> | |||||
public static string GetGuildRoleIconUrl(ulong roleId, string roleHash) | |||||
=> roleHash != null ? $"{DiscordConfig.CDNUrl}role-icons/{roleId}/{roleHash}.png" : null; | |||||
/// <summary> | |||||
/// Returns a guild splash URL. | /// Returns a guild splash URL. | ||||
/// </summary> | /// </summary> | ||||
/// <param name="guildId">The guild snowflake identifier.</param> | /// <param name="guildId">The guild snowflake identifier.</param> | ||||
@@ -131,6 +131,16 @@ | |||||
A URL pointing to the guild's icon. | A URL pointing to the guild's icon. | ||||
</returns> | </returns> | ||||
</member> | </member> | ||||
<member name="M:Discord.CDN.GetGuildRoleIconUrl(System.UInt64,System.String)"> | |||||
<summary> | |||||
Returns a guild role's icon URL. | |||||
</summary> | |||||
<param name="roleId">The role identifier.</param> | |||||
<param name="roleHash">The icon hash.</param> | |||||
<returns> | |||||
A URL pointing to the guild role's icon. | |||||
</returns> | |||||
</member> | |||||
<member name="M:Discord.CDN.GetGuildSplashUrl(System.UInt64,System.String)"> | <member name="M:Discord.CDN.GetGuildSplashUrl(System.UInt64,System.String)"> | ||||
<summary> | <summary> | ||||
Returns a guild splash URL. | Returns a guild splash URL. | ||||
@@ -9646,6 +9656,14 @@ | |||||
A string containing the name of this role. | A string containing the name of this role. | ||||
</returns> | </returns> | ||||
</member> | </member> | ||||
<member name="P:Discord.IRole.Icon"> | |||||
<summary> | |||||
Gets the icon of this role. | |||||
</summary> | |||||
<returns> | |||||
A string containing the hash of this role's icon. | |||||
</returns> | |||||
</member> | |||||
<member name="P:Discord.IRole.Permissions"> | <member name="P:Discord.IRole.Permissions"> | ||||
<summary> | <summary> | ||||
Gets the permissions granted to members of this role. | Gets the permissions granted to members of this role. | ||||
@@ -9684,6 +9702,14 @@ | |||||
A task that represents the asynchronous modification operation. | A task that represents the asynchronous modification operation. | ||||
</returns> | </returns> | ||||
</member> | </member> | ||||
<member name="M:Discord.IRole.GetIconUrl"> | |||||
<summary> | |||||
Gets the image url of the icon role. | |||||
</summary> | |||||
<returns> | |||||
An image url of the icon role. | |||||
</returns> | |||||
</member> | |||||
<member name="T:Discord.ReorderRoleProperties"> | <member name="T:Discord.ReorderRoleProperties"> | ||||
<summary> | <summary> | ||||
Properties that are used to reorder an <see cref="T:Discord.IRole"/>. | Properties that are used to reorder an <see cref="T:Discord.IRole"/>. | ||||
@@ -52,6 +52,13 @@ namespace Discord | |||||
/// </returns> | /// </returns> | ||||
string Name { get; } | string Name { get; } | ||||
/// <summary> | /// <summary> | ||||
/// Gets the icon of this role. | |||||
/// </summary> | |||||
/// <returns> | |||||
/// A string containing the hash of this role's icon. | |||||
/// </returns> | |||||
string Icon { get; } | |||||
/// <summary> | |||||
/// Gets the permissions granted to members of this role. | /// Gets the permissions granted to members of this role. | ||||
/// </summary> | /// </summary> | ||||
/// <returns> | /// <returns> | ||||
@@ -86,5 +93,13 @@ namespace Discord | |||||
/// A task that represents the asynchronous modification operation. | /// A task that represents the asynchronous modification operation. | ||||
/// </returns> | /// </returns> | ||||
Task ModifyAsync(Action<RoleProperties> func, RequestOptions options = null); | Task ModifyAsync(Action<RoleProperties> func, RequestOptions options = null); | ||||
/// <summary> | |||||
/// Gets the image url of the icon role. | |||||
/// </summary> | |||||
/// <returns> | |||||
/// An image url of the icon role. | |||||
/// </returns> | |||||
string GetIconUrl(); | |||||
} | } | ||||
} | } |
@@ -8,6 +8,8 @@ namespace Discord.API | |||||
public ulong Id { get; set; } | public ulong Id { get; set; } | ||||
[JsonProperty("name")] | [JsonProperty("name")] | ||||
public string Name { get; set; } | public string Name { get; set; } | ||||
[JsonProperty("icon")] | |||||
public string Icon { get; set; } | |||||
[JsonProperty("color")] | [JsonProperty("color")] | ||||
public uint Color { get; set; } | public uint Color { get; set; } | ||||
[JsonProperty("hoist")] | [JsonProperty("hoist")] | ||||
@@ -4613,6 +4613,9 @@ | |||||
<member name="P:Discord.Rest.RestRole.Name"> | <member name="P:Discord.Rest.RestRole.Name"> | ||||
<inheritdoc /> | <inheritdoc /> | ||||
</member> | </member> | ||||
<member name="P:Discord.Rest.RestRole.Icon"> | |||||
<inheritdoc /> | |||||
</member> | |||||
<member name="P:Discord.Rest.RestRole.Permissions"> | <member name="P:Discord.Rest.RestRole.Permissions"> | ||||
<inheritdoc /> | <inheritdoc /> | ||||
</member> | </member> | ||||
@@ -4639,6 +4642,9 @@ | |||||
<member name="M:Discord.Rest.RestRole.DeleteAsync(Discord.RequestOptions)"> | <member name="M:Discord.Rest.RestRole.DeleteAsync(Discord.RequestOptions)"> | ||||
<inheritdoc /> | <inheritdoc /> | ||||
</member> | </member> | ||||
<member name="M:Discord.Rest.RestRole.GetIconUrl"> | |||||
<inheritdoc /> | |||||
</member> | |||||
<member name="M:Discord.Rest.RestRole.CompareTo(Discord.IRole)"> | <member name="M:Discord.Rest.RestRole.CompareTo(Discord.IRole)"> | ||||
<inheritdoc /> | <inheritdoc /> | ||||
</member> | </member> | ||||
@@ -24,6 +24,8 @@ namespace Discord.Rest | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public string Name { get; private set; } | public string Name { get; private set; } | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public string Icon { get; private set; } | |||||
/// <inheritdoc /> | |||||
public GuildPermissions Permissions { get; private set; } | public GuildPermissions Permissions { get; private set; } | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public int Position { get; private set; } | public int Position { get; private set; } | ||||
@@ -53,6 +55,7 @@ namespace Discord.Rest | |||||
internal void Update(Model model) | internal void Update(Model model) | ||||
{ | { | ||||
Name = model.Name; | Name = model.Name; | ||||
Icon = model.Icon; | |||||
IsHoisted = model.Hoist; | IsHoisted = model.Hoist; | ||||
IsManaged = model.Managed; | IsManaged = model.Managed; | ||||
IsMentionable = model.Mentionable; | IsMentionable = model.Mentionable; | ||||
@@ -73,6 +76,10 @@ namespace Discord.Rest | |||||
public Task DeleteAsync(RequestOptions options = null) | public Task DeleteAsync(RequestOptions options = null) | ||||
=> RoleHelper.DeleteAsync(this, Discord, options); | => RoleHelper.DeleteAsync(this, Discord, options); | ||||
/// <inheritdoc /> | |||||
public string GetIconUrl() | |||||
=> CDN.GetGuildRoleIconUrl(Id, Icon); | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public int CompareTo(IRole role) => RoleUtils.Compare(this, role); | public int CompareTo(IRole role) => RoleUtils.Compare(this, role); | ||||
@@ -4843,6 +4843,9 @@ | |||||
<member name="P:Discord.WebSocket.SocketRole.Name"> | <member name="P:Discord.WebSocket.SocketRole.Name"> | ||||
<inheritdoc /> | <inheritdoc /> | ||||
</member> | </member> | ||||
<member name="P:Discord.WebSocket.SocketRole.Icon"> | |||||
<inheritdoc /> | |||||
</member> | |||||
<member name="P:Discord.WebSocket.SocketRole.Permissions"> | <member name="P:Discord.WebSocket.SocketRole.Permissions"> | ||||
<inheritdoc /> | <inheritdoc /> | ||||
</member> | </member> | ||||
@@ -4877,6 +4880,9 @@ | |||||
<member name="M:Discord.WebSocket.SocketRole.DeleteAsync(Discord.RequestOptions)"> | <member name="M:Discord.WebSocket.SocketRole.DeleteAsync(Discord.RequestOptions)"> | ||||
<inheritdoc /> | <inheritdoc /> | ||||
</member> | </member> | ||||
<member name="M:Discord.WebSocket.SocketRole.GetIconUrl"> | |||||
<inheritdoc /> | |||||
</member> | |||||
<member name="M:Discord.WebSocket.SocketRole.ToString"> | <member name="M:Discord.WebSocket.SocketRole.ToString"> | ||||
<summary> | <summary> | ||||
Gets the name of the role. | Gets the name of the role. | ||||
@@ -34,6 +34,8 @@ namespace Discord.WebSocket | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public string Name { get; private set; } | public string Name { get; private set; } | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public string Icon { get; private set; } | |||||
/// <inheritdoc /> | |||||
public GuildPermissions Permissions { get; private set; } | public GuildPermissions Permissions { get; private set; } | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public int Position { get; private set; } | public int Position { get; private set; } | ||||
@@ -72,6 +74,7 @@ namespace Discord.WebSocket | |||||
internal void Update(ClientState state, Model model) | internal void Update(ClientState state, Model model) | ||||
{ | { | ||||
Name = model.Name; | Name = model.Name; | ||||
Icon = model.Icon; | |||||
IsHoisted = model.Hoist; | IsHoisted = model.Hoist; | ||||
IsManaged = model.Managed; | IsManaged = model.Managed; | ||||
IsMentionable = model.Mentionable; | IsMentionable = model.Mentionable; | ||||
@@ -89,6 +92,10 @@ namespace Discord.WebSocket | |||||
public Task DeleteAsync(RequestOptions options = null) | public Task DeleteAsync(RequestOptions options = null) | ||||
=> RoleHelper.DeleteAsync(this, Discord, options); | => RoleHelper.DeleteAsync(this, Discord, options); | ||||
/// <inheritdoc /> | |||||
public string GetIconUrl() | |||||
=> CDN.GetGuildRoleIconUrl(Id, Icon); | |||||
/// <summary> | /// <summary> | ||||
/// Gets the name of the role. | /// Gets the name of the role. | ||||
/// </summary> | /// </summary> | ||||