More target-typed new and redundant paranthesis cleanup

This commit is contained in:
Kwoth
2021-12-20 00:33:11 +01:00
parent 345a9e9524
commit 1b2017024c
152 changed files with 573 additions and 580 deletions

View File

@@ -60,7 +60,7 @@ public sealed class AcrophobiaGame : IDisposable
public AcrophobiaGame(Options options)
{
Opts = options;
_rng = new NadekoRandom();
_rng = new();
InitializeStartingLetters();
}

View File

@@ -60,7 +60,7 @@ public class CleverbotIOSession : IChatterBotSession
this._user = user;
this._httpFactory = factory;
_nick = new AsyncLazy<string>((Func<Task<string>>)GetNick);
_nick = new((Func<Task<string>>)GetNick);
}
private async Task<string> GetNick()

View File

@@ -30,7 +30,7 @@ public class GirlRating
Advice = advice; // convenient to have it here, even though atm there are only few different ones.
_httpFactory = factory;
Stream = new AsyncLazy<Stream>(() =>
Stream = new(() =>
{
try
{
@@ -45,7 +45,7 @@ public class GirlRating
using (var pointImg = Image.Load(_images.RategirlDot))
{
img.Mutate(x => x.DrawImage(pointImg, new Point(pointx - 10, pointy - 10), new GraphicsOptions()));
img.Mutate(x => x.DrawImage(pointImg, new(pointx - 10, pointy - 10), new GraphicsOptions()));
}
var imgStream = new MemoryStream();

View File

@@ -67,7 +67,7 @@ public sealed class NunchiGame : IDisposable
return false;
}
_killTimer = new Timer(async state =>
_killTimer = new(async state =>
{
await _locker.WaitAsync().ConfigureAwait(false);
try

View File

@@ -43,7 +43,7 @@ public class PollRunner
if (usr is null)
return false;
voteObj = new PollVote()
voteObj = new()
{
UserId = msg.Author.Id,
VoteIndex = vote,

View File

@@ -68,7 +68,7 @@ public class TicTacToe
};
_phase = Phase.Starting;
_moveLock = new SemaphoreSlim(1, 1);
_moveLock = new(1, 1);
}
private string GetText(LocStr key)
@@ -149,7 +149,7 @@ public class TicTacToe
_phase = Phase.Started;
_timeoutTimer = new Timer(async (_) =>
_timeoutTimer = new(async _ =>
{
await _moveLock.WaitAsync().ConfigureAwait(false);
try

View File

@@ -43,7 +43,7 @@ public class TriviaGame
TriviaOptions options, string quitCommand, IEmbedBuilderService eb)
{
_cache = cache;
_questionPool = new TriviaQuestionPool(_cache);
_questionPool = new(_cache);
_strings = strings;
_client = client;
_config = config;
@@ -65,7 +65,7 @@ public class TriviaGame
while (!ShouldStopGame)
{
// reset the cancellation source
_triviaCancelSource = new CancellationTokenSource();
_triviaCancelSource = new();
showHowToQuit = !showHowToQuit;
// load question

View File

@@ -28,7 +28,7 @@ public class TriviaQuestionPool
if (isPokemon)
{
var num = _rng.Next(1, maxPokemonId + 1);
return new TriviaQuestion("Who's That Pokémon?",
return new("Who's That Pokémon?",
Map[num].ToTitleCase(),
"Pokemon",
$@"https://nadeko.bot/images/pokemon/shadows/{num}.png",

View File

@@ -47,8 +47,8 @@ public class TypingGame
this.Channel = channel;
IsActive = false;
sw = new Stopwatch();
finishedUserIds = new List<ulong>();
sw = new();
finishedUserIds = new();
}
public async Task<bool> Stop()
@@ -85,7 +85,7 @@ public class TypingGame
var time = _options.StartTime;
var msg = await Channel.SendMessageAsync($"Starting new typing contest in **{time}**...", options: new RequestOptions()
var msg = await Channel.SendMessageAsync($"Starting new typing contest in **{time}**...", options: new()
{
RetryMode = RetryMode.AlwaysRetry
}).ConfigureAwait(false);