vars and target-typed new

This commit is contained in:
Kwoth
2021-12-20 00:15:39 +01:00
parent ee33313519
commit cd379fd308
75 changed files with 198 additions and 198 deletions

View File

@@ -133,9 +133,9 @@ public partial class Utility
if (page < 0)
return;
int startCount = page * activityPerPage;
var startCount = page * activityPerPage;
StringBuilder str = new StringBuilder();
var str = new StringBuilder();
foreach (var kvp in CmdHandler.UserMessagesSent.OrderByDescending(kvp => kvp.Value).Skip(page * activityPerPage).Take(activityPerPage))
{
str.AppendLine(GetText(strs.activity_line(

View File

@@ -187,7 +187,7 @@ public partial class Utility
var executesInString = Format.Bold(executesIn.ToPrettyStringHM());
var message = Format.Sanitize(runner.Repeater.Message.TrimTo(50));
string description = "";
var description = string.Empty;
if (_service.IsNoRedundant(runner.Repeater.Id))
{
description = Format.Underline(Format.Bold(GetText(strs.no_redundant))) + "\n\n";

View File

@@ -67,7 +67,7 @@ public class CommandMapService : IInputTransformer, INService
if (guild != null)
{
if (AliasMaps.TryGetValue(guild.Id, out ConcurrentDictionary<string, string> maps))
if (AliasMaps.TryGetValue(guild.Id, out var maps))
{
var keys = maps.Keys
.OrderByDescending(x => x.Length);

View File

@@ -69,7 +69,7 @@ public class StreamRoleService : INService
{
userName.ThrowIfNull(nameof(userName));
bool success = false;
var success = false;
using (var uow = _db.GetDbContext())
{
var streamRoleSettings = uow.GetStreamRoleSettings(guild.Id);

View File

@@ -39,7 +39,7 @@ public partial class Utility
[RequireContext(ContextType.Guild)]
public async Task StreamRoleKeyword([Leftover]string keyword = null)
{
string kw = await this._service.SetKeyword(ctx.Guild, keyword).ConfigureAwait(false);
var kw = await this._service.SetKeyword(ctx.Guild, keyword).ConfigureAwait(false);
if(string.IsNullOrWhiteSpace(keyword))
await ReplyConfirmLocalizedAsync(strs.stream_role_kw_reset).ConfigureAwait(false);

View File

@@ -81,7 +81,7 @@ public partial class Utility : NadekoModule
.Take(60)
.ToArray()).ConfigureAwait(false);
int i = 0;
var i = 0;
if (arr.Length == 0)
await ReplyErrorLocalizedAsync(strs.nobody_playing_game).ConfigureAwait(false);
else
@@ -140,7 +140,7 @@ public partial class Utility : NadekoModule
[RequireContext(ContextType.Guild)]
public async Task CheckPerms(MeOrBot who = MeOrBot.Me)
{
StringBuilder builder = new StringBuilder();
var builder = new StringBuilder();
var user = who == MeOrBot.Me
? (IGuildUser)ctx.User
: ((SocketGuild)ctx.Guild).CurrentUser;