Added and applied styles for private readonly fields, private fields to Extensions and Common folders.

- Some renamings and code cleanups
- Chained method calls, binary expressions and binary patterns will now break into newlines
- Type param constraints and base constructor calls will be on the new line
This commit is contained in:
Kwoth
2021-12-27 03:46:30 +01:00
parent 9ae030a5c5
commit 1b0392dfab
85 changed files with 1015 additions and 906 deletions

View File

@@ -43,8 +43,8 @@ public partial class Administration
[Priority(0)]
public async Task LanguageSet()
=> await ReplyConfirmLocalizedAsync(strs.lang_set_show(
Format.Bold(_cultureInfo.ToString()),
Format.Bold(_cultureInfo.NativeName)));
Format.Bold(Culture.ToString()),
Format.Bold(Culture.NativeName)));
[NadekoCommand, Aliases]
[RequireContext(ContextType.Guild)]

View File

@@ -1002,8 +1002,7 @@ public sealed class LogCommandService : ILogCommandService
{
try
{
var msg = optMsg.Value as IUserMessage;
if (msg is null || msg.IsAuthor(_client))
if (optMsg.Value is not IUserMessage msg || msg.IsAuthor(_client))
return;
if (_ignoreMessageIds.Contains(msg.Id))
@@ -1058,8 +1057,7 @@ public sealed class LogCommandService : ILogCommandService
if (imsg2 is not IUserMessage after || after.IsAuthor(_client))
return;
var before = (optmsg.HasValue ? optmsg.Value : null) as IUserMessage;
if (before is null)
if ((optmsg.HasValue ? optmsg.Value : null) is not IUserMessage before)
return;
if (ch is not ITextChannel channel)

View File

@@ -167,9 +167,7 @@ public class VcRoleService : INService
private Task ClientOnUserVoiceStateUpdated(SocketUser usr, SocketVoiceState oldState,
SocketVoiceState newState)
{
var gusr = usr as SocketGuildUser;
if (gusr is null)
if (usr is not SocketGuildUser gusr)
return Task.CompletedTask;
var oldVc = oldState.VoiceChannel;

View File

@@ -465,7 +465,7 @@ public partial class Administration
.AddField(GetText(strs.duration),
time.Time.Humanize(3,
minUnit: TimeUnit.Minute,
culture: _cultureInfo),
culture: Culture),
true);
if (dmFailed)