mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 09:48:26 -04:00
More target-typed new and redundant paranthesis cleanup
This commit is contained in:
@@ -60,7 +60,7 @@ public sealed class AcrophobiaGame : IDisposable
|
||||
public AcrophobiaGame(Options options)
|
||||
{
|
||||
Opts = options;
|
||||
_rng = new NadekoRandom();
|
||||
_rng = new();
|
||||
InitializeStartingLetters();
|
||||
}
|
||||
|
||||
|
@@ -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()
|
||||
|
@@ -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();
|
||||
|
@@ -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
|
||||
|
@@ -43,7 +43,7 @@ public class PollRunner
|
||||
if (usr is null)
|
||||
return false;
|
||||
|
||||
voteObj = new PollVote()
|
||||
voteObj = new()
|
||||
{
|
||||
UserId = msg.Author.Id,
|
||||
VoteIndex = vote,
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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",
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user