/// <summary> /// If a container type, gets the DiscordColor at the given key. /// </summary> /// <exception cref="InvalidOperationException">Thrown if this data is not a container.</exception> public DiscordColor?GetColor(string key) { AssertContainer(); int?nestedData = GetInteger(key); if (nestedData.HasValue) { return(DiscordColor.FromHexadecimal(nestedData.Value)); } return(null); }
internal DiscordRole(DiscordHttpClient http, Snowflake guildId, DiscordApiData data) : base(data) { this.http = http; GuildId = guildId; Name = data.GetString("name"); IsHoisted = data.GetBoolean("hoist").Value; Position = data.GetInteger("position").Value; IsManaged = data.GetBoolean("managed").Value; IsMentionable = data.GetBoolean("mentionable").Value; int color = data.GetInteger("color").Value; Color = DiscordColor.FromHexadecimal(color); long permissions = data.GetInt64("permissions").Value; Permissions = (DiscordPermission)permissions; }