Skip to content

Commit

Permalink
Merge pull request #323 from Octol1ttle/no-isdefined
Browse files Browse the repository at this point in the history
Do not use IsDefined when updating cached nullable properties in GuildMember
  • Loading branch information
Nihlus authored Dec 9, 2023
2 parents dcf331b + 3630563 commit 1250b1f
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,11 @@ public async Task<Result> RespondAsync(IGuildMemberUpdate gatewayEvent, Cancella
cachedInstance = new GuildMember
(
new Optional<IUser>(gatewayEvent.User),
gatewayEvent.Nickname.IsDefined(out var nickname) ? nickname : cachedInstance.Nickname,
gatewayEvent.Nickname.TryGet(out var nickname) ? nickname : cachedInstance.Nickname,
gatewayEvent.Avatar,
gatewayEvent.Roles,
gatewayEvent.JoinedAt ?? cachedInstance.JoinedAt,
gatewayEvent.PremiumSince.IsDefined(out var premiumSince) ? premiumSince : cachedInstance.PremiumSince,
gatewayEvent.PremiumSince.TryGet(out var premiumSince) ? premiumSince : cachedInstance.PremiumSince,
gatewayEvent.IsDeafened.TryGet(out var isDeafened) ? isDeafened : cachedInstance.IsDeafened,
gatewayEvent.IsMuted.TryGet(out var isMuted) ? isMuted : cachedInstance.IsMuted,
default, // TODO: this is probably on this event, but Discord hasn't documented it
Expand Down

0 comments on commit 1250b1f

Please sign in to comment.