1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-01-31 00:19:00 +03:00

Fix auto-unban and auto-unmute always triggering (#119)

Flipping `>` to `<=` changed null handling semantics within the
operator, causing the unban/unmute code to always run

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
Octol1ttle 2023-09-28 00:07:46 +05:00 committed by GitHub
parent 906bfd07e8
commit e907930623
Signed by: GitHub
GPG key ID: 4AEE18F83AFDEB23

View file

@ -123,7 +123,7 @@ public sealed partial class MemberUpdateService : BackgroundService
private async Task<Result> TryAutoUnbanAsync(
Snowflake guildId, Snowflake id, MemberData data, CancellationToken ct)
{
if (DateTimeOffset.UtcNow <= data.BannedUntil)
if (data.BannedUntil is null || DateTimeOffset.UtcNow <= data.BannedUntil)
{
return Result.FromSuccess();
}
@ -141,7 +141,7 @@ public sealed partial class MemberUpdateService : BackgroundService
private async Task<Result> TryAutoUnmuteAsync(
Snowflake guildId, Snowflake id, MemberData data, CancellationToken ct)
{
if (DateTimeOffset.UtcNow <= data.MutedUntil)
if (data.MutedUntil is null || DateTimeOffset.UtcNow <= data.MutedUntil)
{
return Result.FromSuccess();
}