Skip to content

Commit 86865f9

Browse files
committed
Add support for shared client themes in messages
Introduces the SharedClientTheme class and BaseTheme enum to represent and deserialize shared client theme data in Discord messages. Updates DiscordMessage to include a SharedClientTheme property for accessing theme information.
1 parent 391b71d commit 86865f9

File tree

3 files changed

+60
-0
lines changed

3 files changed

+60
-0
lines changed

DisCatSharp/Entities/Message/DiscordMessage.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,12 @@ public bool HasPoll
493493
[JsonProperty("soundboard_sounds", NullValueHandling = NullValueHandling.Ignore)]
494494
public List<DiscordSoundboardSound>? SoundboardSounds { get; internal set; }
495495

496+
/// <summary>
497+
/// Gets the shared client theme in this message, if applicable.
498+
/// </summary>
499+
[JsonProperty("shared_client_theme")]
500+
public SharedClientTheme? SharedClientTheme { get; set; }
501+
496502
/// <summary>
497503
/// Checks whether this <see cref="DiscordMessage" /> is equal to another <see cref="DiscordMessage" />.
498504
/// </summary>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using System.Collections.Generic;
2+
3+
using DisCatSharp.Enums;
4+
5+
using Newtonsoft.Json;
6+
7+
namespace DisCatSharp.Entities;
8+
9+
/// <summary>
10+
/// Represents the shared client theme for a message.
11+
/// </summary>
12+
public class SharedClientTheme
13+
{
14+
/// <summary>
15+
/// Gets or sets the colors for the theme.
16+
/// </summary>
17+
[JsonProperty("colors")]
18+
public List<string> Colors { get; set; } = [];
19+
20+
/// <summary>
21+
/// Gets or sets the gradient angle (direction in degrees).
22+
/// </summary>
23+
[JsonProperty("gradient_angle")]
24+
public int GradientAngle { get; set; }
25+
26+
/// <summary>
27+
/// Gets or sets the color intensity percentage (base mix). <c>0</c> is no mix, <c>100</c> is full mix.
28+
/// </summary>
29+
[JsonProperty("base_mix")]
30+
public int BaseMix { get; set; }
31+
32+
/// <summary>
33+
/// Gets or sets the appearance.
34+
/// </summary>
35+
[JsonProperty("base_theme")]
36+
public BaseTheme BaseTheme { get; set; }
37+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
namespace DisCatSharp.Enums;
2+
3+
/// <summary>
4+
/// Represents the base theme of a shared client theme.
5+
/// </summary>
6+
public enum BaseTheme
7+
{
8+
/// <summary>
9+
/// Dark theme.
10+
/// </summary>
11+
Dark = 1,
12+
13+
/// <summary>
14+
/// Light theme.
15+
/// </summary>
16+
Light = 2
17+
}

0 commit comments

Comments
 (0)