Skip to content

Commit c2912a4

Browse files
committed
feat: add clan (so sentry is not annoyed)
Closes #477
1 parent 069cb48 commit c2912a4

File tree

8 files changed

+65
-0
lines changed

8 files changed

+65
-0
lines changed

DisCatSharp/Clients/DiscordClient.Dispatch.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,7 @@ internal async Task OnReadyEventAsync(ReadyPayload ready, JArray rawGuilds)
732732
old.Pronouns = usr.Pronouns;
733733
old.Locale = usr.Locale;
734734
old.GlobalName = usr.GlobalName;
735+
old.Clan = usr.Clan;
735736
return old;
736737
});
737738

@@ -1905,6 +1906,7 @@ internal async Task OnGuildMemberAddEventAsync(TransportMember member, DiscordGu
19051906
old.Pronouns = usr.Pronouns;
19061907
old.Locale = usr.Locale;
19071908
old.GlobalName = usr.GlobalName;
1909+
old.Clan = usr.Clan;
19081910
return old;
19091911
});
19101912

@@ -1978,6 +1980,7 @@ internal async Task OnGuildMemberUpdateEventAsync(TransportMember member, Discor
19781980
old.Pronouns = usr.Pronouns;
19791981
old.Locale = usr.Locale;
19801982
old.GlobalName = usr.GlobalName;
1983+
old.Clan = usr.Clan;
19811984
return old;
19821985
});
19831986

DisCatSharp/Clients/DiscordClient.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,7 @@ public async Task<DiscordUser> GetUserAsync(ulong userId, bool fetch = false)
457457
old.ThemeColorsInternal = usr.ThemeColorsInternal;
458458
old.Pronouns = usr.Pronouns;
459459
old.GlobalName = usr.GlobalName;
460+
old.Clan = usr.Clan;
460461
return old;
461462
});
462463

@@ -1450,6 +1451,7 @@ private DiscordUser UpdateUser(DiscordUser usr, ulong? guildId, DiscordGuild? gu
14501451
old.Pronouns = usr.Pronouns;
14511452
old.Locale = usr.Locale;
14521453
old.GlobalName = usr.GlobalName;
1454+
old.Clan = usr.Clan;
14531455
return old;
14541456
});
14551457

@@ -1487,6 +1489,7 @@ private DiscordUser UpdateUser(DiscordUser usr, ulong? guildId, DiscordGuild? gu
14871489
old.Pronouns = usr.Pronouns;
14881490
old.Locale = usr.Locale;
14891491
old.GlobalName = usr.GlobalName;
1492+
old.Clan = usr.Clan;
14901493
return old;
14911494
});
14921495

@@ -1593,6 +1596,7 @@ private void UpdateCachedGuild(DiscordGuild newGuild, JArray? rawMembers)
15931596
old.Pronouns = usr.Pronouns;
15941597
old.Locale = usr.Locale;
15951598
old.GlobalName = usr.GlobalName;
1599+
old.Clan = usr.Clan;
15961600
return old;
15971601
});
15981602

DisCatSharp/Entities/Guild/DiscordGuild.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1767,6 +1767,7 @@ public async Task<IReadOnlyCollection<DiscordMember>> GetAllMembersAsync()
17671767
old.Pronouns = usr.Pronouns;
17681768
old.Locale = usr.Locale;
17691769
old.GlobalName = usr.GlobalName;
1770+
old.Clan = usr.Clan;
17701771
return old;
17711772
});
17721773
var mbr = new DiscordMember(xtm)

DisCatSharp/Entities/Guild/DiscordMember.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,16 @@ public override string BannerHash
358358
internal set => this.User.BannerHash = value;
359359
}
360360

361+
/// <summary>
362+
/// Gets the member's banner hash.
363+
/// </summary>
364+
[JsonIgnore]
365+
public override DiscordClan? Clan
366+
{
367+
get => this.User.Clan;
368+
internal set => this.User.Clan = value;
369+
}
370+
361371
/// <summary>
362372
/// Gets whether the member is a bot.
363373
/// </summary>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using Newtonsoft.Json;
2+
3+
namespace DisCatSharp.Entities;
4+
5+
/// <summary>
6+
/// Represents a discord clan.
7+
/// </summary>
8+
public sealed class DiscordClan
9+
{
10+
/// <summary>
11+
/// Gets the identity guild id.
12+
/// </summary>
13+
[JsonProperty("identity_guild_id")]
14+
public ulong IdentityGuildId { get; internal set; }
15+
16+
/// <summary>
17+
/// Gets whether the identity is enabled and shown to everyone.
18+
/// </summary>
19+
[JsonProperty("identity_enabled", NullValueHandling = NullValueHandling.Ignore)]
20+
public bool IdentityEnabled { get; internal set; }
21+
22+
/// <summary>
23+
/// Gets the clan tag.
24+
/// </summary>
25+
[JsonProperty("tag")]
26+
public string Tag { get; internal set; }
27+
28+
/// <summary>
29+
/// Initializes a new instance of the <see cref="DiscordClan"/> class.
30+
/// </summary>
31+
internal DiscordClan()
32+
{ }
33+
}

DisCatSharp/Entities/User/DiscordUser.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ internal DiscordUser(TransportUser transport)
5252
this.Bio = transport.Bio;
5353
this.Pronouns = transport.Pronouns;
5454
this.GlobalName = transport.GlobalName;
55+
this.Clan = transport.Clan;
5556
}
5657

5758
/// <summary>
@@ -149,6 +150,12 @@ public string? BannerUrl
149150
[JsonProperty("bio", NullValueHandling = NullValueHandling.Ignore)]
150151
public virtual string Bio { get; internal set; }
151152

153+
/// <summary>
154+
/// Gets the users clan.
155+
/// </summary>
156+
[JsonProperty("clan", NullValueHandling = NullValueHandling.Ignore), DiscordUnreleased]
157+
public virtual DiscordClan? Clan { get; internal set; }
158+
152159
/// <summary>
153160
/// Gets the user's avatar hash.
154161
/// </summary>

DisCatSharp/Net/Abstractions/Transport/TransportUser.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,12 @@ internal string UsernameWithGlobalName
134134
[JsonProperty("bio", NullValueHandling = NullValueHandling.Ignore)]
135135
public string Bio { get; internal set; }
136136

137+
/// <summary>
138+
/// Gets the users clan.
139+
/// </summary>
140+
[JsonProperty("clan", NullValueHandling = NullValueHandling.Ignore)]
141+
public DiscordClan? Clan { get; internal set; }
142+
137143
/// <summary>
138144
/// Gets the users pronouns.
139145
/// </summary>

DisCatSharp/Net/Rest/DiscordApiClient.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,7 @@ internal async Task<IReadOnlyList<DiscordMember>> SearchMembersAsync(ulong guild
423423
old.Pronouns = usr.Pronouns;
424424
old.Locale = usr.Locale;
425425
old.GlobalName = usr.GlobalName;
426+
old.Clan = usr.Clan;
426427
return old;
427428
});
428429

0 commit comments

Comments
 (0)