Skip to content

Commit

Permalink
feat: add clan (so sentry is not annoyed)
Browse files Browse the repository at this point in the history
Closes #477
  • Loading branch information
Lulalaby committed Apr 19, 2024
1 parent 069cb48 commit c2912a4
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 0 deletions.
3 changes: 3 additions & 0 deletions DisCatSharp/Clients/DiscordClient.Dispatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,7 @@ internal async Task OnReadyEventAsync(ReadyPayload ready, JArray rawGuilds)
old.Pronouns = usr.Pronouns;
old.Locale = usr.Locale;
old.GlobalName = usr.GlobalName;
old.Clan = usr.Clan;
return old;
});

Expand Down Expand Up @@ -1905,6 +1906,7 @@ internal async Task OnGuildMemberAddEventAsync(TransportMember member, DiscordGu
old.Pronouns = usr.Pronouns;
old.Locale = usr.Locale;
old.GlobalName = usr.GlobalName;
old.Clan = usr.Clan;
return old;
});

Expand Down Expand Up @@ -1978,6 +1980,7 @@ internal async Task OnGuildMemberUpdateEventAsync(TransportMember member, Discor
old.Pronouns = usr.Pronouns;
old.Locale = usr.Locale;
old.GlobalName = usr.GlobalName;
old.Clan = usr.Clan;
return old;
});

Expand Down
4 changes: 4 additions & 0 deletions DisCatSharp/Clients/DiscordClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ public async Task<DiscordUser> GetUserAsync(ulong userId, bool fetch = false)
old.ThemeColorsInternal = usr.ThemeColorsInternal;
old.Pronouns = usr.Pronouns;
old.GlobalName = usr.GlobalName;
old.Clan = usr.Clan;
return old;
});

Expand Down Expand Up @@ -1450,6 +1451,7 @@ private DiscordUser UpdateUser(DiscordUser usr, ulong? guildId, DiscordGuild? gu
old.Pronouns = usr.Pronouns;
old.Locale = usr.Locale;
old.GlobalName = usr.GlobalName;
old.Clan = usr.Clan;
return old;
});

Expand Down Expand Up @@ -1487,6 +1489,7 @@ private DiscordUser UpdateUser(DiscordUser usr, ulong? guildId, DiscordGuild? gu
old.Pronouns = usr.Pronouns;
old.Locale = usr.Locale;
old.GlobalName = usr.GlobalName;
old.Clan = usr.Clan;
return old;
});

Expand Down Expand Up @@ -1593,6 +1596,7 @@ private void UpdateCachedGuild(DiscordGuild newGuild, JArray? rawMembers)
old.Pronouns = usr.Pronouns;
old.Locale = usr.Locale;
old.GlobalName = usr.GlobalName;
old.Clan = usr.Clan;
return old;
});

Expand Down
1 change: 1 addition & 0 deletions DisCatSharp/Entities/Guild/DiscordGuild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1767,6 +1767,7 @@ public async Task<IReadOnlyCollection<DiscordMember>> GetAllMembersAsync()
old.Pronouns = usr.Pronouns;
old.Locale = usr.Locale;
old.GlobalName = usr.GlobalName;
old.Clan = usr.Clan;
return old;
});
var mbr = new DiscordMember(xtm)
Expand Down
10 changes: 10 additions & 0 deletions DisCatSharp/Entities/Guild/DiscordMember.cs
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,16 @@ public override string BannerHash
internal set => this.User.BannerHash = value;
}

/// <summary>
/// Gets the member's banner hash.
/// </summary>
[JsonIgnore]
public override DiscordClan? Clan
{
get => this.User.Clan;
internal set => this.User.Clan = value;
}

/// <summary>
/// Gets whether the member is a bot.
/// </summary>
Expand Down
33 changes: 33 additions & 0 deletions DisCatSharp/Entities/User/DiscordClan.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using Newtonsoft.Json;

namespace DisCatSharp.Entities;

/// <summary>
/// Represents a discord clan.
/// </summary>
public sealed class DiscordClan
{
/// <summary>
/// Gets the identity guild id.
/// </summary>
[JsonProperty("identity_guild_id")]
public ulong IdentityGuildId { get; internal set; }

/// <summary>
/// Gets whether the identity is enabled and shown to everyone.
/// </summary>
[JsonProperty("identity_enabled", NullValueHandling = NullValueHandling.Ignore)]
public bool IdentityEnabled { get; internal set; }

/// <summary>
/// Gets the clan tag.
/// </summary>
[JsonProperty("tag")]
public string Tag { get; internal set; }

/// <summary>
/// Initializes a new instance of the <see cref="DiscordClan"/> class.
/// </summary>
internal DiscordClan()
{ }
}
7 changes: 7 additions & 0 deletions DisCatSharp/Entities/User/DiscordUser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ internal DiscordUser(TransportUser transport)
this.Bio = transport.Bio;
this.Pronouns = transport.Pronouns;
this.GlobalName = transport.GlobalName;
this.Clan = transport.Clan;
}

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

/// <summary>
/// Gets the users clan.
/// </summary>
[JsonProperty("clan", NullValueHandling = NullValueHandling.Ignore), DiscordUnreleased]
public virtual DiscordClan? Clan { get; internal set; }

/// <summary>
/// Gets the user's avatar hash.
/// </summary>
Expand Down
6 changes: 6 additions & 0 deletions DisCatSharp/Net/Abstractions/Transport/TransportUser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,12 @@ internal string UsernameWithGlobalName
[JsonProperty("bio", NullValueHandling = NullValueHandling.Ignore)]
public string Bio { get; internal set; }

/// <summary>
/// Gets the users clan.
/// </summary>
[JsonProperty("clan", NullValueHandling = NullValueHandling.Ignore)]
public DiscordClan? Clan { get; internal set; }

/// <summary>
/// Gets the users pronouns.
/// </summary>
Expand Down
1 change: 1 addition & 0 deletions DisCatSharp/Net/Rest/DiscordApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ internal async Task<IReadOnlyList<DiscordMember>> SearchMembersAsync(ulong guild
old.Pronouns = usr.Pronouns;
old.Locale = usr.Locale;
old.GlobalName = usr.GlobalName;
old.Clan = usr.Clan;
return old;
});

Expand Down

0 comments on commit c2912a4

Please sign in to comment.