Fixed around 140 wrong namings and other refactorings which were marked as warnings

This commit is contained in:
Kwoth
2022-01-08 11:51:41 +01:00
parent a6330119e8
commit 2ce3262d59
109 changed files with 698 additions and 760 deletions

View File

@@ -127,7 +127,7 @@ public sealed class AcrophobiaGame : IDisposable
|| !_usersWhoVoted.Add(userId))
break;
++submissions[toVoteFor];
var _ = Task.Run(() => OnUserVoted(userName));
_= Task.Run(() => OnUserVoted(userName));
return true;
}

View File

@@ -48,7 +48,7 @@ public partial class Games
if (msg.Channel.Id != ctx.Channel.Id)
return Task.CompletedTask;
var _ = Task.Run(async () =>
_= Task.Run(async () =>
{
try
{

View File

@@ -85,7 +85,7 @@ public sealed class NunchiGame : IDisposable
_killTimeout);
CurrentPhase = Phase.Playing;
var _ = OnGameStarted?.Invoke(this);
_= OnGameStarted?.Invoke(this);
var __ = OnRoundStarted?.Invoke(this, CurrentNumber);
return true;
}
@@ -122,7 +122,7 @@ public sealed class NunchiGame : IDisposable
{
_killTimer.Change(Timeout.Infinite, Timeout.Infinite);
CurrentPhase = Phase.Ended;
var _ = OnGameEnded?.Invoke(this, userTuple.Name);
_= OnGameEnded?.Invoke(this, userTuple.Name);
}
else // else just start the new round without the user who was the last
{
@@ -159,7 +159,7 @@ public sealed class NunchiGame : IDisposable
{
_killTimer.Change(Timeout.Infinite, Timeout.Infinite);
CurrentPhase = Phase.Ended;
var _ = OnGameEnded?.Invoke(this, _participants.Count > 0 ? _participants.First().Name : null);
_= OnGameEnded?.Invoke(this, _participants.Count > 0 ? _participants.First().Name : null);
return;
}

View File

@@ -55,7 +55,7 @@ public partial class Games
Task _client_MessageReceived(SocketMessage arg)
{
var _ = Task.Run(async () =>
_= Task.Run(async () =>
{
if (arg.Channel.Id != ctx.Channel.Id)
return;

View File

@@ -43,7 +43,7 @@ public class PollRunner
if (!Poll.Votes.Add(voteObj))
return false;
var _ = OnVoted?.Invoke(msg, usr);
_= OnVoted?.Invoke(msg, usr);
}
finally { _locker.Release(); }

View File

@@ -117,7 +117,7 @@ public class TypingGame
private Task AnswerReceived(SocketMessage imsg)
{
var _ = Task.Run(async () =>
_= Task.Run(async () =>
{
try
{

View File

@@ -182,7 +182,7 @@ public class TicTacToe
private Task Client_MessageReceived(SocketMessage msg)
{
var _ = Task.Run(async () =>
_= Task.Run(async () =>
{
await _moveLock.WaitAsync();
try

View File

@@ -28,7 +28,7 @@ public partial class Games
{
if (_service.TicTacToeGames.TryGetValue(channel.Id, out var game))
{
var _ = Task.Run(async () =>
_= Task.Run(async () =>
{
await game.Start((IGuildUser)ctx.User);
});

View File

@@ -24,10 +24,10 @@ public class TriviaGame
private readonly ICurrencyService _cs;
private readonly TriviaOptions _options;
private CancellationTokenSource _triviaCancelSource;
private CancellationTokenSource triviaCancelSource;
private readonly TriviaQuestionPool _questionPool;
private int _timeoutCount;
private int timeoutCount;
private readonly string _quitCommand;
private readonly IEmbedBuilderService _eb;
@@ -66,7 +66,7 @@ public class TriviaGame
while (!ShouldStopGame)
{
// reset the cancellation source
_triviaCancelSource = new();
triviaCancelSource = new();
showHowToQuit = !showHowToQuit;
// load question
@@ -121,7 +121,7 @@ public class TriviaGame
try
{
//hint
await Task.Delay(_options.QuestionTimer * 1000 / 2, _triviaCancelSource.Token);
await Task.Delay(_options.QuestionTimer * 1000 / 2, triviaCancelSource.Token);
if (!_options.NoHint)
try
{
@@ -136,9 +136,9 @@ public class TriviaGame
catch (Exception ex) { Log.Warning(ex, "Error editing triva message"); }
//timeout
await Task.Delay(_options.QuestionTimer * 1000 / 2, _triviaCancelSource.Token);
await Task.Delay(_options.QuestionTimer * 1000 / 2, triviaCancelSource.Token);
}
catch (TaskCanceledException) { _timeoutCount = 0; } //means someone guessed the answer
catch (TaskCanceledException) { timeoutCount = 0; } //means someone guessed the answer
}
finally
{
@@ -146,7 +146,7 @@ public class TriviaGame
_client.MessageReceived -= PotentialGuess;
}
if (!_triviaCancelSource.IsCancellationRequested)
if (!triviaCancelSource.IsCancellationRequested)
try
{
var embed = _eb.Create()
@@ -158,7 +158,7 @@ public class TriviaGame
await Channel.EmbedAsync(embed);
if (_options.Timeout != 0 && ++_timeoutCount >= _options.Timeout)
if (_options.Timeout != 0 && ++timeoutCount >= _options.Timeout)
await StopGame();
}
catch (Exception ex)
@@ -198,7 +198,7 @@ public class TriviaGame
private Task PotentialGuess(SocketMessage imsg)
{
var _ = Task.Run(async () =>
_= Task.Run(async () =>
{
try
{
@@ -218,7 +218,7 @@ public class TriviaGame
{
if (GameActive
&& CurrentQuestion.IsAnswerCorrect(umsg.Content)
&& !_triviaCancelSource.IsCancellationRequested)
&& !triviaCancelSource.IsCancellationRequested)
{
Users.AddOrUpdate(guildUser, 1, (_, old) => ++old);
guess = true;
@@ -227,7 +227,7 @@ public class TriviaGame
finally { _guessLock.Release(); }
if (!guess) return;
_triviaCancelSource.Cancel();
triviaCancelSource.Cancel();
if (_options.WinRequirement != 0 && Users[guildUser] == _options.WinRequirement)

View File

@@ -21,9 +21,9 @@ public class TriviaQuestion
public string Answer { get; set; }
public string CleanAnswer
=> _cleanAnswer ?? (_cleanAnswer = Clean(Answer));
=> cleanAnswer ?? (cleanAnswer = Clean(Answer));
private string _cleanAnswer;
private string cleanAnswer;
public TriviaQuestion(
string q,