NadekoBot.Extensions should now be fully annotated with nullable reference types as well as many classes from NadekoBot.Common

This commit is contained in:
Kwoth
2021-12-28 10:44:00 +01:00
parent 0634470a8a
commit 59f5056035
543 changed files with 1895 additions and 1448 deletions

View File

@@ -1,4 +1,5 @@
using System.Collections.Immutable;
#nullable disable
using System.Collections.Immutable;
using NadekoBot.Modules.Games.Common.Acrophobia;
using NadekoBot.Modules.Games.Services;
@@ -130,4 +131,4 @@ public partial class Games
await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false);
}
}
}
}

View File

@@ -1,4 +1,5 @@
using NadekoBot.Db;
#nullable disable
using NadekoBot.Db;
using NadekoBot.Modules.Games.Services;
namespace NadekoBot.Modules.Games;
@@ -45,4 +46,4 @@ public partial class Games
}
}
}

View File

@@ -1,4 +1,5 @@
using System.Collections.Immutable;
#nullable disable
using System.Collections.Immutable;
using CommandLine;
namespace NadekoBot.Modules.Games.Common.Acrophobia;
@@ -178,4 +179,4 @@ public sealed class AcrophobiaGame : IDisposable
submissions.Clear();
locker.Dispose();
}
}
}

View File

@@ -1,4 +1,5 @@
namespace NadekoBot.Modules.Games.Common.Acrophobia;
#nullable disable
namespace NadekoBot.Modules.Games.Common.Acrophobia;
public class AcrophobiaUser
{
@@ -20,4 +21,4 @@ public class AcrophobiaUser
=> obj is AcrophobiaUser x
? x.UserId == this.UserId
: false;
}
}

View File

@@ -1,7 +1,8 @@
namespace NadekoBot.Modules.Games.Common.ChatterBot;
#nullable disable
namespace NadekoBot.Modules.Games.Common.ChatterBot;
public class ChatterBotResponse
{
public string Convo_id { get; set; }
public string BotSay { get; set; }
}
}

View File

@@ -1,4 +1,5 @@
using Newtonsoft.Json;
#nullable disable
using Newtonsoft.Json;
namespace NadekoBot.Modules.Games.Common.ChatterBot;
@@ -29,4 +30,4 @@ public class ChatterBotSession : IChatterBotSession
var cbr = JsonConvert.DeserializeObject<ChatterBotResponse>(res);
return cbr.BotSay.Replace("<br/>", "\n", StringComparison.InvariantCulture);
}
}
}

View File

@@ -1,4 +1,5 @@
namespace NadekoBot.Modules.Games.Common.ChatterBot;
#nullable disable
namespace NadekoBot.Modules.Games.Common.ChatterBot;
public class CleverbotResponse
{
@@ -16,4 +17,4 @@ public class CleverbotIOAskResponse
{
public string Status { get; set; }
public string Response { get; set; }
}
}

View File

@@ -1,6 +1,7 @@
namespace NadekoBot.Modules.Games.Common.ChatterBot;
#nullable disable
namespace NadekoBot.Modules.Games.Common.ChatterBot;
public interface IChatterBotSession
{
Task<string> Think(string input);
}
}

View File

@@ -1,4 +1,5 @@
using Newtonsoft.Json;
#nullable disable
using Newtonsoft.Json;
namespace NadekoBot.Modules.Games.Common.ChatterBot;
@@ -93,4 +94,4 @@ public class CleverbotIOSession : IChatterBotSession
return obj.Response;
}
}
}

View File

@@ -1,4 +1,5 @@
using Cloneable;
#nullable disable
using Cloneable;
using NadekoBot.Common.Yml;
namespace NadekoBot.Modules.Games.Common;
@@ -87,4 +88,4 @@ public sealed partial class RaceAnimal
{
public string Icon { get; set; }
public string Name { get; set; }
}
}

View File

@@ -1,4 +1,5 @@
using Image = SixLabors.ImageSharp.Image;
#nullable disable
using Image = SixLabors.ImageSharp.Image;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Processing;
@@ -63,4 +64,4 @@ public class GirlRating
}
});
}
}
}

View File

@@ -1,5 +1,4 @@
#nullable enable
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.CodeAnalysis;
using NadekoBot.Common.Yml;
namespace NadekoBot.Modules.Games.Hangman;
@@ -62,4 +61,4 @@ public sealed class DefaultHangmanSource : IHangmanSource
term = null;
return false;
}
}
}

View File

@@ -1,4 +1,5 @@
using AngleSharp.Text;
#nullable disable
using AngleSharp.Text;
namespace NadekoBot.Modules.Games.Hangman;
@@ -114,4 +115,4 @@ public sealed class HangmanGame
return GetState(GuessResult.Incorrect);
}
}
}

View File

@@ -1,5 +1,4 @@
#nullable enable
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.CodeAnalysis;
using Microsoft.Extensions.Caching.Memory;
using NadekoBot.Common.ModuleBehaviors;
using NadekoBot.Modules.Games.Services;
@@ -135,4 +134,4 @@ public sealed class HangmanService : IHangmanService, ILateExecutor
return channel.EmbedAsync(embed);
}
}
}

View File

@@ -1,7 +1,8 @@
namespace NadekoBot.Modules.Games.Hangman;
#nullable disable
namespace NadekoBot.Modules.Games.Hangman;
public sealed class HangmanTerm
{
public string Word { get; set; }
public string ImageUrl { get; set; }
}
}

View File

@@ -1,5 +1,4 @@
#nullable enable
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.CodeAnalysis;
namespace NadekoBot.Modules.Games.Hangman;
@@ -8,4 +7,4 @@ public interface IHangmanService
bool StartHangman(ulong channelId, string? category, [NotNullWhen(true)] out HangmanGame.State? hangmanController);
ValueTask<bool> StopHangman(ulong channelId);
IReadOnlyCollection<string> GetHangmanTypes();
}
}

View File

@@ -1,5 +1,4 @@
#nullable enable
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.CodeAnalysis;
namespace NadekoBot.Modules.Games.Hangman;
@@ -8,4 +7,4 @@ public interface IHangmanSource : INService
public IReadOnlyCollection<string> GetCategories();
public void Reload();
public bool GetTerm(string? category, [NotNullWhen(true)] out HangmanTerm? term);
}
}

View File

@@ -1,4 +1,5 @@
using System.Collections.Immutable;
#nullable disable
using System.Collections.Immutable;
namespace NadekoBot.Modules.Games.Common.Nunchi;
@@ -173,4 +174,4 @@ public sealed class NunchiGame : IDisposable
OnRoundStarted = null;
OnUserGuessed = null;
}
}
}

View File

@@ -1,4 +1,5 @@
using NadekoBot.Services.Database.Models;
#nullable disable
using NadekoBot.Services.Database.Models;
namespace NadekoBot.Modules.Games.Common;
@@ -60,4 +61,4 @@ public class PollRunner
public void End()
=> OnVoted = null;
}
}

View File

@@ -1,4 +1,5 @@
using System.Text;
#nullable disable
using System.Text;
using CommandLine;
namespace NadekoBot.Modules.Games.Common;
@@ -281,4 +282,4 @@ public class TicTacToe
return Task.CompletedTask;
}
}
}

View File

@@ -1,4 +1,5 @@
using System.Text;
#nullable disable
using System.Text;
namespace NadekoBot.Modules.Games.Common.Trivia;
@@ -265,4 +266,4 @@ public class TriviaGame
return sb.ToString();
}
}
}

View File

@@ -1,4 +1,5 @@
using CommandLine;
#nullable disable
using CommandLine;
namespace NadekoBot.Modules.Games.Common.Trivia;
@@ -25,4 +26,4 @@ public class TriviaOptions : INadekoCommandOptions
Timeout = 10;
}
}
}

View File

@@ -1,4 +1,5 @@
using System.Text.RegularExpressions;
#nullable disable
using System.Text.RegularExpressions;
// THANKS @ShoMinamimoto for suggestions and coding help
namespace NadekoBot.Modules.Games.Common.Trivia;
@@ -103,4 +104,4 @@ public class TriviaQuestion
}
return string.Join(" ", new string(letters).Replace(" ", " \u2000", StringComparison.InvariantCulture).AsEnumerable());
}
}
}

View File

@@ -1,4 +1,5 @@
namespace NadekoBot.Modules.Games.Common.Trivia;
#nullable disable
namespace NadekoBot.Modules.Games.Common.Trivia;
public class TriviaQuestionPool
{
@@ -35,4 +36,4 @@ public class TriviaQuestionPool
return randomQuestion;
}
}
}

View File

@@ -1,8 +1,9 @@
namespace NadekoBot.Modules.Games.Common;
#nullable disable
namespace NadekoBot.Modules.Games.Common;
public class TypingArticle
{
public string Source { get; set; }
public string Extra { get; set; }
public string Text { get; set; }
}
}

View File

@@ -1,4 +1,5 @@
using System.Diagnostics;
#nullable disable
using System.Diagnostics;
using NadekoBot.Modules.Games.Services;
using CommandLine;
@@ -172,4 +173,4 @@ public class TypingGame
private static bool Judge(int errors, int textLength) => errors <= textLength / 25;
}
}

View File

@@ -1 +1,2 @@

#nullable disable

View File

@@ -1,4 +1,5 @@
using NadekoBot.Modules.Games.Common;
#nullable disable
using NadekoBot.Modules.Games.Common;
using NadekoBot.Modules.Games.Services;
namespace NadekoBot.Modules.Games;
@@ -144,4 +145,4 @@ Many computer users run a modified version of the {guhnoo} system every day, wit
There really is a {loonix}, and these people are using it, but it is just a part of the system they use. {loonix} is the kernel: the program in the system that allocates the machine's resources to the other programs that you run. The kernel is an essential part of an operating system, but useless by itself; it can only function in the context of a complete operating system. {loonix} is normally used in combination with the {guhnoo} operating system: the whole system is basically {guhnoo} with {loonix} added, or {guhnoo}/{loonix}. All the so-called {loonix} distributions are really distributions of {guhnoo}/{loonix}."
).ConfigureAwait(false);
}
}

View File

@@ -1,4 +1,3 @@
#nullable enable
using NadekoBot.Modules.Games.Hangman;
namespace NadekoBot.Modules.Games;
@@ -74,4 +73,4 @@ public partial class Games
}
}
}
}
}

View File

@@ -1,4 +1,5 @@
using NadekoBot.Modules.Games.Common.Nunchi;
#nullable disable
using NadekoBot.Modules.Games.Common.Nunchi;
using NadekoBot.Modules.Games.Services;
namespace NadekoBot.Modules.Games;
@@ -108,4 +109,4 @@ public partial class Games
private Task Nunchi_OnGameStarted(NunchiGame arg)
=> ConfirmLocalizedAsync(strs.nunchi_started(Format.Bold(arg.ParticipantCount.ToString())));
}
}
}

View File

@@ -1,4 +1,5 @@
using NadekoBot.Modules.Games.Services;
#nullable disable
using NadekoBot.Modules.Games.Services;
using NadekoBot.Services.Database.Models;
using System.Text;
@@ -111,4 +112,4 @@ public partial class Games
.WithOkColor();
}
}
}
}

View File

@@ -1,4 +1,5 @@
using NadekoBot.Common.ModuleBehaviors;
#nullable disable
using NadekoBot.Common.ModuleBehaviors;
using NadekoBot.Modules.Permissions.Common;
using NadekoBot.Modules.Permissions.Services;
using NadekoBot.Modules.Games.Common.ChatterBot;
@@ -138,4 +139,4 @@ Message: {usrMsg.Content}");
}
return false;
}
}
}

View File

@@ -1,4 +1,5 @@
using NadekoBot.Common.Configs;
#nullable disable
using NadekoBot.Common.Configs;
using NadekoBot.Modules.Games.Common;
namespace NadekoBot.Modules.Games.Services;
@@ -36,4 +37,4 @@ public sealed class GamesConfigService : ConfigServiceBase<GamesConfig>
});
}
}
}
}

View File

@@ -1,4 +1,5 @@
using NadekoBot.Modules.Games.Common;
#nullable disable
using NadekoBot.Modules.Games.Common;
using NadekoBot.Modules.Games.Common.Acrophobia;
using NadekoBot.Modules.Games.Common.Nunchi;
using NadekoBot.Modules.Games.Common.Trivia;
@@ -113,4 +114,4 @@ public class GamesService : INService
File.WriteAllText(TypingArticlesPath, JsonConvert.SerializeObject(articles));
return removed;
}
}
}

View File

@@ -1,4 +1,5 @@
using NadekoBot.Common.ModuleBehaviors;
#nullable disable
using NadekoBot.Common.ModuleBehaviors;
using NadekoBot.Modules.Games.Common;
using NadekoBot.Common.Collections;
using NadekoBot.Services.Database.Models;
@@ -125,4 +126,4 @@ public class PollService : IEarlyBehavior
return false;
}
}
}

View File

@@ -1,4 +1,5 @@
using NadekoBot.Modules.Games.Common;
#nullable disable
using NadekoBot.Modules.Games.Common;
using NadekoBot.Modules.Games.Services;
namespace NadekoBot.Modules.Games;
@@ -103,4 +104,4 @@ public partial class Games
await ctx.Channel.EmbedAsync(embed);
}
}
}
}

View File

@@ -1,4 +1,5 @@
using NadekoBot.Modules.Games.Common;
#nullable disable
using NadekoBot.Modules.Games.Common;
using NadekoBot.Modules.Games.Services;
namespace NadekoBot.Modules.Games;
@@ -49,4 +50,4 @@ public partial class Games
}
}
}
}
}

View File

@@ -1,4 +1,5 @@
using NadekoBot.Modules.Games.Common.Trivia;
#nullable disable
using NadekoBot.Modules.Games.Common.Trivia;
using NadekoBot.Modules.Games.Services;
namespace NadekoBot.Modules.Games;
@@ -89,4 +90,4 @@ public partial class Games
await ReplyErrorLocalizedAsync(strs.trivia_none).ConfigureAwait(false);
}
}
}
}