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:
@@ -139,7 +139,7 @@ public static class Extensions
|
||||
|
||||
public static IEmbedBuilder AddPaginatedFooter(this IEmbedBuilder embed, int curPage, int? lastPage)
|
||||
{
|
||||
if (lastPage != null)
|
||||
if (lastPage is not null)
|
||||
return embed.WithFooter($"{curPage + 1} / {lastPage + 1}");
|
||||
return embed.WithFooter(curPage.ToString());
|
||||
}
|
||||
@@ -196,7 +196,7 @@ public static class Extensions
|
||||
Task.Run(async () =>
|
||||
{
|
||||
await Task.Delay(seconds * 1000);
|
||||
if (logService != null) logService.AddDeleteIgnore(msg.Id);
|
||||
if (logService is not null) logService.AddDeleteIgnore(msg.Id);
|
||||
|
||||
try { await msg.DeleteAsync(); }
|
||||
catch { }
|
||||
@@ -206,7 +206,7 @@ public static class Extensions
|
||||
|
||||
public static ModuleInfo GetTopLevelModule(this ModuleInfo module)
|
||||
{
|
||||
while (module.Parent != null) module = module.Parent;
|
||||
while (module.Parent is not null) module = module.Parent;
|
||||
|
||||
return module;
|
||||
}
|
||||
@@ -269,7 +269,7 @@ public static class Extensions
|
||||
}
|
||||
|
||||
public static IEnumerable<IRole> GetRoles(this IGuildUser user)
|
||||
=> user.RoleIds.Select(r => user.Guild.GetRole(r)).Where(r => r != null);
|
||||
=> user.RoleIds.Select(r => user.Guild.GetRole(r)).Where(r => r is not null);
|
||||
|
||||
public static bool IsImage(this HttpResponseMessage msg)
|
||||
=> IsImage(msg, out _);
|
||||
|
@@ -40,7 +40,7 @@ public static class MessageChannelExtensions
|
||||
{
|
||||
var embed = eb.Create().WithErrorColor().WithDescription(error).WithTitle(title);
|
||||
|
||||
if (url != null && Uri.IsWellFormedUriString(url, UriKind.Absolute))
|
||||
if (url is not null && Uri.IsWellFormedUriString(url, UriKind.Absolute))
|
||||
embed.WithUrl(url);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(footer))
|
||||
@@ -65,7 +65,7 @@ public static class MessageChannelExtensions
|
||||
{
|
||||
var embed = eb.Create().WithOkColor().WithDescription(text).WithTitle(title);
|
||||
|
||||
if (url != null && Uri.IsWellFormedUriString(url, UriKind.Absolute))
|
||||
if (url is not null && Uri.IsWellFormedUriString(url, UriKind.Absolute))
|
||||
embed.WithUrl(url);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(footer))
|
||||
|
@@ -1,5 +1,6 @@
|
||||
using NadekoBot.Common.Yml;
|
||||
using Newtonsoft.Json;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
|
Reference in New Issue
Block a user