From eaf3ddf77e94a8345077d9e4205847e9e22b403c Mon Sep 17 00:00:00 2001 From: Octol1ttle Date: Sun, 9 Jul 2023 17:19:58 +0500 Subject: [PATCH] fix warnings Signed-off-by: Octol1ttle --- Commands/SettingsCommandGroup.cs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Commands/SettingsCommandGroup.cs b/Commands/SettingsCommandGroup.cs index 245f8c2..d949c7e 100644 --- a/Commands/SettingsCommandGroup.cs +++ b/Commands/SettingsCommandGroup.cs @@ -24,10 +24,10 @@ namespace Boyfriend.Commands; /// Handles the command to show information about this bot: /about /// public class SettingsCommandGroup : CommandGroup { - private readonly ICommandContext _context; - private readonly GuildDataService _dataService; - private readonly FeedbackService _feedbackService; - private readonly IDiscordRestUserAPI _userApi; + private readonly ICommandContext _context; + private readonly GuildDataService _dataService; + private readonly FeedbackService _feedbackService; + private readonly IDiscordRestUserAPI _userApi; public SettingsCommandGroup( ICommandContext context, GuildDataService dataService, @@ -57,14 +57,12 @@ public class SettingsCommandGroup : CommandGroup { foreach (var setting in typeof(GuildConfiguration).GetProperties()) { builder.Append(Markdown.InlineCode(setting.Name)) - .Append(": "); + .Append(": "); var something = setting.GetValue(cfg); - if (something.GetType() == typeof(List)) { + if (something!.GetType() == typeof(List)) { var list = (something as List); - builder.AppendLine(string.Join(", ", list.Select(v => Markdown.InlineCode(v.ToString())))); - } else { - builder.AppendLine(Markdown.InlineCode(something.ToString())); - } + builder.AppendLine(string.Join(", ", list!.Select(v => Markdown.InlineCode(v.ToString())))); + } else { builder.AppendLine(Markdown.InlineCode(something.ToString()!)); } } var embed = new EmbedBuilder().WithSmallTitle(Messages.SettingsListTitle, currentUser) @@ -73,8 +71,10 @@ public class SettingsCommandGroup : CommandGroup { .Build(); if (!embed.IsDefined(out var built)) return Result.FromError(embed); - return (Result)await _feedbackService.SendContextualEmbedAsync(built, ct: CancellationToken, options: new FeedbackMessageOptions(MessageFlags: MessageFlags.Ephemeral)); + return (Result)await _feedbackService.SendContextualEmbedAsync( + built, ct: CancellationToken, options: new FeedbackMessageOptions(MessageFlags: MessageFlags.Ephemeral)); } + /// /// A slash command that shows information about this bot. /// @@ -101,7 +101,7 @@ public class SettingsCommandGroup : CommandGroup { try { foreach (var prop in typeof(GuildConfiguration).GetProperties()) - if (setting.ToLower() == prop.Name.ToLower()) + if (string.Equals(setting, prop.Name, StringComparison.CurrentCultureIgnoreCase)) property = prop; if (property == null || !property.CanWrite) throw new ApplicationException(Messages.SettingDoesntExist);