diff --git a/src/Accord.Bot/Accord.Bot.csproj b/src/Accord.Bot/Accord.Bot.csproj index e03f04c..b1c96a5 100644 --- a/src/Accord.Bot/Accord.Bot.csproj +++ b/src/Accord.Bot/Accord.Bot.csproj @@ -10,7 +10,7 @@ - + diff --git a/src/Accord.Bot/Responders/MemberUpdateResponder.cs b/src/Accord.Bot/Responders/MemberUpdateResponder.cs index 10179e1..0f783a3 100644 --- a/src/Accord.Bot/Responders/MemberUpdateResponder.cs +++ b/src/Accord.Bot/Responders/MemberUpdateResponder.cs @@ -105,8 +105,7 @@ private async Task HandleTimeOut(IGuildMemberUpdate gatewayEvent, IUser user, Da if (!timeoutHasChanged) return; - var logRequest = await _auditLogApi.GetAuditLogAsync(gatewayEvent.GuildID, - actionType: AuditLogEvent.MemberUpdate, ct: cancellationToken); + var logRequest = await _auditLogApi.GetGuildAuditLogAsync(gatewayEvent.GuildID, actionType: AuditLogEvent.MemberUpdate, ct: cancellationToken); var durationMessage = "has been timed out"; var actor = "a moderator"; @@ -120,16 +119,15 @@ private async Task HandleTimeOut(IGuildMemberUpdate gatewayEvent, IUser user, Da .Where(x => x.TargetID == rawUserId) .Where(x => x.UserID != null) .Where(x => x.Changes.HasValue && x.Changes.Value.Any(a => a.Key == "communication_disabled_until")) - .OrderByDescending(x => x.ID) - .FirstOrDefault(); + .MaxBy(x => x.ID); - if (probableAudit is { } audit) + if (probableAudit != null) { - var timedOutFrom = audit.ID.Timestamp; + var timedOutFrom = probableAudit.ID.Timestamp; var durationOfTimeout = timedOutUntil - timedOutFrom; durationMessage = $"has been timed out for {durationOfTimeout.Humanize()}"; - actor = $"{DiscordFormatter.UserIdToMention(audit.UserID!.Value.Value)}"; - reason = audit.Reason.HasValue ? audit.Reason.Value : "an unknown reason"; + actor = $"{DiscordFormatter.UserIdToMention(probableAudit.UserID!.Value.Value)}"; + reason = probableAudit.Reason.HasValue ? probableAudit.Reason.Value : "an unknown reason"; } } diff --git a/src/Accord.Bot/Responders/ReadyResponder.cs b/src/Accord.Bot/Responders/ReadyResponder.cs index 57dddcc..f0e9ec1 100644 --- a/src/Accord.Bot/Responders/ReadyResponder.cs +++ b/src/Accord.Bot/Responders/ReadyResponder.cs @@ -31,7 +31,7 @@ public partial class ReadyResponder : IResponder _discordCache.SetSelfSnowflake(gatewayEvent.User.ID); await CacheGuild(gatewayEvent.User, ct); - var updateCommand = new UpdatePresence(ClientStatus.Online, false, null, new IActivity[] + var updateCommand = new UpdatePresence(UserStatus.Online, false, null, new IActivity[] { new Activity("for everything", ActivityType.Watching) });