- More code cleanup and codestyle updates

- Fixed some possible nullref exceptions
- Methods signatures now have up to 3 parameters before breakaing down each parameter in a separate line
- Method invocations have the same rule, except the first parameter will be in the same line as the invocation to prevent some ugliness when passing lambas as arguments
- Applied many more codestyles
- Extensions folder fully reformatted
This commit is contained in:
Kwoth
2021-12-26 17:28:39 +01:00
parent b85ba177cd
commit d5fd6aae8e
217 changed files with 1017 additions and 1494 deletions

View File

@@ -1,6 +1,5 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Caching.Memory;
using NadekoBot.Common.Collections;
using NadekoBot.Services.Database.Models;
using NadekoBot.Db;
using NadekoBot.Modules.Administration.Common;
@@ -23,24 +22,16 @@ public sealed class DummyLogCommandService : ILogCommandService
}
public Task LogServer(ulong guildId, ulong channelId, bool actionValue)
{
return Task.CompletedTask;
}
=> Task.CompletedTask;
public bool LogIgnore(ulong guildId, ulong itemId, IgnoredItemType itemType)
{
return false;
}
=> false;
public LogSetting GetGuildLogSettings(ulong guildId)
{
return default;
}
=> default;
public bool Log(ulong guildId, ulong? channelId, LogType type)
{
return false;
}
=> false;
}
public sealed class LogCommandService : ILogCommandService
@@ -150,9 +141,7 @@ public sealed class LogCommandService : ILogCommandService
}
public void AddDeleteIgnore(ulong messageId)
{
_ignoreMessageIds.Add(messageId);
}
=> _ignoreMessageIds.Add(messageId);
public bool LogIgnore(ulong gid, ulong itemId, IgnoredItemType itemType)
{
@@ -1172,7 +1161,7 @@ public sealed class LogCommandService : ILogCommandService
break;
}
if (!id.HasValue || id == 0)
if (id is null or 0)
{
UnsetLogSetting(guild.Id, logChannelType);
return null;