diff --git a/src/Kook.Net.Rest/API/Common/Role.cs b/src/Kook.Net.Rest/API/Common/Role.cs index a759aeac..0c8bb10b 100644 --- a/src/Kook.Net.Rest/API/Common/Role.cs +++ b/src/Kook.Net.Rest/API/Common/Role.cs @@ -16,7 +16,7 @@ internal class Role public Color Color { get; set; } [JsonPropertyName("color_type")] - public ColorType ColorType { get; set; } + public ColorType? ColorType { get; set; } [JsonPropertyName("color_map")] [JsonConverter(typeof(NullableGradientColorConverter))] diff --git a/src/Kook.Net.Rest/Entities/Roles/RestRole.cs b/src/Kook.Net.Rest/Entities/Roles/RestRole.cs index d1c84c78..f367027a 100644 --- a/src/Kook.Net.Rest/Entities/Roles/RestRole.cs +++ b/src/Kook.Net.Rest/Entities/Roles/RestRole.cs @@ -76,7 +76,7 @@ internal void Update(Model model) Name = model.Name; Type = model.Type; Color = model.Color; - ColorType = model.ColorType; + ColorType = model.ColorType ?? ColorType.Solid; // BUG: The API returns null when creating new roles. GradientColor = model.GradientColor; IsHoisted = model.Hoist == 1; IsMentionable = model.Mentionable == 1; diff --git a/src/Kook.Net.Rest/Kook.Net.Rest.csproj b/src/Kook.Net.Rest/Kook.Net.Rest.csproj index a6540b2d..c3d0aaff 100644 --- a/src/Kook.Net.Rest/Kook.Net.Rest.csproj +++ b/src/Kook.Net.Rest/Kook.Net.Rest.csproj @@ -7,7 +7,7 @@ - TRACE_REST;DEBUG_REST + TRACE_REST diff --git a/src/Kook.Net.WebSocket/Entities/Roles/SocketRole.cs b/src/Kook.Net.WebSocket/Entities/Roles/SocketRole.cs index 1d8c2028..31059811 100644 --- a/src/Kook.Net.WebSocket/Entities/Roles/SocketRole.cs +++ b/src/Kook.Net.WebSocket/Entities/Roles/SocketRole.cs @@ -79,7 +79,7 @@ internal void Update(ClientState state, Model model) Name = model.Name; Type = model.Type; Color = model.Color; - ColorType = model.ColorType; + ColorType = model.ColorType ?? ColorType.Solid; // BUG: The API returns null when creating new roles. GradientColor = model.GradientColor; Position = model.Position; IsHoisted = model.Hoist switch