From 6247a55a35f5ec1d971e40ea10b7019a3ab02d96 Mon Sep 17 00:00:00 2001 From: Octol1ttle Date: Sat, 30 Sep 2023 20:53:05 +0500 Subject: [PATCH] Use Snowflake#Empty extension method instead of '== 0' checks (#134) --- src/Commands/MuteCommandGroup.cs | 2 +- src/Services/Update/MemberUpdateService.cs | 2 +- src/Services/UtilityService.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Commands/MuteCommandGroup.cs b/src/Commands/MuteCommandGroup.cs index 33e8a9f..d558ba2 100644 --- a/src/Commands/MuteCommandGroup.cs +++ b/src/Commands/MuteCommandGroup.cs @@ -101,7 +101,7 @@ public class MuteCommandGroup : CommandGroup return await _feedback.SendContextualEmbedResultAsync(embed, CancellationToken); } - if (GuildSettings.MuteRole.Get(data.Settings) != 0) + if (!GuildSettings.MuteRole.Get(data.Settings).Empty()) { return await RoleMuteUserAsync( target, reason, duration, guildId, data, channelId, user, currentUser, CancellationToken); diff --git a/src/Services/Update/MemberUpdateService.cs b/src/Services/Update/MemberUpdateService.cs index 1d2b7f6..22b2849 100644 --- a/src/Services/Update/MemberUpdateService.cs +++ b/src/Services/Update/MemberUpdateService.cs @@ -97,7 +97,7 @@ public sealed partial class MemberUpdateService : BackgroundService var autoUnmuteResult = await TryAutoUnmuteAsync(guildId, id, data, ct); failedResults.AddIfFailed(autoUnmuteResult); - if (defaultRole.Value is not 0 && !data.Roles.Contains(defaultRole.Value)) + if (!defaultRole.Empty() && !data.Roles.Contains(defaultRole.Value)) { var addResult = await _guildApi.AddGuildMemberRoleAsync( guildId, id, defaultRole, ct: ct); diff --git a/src/Services/UtilityService.cs b/src/Services/UtilityService.cs index bc4ce35..4bd9add 100644 --- a/src/Services/UtilityService.cs +++ b/src/Services/UtilityService.cs @@ -174,7 +174,7 @@ public sealed class UtilityService : IHostedService return Result.FromError(usersResult); } - if (role.Value is not 0) + if (!role.Empty()) { builder.Append($"{Mention.Role(role)} "); }