mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 09:48:26 -04:00
Using pattern matching for nulls where applicable, discarded unused lambda parameters, cleaned up some classes. Unignored ServerLog commands which was mistakenly ignored due to a .gitignore rule
This commit is contained in:
@@ -219,7 +219,7 @@ public partial class Help : NadekoModule<HelpService>
|
||||
}
|
||||
|
||||
var cnt = 0;
|
||||
var groups = cmdsWithGroup.GroupBy(x => cnt++ / 48).ToArray();
|
||||
var groups = cmdsWithGroup.GroupBy(_ => cnt++ / 48).ToArray();
|
||||
var embed = _eb.Create().WithOkColor();
|
||||
foreach (var g in groups)
|
||||
{
|
||||
@@ -259,7 +259,7 @@ public partial class Help : NadekoModule<HelpService>
|
||||
{
|
||||
var prefixless =
|
||||
_cmds.Commands.FirstOrDefault(x => x.Aliases.Any(cmdName => cmdName.ToLowerInvariant() == fail));
|
||||
if (prefixless != null)
|
||||
if (prefixless is not null)
|
||||
{
|
||||
await H(prefixless);
|
||||
return;
|
||||
@@ -316,7 +316,7 @@ public partial class Help : NadekoModule<HelpService>
|
||||
var opt = ((NadekoOptionsAttribute)com.Attributes.FirstOrDefault(x
|
||||
=> x is NadekoOptionsAttribute))
|
||||
?.OptionType;
|
||||
if (opt != null) optHelpStr = HelpService.GetCommandOptionHelpList(opt);
|
||||
if (opt is not null) optHelpStr = HelpService.GetCommandOptionHelpList(opt);
|
||||
|
||||
return new CommandJsonObject
|
||||
{
|
||||
|
@@ -60,7 +60,7 @@ public class HelpService : ILateExecutor, INService
|
||||
|
||||
var str = $"**`{prefix + com.Aliases.First()}`**";
|
||||
var alias = com.Aliases.Skip(1).FirstOrDefault();
|
||||
if (alias != null)
|
||||
if (alias is not null)
|
||||
str += $" **/ `{prefix + alias}`**";
|
||||
var em = _eb.Create().AddField(str, $"{com.RealSummary(_strings, guild?.Id, prefix)}", true);
|
||||
|
||||
@@ -75,7 +75,7 @@ public class HelpService : ILateExecutor, INService
|
||||
.WithOkColor();
|
||||
|
||||
var opt = ((NadekoOptionsAttribute)com.Attributes.FirstOrDefault(x => x is NadekoOptionsAttribute))?.OptionType;
|
||||
if (opt != null)
|
||||
if (opt is not null)
|
||||
{
|
||||
var hs = GetCommandOptionHelp(opt);
|
||||
if (!string.IsNullOrWhiteSpace(hs))
|
||||
@@ -96,7 +96,7 @@ public class HelpService : ILateExecutor, INService
|
||||
{
|
||||
var strs = opt.GetProperties()
|
||||
.Select(x => x.GetCustomAttributes(true).FirstOrDefault(a => a is OptionAttribute))
|
||||
.Where(x => x != null)
|
||||
.Where(x => x is not null)
|
||||
.Cast<OptionAttribute>()
|
||||
.Select(x =>
|
||||
{
|
||||
|
Reference in New Issue
Block a user